don't allow to open information window when we are offline. Fixes #7082

This commit is contained in:
Yann Leboulanger 2012-01-22 11:25:22 +01:00
parent b30b6dd94f
commit afdd17bee3
2 changed files with 40 additions and 33 deletions

View File

@ -1485,11 +1485,11 @@ class ChatControl(ChatControlBase):
self._on_convert_to_gc_menuitem_activate) self._on_convert_to_gc_menuitem_activate)
self.handlers[id_] = self._convert_to_gc_button self.handlers[id_] = self._convert_to_gc_button
contact_information_button = self.xml.get_object( self._contact_information_button = self.xml.get_object(
'contact_information_button') 'contact_information_button')
id_ = contact_information_button.connect('clicked', id_ = self._contact_information_button.connect('clicked',
self._on_contact_information_menuitem_activate) self._on_contact_information_menuitem_activate)
self.handlers[id_] = contact_information_button self.handlers[id_] = self._contact_information_button
compact_view = gajim.config.get('compact_view') compact_view = gajim.config.get('compact_view')
self.chat_buttons_set_visible(compact_view) self.chat_buttons_set_visible(compact_view)
@ -1627,8 +1627,7 @@ class ChatControl(ChatControlBase):
# Enable encryption if needed # Enable encryption if needed
self.no_autonegotiation = False self.no_autonegotiation = False
e2e_is_active = self.session and self.session.enable_encryption e2e_is_active = self.session and self.session.enable_encryption
gpg_pref = gajim.config.get_per('contacts', contact.jid, gpg_pref = gajim.config.get_per('contacts', contact.jid, 'gpg_enabled')
'gpg_enabled')
# try GPG first # try GPG first
if not e2e_is_active and gpg_pref and \ if not e2e_is_active and gpg_pref and \
@ -1637,8 +1636,8 @@ class ChatControl(ChatControlBase):
self.gpg_is_active = True self.gpg_is_active = True
gajim.encrypted_chats[self.account].append(contact.jid) gajim.encrypted_chats[self.account].append(contact.jid)
msg = _('GPG encryption enabled') msg = _('GPG encryption enabled')
ChatControlBase.print_conversation_line(self, msg, ChatControlBase.print_conversation_line(self, msg, 'status', '',
'status', '', None) None)
if self.session: if self.session:
self.session.loggable = gajim.config.get_per('accounts', self.session.loggable = gajim.config.get_per('accounts',
@ -1743,6 +1742,13 @@ class ChatControl(ChatControlBase):
else: else:
self._convert_to_gc_button.set_sensitive(False) self._convert_to_gc_button.set_sensitive(False)
# Information
if gajim.account_is_disconnected(self.account):
self._contact_information_button.set_sensitive(False)
else:
self._contact_information_button.set_sensitive(True)
def update_all_pep_types(self): def update_all_pep_types(self):
for pep_type in self._pep_images: for pep_type in self._pep_images:
self.update_pep(pep_type) self.update_pep(pep_type)

View File

@ -273,7 +273,8 @@ control=None, gc_contact=None):
# Unsensitive many items when account is offline # Unsensitive many items when account is offline
if gajim.account_is_disconnected(account): if gajim.account_is_disconnected(account):
for widget in (start_chat_menuitem, rename_menuitem, for widget in (start_chat_menuitem, rename_menuitem,
edit_groups_menuitem, send_file_menuitem, convert_to_gc_menuitem): edit_groups_menuitem, send_file_menuitem, convert_to_gc_menuitem,
information_menuitem):
widget.set_sensitive(False) widget.set_sensitive(False)
if not show_start_chat: if not show_start_chat: