Class: MyConfig::ConfComboHolder::ConfCombo

Inherits:
Gtk::ComboBox
  • Object
show all
Includes:
Conf
Defined in:
lib/MyConfig.rb

Instance Method Summary collapse

Methods included from Conf

#get_conf, #load_conf, #save_conf, #set_conf

Constructor Details

#initialize(values) ⇒ ConfCombo

Returns a new instance of ConfCombo.



10
11
12
13
14
15
16
17
# File 'lib/MyConfig.rb', line 10

def initialize(values)
	super(Gtk::ListStore.new(String,String))
	pack_start(renderer=Gtk::CellRendererText.new,true).add_attribute(renderer,:text,1)
	values.each_pair{|key,value| model.append.set_value(0,key).set_value(1,value)}
	signal_connect('changed'){|me| 
		set_conf(0,0,parent.conf_text,me.active_iter[0])
	}
end

Instance Method Details

#set_active(defval) ⇒ Object



18
19
20
# File 'lib/MyConfig.rb', line 18

def set_active(defval)
	model.each{|model,path,iter| set_active_iter(iter) if iter[0] == defval}
end