Author: asterix Date: 2007-08-19 17:32:41 +0200 (Sun, 19 Aug 2007) New Revision: 8505
Modified: trunk/src/common/connection.py trunk/src/common/connection_handlers.py trunk/src/config.py trunk/src/dialogs.py trunk/src/groupchat_control.py trunk/src/roster_window.py Log: don't allow to bookmark a room on server that don't support private storage.
Modified: trunk/src/common/connection.py =================================================================== --- trunk/src/common/connection.py 2007-08-19 10:16:08 UTC (rev 8504) +++ trunk/src/common/connection.py 2007-08-19 15:32:41 UTC (rev 8505) @@ -151,7 +151,7 @@ self.available_transports = {} # list of available transports on this # server {'icq': ['icq.server.com', 'icq2.server.com'], } self.vcard_supported = True - self.metacontacts_supported = True + self.private_storage_supported = True # END __init__
def put_event(self, ev):
Modified: trunk/src/common/connection_handlers.py =================================================================== --- trunk/src/common/connection_handlers.py 2007-08-19 10:16:08 UTC (rev 8504) +++ trunk/src/common/connection_handlers.py 2007-08-19 15:32:41 UTC (rev 8505) @@ -1072,7 +1072,7 @@ meta_list[tag] = [data] self.dispatch('METACONTACTS', meta_list) else: - self.metacontacts_supported = False + self.private_storage_supported = False # We can now continue connection by requesting the roster self.connection.initRoster() elif self.awaiting_answers[id][0] == PRIVACY_ARRIVED: @@ -1286,7 +1286,7 @@ if storage_tag: ns = storage_tag.getNamespace() if ns == 'storage:metacontacts': - self.metacontacts_supported = False + self.private_storage_supported = False # Private XML Storage (XEP49) is not supported by server # Continue connecting self.connection.initRoster()
Modified: trunk/src/config.py =================================================================== --- trunk/src/config.py 2007-08-19 10:16:08 UTC (rev 8504) +++ trunk/src/config.py 2007-08-19 15:32:41 UTC (rev 8505) @@ -2676,6 +2676,8 @@ continue if gajim.connections[account].is_zeroconf: continue + if not gajim.connections[account].private_storage_supported: + continue iter = self.treestore.append(None, [None, account, None, None, None, None, None, None])
Modified: trunk/src/dialogs.py =================================================================== --- trunk/src/dialogs.py 2007-08-19 10:16:08 UTC (rev 8504) +++ trunk/src/dialogs.py 2007-08-19 15:32:41 UTC (rev 8505) @@ -1289,6 +1289,9 @@ if len(self._empty_required_widgets): self.xml.get_widget('join_button').set_sensitive(False)
+ if not gajim.connections[account].private_storage_supported: + self.xml.get_widget('auto_join_checkbutton').set_sensitive(False) + self.window.show_all()
def on_join_groupchat_window_destroy(self, widget):
Modified: trunk/src/groupchat_control.py =================================================================== --- trunk/src/groupchat_control.py 2007-08-19 10:16:08 UTC (rev 8504) +++ trunk/src/groupchat_control.py 2007-08-19 15:32:41 UTC (rev 8505) @@ -221,10 +221,10 @@ # connect the menuitems to their respective functions xm = gtkgui_helpers.get_glade('gc_control_popup_menu.glade')
- widget = xm.get_widget('bookmark_room_menuitem') - id = widget.connect('activate', + self.bookmark_room_menuitem = xm.get_widget('bookmark_room_menuitem') + id = self.bookmark_room_menuitem.connect('activate', self._on_bookmark_room_menuitem_activate) - self.handlers[id] = widget + self.handlers[id] = self.bookmark_room_menuitem
self.change_nick_menuitem = xm.get_widget('change_nick_menuitem') id = self.change_nick_menuitem.connect('activate', @@ -494,6 +494,8 @@ if self.contact.jid in gajim.config.get_per('accounts', self.account, 'minimized_gc').split(' '): self.minimize_menuitem.set_active(True) + if not gajim.connections[self.account].private_storage_supported: + self.bookmark_room_menuitem.set_sensitive(False) if gajim.gc_connected[self.account][self.room_jid]: c = gajim.contacts.get_gc_contact(self.account, self.room_jid, self.nick)
Modified: trunk/src/roster_window.py =================================================================== --- trunk/src/roster_window.py 2007-08-19 10:16:08 UTC (rev 8504) +++ trunk/src/roster_window.py 2007-08-19 15:32:41 UTC (rev 8505) @@ -970,6 +970,9 @@ join_gc_menuitem.set_submenu(gc_sub_menu)
connected_accounts = gajim.get_number_of_connected_accounts() + + connected_accounts_with_private_storage = 0 + if connected_accounts > 1: # 2 or more accounts? make submenus add_sub_menu = gtk.Menu() disco_sub_menu = gtk.Menu() @@ -993,15 +996,14 @@ continue
# join gc + if gajim.connections[account].private_storage_supported: + connected_accounts_with_private_storage += 1 gc_item = gtk.MenuItem(_('using account %s') % account, False) gc_sub_menu.append(gc_item) gc_menuitem_menu = gtk.Menu() self.add_bookmarks_list(gc_menuitem_menu, account) gc_item.set_submenu(gc_menuitem_menu)
- # the 'manage gc bookmarks' item is shown - # below to avoid duplicate code - # add add_item = gtk.MenuItem(_('to %s account') % account, False) add_sub_menu.append(add_item) @@ -1013,7 +1015,6 @@ disco_item.connect('activate', self.on_service_disco_menuitem_activate, account)
- add_new_contact_menuitem.set_submenu(add_sub_menu) add_sub_menu.show_all() service_disco_menuitem.set_submenu(disco_sub_menu) @@ -1026,7 +1027,10 @@ for account in gajim.connections: if gajim.account_is_connected(account): # THE connected account # gc + if gajim.connections[account].private_storage_supported: + connected_accounts_with_private_storage += 1 self.add_bookmarks_list(gc_sub_menu, account) + gc_sub_menu.show_all() # add if not self.add_new_contact_handler_id: self.add_new_contact_handler_id =\ @@ -1070,10 +1074,21 @@ add_new_contact_menuitem, service_disco_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)
+ 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() + connected_accounts_with_vcard = [] for account in gajim.connections: if gajim.account_is_connected(account) and \ @@ -1104,15 +1119,6 @@ else: profile_avatar_menuitem.set_sensitive(True)
- 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() - # Advanced Actions if len(gajim.connections) == 0: # user has no accounts advanced_menuitem.set_sensitive(False) @@ -4691,8 +4697,8 @@
def on_drop_in_contact(self, widget, account_source, c_source, account_dest, c_dest, was_big_brother, context, etime): - if not gajim.connections[account_source].metacontacts_supported or not \ - gajim.connections[account_dest].metacontacts_supported: + if not gajim.connections[account_source].private_storage_supported or not\ + gajim.connections[account_dest].private_storage_supported: dialogs.WarningDialog(_('Metacontacts storage not supported by your ' 'server'), _('Your server does not support storing metacontacts information. '