lib/rabbit/gtk.rb in rabbit-2.2.0 vs lib/rabbit/gtk.rb in rabbit-2.2.1
- old
+ new
@@ -35,10 +35,20 @@
end
end
end
end
+module Pango
+ unless const_defined?(:WrapMode)
+ WrapMode = Layout::WrapMode
+ end
+
+ unless const_defined?(:Alignment)
+ Alignment = Layout::Alignment
+ end
+end
+
module Gdk
class Event
STOP = true unless const_defined?(:STOP)
PROPAGATE = false unless const_defined?(:PROPAGATE)
end
@@ -102,35 +112,32 @@
end
end
unless const_defined?(:Application)
class Application < Gio::Application
+ attr_reader :windows
def initialize(id, flags)
super
signal_connect_after("activate") do
- Gtk.main if ApplicationWindow.n_instances > 0
+ Gtk.main unless @windows.empty?
end
+ @windows = []
end
end
end
unless const_defined?(:ApplicationWindow)
class ApplicationWindow
- @@n_instances = 0
-
class << self
def new(application)
window = Window.new
- @@n_instances += 1
+ application.windows << window
window.signal_connect("destroy") do
- @@n_instances -= 1
- Gtk.main_quit if @@n_instances.zero?
+ windows = application.windows
+ windows.delete(window)
+ Gtk.main_quit if windows.empty?
end
window
- end
-
- def n_instances
- @@n_instances
end
end
end
end