[omemo] Show all fingerprints in one list
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.3 -->
|
||||
<!-- Generated with glade 3.22.1 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.0"/>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkListStore" id="fingerprint_store">
|
||||
<columns>
|
||||
<!-- column-name id -->
|
||||
@@ -16,16 +16,62 @@
|
||||
<column type="gint"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkNotebook" id="notebook1">
|
||||
<object class="GtkBox" id="fingerprint_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<signal name="switch-page" handler="update_context_list" after="yes" swapped="no"/>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">18</property>
|
||||
<property name="margin_right">18</property>
|
||||
<property name="margin_top">18</property>
|
||||
<property name="margin_bottom">18</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox4">
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="spacing">10</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="fingerprint_label_desc1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes" comments="Descriptive label">Own Fingerprint:</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="fingerprint_label_own">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label"><tt>-------- -------- -------- -------- -------- </tt></property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="selectable">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="height_request">200</property>
|
||||
@@ -93,10 +139,10 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox3">
|
||||
<object class="GtkButtonBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<property name="layout_style">start</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="trust_button">
|
||||
<property name="label" translatable="yes" comments="button">Trust/Revoke Fingerprint</property>
|
||||
@@ -120,170 +166,12 @@
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes" comments="tab label">Contact</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="fingerprint_label_desc1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes" comments="Descriptive label">Own Fingerprint:</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="fingerprint_label_own">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label"><tt>-------- -------- -------- -------- -------- </tt></property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="selectable">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow2">
|
||||
<property name="height_request">100</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="fingerprint_view_own">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="model">fingerprint_store</property>
|
||||
<property name="headers_clickable">False</property>
|
||||
<property name="search_column">0</property>
|
||||
<property name="tooltip_column">3</property>
|
||||
<signal name="button-press-event" handler="fpr_button_pressed_cb" swapped="no"/>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="treeview-selection2"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="name_column1">
|
||||
<property name="resizable">True</property>
|
||||
<property name="title" translatable="yes">Name</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="NameCell1"/>
|
||||
<attributes>
|
||||
<attribute name="text">1</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="trust_column1">
|
||||
<property name="resizable">True</property>
|
||||
<property name="title" translatable="yes">Trust</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="TrustCell2"/>
|
||||
<attributes>
|
||||
<attribute name="text">2</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="fingerprint_column1">
|
||||
<property name="resizable">True</property>
|
||||
<property name="title" translatable="yes">Fingerprint</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="FingerprintCell1"/>
|
||||
<attributes>
|
||||
<attribute name="markup">3</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="trust_button1">
|
||||
<property name="label" translatable="yes" comments="button">Trust/Revoke Fingerprint</property>
|
||||
<property name="width_request">200</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<signal name="clicked" handler="trust_button_clicked_cb" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Own Devices</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkMenu" id="fprclipboard_menu">
|
||||
<property name="visible">True</property>
|
||||
|
||||
@@ -288,20 +288,17 @@ class OmemoPlugin(GajimPlugin):
|
||||
omemo = self.get_omemo(account)
|
||||
transient = chat_control.parent_win.window
|
||||
if 'dialog' not in self.windowinstances:
|
||||
if isinstance(chat_control, GroupchatControl):
|
||||
self.windowinstances['dialog'] = \
|
||||
FingerprintWindow(self, contact, transient,
|
||||
self.windowinstances, groupchat=True)
|
||||
else:
|
||||
self.windowinstances['dialog'] = \
|
||||
FingerprintWindow(self, contact, transient,
|
||||
self.windowinstances)
|
||||
is_groupchat = isinstance(chat_control, GroupchatControl)
|
||||
self.windowinstances['dialog'] = \
|
||||
FingerprintWindow(self, contact, transient,
|
||||
self.windowinstances, groupchat=is_groupchat)
|
||||
self.windowinstances['dialog'].show_all()
|
||||
if fingerprints:
|
||||
log.debug('%s => Showing Fingerprint Prompt for %s',
|
||||
account, contact.jid)
|
||||
omemo.store.setShownFingerprints(fingerprints)
|
||||
else:
|
||||
self.windowinstances['dialog'].present()
|
||||
self.windowinstances['dialog'].update_context_list()
|
||||
if fingerprints:
|
||||
omemo.store.setShownFingerprints(fingerprints)
|
||||
|
||||
41
omemo/ui.py
41
omemo/ui.py
@@ -374,9 +374,8 @@ class FingerprintWindow(Gtk.Dialog):
|
||||
title=(_('Fingerprints for %s')) % contact.jid,
|
||||
parent=parent,
|
||||
flags=Gtk.DialogFlags.DESTROY_WITH_PARENT)
|
||||
close_button = self.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
|
||||
close_button.connect('clicked', self.on_close_button_clicked)
|
||||
self.connect('delete-event', self.on_window_delete)
|
||||
|
||||
self.connect('destroy', self._on_destroy)
|
||||
|
||||
self.GTK_BUILDER_FILE_PATH = \
|
||||
self.plugin.local_file_path('fpr_dialog.ui')
|
||||
@@ -389,7 +388,7 @@ class FingerprintWindow(Gtk.Dialog):
|
||||
self.fpr_view = self.xml.get_object('fingerprint_view')
|
||||
self.fpr_view_own = self.xml.get_object('fingerprint_view_own')
|
||||
|
||||
self.notebook = self.xml.get_object('notebook1')
|
||||
self.notebook = self.xml.get_object('fingerprint_box')
|
||||
vbox = self.get_content_area()
|
||||
vbox.pack_start(self.notebook, True, True, 0)
|
||||
|
||||
@@ -405,21 +404,13 @@ class FingerprintWindow(Gtk.Dialog):
|
||||
|
||||
self.show_all()
|
||||
|
||||
def on_close_button_clicked(self, widget):
|
||||
def _on_destroy(self, *args):
|
||||
del self.windowinstances['dialog']
|
||||
self.hide()
|
||||
|
||||
def on_window_delete(self, widget, event):
|
||||
del self.windowinstances['dialog']
|
||||
self.hide()
|
||||
|
||||
def trust_button_clicked_cb(self, button, *args):
|
||||
state = self.omemostate
|
||||
|
||||
if self.notebook.get_current_page() == 1:
|
||||
mod, paths = self.fpr_view_own.get_selection().get_selected_rows()
|
||||
else:
|
||||
mod, paths = self.fpr_view.get_selection().get_selected_rows()
|
||||
mod, paths = self.fpr_view.get_selection().get_selected_rows()
|
||||
|
||||
def on_yes(checked, identity_key):
|
||||
state.store.setTrust(identity_key, State.TRUSTED)
|
||||
@@ -440,8 +431,10 @@ class FingerprintWindow(Gtk.Dialog):
|
||||
YesNoDialog(
|
||||
_('Trust / Revoke Fingerprint?'),
|
||||
_('Do you want to trust the fingerprint of <b>{jid}</b> '
|
||||
'on your account <b>{account}</b>?\n\n'
|
||||
'<tt>{fingerprint}</tt>').format(jid=jid, account=self.account, fingerprint=fpr),
|
||||
'on your account <b>{account}</b>?\n\n'
|
||||
'<tt>{fingerprint}</tt>').format(jid=jid,
|
||||
account=self.account,
|
||||
fingerprint=fpr),
|
||||
on_response_yes=(on_yes, identity_key),
|
||||
on_response_no=(on_no, identity_key),
|
||||
transient_for=self)
|
||||
@@ -468,10 +461,7 @@ class FingerprintWindow(Gtk.Dialog):
|
||||
return keep_selection
|
||||
|
||||
def clipboard_button_cb(self, menuitem):
|
||||
if self.notebook.get_current_page() == 1:
|
||||
mod, paths = self.fpr_view_own.get_selection().get_selected_rows()
|
||||
else:
|
||||
mod, paths = self.fpr_view.get_selection().get_selected_rows()
|
||||
mod, paths = self.fpr_view.get_selection().get_selected_rows()
|
||||
|
||||
fprs = []
|
||||
for path in paths:
|
||||
@@ -483,15 +473,14 @@ class FingerprintWindow(Gtk.Dialog):
|
||||
|
||||
def update_context_list(self, *args):
|
||||
self.fpr_model.clear()
|
||||
self._load_fingerprints(self.own_jid)
|
||||
self._load_fingerprints(self.contact.jid, self.groupchat is True)
|
||||
|
||||
def _load_fingerprints(self, contact_jid, groupchat=False):
|
||||
state = self.omemostate
|
||||
|
||||
if self.notebook.get_current_page() == 1:
|
||||
contact_jid = self.own_jid
|
||||
else:
|
||||
contact_jid = self.contact.jid
|
||||
|
||||
trust_str = {0: 'False', 1: 'True', 2: 'Undecided'}
|
||||
if self.groupchat and self.notebook.get_current_page() == 0:
|
||||
if groupchat:
|
||||
contact_jids = []
|
||||
for nick in self.con.groupchat[contact_jid]:
|
||||
real_jid = self.con.groupchat[contact_jid][nick]
|
||||
|
||||
Reference in New Issue
Block a user