Commit 55f32fb2 authored by Philipp Hörist's avatar Philipp Hörist

[omemo] Add search to Key Dialog

parent a9d10991
......@@ -94,6 +94,9 @@ class KeyDialog(Gtk.Dialog):
self.show_all()
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):
return False
if self._show_inactive:
return True
return row.active
......@@ -111,6 +114,9 @@ class KeyDialog(Gtk.Dialog):
return -1 if row1.trust > row2.trust else 1
return 0
def _on_search_changed(self, _entry):
self._ui.list.invalidate_filter()
def update(self):
self._ui.list.foreach(self._ui.list.remove)
self._load_fingerprints(self._own_jid)
......
......@@ -61,6 +61,20 @@ you have to install python-qrcode</property>
</object>
</child>
</object>
<object class="GtkPopover" id="search_popover">
<property name="can_focus">False</property>
<child>
<object class="GtkSearchEntry" id="search">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="caps_lock_warning">False</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
<signal name="search-changed" handler="_on_search_changed" swapped="no"/>
</object>
</child>
</object>
<object class="GtkGrid" id="grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
......@@ -193,7 +207,25 @@ you have to install python-qrcode</property>
</packing>
</child>
<child>
<placeholder/>
<object class="GtkMenuButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="popover">search_popover</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">edit-find-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</interface>
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