don't allow to open information window when we are offline. Fixes #7082
This commit is contained in:
parent
b30b6dd94f
commit
afdd17bee3
|
@ -1437,22 +1437,22 @@ class ChatControl(ChatControlBase):
|
||||||
|
|
||||||
def __init__(self, parent_win, contact, acct, session, resource=None):
|
def __init__(self, parent_win, contact, acct, session, resource=None):
|
||||||
ChatControlBase.__init__(self, self.TYPE_ID, parent_win,
|
ChatControlBase.__init__(self, self.TYPE_ID, parent_win,
|
||||||
'chat_control', contact, acct, resource)
|
'chat_control', contact, acct, resource)
|
||||||
|
|
||||||
self.gpg_is_active = False
|
self.gpg_is_active = False
|
||||||
# for muc use:
|
# for muc use:
|
||||||
# widget = self.xml.get_object('muc_window_actions_button')
|
# widget = self.xml.get_object('muc_window_actions_button')
|
||||||
self.actions_button = self.xml.get_object('message_window_actions_button')
|
self.actions_button = self.xml.get_object('message_window_actions_button')
|
||||||
id_ = self.actions_button.connect('clicked',
|
id_ = self.actions_button.connect('clicked',
|
||||||
self.on_actions_button_clicked)
|
self.on_actions_button_clicked)
|
||||||
self.handlers[id_] = self.actions_button
|
self.handlers[id_] = self.actions_button
|
||||||
|
|
||||||
self._formattings_button = self.xml.get_object('formattings_button')
|
self._formattings_button = self.xml.get_object('formattings_button')
|
||||||
|
|
||||||
self._add_to_roster_button = self.xml.get_object(
|
self._add_to_roster_button = self.xml.get_object(
|
||||||
'add_to_roster_button')
|
'add_to_roster_button')
|
||||||
id_ = self._add_to_roster_button.connect('clicked',
|
id_ = self._add_to_roster_button.connect('clicked',
|
||||||
self._on_add_to_roster_menuitem_activate)
|
self._on_add_to_roster_menuitem_activate)
|
||||||
self.handlers[id_] = self._add_to_roster_button
|
self.handlers[id_] = self._add_to_roster_button
|
||||||
|
|
||||||
self._audio_button = self.xml.get_object('audio_togglebutton')
|
self._audio_button = self.xml.get_object('audio_togglebutton')
|
||||||
|
@ -1460,14 +1460,14 @@ class ChatControl(ChatControlBase):
|
||||||
self.handlers[id_] = self._audio_button
|
self.handlers[id_] = self._audio_button
|
||||||
# add a special img
|
# add a special img
|
||||||
gtkgui_helpers.add_image_to_button(self._audio_button,
|
gtkgui_helpers.add_image_to_button(self._audio_button,
|
||||||
'gajim-mic_inactive')
|
'gajim-mic_inactive')
|
||||||
|
|
||||||
self._video_button = self.xml.get_object('video_togglebutton')
|
self._video_button = self.xml.get_object('video_togglebutton')
|
||||||
id_ = self._video_button.connect('toggled', self.on_video_button_toggled)
|
id_ = self._video_button.connect('toggled', self.on_video_button_toggled)
|
||||||
self.handlers[id_] = self._video_button
|
self.handlers[id_] = self._video_button
|
||||||
# add a special img
|
# add a special img
|
||||||
gtkgui_helpers.add_image_to_button(self._video_button,
|
gtkgui_helpers.add_image_to_button(self._video_button,
|
||||||
'gajim-cam_inactive')
|
'gajim-cam_inactive')
|
||||||
|
|
||||||
self._send_file_button = self.xml.get_object('send_file_button')
|
self._send_file_button = self.xml.get_object('send_file_button')
|
||||||
# add a special img for send file button
|
# add a special img for send file button
|
||||||
|
@ -1476,30 +1476,30 @@ class ChatControl(ChatControlBase):
|
||||||
img.set_from_file(path_to_upload_img)
|
img.set_from_file(path_to_upload_img)
|
||||||
self._send_file_button.set_image(img)
|
self._send_file_button.set_image(img)
|
||||||
id_ = self._send_file_button.connect('clicked',
|
id_ = self._send_file_button.connect('clicked',
|
||||||
self._on_send_file_menuitem_activate)
|
self._on_send_file_menuitem_activate)
|
||||||
self.handlers[id_] = self._send_file_button
|
self.handlers[id_] = self._send_file_button
|
||||||
|
|
||||||
self._convert_to_gc_button = self.xml.get_object(
|
self._convert_to_gc_button = self.xml.get_object(
|
||||||
'convert_to_gc_button')
|
'convert_to_gc_button')
|
||||||
id_ = self._convert_to_gc_button.connect('clicked',
|
id_ = self._convert_to_gc_button.connect('clicked',
|
||||||
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)
|
||||||
self.widget_set_visible(self.xml.get_object('banner_eventbox'),
|
self.widget_set_visible(self.xml.get_object('banner_eventbox'),
|
||||||
gajim.config.get('hide_chat_banner'))
|
gajim.config.get('hide_chat_banner'))
|
||||||
|
|
||||||
self.authentication_button = self.xml.get_object(
|
self.authentication_button = self.xml.get_object(
|
||||||
'authentication_button')
|
'authentication_button')
|
||||||
id_ = self.authentication_button.connect('clicked',
|
id_ = self.authentication_button.connect('clicked',
|
||||||
self._on_authentication_button_clicked)
|
self._on_authentication_button_clicked)
|
||||||
self.handlers[id_] = self.authentication_button
|
self.handlers[id_] = self.authentication_button
|
||||||
|
|
||||||
# Add lock image to show chat encryption
|
# Add lock image to show chat encryption
|
||||||
|
@ -1541,31 +1541,31 @@ class ChatControl(ChatControlBase):
|
||||||
|
|
||||||
# Hook up signals
|
# Hook up signals
|
||||||
id_ = self.parent_win.window.connect('motion-notify-event',
|
id_ = self.parent_win.window.connect('motion-notify-event',
|
||||||
self._on_window_motion_notify)
|
self._on_window_motion_notify)
|
||||||
self.handlers[id_] = self.parent_win.window
|
self.handlers[id_] = self.parent_win.window
|
||||||
message_tv_buffer = self.msg_textview.get_buffer()
|
message_tv_buffer = self.msg_textview.get_buffer()
|
||||||
id_ = message_tv_buffer.connect('changed',
|
id_ = message_tv_buffer.connect('changed',
|
||||||
self._on_message_tv_buffer_changed)
|
self._on_message_tv_buffer_changed)
|
||||||
self.handlers[id_] = message_tv_buffer
|
self.handlers[id_] = message_tv_buffer
|
||||||
|
|
||||||
widget = self.xml.get_object('avatar_eventbox')
|
widget = self.xml.get_object('avatar_eventbox')
|
||||||
widget.set_property('height-request', gajim.config.get(
|
widget.set_property('height-request', gajim.config.get(
|
||||||
'chat_avatar_height'))
|
'chat_avatar_height'))
|
||||||
id_ = widget.connect('enter-notify-event',
|
id_ = widget.connect('enter-notify-event',
|
||||||
self.on_avatar_eventbox_enter_notify_event)
|
self.on_avatar_eventbox_enter_notify_event)
|
||||||
self.handlers[id_] = widget
|
self.handlers[id_] = widget
|
||||||
|
|
||||||
id_ = widget.connect('leave-notify-event',
|
id_ = widget.connect('leave-notify-event',
|
||||||
self.on_avatar_eventbox_leave_notify_event)
|
self.on_avatar_eventbox_leave_notify_event)
|
||||||
self.handlers[id_] = widget
|
self.handlers[id_] = widget
|
||||||
|
|
||||||
id_ = widget.connect('button-press-event',
|
id_ = widget.connect('button-press-event',
|
||||||
self.on_avatar_eventbox_button_press_event)
|
self.on_avatar_eventbox_button_press_event)
|
||||||
self.handlers[id_] = widget
|
self.handlers[id_] = widget
|
||||||
|
|
||||||
widget = self.xml.get_object('location_eventbox')
|
widget = self.xml.get_object('location_eventbox')
|
||||||
id_ = widget.connect('button-release-event',
|
id_ = widget.connect('button-release-event',
|
||||||
self.on_location_eventbox_button_release_event)
|
self.on_location_eventbox_button_release_event)
|
||||||
self.handlers[id_] = widget
|
self.handlers[id_] = widget
|
||||||
|
|
||||||
for key in ('1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '0', '#'):
|
for key in ('1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '0', '#'):
|
||||||
|
@ -1614,7 +1614,7 @@ class ChatControl(ChatControlBase):
|
||||||
if not resource:
|
if not resource:
|
||||||
resource = contact.resource
|
resource = contact.resource
|
||||||
session = gajim.connections[self.account].find_controlless_session(
|
session = gajim.connections[self.account].find_controlless_session(
|
||||||
self.contact.jid, resource)
|
self.contact.jid, resource)
|
||||||
|
|
||||||
self.setup_seclabel(self.xml.get_object('label_selector'))
|
self.setup_seclabel(self.xml.get_object('label_selector'))
|
||||||
if session:
|
if session:
|
||||||
|
@ -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,15 +1636,15 @@ 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',
|
||||||
self.account, 'log_encrypted_sessions')
|
self.account, 'log_encrypted_sessions')
|
||||||
# GPG is always authenticated as we use GPG's WoT
|
# GPG is always authenticated as we use GPG's WoT
|
||||||
self._show_lock_image(self.gpg_is_active, 'GPG', self.gpg_is_active,
|
self._show_lock_image(self.gpg_is_active, 'GPG', self.gpg_is_active,
|
||||||
self.session and self.session.is_loggable(), True)
|
self.session and self.session.is_loggable(), True)
|
||||||
|
|
||||||
self.update_ui()
|
self.update_ui()
|
||||||
# restore previous conversation
|
# restore previous conversation
|
||||||
|
@ -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)
|
||||||
|
|
|
@ -272,8 +272,9 @@ 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:
|
||||||
|
|
Loading…
Reference in New Issue