lib/knj/gtk2_window.rb in knjrbfw-0.0.50 vs lib/knj/gtk2_window.rb in knjrbfw-0.0.51
- old
+ new
@@ -21,6 +21,18 @@
else
obj = yield
@@uniques[id] = obj
end
end
+
+ #Returns the object if it hasnt been destroyed.
+ #===Examples
+ # Knj::Gtk2::Window.get("my_window") #=> nil
+ # Knj::Gtk2::Window.get("my_window") #=> Gtk::Builder-object
+ def self.get(id)
+ if instance and !instance.gui["window"].destroyed?
+ return instance.gui["window"]
+ end
+
+ return nil
+ end
end
\ No newline at end of file