From a587ff709a8949763e5764a7031d65c729a7e2cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Br=C3=B6tzmann?= Date: Sat, 27 Jun 2020 21:02:18 +0200 Subject: [PATCH] [omemo] Add infobar in fingerprints dialog --- omemo/gtk/key.py | 14 +- omemo/gtk/key.ui | 357 ++++++++++++++++++++++++++++---------------- omemo/gtk/style.css | 2 - omemo/plugin.py | 3 +- 4 files changed, 244 insertions(+), 132 deletions(-) diff --git a/omemo/gtk/key.py b/omemo/gtk/key.py index 9caee66..5b2a4db 100644 --- a/omemo/gtk/key.py +++ b/omemo/gtk/key.py @@ -78,6 +78,13 @@ class KeyDialog(Gtk.Dialog): path = self._plugin.local_file_path('gtk/key.ui') self._ui = get_builder(path) + markup = '%s' % ( + 'https://dev.gajim.org/gajim/gajim-plugins/-/' + 'wikis/omemogajimplugin', _('Read more about blind trust.')) + self._ui.btbv_link.set_markup(markup) + self._ui.infobar.set_revealed( + self._plugin.config['SHOW_HELP_FINGERPRINTS']) + self._ui.header.set_text(_('Fingerprints for %s') % self._contact.jid) omemo_img_path = self._plugin.local_file_path('omemo.png') @@ -90,7 +97,7 @@ class KeyDialog(Gtk.Dialog): ownfpr_format = get_fingerprint(self._identity_key, formatted=True) self._ui.own_fingerprint.set_text(ownfpr_format) - self.get_content_area().add(self._ui.grid) + self.get_content_area().add(self._ui.box) self.update() self._load_qrcode() @@ -98,6 +105,11 @@ class KeyDialog(Gtk.Dialog): self.connect('destroy', self._on_destroy) self.show_all() + def _on_infobar_response(self, _widget, response): + if response == Gtk.ResponseType.CLOSE: + self._ui.infobar.set_revealed(False) + self._plugin.config['SHOW_HELP_FINGERPRINTS'] = False + def _filter_func(self, row, _user_data): search_text = self._ui.search.get_text() if search_text and search_text.lower() not in str(row.jid): diff --git a/omemo/gtk/key.ui b/omemo/gtk/key.ui index 42a3b50..433bac6 100644 --- a/omemo/gtk/key.ui +++ b/omemo/gtk/key.ui @@ -1,7 +1,7 @@ - + - + False none @@ -9,10 +9,7 @@ True False - 12 - 12 - 12 - 12 + 12 vertical 12 @@ -34,7 +31,6 @@ True False - gtk-missing-image False @@ -75,156 +71,261 @@ you have to install python-qrcode - + True False - 12 + vertical - + True - True - True - never - in - 270 - False - - - True + False + True + True + False + + + False + end - + + + + + False + False + 0 + + + + + False + 6 + + True False - none + dialog-information-symbolic + 3 + + + False + True + 0 + + + + + True + False + vertical + + + True + False + Click the shield icon to manage trust for each fingerprint. + True + 46 + 0 + + + False + True + 0 + + + + + True + False + Read more on blind trust. + 0 + + + False + True + 1 + + + + + True + True + 1 + + + + + False + False + 0 + + + + + False + True + 0 + + + + + True + False + 18 + 12 + + + True + False + start + 11 + + + True + False + + + False + True + 0 + + + + + True + False + + + + False + True + 1 + + + + + 0 + 0 + + + + + True + True + True + end + center + search_popover + + + True + False + edit-find-symbolic - - - - 0 - 1 - 2 - - - - - True - False - start - 11 - - - True - False - gtk-missing-image - - False - True - 0 + 1 + 0 - - True - False - - - - False - True - 1 - - - - - 0 - 0 - - - - - True - True - True - end - center - up - popover - - - True - False - Own Fingerprint - - - - - 1 - 2 - - - - - True - False - start - center - 12 - - + True True - + True + never + in + 270 + False + + + True + False + + + True + False + none + + + + - False - True - 0 + 0 + 1 + 2 - + True - False - Show inactive + True + True + end + center + up + popover + + + True + False + Own Fingerprint + + - False - True - 1 + 1 + 2 + + + + + True + False + start + center + 12 + + + True + True + + + + False + True + 0 + + + + + True + False + Show inactive + + + False + True + 1 + + + + + 0 + 2 - 0 - 2 - - - - - True - True - True - end - center - search_popover - - - True - False - edit-find-symbolic - - - - - 1 - 0 + False + True + 1 diff --git a/omemo/gtk/style.css b/omemo/gtk/style.css index abae1fa..ad2b930 100644 --- a/omemo/gtk/style.css +++ b/omemo/gtk/style.css @@ -7,8 +7,6 @@ .omemo-last-seen { font-size: 11px; } -.omemo-key-dialog > box { margin: 18px; } - .omemo-key-dialog scrolledwindow row { border-bottom: 1px solid; border-color: @unfocused_borders; diff --git a/omemo/plugin.py b/omemo/plugin.py index 4456648..944457d 100644 --- a/omemo/plugin.py +++ b/omemo/plugin.py @@ -116,7 +116,8 @@ class OmemoPlugin(GajimPlugin): self.config_default_values = { 'DISABLED_ACCOUNTS': ([], ''), - 'BLIND_TRUST': (True, '') + 'BLIND_TRUST': (True, ''), + 'SHOW_HELP_FINGERPRINTS': (True, ''), } for account in self.config['DISABLED_ACCOUNTS']: