Class: Clipcellar::Window
- Inherits:
-
Gtk::Window
- Object
- Gtk::Window
- Clipcellar::Window
- Defined in:
- lib/clipcellar/window.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(records) ⇒ Window
constructor
A new instance of Window.
- #run ⇒ Object
Constructor Details
#initialize(records) ⇒ Window
Returns a new instance of Window.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/clipcellar/window.rb', line 25 def initialize(records) super() @records = records self.title = "Clipcellar" set_default_size(640, 480) signal_connect("destroy") do Gtk.main_quit end @vbox = Gtk::VBox.new add(@vbox) @scrolled_window = Gtk::ScrolledWindow.new @scrolled_window.set_policy(:automatic, :automatic) @vbox.pack_start(@scrolled_window, true, true, 0) @tree_view = TreeView.new(records) @scrolled_window.add(@tree_view) @label = Gtk::Label.new @label.text = "Double Click or Press Return: Copy to Clipboard / Ctrl+d: Delete from Data Store" @vbox.pack_start(@label, false, false, 0) @tree_view.signal_connect("row-activated") do |tree_view, path, column| Clipboard.copy_to_clipboard(@tree_view.selected_text) end define_key_bindings end |
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
24 25 26 |
# File 'lib/clipcellar/window.rb', line 24 def text @text end |
Instance Method Details
#run ⇒ Object
55 56 57 58 |
# File 'lib/clipcellar/window.rb', line 55 def run show_all Gtk.main end |