class ListStoreDemo
# Copyright © 2016 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. #
Tree View/List Store¶ ↑
The GtkListStore is used to store data in list form, to be used later on by a GtkTreeView to display it. This demo builds a simple GtkListStore and displays it.
Constants
- Bug
- DATA
- NUM_COLUMNS
Public Class Methods
new(main_window)
click to toggle source
# File gtk3/sample/gtk-demo/list_store.rb, line 36 def initialize(main_window) @window = Gtk::Window.new(:toplevel) @window.screen = main_window.screen @window.title = "List Store" @timeout = 0 @window.signal_connect "delete-event" do @model = nil GLib::Source.remove(@timeout) unless @timeout.zero? @timeout = 0 false end vbox = Gtk::Box.new(:vertical, 8) vbox.margin = 8 @window.add(vbox) label = Gtk::Label.new(" This is the bug list (note: not based on real data, it would be nice to have a nice ODBC interface to bugzilla or so, though). ") vbox.pack_start(label, :expand => false, :fill => false, :padding => 0) sw = Gtk::ScrolledWindow.new(nil, nil) sw.shadow_type = :etched_in sw.set_policy(:never, :automatic) vbox.pack_start(sw, :expand => true, :fill => true, :padding => 0) # create tree model create_model # create tree view treeview = Gtk::TreeView.new(@model) treeview.search_column = COLUMN_DESCRIPTION sw.add(treeview) # add columns to the tree view add_columns(treeview) # finish and show @window.set_default_size(280, 250) end
Public Instance Methods
run()
click to toggle source
# File gtk3/sample/gtk-demo/list_store.rb, line 76 def run if !@window.visible? @window.show_all add_spinner else @window.destroy GLib::Source.remove(@tiemout) unless @timeout.zero? @timeout = 0 end @window end