Skip to content
Snippets Groups Projects
Commit d23612c9 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

implement double_click in systray. see #2932

parent f586c8dd
No related branches found
No related tags found
No related merge requests found
......@@ -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:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment