Class: Grumblr::UI
- Inherits:
-
Gtk::Window
- Object
- Gtk::Window
- Grumblr::UI
- Defined in:
- lib/grumblr/ui.rb
Instance Attribute Summary collapse
-
#logo ⇒ Object
Returns the value of attribute logo.
Instance Method Summary collapse
-
#initialize ⇒ UI
constructor
A new instance of UI.
- #minimize ⇒ Object
Constructor Details
#initialize ⇒ UI
Returns a new instance of UI.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/grumblr/ui.rb', line 11 def initialize super Gtk::Window::TOPLEVEL filename = File.join(Grumblr::DATA_ROOT, 'grumblr.svg') self.logo = Gdk::Pixbuf.new filename, 128, 128 self.set_size_request 480, 360 self.set_allow_shrink false self.set_title 'Grumblr' self.set_icon self.logo self.set_default_width $cfg.get(:window_width).to_i self.set_default_height $cfg.get(:window_height).to_i self.move $cfg.get(:window_x_pos).to_i, $cfg.get(:window_y_pos).to_i self.signal_connect(:destroy) { quit } self.signal_connect(:delete_event) { minimize } self.signal_connect(:check_resize) do || x, y = .position w, h = .size $cfg.set :window_x_pos, x $cfg.set :window_y_pos, y $cfg.set :window_width, w $cfg.set :window_height, h end signal_connect(:window_state_event) do |, e| case e.event_type when Gdk::Event::WINDOW_STATE minimize if e.changed_mask.iconified? and e.new_window_state.iconified? end end show end |
Instance Attribute Details
#logo ⇒ Object
Returns the value of attribute logo.
9 10 11 |
# File 'lib/grumblr/ui.rb', line 9 def logo @logo end |
Instance Method Details
#minimize ⇒ Object
44 45 46 |
# File 'lib/grumblr/ui.rb', line 44 def minimize self.hide end |