diff --git a/src/roster_window.py b/src/roster_window.py index bfbc55988..9de49e574 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -564,57 +564,149 @@ class RosterWindow: user = self.contacts[account][jid][0] menu = gtk.Menu() - item = gtk.MenuItem(_('Start Chat')) - menu.append(item) - item.connect('activate', self.on_roster_treeview_row_activated, path) - item = gtk.MenuItem(_('Rename')) - menu.append(item) - item.connect('activate', self.on_rename, iter, path) + + chat_item = gtk.MenuItem() + chat_icon = gtk.Image() + chat_icon.set_from_stock(gtk.STOCK_JUMP_TO, gtk.ICON_SIZE_BUTTON) + label = gtk.Label(_('Start Chat')) + chat_hbox = gtk.HBox(False, 3) + chat_hbox.pack_start(chat_icon, False, False) + chat_hbox.pack_start(label, False, False) + chat_item.add(chat_hbox) + menu.append(chat_item) + chat_item.connect('activate', self.on_roster_treeview_row_activated, path) + + rename_item = gtk.MenuItem() + rename_icon = gtk.Image() + rename_icon.set_from_stock(gtk.STOCK_REFRESH, gtk.ICON_SIZE_BUTTON) + label = gtk.Label(_('Rename')) + rename_hbox = gtk.HBox(False, 3) + rename_hbox.pack_start(rename_icon, False, False) + rename_hbox.pack_start(label, False, False) + rename_item.add(rename_hbox) + menu.append(rename_item) + rename_item.connect('activate', self.on_rename, iter, path) + if not 'not in the roster' in user.groups: - item = gtk.MenuItem(_('Edit Groups')) - menu.append(item) - item.connect('activate', self.on_edit_groups, user, account) + edit_groups_item = gtk.MenuItem() + edit_groups_icon = gtk.Image() + edit_groups_icon.set_from_stock(gtk.STOCK_EDIT, gtk.ICON_SIZE_BUTTON) + label = gtk.Label(_('Edit Groups')) + edit_groups_hbox = gtk.HBox(False, 3) + edit_groups_hbox.pack_start(edit_groups_icon, False, False) + edit_groups_hbox.pack_start(label, False, False) + edit_groups_item.add(edit_groups_hbox) + menu.append(edit_groups_item) + edit_groups_item.connect('activate', self.on_edit_groups, user, account) + item = gtk.MenuItem() menu.append(item) if gajim.config.get('usegpg'): - item = gtk.MenuItem(_('Assign OpenPGP Key')) - menu.append(item) - item.connect('activate', self.on_assign_pgp_key, user, account) + + gpg_key_item = gtk.MenuItem() + gpg_key_icon = gtk.Image() + gpg_key_icon.set_from_stock(gtk.STOCK_DIALOG_AUTHENTICATION, gtk.ICON_SIZE_BUTTON) + label = gtk.Label(_('Assign OpenPGP Key')) + gpg_key_hbox = gtk.HBox(False, 3) + gpg_key_hbox.pack_start(gpg_key_icon, False, False) + gpg_key_hbox.pack_start(label, False, False) + gpg_key_item.add(gpg_key_hbox) + menu.append(gpg_key_item) + gpg_key_item.connect('activate', self.on_assign_pgp_key, user, account) + item = gtk.MenuItem() menu.append(item) - item = gtk.MenuItem(_('Subscription')) - menu.append(item) + + subscription_item = gtk.MenuItem() + subscription_icon = gtk.Image() + subscription_icon.set_from_stock(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_BUTTON) + label = gtk.Label(_('Subscription')) + subscription_hbox = gtk.HBox(False, 3) + subscription_hbox.pack_start(subscription_icon, False, False) + subscription_hbox.pack_start(label, False, False) + subscription_item.add(subscription_hbox) + menu.append(subscription_item) sub_menu = gtk.Menu() - item.set_submenu(sub_menu) + subscription_item.set_submenu(sub_menu) - item = gtk.MenuItem(_('Re_send Authorization to')) - sub_menu.append(item) - item.connect('activate', self.authorize, jid, account) + resend_auth_item = gtk.MenuItem() + resend_auth_icon = gtk.Image() + resend_auth_icon.set_from_stock(gtk.STOCK_GO_FORWARD, gtk.ICON_SIZE_BUTTON) + label = gtk.Label(_('Re_send Authorization to')) + label.set_use_underline(True) + resend_auth_hbox = gtk.HBox(False, 3) + resend_auth_hbox.pack_start(resend_auth_icon, False, False) + resend_auth_hbox.pack_start(label, False, False) + resend_auth_item.add(resend_auth_hbox) + sub_menu.append(resend_auth_item) + resend_auth_item.connect('activate', self.authorize, jid, account) - item = gtk.MenuItem(_('Rere_quest Authorization from')) - sub_menu.append(item) - item.connect('activate', self.req_sub, jid, + rerequest_auth_item = gtk.MenuItem() + rerequest_auth_icon = gtk.Image() + rerequest_auth_icon.set_from_stock(gtk.STOCK_GO_BACK, gtk.ICON_SIZE_BUTTON) + label = gtk.Label(_('Rere_quest Authorization from')) + label.set_use_underline(True) + rerequest_auth_hbox = gtk.HBox(False, 3) + rerequest_auth_hbox.pack_start(rerequest_auth_icon, False, False) + rerequest_auth_hbox.pack_start(label, False, False) + rerequest_auth_item.add(rerequest_auth_hbox) + sub_menu.append(rerequest_auth_item) + rerequest_auth_item.connect('activate', self.req_sub, jid, _('I would like to add you to my roster'), account) + else: item = gtk.MenuItem() menu.append(item) - item = gtk.MenuItem(_('Add to Roster')) - menu.append(item) - item.connect('activate', self.on_add_to_roster, user, account) - item = gtk.MenuItem(_('Remove')) - menu.append(item) - item.connect('activate', self.on_req_usub, user, account) + add_item = gtk.MenuItem() + add_icon = gtk.Image() + add_icon.set_from_stock(gtk.STOCK_ADD, gtk.ICON_SIZE_BUTTON) + label = gtk.Label(_('_Add to Roster')) + label.set_use_underline(True) + add_hbox = gtk.HBox(False, 3) + add_hbox.pack_start(add_icon, False, False) + add_hbox.pack_start(label, False, False) + add_item.add(add_hbox) + menu.append(add_item) + add_item.connect('activate', self.on_add_to_roster, user, account) + + remove_item = gtk.MenuItem() + remove_icon = gtk.Image() + remove_icon.set_from_stock(gtk.STOCK_REMOVE, gtk.ICON_SIZE_BUTTON) + label = gtk.Label(_('_Remove from Roster')) + label.set_use_underline(True) + remove_hbox = gtk.HBox(False, 3) + remove_hbox.pack_start(remove_icon, False, False) + remove_hbox.pack_start(label, False, False) + remove_item.add(remove_hbox) + menu.append(remove_item) + remove_item.connect('activate', self.on_req_usub, user, account) item = gtk.MenuItem() menu.append(item) - item = gtk.MenuItem(_('Information')) - menu.append(item) - item.connect('activate', self.on_info, user, account) - item = gtk.MenuItem(_('History')) - menu.append(item) - item.connect('activate', self.on_history, user) + + info_item = gtk.MenuItem() + info_icon = gtk.Image() + info_icon.set_from_stock(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_BUTTON) + label = gtk.Label(_('Information')) + info_hbox = gtk.HBox(False, 3) + info_hbox.pack_start(info_icon, False, False) + info_hbox.pack_start(label, False, False) + info_item.add(info_hbox) + menu.append(info_item) + info_item.connect('activate', self.on_info, user, account) + + history_item = gtk.MenuItem() + history_icon = gtk.Image() + history_icon.set_from_stock(gtk.STOCK_JUSTIFY_FILL, gtk.ICON_SIZE_BUTTON) + label = gtk.Label(_('History')) + history_hbox = gtk.HBox(False, 3) + history_hbox.pack_start(history_icon, False, False) + history_hbox.pack_start(label, False, False) + history_item.add(history_hbox) + menu.append(history_item) + history_item.connect('activate', self.on_history, user) menu.popup(None, None, None, event.button, event.time) menu.show_all() @@ -626,9 +718,18 @@ class RosterWindow: path = model.get_path(iter) menu = gtk.Menu() - item = gtk.MenuItem(_('Rename')) - menu.append(item) - item.connect('activate', self.on_rename, iter, path) + + rename_item = gtk.MenuItem() + rename_icon = gtk.Image() + rename_icon.set_from_stock(gtk.STOCK_REFRESH, gtk.ICON_SIZE_BUTTON) + label = gtk.Label(_('Rename')) + rename_hbox = gtk.HBox(False, 3) + rename_hbox.pack_start(rename_icon, False, False) + rename_hbox.pack_start(label, False, False) + rename_item.add(rename_hbox) + menu.append(rename_item) + rename_item.connect('activate', self.on_rename, iter, path) + menu.popup(None, None, None, event.button, event.time) menu.show_all() menu.reposition() @@ -641,28 +742,61 @@ class RosterWindow: account = model.get_value(iter, 4) user = self.contacts[account][jid][0] menu = gtk.Menu() - item = gtk.MenuItem(_('_Log on')) + + state_images = self.get_appropriate_state_images(jid) + + item = gtk.MenuItem() + icon = state_images['online'] + label = gtk.Label(_('_Log on')) + label.set_use_underline(True) + hbox = gtk.HBox(False, 3) + hbox.pack_start(icon, False, False) + hbox.pack_start(label, False, False) + item.add(hbox) + menu.append(item) show = self.contacts[account][jid][0].show if show != 'offline' and show != 'error': item.set_sensitive(False) - menu.append(item) item.connect('activate', self.on_agent_logging, jid, None, account) - item = gtk.MenuItem(_('Log _off')) + item = gtk.MenuItem() + icon = state_images['offline'] + label = gtk.Label(_('Log _off')) + label.set_use_underline(True) + hbox = gtk.HBox(False, 3) + hbox.pack_start(icon, False, False) + hbox.pack_start(label, False, False) + item.add(hbox) + menu.append(item) if show == 'offline' or show == 'error': item.set_sensitive(False) - menu.append(item) item.connect('activate', self.on_agent_logging, jid, 'unavailable', account) item = gtk.MenuItem() menu.append(item) - item = gtk.MenuItem(_('_Edit')) + item = gtk.MenuItem() + icon = gtk.Image() + icon.set_from_stock(gtk.STOCK_EDIT, gtk.ICON_SIZE_BUTTON) + label = gtk.Label(_('Edit')) + label.set_use_underline(True) + hbox = gtk.HBox(False, 3) + hbox.pack_start(icon, False, False) + hbox.pack_start(label, False, False) + item.add(hbox) menu.append(item) item.connect('activate', self.on_edit_agent, user, account) - item = gtk.MenuItem(_('_Remove')) + item = gtk.MenuItem() + icon = gtk.Image() + icon.set_from_stock(gtk.STOCK_REMOVE, gtk.ICON_SIZE_BUTTON) + label = gtk.Label(_('_Remove from Roster')) + label.set_use_underline(True) + hbox = gtk.HBox(False, 3) + hbox.pack_start(icon, False, False) + hbox.pack_start(label, False, False) + item.add(hbox) menu.append(item) item.connect('activate', self.on_remove_agent, user, account) @@ -681,56 +815,110 @@ class RosterWindow: '''Make account's popup menu''' model = self.tree.get_model() account = model.get_value(iter, 3) - + + # we have to create our own set of icons for the menu + # using self.jabber_status_images is poopoo + iconset = gajim.config.get('iconset') + if not iconset: + iconset = 'sun' + path = os.path.join(gajim.DATA_DIR, 'iconsets/' + iconset + '/16x16/') + state_images = self.load_iconset(path) + menu = gtk.Menu() - item = gtk.MenuItem(_('Status')) - menu.append(item) + + status_item = gtk.MenuItem() + status_icon = gtk.Image() + status_icon.set_from_stock(gtk.STOCK_NETWORK, gtk.ICON_SIZE_BUTTON) + status_label = gtk.Label(_('Status')) + status_hbox = gtk.HBox(False, 3) + status_hbox.pack_start(status_icon, False, False) + status_hbox.pack_start(status_label, False, False) + status_item.add(status_hbox) + menu.append(status_item) sub_menu = gtk.Menu() - item.set_submenu(sub_menu) - item = gtk.MenuItem(_('Online')) - sub_menu.append(item) - item.connect('activate', self.change_status, account, 'online') - item = gtk.MenuItem(_('Free for chat')) - sub_menu.append(item) - item.connect('activate', self.change_status, account, 'chat') - item = gtk.MenuItem(_('Away')) - sub_menu.append(item) - item.connect('activate', self.change_status, account, 'away') - item = gtk.MenuItem(_('Not Available')) - sub_menu.append(item) - item.connect('activate', self.change_status, account, 'xa') - item = gtk.MenuItem(_('Busy')) - sub_menu.append(item) - item.connect('activate', self.change_status, account, 'dnd') - item = gtk.MenuItem(_('Invisible')) - sub_menu.append(item) - item.connect('activate', self.change_status, account, 'invisible') - item = gtk.MenuItem() - sub_menu.append(item) - item = gtk.MenuItem(_('Offline')) - sub_menu.append(item) - item.connect('activate', self.change_status, account, 'offline') + status_item.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.change_status, account, show) item = gtk.MenuItem() menu.append(item) - item = gtk.MenuItem(_('_Edit Account')) - menu.append(item) - item.connect('activate', self.on_edit_account, account) - item = gtk.MenuItem(_('_Service Discovery')) - menu.append(item) - item.connect('activate', self.on_service_disco_menuitem_activate, account) - item = gtk.MenuItem(_('_Add Contact')) - menu.append(item) - item.connect('activate', self.on_add_new_contact, account) - item = gtk.MenuItem(_('Join _Groupchat')) - menu.append(item) - item.connect('activate', self.on_join_gc_activate, account) - item = gtk.MenuItem(_('_New Message')) - menu.append(item) - item.connect('activate', self.on_new_message_menuitem_activate, account) - + edit_item = gtk.MenuItem() + edit_icon = gtk.Image() + edit_icon.set_from_stock(gtk.STOCK_EDIT, gtk.ICON_SIZE_BUTTON) + edit_label = gtk.Label(_('_Edit Account')) + edit_label.set_use_underline(True) + edit_hbox = gtk.HBox(False, 3) + edit_hbox.pack_start(edit_icon, False, False) + edit_hbox.pack_start(edit_label, False, False) + edit_item.add(edit_hbox) + edit_item.connect('activate', self.on_edit_account, account) + menu.append(edit_item) + + discover_item = gtk.MenuItem() + discover_icon = gtk.Image() + discover_icon.set_from_stock(gtk.STOCK_FIND, gtk.ICON_SIZE_BUTTON) + discover_label = gtk.Label(_('_Service Discovery')) + discover_label.set_use_underline(True) + discover_hbox = gtk.HBox(False, 3) + discover_hbox.pack_start(discover_icon, False, False) + discover_hbox.pack_start(discover_label, False, False) + discover_item.add(discover_hbox) + discover_item.connect('activate', self.on_service_disco_menuitem_activate, account) + menu.append(discover_item) + + add_contact_item = gtk.MenuItem() + add_contact_icon = gtk.Image() + add_contact_icon.set_from_stock(gtk.STOCK_ADD, gtk.ICON_SIZE_BUTTON) + add_contact_label = gtk.Label(_('_Add Contact')) + add_contact_label.set_use_underline(True) + add_contact_hbox = gtk.HBox(False, 3) + add_contact_hbox.pack_start(add_contact_icon, False, False) + add_contact_hbox.pack_start(add_contact_label, False, False) + add_contact_item.add(add_contact_hbox) + add_contact_item.connect('activate', self.on_add_new_contact, account) + menu.append(add_contact_item) + + join_gc_item = gtk.MenuItem() + join_gc_icon = gtk.Image() + join_gc_icon.set_from_stock(gtk.STOCK_CONNECT, gtk.ICON_SIZE_BUTTON) + join_gc_label = gtk.Label(_('Join _Groupchat')) + join_gc_label.set_use_underline(True) + join_gc_hbox = gtk.HBox(False, 3) + join_gc_hbox.pack_start(join_gc_icon, False, False) + join_gc_hbox.pack_start(join_gc_label, False, False) + join_gc_item.add(join_gc_hbox) + join_gc_item.connect('activate', self.on_join_gc_activate, account) + menu.append(join_gc_item) + + new_message_item = gtk.MenuItem() + new_message_icon = gtk.Image() + new_message_icon.set_from_stock(gtk.STOCK_NEW, gtk.ICON_SIZE_BUTTON) + new_message_label = gtk.Label(_('_New Message')) + new_message_label.set_use_underline(True) + new_message_hbox = gtk.HBox(False, 3) + new_message_hbox.pack_start(new_message_icon, False, False) + new_message_hbox.pack_start(new_message_label, False, False) + new_message_item.add(new_message_hbox) + new_message_item.connect('activate', self.on_new_message_menuitem_activate, account) + menu.append(new_message_item) + menu.popup(None, None, None, event.button, event.time) menu.show_all() menu.reposition() diff --git a/src/systray.py b/src/systray.py index c3fce63ff..e1890df8b 100644 --- a/src/systray.py +++ b/src/systray.py @@ -134,12 +134,16 @@ class Systray: 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) + # We need our own set of status icons, let's make 'em! + iconset = gajim.config.get('iconset') + if not iconset: + iconset = 'sun' + path = os.path.join(gajim.DATA_DIR, 'iconsets/' + iconset + '/16x16/') + state_images = self.plugin.roster.load_iconset(path) + for show in ['online', 'chat', 'away', 'xa', 'dnd', 'invisible', 'offline']: