Commit 575eb729 authored by Philipp Hörist's avatar Philipp Hörist

[omemo] Show all fingerprints in one list

parent f2c914e8
<?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,175 +16,69 @@
<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="GtkScrolledWindow" id="scrolledwindow1">
<property name="height_request">200</property>
<object class="GtkLabel" id="fingerprint_label_desc1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkTreeView" id="fingerprint_view">
<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-selection1"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="name_column">
<property name="resizable">True</property>
<property name="title" translatable="yes">Name</property>
<property name="clickable">True</property>
<property name="sort_indicator">True</property>
<property name="sort_column_id">1</property>
<child>
<object class="GtkCellRendererText" id="NameCell"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="trust_column">
<property name="resizable">True</property>
<property name="title" translatable="yes">Trust</property>
<child>
<object class="GtkCellRendererText" id="TrustCell"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="fingerprint_column">
<property name="resizable">True</property>
<property name="title" translatable="yes">Fingerprint</property>
<child>
<object class="GtkCellRendererText" id="FingerprintCell"/>
<attributes>
<attribute name="markup">3</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
<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">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox3">
<object class="GtkLabel" id="fingerprint_label_own">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkButton" id="trust_button">
<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>
<property name="label">&lt;tt&gt;-------- -------- -------- -------- -------- &lt;/tt&gt;</property>
<property name="use_markup">True</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="fill">False</property>
<property name="position">1</property>
</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>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox1">
<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>
<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">&lt;tt&gt;-------- -------- -------- -------- -------- &lt;/tt&gt;</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>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="height_request">100</property>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="height_request">200</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkTreeView" id="fingerprint_view_own">
<object class="GtkTreeView" id="fingerprint_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_tooltip">True</property>
......@@ -194,14 +88,17 @@
<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"/>
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="name_column1">
<object class="GtkTreeViewColumn" id="name_column">
<property name="resizable">True</property>
<property name="title" translatable="yes">Name</property>
<property name="clickable">True</property>
<property name="sort_indicator">True</property>
<property name="sort_column_id">1</property>
<child>
<object class="GtkCellRendererText" id="NameCell1"/>
<object class="GtkCellRendererText" id="NameCell"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
......@@ -209,11 +106,11 @@
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="trust_column1">
<object class="GtkTreeViewColumn" id="trust_column">
<property name="resizable">True</property>
<property name="title" translatable="yes">Trust</property>
<child>
<object class="GtkCellRendererText" id="TrustCell2"/>
<object class="GtkCellRendererText" id="TrustCell"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
......@@ -221,11 +118,11 @@
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="fingerprint_column1">
<object class="GtkTreeViewColumn" id="fingerprint_column">
<property name="resizable">True</property>
<property name="title" translatable="yes">Fingerprint</property>
<child>
<object class="GtkCellRendererText" id="FingerprintCell1"/>
<object class="GtkCellRendererText" id="FingerprintCell"/>
<attributes>
<attribute name="markup">3</attribute>
</attributes>
......@@ -238,16 +135,16 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox4">
<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_button1">
<object class="GtkButton" id="trust_button">
<property name="label" translatable="yes" comments="button">Trust/Revoke Fingerprint</property>
<property name="width_request">200</property>
<property name="visible">True</property>
......@@ -265,25 +162,16 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">1</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)
......
......@@ -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):
del self.windowinstances['dialog']
self.hide()
def on_window_delete(self, widget, event):
def _on_destroy(self, *args):
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()
state = self.omemostate
self._load_fingerprints(self.own_jid)
self._load_fingerprints(self.contact.jid, self.groupchat is True)
if self.notebook.get_current_page() == 1:
contact_jid = self.own_jid
else:
contact_jid = self.contact.jid
def _load_fingerprints(self, contact_jid, groupchat=False):
state = self.omemostate
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]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment