add img instead of text for show in chat with in systray

This commit is contained in:
Nikos Kouremenos 2005-11-04 15:22:12 +00:00
parent 9bd80e6772
commit 542349ad64
1 changed files with 20 additions and 9 deletions

View File

@ -228,6 +228,12 @@ class Systray:
gajim.interface.roster.on_quit_menuitem_activate(widget) gajim.interface.roster.on_quit_menuitem_activate(widget)
def make_groups_submenus_for_chat_with(self, account): def make_groups_submenus_for_chat_with(self, account):
iconset = gajim.config.get('iconset')
if not iconset:
iconset = 'sun'
path = os.path.join(gajim.DATA_DIR, 'iconsets/' + iconset + '/16x16/')
state_images = gajim.interface.roster.load_iconset(path)
groups_menu = gtk.Menu() groups_menu = gtk.Menu()
for group in gajim.groups[account].keys(): for group in gajim.groups[account].keys():
@ -239,16 +245,21 @@ class Systray:
groups_menu.append(item) groups_menu.append(item)
contacts_menu = gtk.Menu() contacts_menu = gtk.Menu()
item.set_submenu(contacts_menu) item.set_submenu(contacts_menu)
for users in gajim.contacts[account].values(): for contacts in gajim.contacts[account].values():
user = users[0] contact = gajim.get_highest_prio_contact_from_contacts(contacts)
if group in user.groups and user.show != 'offline' and \ if group in contact.groups and contact.show != 'offline' and \
user.show != 'error': contact.show != 'error':
at_least_one = True at_least_one = True
show = helpers.get_uf_show(user.show) s = contact.name.replace('_', '__') # FIXME: find a way to show one _ and not underline
s = user.name.replace('_', '__') + ' (' + show + ')' item = gtk.ImageMenuItem(s)
item = gtk.MenuItem(s) # any given gtk widget can only be used in one place
item.connect('activate', self.start_chat, account,\ # (here we use it in status menu too)
user.jid) # gtk.Image is a widget, it's better we refactor to use gdk.gdk.Pixbuf allover
img = state_images[contact.show]
img_copy = gobject.new(gtk.Image, pixbuf=img.get_pixbuf())
item.set_image(img_copy)
item.connect('activate', self.start_chat, account,
contact.jid)
contacts_menu.append(item) contacts_menu.append(item)
if not at_least_one: if not at_least_one: