class ItemList

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

Attributes

item[R]
updated[R]

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/PrintEditor/ItemInfo/ItemList.rb, line 7
def initialize
        @updated=false
        super(Gtk::ListStore.new(String,String))
        frenderer=Gtk::CellRendererText.new
        pack_start(frenderer,true).add_attribute(frenderer,:text,1)
        signal_connect("changed"){|me| 
                unless me.active_iter.nil? or @item.nil?
                        @item.set_text(me.active_iter[0].to_s) 
                        @item.child.set_label(active_iter[1])
                end
        }
end

Public Instance Methods

update(item) click to toggle source
# File lib/PrintEditor/ItemInfo/ItemList.rb, line 20
def update(item)
        @item=item
        rows("select moditems.id,moditems.display 
                from moditems 
                left join modules on moditems.modid = modules.id 
                left join buttons on buttons.moditemid = moditems.parent
                where modules.modname = 'listing' 
                        and buttons.target_moditemid = '#{@item.moditemid}'"){|sublist|
                i=model.append
                i[0]=sublist["id"]
                i[1]=sublist["display"]
        } unless @updated
        @updated=true
        found=nil
        model.each{|model,path,iter| found=iter if @item.text.to_s == iter[0]}
        if found then 
                set_active_iter(found) 
                @item.child.set_label(found[1])
        else 
                set_active(-1)
        end
        self
end