Skip to content
Snippets Groups Projects
Commit c91ad788 authored by Daniel Brötzmann's avatar Daniel Brötzmann Committed by Philipp Hörist
Browse files

StartChat: Add filter bar

parent 18d67fbc
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
gajim/data/icons/hicolor/16x16/devices/feather-filter-symbolic.symbolic.png

273 B

gajim/data/icons/hicolor/32x32/devices/feather-filter-symbolic.symbolic.png

485 B

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="feather feather-filter"
version="1.1"
id="svg4"
sodipodi:docname="feather-filter-symbolic.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15, custom)">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="998"
id="namedview6"
showgrid="false"
inkscape:zoom="34.291667"
inkscape:cx="12"
inkscape:cy="12"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg4" />
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
d="M 2 2 A 1.0001 1.0001 0 0 0 1.2363281 3.6464844 L 9 12.826172 L 9 19 A 1.0001 1.0001 0 0 0 9.5527344 19.894531 L 13.552734 21.894531 A 1.0001 1.0001 0 0 0 15 21 L 15 12.826172 L 22.763672 3.6464844 A 1.0001 1.0001 0 0 0 22 2 L 2 2 z M 4.15625 4 L 19.84375 4 L 13.236328 11.814453 A 1.0001 1.0001 0 0 0 13 12.460938 L 13 19.382812 L 11 18.382812 L 11 12.460938 A 1.0001 1.0001 0 0 0 10.763672 11.814453 L 4.15625 4 z "
id="polygon2" />
</svg>
......@@ -283,6 +283,13 @@ def _on_infobar_response(self, _widget, response):
self._ui.infobar.set_revealed(False)
app.settings.set('show_help_start_chat', False)
def _on_filter_bar_toggled(self, toggle_button):
active = toggle_button.get_active()
self._ui.filter_bar_revealer.set_reveal_child(active)
def _on_filter_toggled(self, _toggle_button):
self._ui.listbox.invalidate_filter()
def _start_new_chat(self, row):
if row.new:
try:
......@@ -406,6 +413,8 @@ def _on_global_search_toggle(self, button):
self._ui.search_entry.grab_focus()
image_style_context = button.get_children()[0].get_style_context()
if button.get_active():
self._ui.filter_bar_toggle.set_active(False)
self._ui.filter_bar_toggle.set_sensitive(False)
image_style_context.add_class('selected-color')
self._set_listbox(self._global_search_listbox)
if self._ui.search_entry.get_text():
......@@ -413,6 +422,7 @@ def _on_global_search_toggle(self, button):
self._remove_new_jid_row()
self._ui.listbox.invalidate_filter()
else:
self._ui.filter_bar_toggle.set_sensitive(True)
self._ui.search_entry.set_text('')
image_style_context.remove_class('selected-color')
self._set_listbox(self._ui.listbox)
......@@ -495,6 +505,14 @@ def _filter_func(self, row, _user_data):
search_text = self._ui.search_entry.get_text().lower()
search_text_list = search_text.split()
row_text = row.get_search_text().lower()
show_chats = self._ui.filter_chats.get_active()
show_groupchats = self._ui.filter_groupchats.get_active()
if row.groupchat and not show_groupchats:
return False
if not row.groupchat and not show_chats:
return False
for text in search_text_list:
if text not in row_text:
GLib.timeout_add(50, self.select_first_row)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment