Replace the broken gpg-togglebutton by an insensitve status image. See #3196

This commit is contained in:
Stephan Erb 2008-01-11 17:45:20 +00:00
parent 40af7bfc1c
commit 79fb241153
2 changed files with 52 additions and 42 deletions

View File

@ -108,15 +108,37 @@
</widget>
</child>
<child>
<widget class="GtkScrolledWindow" id="message_scrolledwindow">
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="border_width">3</property>
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
<property name="vscrollbar_policy">GTK_POLICY_NEVER</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<placeholder/>
<widget class="GtkImage" id="lock_image">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="no_show_all">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip_markup">&lt;b&gt;markuptest&lt;/b&gt;</property>
<property name="tooltip_text">tooltip test</property>
<property name="stock">gtk-dialog-authentication</property>
</widget>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="message_scrolledwindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="border_width">3</property>
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
<property name="vscrollbar_policy">GTK_POLICY_NEVER</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
@ -136,38 +158,6 @@
<widget class="GtkHBox" id="hbox3006">
<property name="visible">True</property>
<property name="spacing">1</property>
<child>
<widget class="GtkEventBox" id="gpg_eventbox">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">OpenPGP Encryption</property>
<child>
<widget class="GtkToggleButton" id="gpg_togglebutton">
<property name="visible">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">False</property>
<property name="response_id">0</property>
<child>
<widget class="GtkImage" id="image1333">
<property name="visible">True</property>
<property name="stock">gtk-dialog-authentication</property>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
<widget class="GtkVSeparator" id="vseparator4">
<property name="visible">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
<child>

View File

@ -1018,6 +1018,10 @@ class ChatControl(ChatControlBase):
self.widget_set_visible(self.xml.get_widget('banner_eventbox'),
gajim.config.get('hide_chat_banner'))
# Add lock image to show chat encryption
self.lock_image = self.xml.get_widget('lock_image')
self.lock_tooltip = gtk.Tooltips()
# keep timeout id and window obj for possible big avatar
# it is on enter-notify and leave-notify so no need to be per jid
self.show_bigger_avatar_timeout_id = None
@ -1063,6 +1067,7 @@ class ChatControl(ChatControlBase):
gajim.encrypted_chats[self.account].append(contact.jid)
msg = _('GPG encryption enabled')
ChatControlBase.print_conversation_line(self, msg, 'status', '', None)
self._show_lock_image(self.gpg_is_active, 'GPG', self.gpg_is_active, True)
self.status_tooltip = gtk.Tooltips()
self.update_ui()
@ -1277,6 +1282,18 @@ class ChatControl(ChatControlBase):
gajim.config.set_per('contacts', self.contact.jid, 'gpg_enabled',
self.gpg_is_active)
ChatControlBase.print_conversation_line(self, msg, 'status', '', None)
self._show_lock_image(self.gpg_is_active, 'GPG', self.gpg_is_active, True)
def _show_lock_image(self, visible, enc_type = '', enc_enabled = False, chat_logged = False):
'''Set lock icon visibiity and create tooltip'''
status_string = enc_enabled and 'is' or 'is NOT'
logged_string = chat_logged and 'will' or 'will NOT'
tooltip = '%s Encryption %s active. \nYour chat session %s be logged.' %\
(enc_type, status_string, logged_string)
self.lock_tooltip.set_tip(self.lock_image, tooltip)
self.widget_set_visible(self.lock_image, not visible)
self.lock_image.set_sensitive(enc_enabled)
def _process_command(self, message):
if message[0] != '/':
@ -1465,9 +1482,10 @@ class ChatControl(ChatControlBase):
msg = _('Session negotiation cancelled')
ChatControlBase.print_conversation_line(self, msg, 'status', '', None)
# print esession settings to textview
def print_esession_details(self):
if self.session and self.session.enable_encryption:
'''print esession settings to textview'''
e2e_is_active = self.session and self.session.enable_encryption
if e2e_is_active:
msg = _('E2E encryption enabled')
ChatControlBase.print_conversation_line(self, msg, 'status', '', None)
@ -1480,6 +1498,8 @@ class ChatControl(ChatControlBase):
else:
msg = _('E2E encryption disabled')
ChatControlBase.print_conversation_line(self, msg, 'status', '', None)
self._show_lock_image(e2e_is_active, 'E2E', e2e_is_active, self.session and \
self.session.loggable)
def print_conversation(self, text, frm = '', tim = None,
encrypted = False, subject = None, xhtml = None):