module GtkAttributes

this file is part of manqod manqod is distributed under the CDDL licence the owner of manqod is Dobai-Pataky Balint(dpblnt@gmail.com)

Public Instance Methods

gtk_attribute(gtk_attr, context=self) click to toggle source
# File lib/DrbDB/GtkAttributes.rb, line 19
def gtk_attribute(gtk_attr, context=self)

        got=case context.class.name
                when "DrbListModel" then "list"
                when "DrbForm" then "form"
                else edebug("unsupported class in gtk_attributes: #{context.class.name} for #{context}")
        end

        (@gtk_attributes.has_key?(context.get_id.to_s) ? 
                ( (@gtk_attributes[context.get_id.to_s].has_key?(got)) ? 
                        @gtk_attributes[context.get_id.to_s][got][gtk_attr] : nil) : nil )
end
gtk_attribute_of_object(gtk_attr,gtkobject_id,gtkobject_type) click to toggle source
# File lib/DrbDB/GtkAttributes.rb, line 32
def gtk_attribute_of_object(gtk_attr,gtkobject_id,gtkobject_type)
        (@gtk_attributes.has_key?(gtkobject_id.to_s) ? 
                ( (@gtk_attributes[gtkobject_id.to_s].has_key?(gtkobject_type)) ? 
                        @gtk_attributes[gtkobject_id.to_s][gtkobject_type][gtk_attr] : nil) : nil )
end
load_all_attributes() click to toggle source
# File lib/DrbDB/GtkAttributes.rb, line 6
def load_all_attributes
        @gtk_attributes=Hash.new
        cnt=0
        admin.rows("select * from gtkattributes").each{|row|
                @gtk_attributes[row["gtkobjectid"]]=Hash.new unless @gtk_attributes.has_key?(row["gtkobjectid"])
                @gtk_attributes[row["gtkobjectid"]][row["gtkobjecttype"]]=Hash.new unless @gtk_attributes[row["gtkobjectid"]].has_key?(row["gtkobjecttype"])
                @gtk_attributes[row["gtkobjectid"]][row["gtkobjecttype"]][row["attribute"]]=row['data']
                cnt+=1
        }
        cache.set("attributes",@gtk_attributes)
        einfo("loaded #{cnt} attributes")
end