Exit when the connection to the daemon is lost.
[snett.git] / bin / snett
index 1dce7081742f33f988600821db29f5d5d4954329..62b82692261e6df5b3d92a512a87e330b567b69f 100755 (executable)
--- a/bin/snett
+++ b/bin/snett
@@ -71,6 +71,7 @@ module Snett
                        @xmms = Xmms::Client.new(PKG_NAME)
                        @xmms.connect(ENV["XMMS_PATH"])
                        @xmms.add_to_glib_mainloop
+                       @xmms.on_disconnect { destroy }
 
                        @broadcasts = []
 
@@ -99,15 +100,12 @@ module Snett
                        event_box.events = Gdk::Event::BUTTON_PRESS_MASK |
                                           Gdk::Event::BUTTON_RELEASE_MASK
 
-                       event_box.signal_connect("button_release_event") do |_, event|
-                               menu.popup(event) if event.button == 3
-                               false
-                       end
-
                        event_box.signal_connect("button_press_event") do |_, event|
                                if event.button == 1
                                        x, y = Gdk::Display.default.pointer[1, 2]
                                        self.begin_move_drag(event.button, x, y, event.time)
+                               elsif event.button == 3
+                                       menu.popup(event)
                                end
 
                                false