[gnome-contacts] Window: properly handling address-book setup



commit 9637c629eb53c9f48b7167c0fcec5af151151eee
Author: Erick Pérez Castellanos <erick red gmail com>
Date:   Wed May 28 23:44:05 2014 -0400

    Window: properly handling address-book setup

 src/contacts-window.vala |   32 +++++++++++++++++++++++---------
 1 files changed, 23 insertions(+), 9 deletions(-)
---
diff --git a/src/contacts-window.vala b/src/contacts-window.vala
index 191be8a..1ab0cc9 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -92,29 +92,43 @@ public class Contacts.Window : Gtk.ApplicationWindow {
 
     contact_pane.store = contacts_store;
 
-    /* FIXME: order me, debug code */
-    if (true) { /* setup is done ? */
+    if ((app as App).settings.get_boolean ("did-initial-setup")) {
       view_switcher.visible_child_name = "content-view";
       set_titlebar (content_header_bar);
     } else {
-      /* here we need to wait for Store::prepare */
+      var change_book_action = app.lookup_action ("change_book") as GLib.SimpleAction;
+      if (change_book_action != null) {
+       change_book_action.set_enabled (false);
+      }
+
+      store.eds_persona_store_changed.connect  ( () => {
+         setup_accounts_list.update_contents (false);
+       });
+      ulong id2 = 0;
+      id2 = setup_accounts_list.account_selected.connect (() => {
+         setup_done_button.set_sensitive (true);
+         setup_accounts_list.disconnect (id2);
+       });
+
       view_switcher.visible_child_name = "setup-view";
       set_titlebar (setup_header_bar);
 
       setup_accounts_list.update_contents (false);
 
       setup_done_button.clicked.connect (() => {
-         /* Here we need to wait for Store::quiescent */
          view_switcher.visible_child_name = "content-view";
          set_titlebar (content_header_bar);
 
-          Timeout.add (5000, () => {
-             this.set_list_pane ();
-             return false;
-           });
+         var e_store = setup_accounts_list.selected_store as Edsf.PersonaStore;
+         eds_source_registry.set_default_address_book (e_store.source);
+         (app as App).settings.set_boolean ("did-initial-setup", true);
+
+         if (change_book_action != null) {
+           change_book_action.set_enabled (true);
+         }
        });
       setup_cancel_button.clicked.connect (() => {
-         destroy ();
+         app.quit ();
        });
     }
 


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