From 9fc4e790e822af8c67e9f3037b84d0ee51d60883 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 20 Jun 2005 17:45:04 +0000 Subject: [PATCH] we know have icons in systray submenu --- src/gtkgui.glade | 82 +----------------------------------------------- src/systray.py | 51 +++++++++++++++++------------- 2 files changed, 31 insertions(+), 102 deletions(-) diff --git a/src/gtkgui.glade b/src/gtkgui.glade index b4a5b7493..f386e096b 100644 --- a/src/gtkgui.glade +++ b/src/gtkgui.glade @@ -10784,86 +10784,6 @@ JID: whatever@jabber.org True _Status True - - - - - - - True - Online - True - - - - - - - True - Free for Chat - True - - - - - - - True - - - - - - True - Away - True - - - - - - - True - Not Available - True - - - - - - - True - Busy - True - - - - - - - True - Invisible - True - - - - - - - True - - - - - - True - Offline - True - - - - - @@ -10882,7 +10802,7 @@ JID: whatever@jabber.org True - + True gtk-new 1 diff --git a/src/systray.py b/src/systray.py index 819a15db8..c3fce63ff 100644 --- a/src/systray.py +++ b/src/systray.py @@ -20,6 +20,7 @@ import gtk import gtk.glade import dialogs +import os from common import gajim from common import helpers @@ -131,7 +132,31 @@ class Systray: chat_with_menuitem = self.xml.get_widget('chat_with_menuitem') new_message_menuitem = self.xml.get_widget('new_message_menuitem') - + status_menuitem = self.xml.get_widget('status_menu') + + # We need our own set of status icons, let's make 'em! + state_images = self.plugin.roster.jabber_state_images + + sub_menu = gtk.Menu() + status_menuitem.set_submenu(sub_menu) + + for show in ['online', 'chat', 'away', 'xa', 'dnd', 'invisible', + 'offline']: + + if show == 'offline': # We add a sep before offline item + item = gtk.MenuItem() + sub_menu.append(item) + + item = gtk.MenuItem() + icon = state_images[show] + label = gtk.Label(helpers.get_uf_show(show)) + hbox = gtk.HBox(False, 3) + hbox.pack_start(icon, False, False) + hbox.pack_start(label, False, False) + item.add(hbox) + sub_menu.append(item) + item.connect('activate', self.on_show_menuitem_activate, show) + iskey = len(gajim.connections) > 0 chat_with_menuitem.set_sensitive(iskey) new_message_menuitem.set_sensitive(iskey) @@ -245,26 +270,10 @@ class Systray: if event.button == 3: # right click self.make_menu(event) - def on_online_menuitem_activate(self, widget): - self.plugin.roster.status_combobox.set_active(0) # 0 is online - - def on_free_for_chat_menuitem_activate(self, widget): - self.plugin.roster.status_combobox.set_active(1) # 1 is free for chat - - def on_away_menuitem_activate(self, widget): - self.plugin.roster.status_combobox.set_active(2) # 2 is away - - def on_xa_menuitem_activate(self, widget): - self.plugin.roster.status_combobox.set_active(3) # 3 is xa - - def on_dnd_menuitem_activate(self, widget): - self.plugin.roster.status_combobox.set_active(4) # 4 is dnd - - def on_invisible_menuitem_activate(self, widget): - self.plugin.roster.status_combobox.set_active(5) # 5 is invisible - - def on_offline_menuitem_activate(self, widget): - self.plugin.roster.status_combobox.set_active(6) # 6 is offline + def on_show_menuitem_activate(self, widget, show): + list = ['online', 'chat', 'away', 'xa', 'dnd', 'invisible', 'offline'] + index = list.index(show) + self.plugin.roster.status_combobox.set_active(index) def show_icon(self): if not self.t: