[gnome-contacts] Emit a log message if no address books are found



commit 59ac39fa7e0d62130303e7bf3d38dfdda2321187
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Sat Sep 3 09:54:43 2022 +0200

    Emit a log message if no address books are found
    
    On a well configured system, this shouldn't happen since we expect
    something like E-D-S to be running. Of course, distro bugs can happen,
    and people can always screw up their system, so at least put a log
    message asking them if something like E-D-S is running.
    
    Related: https://gitlab.gnome.org/GNOME/gnome-contacts/-/issues/179

 src/contacts-setup-window.vala | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/src/contacts-setup-window.vala b/src/contacts-setup-window.vala
index 365f94c3..7a560d2b 100644
--- a/src/contacts-setup-window.vala
+++ b/src/contacts-setup-window.vala
@@ -41,6 +41,7 @@ public class Contacts.SetupWindow : Adw.ApplicationWindow {
   public SetupWindow (App app, Store store) {
     Object (application: app, icon_name: Config.APP_ID);
 
+    // Setup the list of address books
     this.accounts_list = new AccountsList (store);
     this.clamp.set_child (this.accounts_list);
 
@@ -48,6 +49,17 @@ public class Contacts.SetupWindow : Adw.ApplicationWindow {
       this.setup_done_button.sensitive = (this.accounts_list.selected_store != null);
     });
 
+    // In case of a badly configured system, there will be 0 address books and
+    // as a user there's no way to know why that might happen, so at least put
+    // a warning log message. Make sure we do give Backends some time to come
+    // up
+    Timeout.add_seconds (5, () => {
+      if (store.address_books.get_n_items () == 0)
+        warning ("No address books were found on the system. Are you sure evolution-data-server is 
running?");
+      return Source.REMOVE;
+    });
+
+    // Make sure we emit a signal when setup is complete
     this.setup_done_button.clicked.connect (() => {
       setup_done ((Edsf.PersonaStore) this.accounts_list.selected_store);
     });


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