From 9094c98fc3f85da0ad03aeec52f511c584ca2401 Mon Sep 17 00:00:00 2001 From: Alexander Mikhaylenko Date: Fri, 12 Aug 2022 17:19:11 +0400 Subject: Fix unselecting sidebar item Multiple things here. - The selection model state was mever synced back to the list - The selected == null codepath didn't work - unselect_all() does nothing with GtkSingleSelection - gtk_list_box_unselect_all() does nothing with BROWSE selection mode Fixes https://gitlab.gnome.org/GNOME/gnome-contacts/-/issues/262 --- src/contacts-contact-pane.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/contacts-contact-pane.vala') diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala index 5cbbc84..b375a9c 100644 --- a/src/contacts-contact-pane.vala +++ b/src/contacts-contact-pane.vala @@ -238,7 +238,7 @@ public class Contacts.ContactPane : Adw.Bin { persona = yield primary_store.add_persona_from_details (details); } catch (Error e) { show_message_dialog (_("Unable to create new contacts: %s").printf (e.message)); - this.store.selection.unselect_all (); + this.store.selection.unselect_item (this.store.selection.get_selected ()); return; } @@ -253,7 +253,7 @@ public class Contacts.ContactPane : Adw.Bin { // If we got here, we couldn't find the individual show_message_dialog (_("Unable to find newly created contact")); - this.store.selection.unselect_all (); + this.store.selection.unselect_item (this.store.selection.get_selected ()); } private void show_message_dialog (string message) { -- cgit v1.2.1