diff --git a/omemo/gtk/key.py b/omemo/gtk/key.py
index f1bc575..a1feca5 100644
--- a/omemo/gtk/key.py
+++ b/omemo/gtk/key.py
@@ -16,6 +16,7 @@
import os
import time
+import locale
import logging
import tempfile
@@ -67,6 +68,7 @@ class KeyDialog(Gtk.Dialog):
self._plugin = plugin
self._omemo = self._plugin.get_omemo(self._account)
self._own_jid = app.get_jid_from_account(self._account)
+ self._show_inactive = False
path = self._plugin.local_file_path('gtk/key.ui')
self._ui = get_builder(path)
@@ -76,6 +78,9 @@ class KeyDialog(Gtk.Dialog):
omemo_img_path = self._plugin.local_file_path('omemo.png')
self._ui.omemo_image.set_from_file(omemo_img_path)
+ self._ui.list.set_filter_func(self._filter_func, None)
+ self._ui.list.set_sort_func(self._sort_func, None)
+
self._identity_key = self._omemo.backend.storage.getIdentityKeyPair()
ownfpr_format = get_fingerprint(self._identity_key, formatted=True)
self._ui.own_fingerprint.set_text(ownfpr_format)
@@ -84,9 +89,28 @@ class KeyDialog(Gtk.Dialog):
self.update()
self._load_qrcode()
+ self._ui.connect_signals(self)
self.connect('destroy', self._on_destroy)
self.show_all()
+ def _filter_func(self, row, _user_data):
+ if self._show_inactive:
+ return True
+ return row.active
+
+ @staticmethod
+ def _sort_func(row1, row2, _user_data):
+ result = locale.strcoll(str(row1.jid), str(row2.jid))
+ if result != 0:
+ return result
+
+ if row1.active != row2.active:
+ return -1 if row1.active else 1
+
+ if row1.trust != row2.trust:
+ return -1 if row1.trust > row2.trust else 1
+ return 0
+
def update(self):
self._ui.list.foreach(self._ui.list.remove)
self._load_fingerprints(self._own_jid)
@@ -168,6 +192,10 @@ class KeyDialog(Gtk.Dialog):
self._ui.qrcode.show()
self._ui.qrinfo.hide()
+ def _on_show_inactive(self, switch, param):
+ self._show_inactive = switch.get_active()
+ self._ui.list.invalidate_filter()
+
def _on_destroy(self, *args):
del self._windows['dialog']
diff --git a/omemo/gtk/key.ui b/omemo/gtk/key.ui
index b02e498..07a575a 100644
--- a/omemo/gtk/key.ui
+++ b/omemo/gtk/key.ui
@@ -91,28 +91,7 @@ you have to install python-qrcode
0
1
-
-
-
-
-
- 0
- 2
+ 2
@@ -154,5 +133,67 @@ you have to install python-qrcode
0
+
+
+
+ 1
+ 2
+
+
+
+
+
+ 0
+ 2
+
+
+
+
+
diff --git a/omemo/gtk/style.css b/omemo/gtk/style.css
index 0361536..abae1fa 100644
--- a/omemo/gtk/style.css
+++ b/omemo/gtk/style.css
@@ -15,7 +15,7 @@
padding: 10px 20px 10px 10px;
}
.omemo-key-dialog scrolledwindow row:last-child { border-bottom: 0px}
-
.omemo-key-dialog scrolledwindow { border: 1px solid; border-color:@unfocused_borders; }
+.omemo-key-dialog list > row { outline: none; }
.omemo-trust-popover row { padding: 10px 15px 10px 10px; }