Permalink
Browse files

Properly retrieve generated widgets from builder.

  • Loading branch information...
1 parent 6b42a57 commit d4d6e28288716ae49be9fb30792997a82184b6f4 @mvz committed Dec 21, 2010
Showing with 11 additions and 6 deletions.
  1. +11 −6 lib/pinhole/mainwindow.rb
View
17 lib/pinhole/mainwindow.rb
@@ -9,8 +9,8 @@ def run
setup_ui
- @window = @builder["mainwindow"]
- @box = @builder["mainvbox"]
+ @window = built_object("mainwindow")
+ @box = built_object("mainvbox")
@browser = Browser.new
@image = Image.new
@@ -71,19 +71,24 @@ def cast_object_pointer optr
klass.send :_real_new, optr
end
+ # FIXME: Adjust Gtk::Builder#get_object
+ def built_object name
+ cast_object_pointer(@builder.get_object(name).to_ptr)
+ end
+
def on_mainwindow_destroy
Gtk.main_quit
end
def on_mainwindow_window_state_event w, e
if e.new_window_state.fullscreen?
- @builder["menubar"].visible = false
- @builder["statusbar"].visible = false
+ built_object("menubar").visible = false
+ built_object("statusbar").visible = false
@active_widget.fullscreen
@fullscreen = true
else
- @builder["menubar"].visible = true
- @builder["statusbar"].visible = true
+ built_object("menubar").visible = true
+ built_object("statusbar").visible = true
@active_widget.unfullscreen
@fullscreen = false
end

0 comments on commit d4d6e28

Please sign in to comment.