diff options
author | Yann Leboulanger <asterix@lagaule.org> | 2008-07-31 12:49:31 +0400 |
---|---|---|
committer | Yann Leboulanger <asterix@lagaule.org> | 2008-07-31 12:49:31 +0400 |
commit | d23612c90482b61d71f42712a2c87bddc90c1bf7 (patch) | |
tree | c3968c1ed888b8157ae30fd7e997ac120547a7a2 | |
parent | f586c8dd5520d11eabf5d892aa5f942fb5ce548c (diff) |
implement double_click in systray. see #2932
-rw-r--r-- | src/systray.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/systray.py b/src/systray.py index 6d08bd83e..09dc67f58 100644 --- a/src/systray.py +++ b/src/systray.py @@ -60,6 +60,10 @@ class Systray: self.added_hide_menuitem = False self.img_tray = gtk.Image() self.status = 'offline' + self.double_click = False + self.double_click_id = None + self.double_click_time = gtk.settings_get_default().get_property( + 'gtk-double-click-time') self.xml = gtkgui_helpers.get_glade('systray_context_menu.glade') self.systray_context_menu = self.xml.get_widget('systray_context_menu') self.xml.signal_autoconnect(self) @@ -283,6 +287,10 @@ class Systray: gajim.interface.roster.on_quit_request() def on_left_click(self): + self.double_click_id = None + if self.double_click: + self.double_click = False + return win = gajim.interface.roster.window # toggle visible/hidden for roster window if win.get_property('visible') and win.get_property('has-toplevel-focus'): @@ -312,10 +320,16 @@ class Systray: def on_clicked(self, widget, event): self.on_tray_leave_notify_event(widget, None) + if event.type == gtk.gdk._2BUTTON_PRESS: + self.double_click = True + self.on_middle_click() if event.type != gtk.gdk.BUTTON_PRESS: return if event.button == 1: # Left click - self.on_left_click() + if self.double_click_id: + gobject.source_remove(self.double_click_id) + self.double_click_id = gobject.timeout_add(self.double_click_time, + self.on_left_click) elif event.button == 2: # middle click self.on_middle_click() elif event.button == 3: # right click @@ -405,4 +419,4 @@ class Systray: self.t = None self.unsubscribe_events() -# vim: se ts=3:
\ No newline at end of file +# vim: se ts=3: |