From f55651d9055cb603e260dc41f3b0bba564a21046 Mon Sep 17 00:00:00 2001 From: Stephan Erb Date: Mon, 25 Aug 2008 19:35:47 +0000 Subject: [PATCH] * Don't hide manage GC Bookmark menuitem when the server doesn't support private storage * Fix indentation problem * Use generators instead of list comprehension (take less memory) --- src/gajim.py | 2 +- src/roster_window.py | 36 +++++++++++++++++------------------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/gajim.py b/src/gajim.py index d873dd25a..c91121d63 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -334,7 +334,7 @@ def pid_alive(): try: from osx import checkPID return checkPID(pid, 'Gajim.bin') - except ImportError: + except ImportError: return try: if not os.path.exists('/proc'): diff --git a/src/roster_window.py b/src/roster_window.py index e4cf63c50..0fd200ccf 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -4707,34 +4707,32 @@ class RosterWindow: single_message_menuitem]: item.set_sensitive(False) else: # we have one or more connected accounts - for item in [new_chat_menuitem, join_gc_menuitem,\ - add_new_contact_menuitem, service_disco_menuitem,\ - single_message_menuitem]: + for item in (new_chat_menuitem, join_gc_menuitem, + add_new_contact_menuitem, service_disco_menuitem, + single_message_menuitem): item.set_sensitive(True) # disable some fields if only local account is there if connected_accounts == 1: for account in gajim.connections: if gajim.account_is_connected(account) and \ gajim.connections[account].is_zeroconf: - for item in [join_gc_menuitem,\ - add_new_contact_menuitem, service_disco_menuitem, - single_message_menuitem]: + for item in (join_gc_menuitem, add_new_contact_menuitem, + service_disco_menuitem, single_message_menuitem): item.set_sensitive(False) - if connected_accounts_with_private_storage > 0: - # At least one account with private storage support - # show the 'manage gc bookmarks' item - newitem = gtk.SeparatorMenuItem() # separator - gc_sub_menu.append(newitem) + # Manage GC bookmarks + newitem = gtk.SeparatorMenuItem() # separator + gc_sub_menu.append(newitem) - newitem = gtk.ImageMenuItem(_('_Manage Bookmarks...')) - img = gtk.image_new_from_stock(gtk.STOCK_PREFERENCES, - gtk.ICON_SIZE_MENU) - newitem.set_image(img) - newitem.connect('activate', - self.on_manage_bookmarks_menuitem_activate) - gc_sub_menu.append(newitem) - gc_sub_menu.show_all() + newitem = gtk.ImageMenuItem(_('_Manage Bookmarks...')) + img = gtk.image_new_from_stock(gtk.STOCK_PREFERENCES, + gtk.ICON_SIZE_MENU) + newitem.set_image(img) + newitem.connect('activate', self.on_manage_bookmarks_menuitem_activate) + gc_sub_menu.append(newitem) + gc_sub_menu.show_all() + if connected_accounts_with_private_storage == 0: + newitem.set_sensitive(False) connected_accounts_with_vcard = [] for account in gajim.connections: