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.
19 20 21 22 23 24 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 |
# File 'lib/grumblr/ui.rb', line 19 def initialize super Gtk::Window::TOPLEVEL filename = File.join(Grumblr::DATA_ROOT, 'pixmaps', 'grumblr.svg') self.logo = Gdk::Pixbuf.new(filename, 128, 128) set_size_request 400, 300 set_border_width 0 set_allow_shrink false set_title "#{Grumblr::APP_NAME} #{Grumblr::VERSION}" set_icon self.logo set_default_width $cfg.get(:window_width).to_i set_default_height $cfg.get(:window_height).to_i move $cfg.get(:window_x_pos).to_i, $cfg.get(:window_y_pos).to_i signal_connect(:destroy) { quit } signal_connect(:delete_event) { minimize } signal_connect(:check_resize) do || position_x, position_y = .position size_w, size_h = .size $cfg.set :window_x_pos, position_x $cfg.set :window_y_pos, position_y $cfg.set :window_width, size_w $cfg.set :window_height, size_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? else nil end end show end |
Instance Attribute Details
#logo ⇒ Object
Returns the value of attribute logo.
17 18 19 |
# File 'lib/grumblr/ui.rb', line 17 def logo @logo end |
Instance Method Details
#minimize ⇒ Object
54 55 56 |
# File 'lib/grumblr/ui.rb', line 54 def minimize self.hide end |