aboutsummaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorMiquel Lionel <lionel@les-miquelots.net>2024-01-28 00:43:37 +0100
committerMiquel Lionel <lionel@les-miquelots.net>2024-01-28 02:03:37 +0100
commit92bea39ffe8a8ed15008fc6e38c1ab0b7e8d277d (patch)
tree80669607a0691864cbe5170353180a9663a1f399 /main
parent8199c85848346b59518f6c882be1b5b885eb78cf (diff)
downloaddino-show-contact-status-in-start-chat-window.tar.gz
dino-show-contact-status-in-start-chat-window.zip
Expand #836, can filter and search online contact nowshow-contact-status-in-start-chat-windowsearch-filter-online-contacts
Diffstat (limited to 'main')
-rw-r--r--main/src/ui/add_conversation/select_jid_fragment.vala41
1 files changed, 18 insertions, 23 deletions
diff --git a/main/src/ui/add_conversation/select_jid_fragment.vala b/main/src/ui/add_conversation/select_jid_fragment.vala
index 36b6bdae..bdd40d76 100644
--- a/main/src/ui/add_conversation/select_jid_fragment.vala
+++ b/main/src/ui/add_conversation/select_jid_fragment.vala
@@ -54,20 +54,20 @@ public class SelectJidFragment : Gtk.Box {
if (list_row == null) return;
remove_jid(list_row.child as ListRow);
});
- filter_online_button.clicked.connect(() => {
- if(!filter_online_toggled){
- filter_online_toggled = true;
- list.set_filter_func(filter_online);
- Util.force_css(filter_online_button, "* {border: 2px solid limegreen;}");
- filter_online_button.set_tooltip_text(_("Only showing online users is toggled on."));
- }
- else{
- filter_online_toggled = false;
+ filter_online_button.clicked.connect(() => {
+ if(!filter_online_toggled){
+ filter_online_toggled = true;
+ Util.force_css(filter_online_button, "* {border: 2px solid limegreen;}");
+ filter_online_button.set_tooltip_text(_("Only showing online users is toggled on."));
+ }
+ else{
+ filter_online_toggled = false;
+ Util.force_css(filter_online_button, "* {border: initial;}");
+ filter_online_button.set_tooltip_text(_("Only showing online users is not toggled on."));
+ }
list.set_filter_func(filter);
- Util.force_css(filter_online_button, "* {border: initial;}");
- filter_online_button.set_tooltip_text(_("Only showing online users is not toggled on."));
- }
- });
+ entry.grab_focus();
+ });
}
public void set_filter(string str) {
@@ -78,7 +78,6 @@ public class SelectJidFragment : Gtk.Box {
filter_values = str == "" ? null : str.split(" ");
list.invalidate_filter();
- filter_online_button.sensitive = str.length > 0 ? false : true;
try {
Jid parsed_jid = new Jid(str);
@@ -122,6 +121,11 @@ public class SelectJidFragment : Gtk.Box {
private bool filter(ListBoxRow r) {
ListRow? row = (r.child as ListRow);
if (row == null) return true;
+ if (filter_online_toggled){
+ if(row.status_str == null){
+ return false;
+ }
+ }
if (filter_values != null) {
foreach (string filter in filter_values) {
@@ -134,15 +138,6 @@ public class SelectJidFragment : Gtk.Box {
return true;
}
- private bool filter_online(ListBoxRow r){
- ListRow? row = (r.child as ListRow);
- if (row == null) return true;
- if(row.status_str == null){
- return false;
- }
- return true;
- }
-
private void header(ListBoxRow row, ListBoxRow? before_row) {
if (row.get_header() == null && before_row != null) {
row.set_header(new Separator(Orientation.HORIZONTAL));