Class: AdvancedFilterButton

Inherits:
Gtk::ToggleButton
  • Object
show all
Includes:
Conf
Defined in:
lib/ListHolder/ListButtonHolder/FilterButton.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) ⇒ AdvancedFilterButton

Returns a new instance of AdvancedFilterButton.



8
9
10
11
12
13
14
15
16
17
# File 'lib/ListHolder/ListButtonHolder/FilterButton.rb', line 8

def initialize(list_holder)
	@list_holder=list_holder
	super()
	set_relief(Gtk::ReliefStyle::NONE)
	set_image(Gtk::Image.new(Gtk::Stock::FIND,Gtk::IconSize.from_name(get_conf(0,0,"button-size"))))
	signal_connect('toggled'){|me|
		me.list_holder.list_panel.set_visibility
		set_conf(list_holder.list.get_id,0,"advanced-filter",me.active?.to_s)
	}
end

Instance Attribute Details

#list_holderObject

Returns the value of attribute list_holder.



18
19
20
# File 'lib/ListHolder/ListButtonHolder/FilterButton.rb', line 18

def list_holder
  @list_holder
end

Instance Method Details

#update(notifier = nil) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/ListHolder/ListButtonHolder/FilterButton.rb', line 20

def update(notifier=nil)
	#we have fixed ordering, we disable filtering
	if @list_holder.list.gtk_attribute("ordering")
		set_conf(list_holder.list.get_id,0,"advanced-filter","false")
		set_sensitive(false)
	end
	set_active(get_conf(list_holder.list.get_id,0,"advanced-filter")=="true")
end