Class: ListView

Inherits:
Object
  • Object
show all
Includes:
Observable
Defined in:
lib/gswax/shared.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeListView

Returns a new instance of ListView.



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/gswax/shared.rb', line 174

def initialize
	@store = Gtk::ListStore.new(String, String)
	@list = Gtk::TreeView.new(@store)
	@list.enable_search=(true)
	@list.headers_visible=(false)
	renderer = Gtk::CellRendererText.new
	column = Gtk::TreeViewColumn.new("", renderer, :text => 0)
	@list.append_column(column)
	@list_selection = @list.selection
	@list_selection.mode=(Gtk::SELECTION_MULTIPLE)
	@list.signal_connect("row-activated"){|view, path, column|
		emit_signal("row-activated", view, path, column)
	}
	@list_selection.signal_connect("changed"){|view, path, column|
		emit_signal("changed", view, path, column)
	}
end

Instance Attribute Details

#listObject

Returns the value of attribute list.



172
173
174
# File 'lib/gswax/shared.rb', line 172

def list
  @list
end

#list_selectionObject

Returns the value of attribute list_selection.



172
173
174
# File 'lib/gswax/shared.rb', line 172

def list_selection
  @list_selection
end

#storeObject

Returns the value of attribute store.



172
173
174
# File 'lib/gswax/shared.rb', line 172

def store
  @store
end

Instance Method Details

#add_to_list(entry, position = "append") ⇒ Object



192
193
194
195
196
197
198
199
200
# File 'lib/gswax/shared.rb', line 192

def add_to_list(entry, position = "append")
	if  position == "append" 
		iter = @store.append
	else
		iter = @store.prepend
	end
	@store.set_value(iter, 0, File.basename(entry))
	@store.set_value(iter, 1, entry)
end

#emit_signal(*args) ⇒ Object



202
203
204
# File 'lib/gswax/shared.rb', line 202

def emit_signal(*args)
	changed; notify_observers(*args)
end