diff --git a/src/systray.py b/src/systray.py index 6d08bd83eec06900d340552a5b08eadc946ca8a4..09dc67f58a4d1a0823343451286f1884243a8118 100644 --- a/src/systray.py +++ b/src/systray.py @@ -60,6 +60,10 @@ def __init__(self): 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 @@ def on_quit_menuitem_activate(self, widget): 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 @@ def on_middle_click(self): 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 @@ def hide_icon(self): self.t = None self.unsubscribe_events() -# vim: se ts=3: \ No newline at end of file +# vim: se ts=3: