we know have icons in systray submenu

This commit is contained in:
Yann Leboulanger 2005-06-20 17:45:04 +00:00
parent 908add931b
commit 9fc4e790e8
2 changed files with 31 additions and 102 deletions

View File

@ -10784,86 +10784,6 @@ JID: whatever@jabber.org</property>
<property name="visible">True</property>
<property name="label" translatable="yes">_Status</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="status_menu_menu">
<child>
<widget class="GtkMenuItem" id="online_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">Online</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_online_menuitem_activate" last_modification_time="Tue, 15 Mar 2005 00:15:28 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="free_for_chat_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">Free for Chat</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_free_for_chat_menuitem_activate" last_modification_time="Mon, 18 Apr 2005 22:28:10 GMT"/>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator5">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="away_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">Away</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_away_menuitem_activate" last_modification_time="Tue, 15 Mar 2005 00:15:28 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="xa_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">Not Available</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_xa_menuitem_activate" last_modification_time="Tue, 15 Mar 2005 00:15:28 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="dnd_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">Busy</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_dnd_menuitem_activate" last_modification_time="Tue, 15 Mar 2005 00:15:28 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="invisible_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">Invisible</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_invisible_menuitem_activate" last_modification_time="Tue, 15 Mar 2005 00:15:28 GMT"/>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator4">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="offline_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">Offline</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_offline_menuitem_activate" last_modification_time="Tue, 15 Mar 2005 00:15:28 GMT"/>
</widget>
</child>
</widget>
</child>
</widget>
</child>
@ -10882,7 +10802,7 @@ JID: whatever@jabber.org</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image687">
<widget class="GtkImage" id="image707">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>

View File

@ -20,6 +20,7 @@
import gtk
import gtk.glade
import dialogs
import os
from common import gajim
from common import helpers
@ -131,6 +132,30 @@ 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)
@ -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: