[gnome-contacts/nielsdg/fix-account-list-selection] accounts-list: Don't autoselect an address book




commit fff05142b1f93a6fbab2ec3d0d64513338510dd9
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Mon Aug 8 08:10:49 2022 +0200

    accounts-list: Don't autoselect an address book
    
    There's 2 reasons why we don't want the AccountsList widget to
    automatically select an address book:
    
    1. In the initial setup, we want a user to explicitly choose which
       address book they'd like to use for storing contacts
    2. We haven't setup the selection_changed handler yet, meaning the
       "selected-store" property will not get notified of the initial
       selection.
    
    Fixes: https://gitlab.gnome.org/GNOME/gnome-contacts/-/issues/260

 src/contacts-accounts-list.vala | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/contacts-accounts-list.vala b/src/contacts-accounts-list.vala
index db04cc9a..0990f302 100644
--- a/src/contacts-accounts-list.vala
+++ b/src/contacts-accounts-list.vala
@@ -49,7 +49,9 @@ public class Contacts.AccountsList : Adw.PreferencesGroup {
     on_model_items_changed (model, 0, 0, model.get_n_items ());
 
     // Setup the selection model
-    this.selection = new Gtk.SingleSelection (model);
+    this.selection = new Gtk.SingleSelection (null);
+    this.selection.autoselect = false;
+    this.selection.model = model;
 
     // Update the row when the selection model changes
     this.selection.selection_changed.connect ((sel, pos, n_items) => {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]