double clicked on systray icon show/hide roster if there is no event, or show an event otherwise.
This commit is contained in:
parent
0fca234f0a
commit
3d1ee5bf08
1 changed files with 33 additions and 11 deletions
|
@ -100,7 +100,7 @@ class message_Window:
|
||||||
self.print_conversation(evt[0], tim = evt[1])
|
self.print_conversation(evt[0], tim = evt[1])
|
||||||
del self.plugin.queues[self.account][self.user.jid]
|
del self.plugin.queues[self.account][self.user.jid]
|
||||||
self.plugin.roster.redraw_jid(self.user.jid, self.account)
|
self.plugin.roster.redraw_jid(self.user.jid, self.account)
|
||||||
self.plugin.systray.remove_jid(self.user.jid)
|
self.plugin.systray.remove_jid(self.user.jid, self.account)
|
||||||
showOffline = self.plugin.config['showoffline']
|
showOffline = self.plugin.config['showoffline']
|
||||||
if (self.user.show == 'offline' or self.user.show == 'error') and \
|
if (self.user.show == 'offline' or self.user.show == 'error') and \
|
||||||
not showOffline:
|
not showOffline:
|
||||||
|
@ -140,7 +140,7 @@ class message_Window:
|
||||||
|
|
||||||
def on_focus(self, widget, event):
|
def on_focus(self, widget, event):
|
||||||
"""When window get focus"""
|
"""When window get focus"""
|
||||||
self.plugin.systray.remove_jid(self.user.jid)
|
self.plugin.systray.remove_jid(self.user.jid, self.account)
|
||||||
|
|
||||||
def __init__(self, user, plugin, account):
|
def __init__(self, user, plugin, account):
|
||||||
self.user = user
|
self.user = user
|
||||||
|
@ -908,7 +908,7 @@ class roster_Window:
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
self.plugin.queues[account][jid] = Queue.Queue(50)
|
self.plugin.queues[account][jid] = Queue.Queue(50)
|
||||||
self.redraw_jid(jid, account)
|
self.redraw_jid(jid, account)
|
||||||
self.plugin.systray.add_jid(jid)
|
self.plugin.systray.add_jid(jid, account)
|
||||||
tim = time.strftime("[%H:%M:%S]")
|
tim = time.strftime("[%H:%M:%S]")
|
||||||
self.plugin.queues[account][jid].put((msg, tim))
|
self.plugin.queues[account][jid].put((msg, tim))
|
||||||
if not path:
|
if not path:
|
||||||
|
@ -932,7 +932,7 @@ class roster_Window:
|
||||||
self.plugin.windows[account]['chats'][jid].print_conversation(msg)
|
self.plugin.windows[account]['chats'][jid].print_conversation(msg)
|
||||||
if not self.plugin.windows[account]['chats'][jid].window.\
|
if not self.plugin.windows[account]['chats'][jid].window.\
|
||||||
get_property('is-active'):
|
get_property('is-active'):
|
||||||
self.plugin.systray.add_jid(jid)
|
self.plugin.systray.add_jid(jid, account)
|
||||||
|
|
||||||
def on_prefs(self, widget):
|
def on_prefs(self, widget):
|
||||||
"""When preferences is selected :
|
"""When preferences is selected :
|
||||||
|
@ -1214,14 +1214,16 @@ class systray:
|
||||||
else:
|
else:
|
||||||
self.img_tray.set_from_pixbuf(pix)
|
self.img_tray.set_from_pixbuf(pix)
|
||||||
|
|
||||||
def add_jid(self, jid):
|
def add_jid(self, jid, account):
|
||||||
if not jid in self.jids:
|
list = [account, jid]
|
||||||
self.jids.append(jid)
|
if not list in self.jids:
|
||||||
|
self.jids.append(list)
|
||||||
self.set_img()
|
self.set_img()
|
||||||
|
|
||||||
def remove_jid(self, jid):
|
def remove_jid(self, jid, account):
|
||||||
if jid in self.jids:
|
list = [account, jid]
|
||||||
self.jids.remove(jid)
|
if list in self.jids:
|
||||||
|
self.jids.remove(list)
|
||||||
self.set_img()
|
self.set_img()
|
||||||
|
|
||||||
def set_status(self, status):
|
def set_status(self, status):
|
||||||
|
@ -1272,14 +1274,34 @@ class systray:
|
||||||
menu.show_all()
|
menu.show_all()
|
||||||
menu.reposition()
|
menu.reposition()
|
||||||
|
|
||||||
|
|
||||||
def on_clicked(self, widget, event):
|
def on_clicked(self, widget, event):
|
||||||
|
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
||||||
|
if len(self.jids) == 0:
|
||||||
|
win = self.plugin.roster.xml.get_widget('Gajim')
|
||||||
|
if self.iconified:
|
||||||
|
win.deiconify()
|
||||||
|
else:
|
||||||
|
win.iconify()
|
||||||
|
else:
|
||||||
|
account = self.jids[0][0]
|
||||||
|
jid = self.jids[0][1]
|
||||||
|
if self.plugin.windows[account]['chats'].has_key(jid):
|
||||||
|
self.plugin.windows[account]['chats'][jid].window.present()
|
||||||
if event.button == 3:
|
if event.button == 3:
|
||||||
self.mk_menu(event)
|
self.mk_menu(event)
|
||||||
|
|
||||||
|
def state_changed(self, widget, event):
|
||||||
|
if event.new_window_state & gtk.gdk.WINDOW_STATE_ICONIFIED:
|
||||||
|
self.iconified = 1
|
||||||
|
else:
|
||||||
|
self.iconified = 0
|
||||||
|
|
||||||
def __init__(self, plugin):
|
def __init__(self, plugin):
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
self.jids = []
|
self.jids = []
|
||||||
|
self.iconified = 0
|
||||||
|
win = self.plugin.roster.xml.get_widget('Gajim')
|
||||||
|
win.connect("window-state-event", self.state_changed)
|
||||||
t = trayicon.TrayIcon("Gajim")
|
t = trayicon.TrayIcon("Gajim")
|
||||||
eb = gtk.EventBox()
|
eb = gtk.EventBox()
|
||||||
eb.connect("button-press-event", self.on_clicked)
|
eb.connect("button-press-event", self.on_clicked)
|
||||||
|
|
Loading…
Add table
Reference in a new issue