Class: ArchiveButton

Inherits:
Gtk::ToggleButton
  • Object
show all
Includes:
Conf
Defined in:
lib/ListHolder/ListButtonHolder/ArchiveButton.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Conf

#get_conf, #load_conf, #save_conf, #set_conf

Constructor Details

#initialize(list_holder) ⇒ ArchiveButton

Returns a new instance of ArchiveButton.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ListHolder/ListButtonHolder/ArchiveButton.rb', line 8

def initialize(list_holder)
	@list_holder=list_holder
	@auto_update=false
	super()
	set_relief(Gtk::ReliefStyle::NONE)
	set_image(Gtk::Image.new(Gtk::Stock::BOLD,Gtk::IconSize.from_name(get_conf(0,0,"button-size"))))
	signal_connect('toggled'){|me|
 me.list_holder.list.list_model.set_show_archive(me.active?)
 if @auto_update
 	set_conf(list_holder.list.get_id,0,"archive",me.active?.to_s)
 	@list_holder.notebook.lists{|list|
 		list.archive_button.set_active(me.active?)
 	} if @list_holder.notebook
 	@list_holder.list.update(self)
 end
	}
end

Instance Attribute Details

#list_holderObject

Returns the value of attribute list_holder.



25
26
27
# File 'lib/ListHolder/ListButtonHolder/ArchiveButton.rb', line 25

def list_holder
  @list_holder
end

Instance Method Details

#to_sObject



34
35
36
# File 'lib/ListHolder/ListButtonHolder/ArchiveButton.rb', line 34

def to_s
	"ArchiveButton of #{@list_holder}"
end

#updateObject



27
28
29
30
31
32
33
# File 'lib/ListHolder/ListButtonHolder/ArchiveButton.rb', line 27

def update
 	@auto_update=false
 	set_no_show_all(@list_holder.list.list_model.archive_key.nil?)
 	set_visible(!@list_holder.list.list_model.archive_key.nil?)
 	set_active(get_conf(@list_holder.list.list_id,0,"archive")=="true")
 	@auto_update=true
end