[gnome-contacts] Initial work to move code into Contacts.Window



commit d6f248a1d8ed62cf970d9a3084e05f1782b9b712
Author: Erick Pérez Castellanos <erick red gmail com>
Date:   Fri Apr 25 23:01:53 2014 -0400

    Initial work to move code into Contacts.Window
    
    Moved Contacts.Store, this broke setup related code, but that code will
    live on Contacts.Window as well, so eventually will work.

 src/contacts-app.vala    |   10 +++++++---
 src/contacts-store.vala  |    2 +-
 src/contacts-window.ui   |    1 +
 src/contacts-window.vala |    3 +++
 4 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index 790b1f9..540d2af 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -23,7 +23,9 @@ using Folks;
 public class Contacts.App : Gtk.Application {
   public static App app;
   public GLib.Settings settings;
-  public Store contacts_store;
+
+  /* moving creation to Window */
+  public weak Store contacts_store;
 
   public Contacts.Window window;
 
@@ -234,6 +236,9 @@ public class Contacts.App : Gtk.Application {
 
   private void create_window () {
     window = new Contacts.Window (this);
+
+    contacts_store = window.contacts_store;
+
     window.delete_event.connect (window_delete_event);
     window.key_press_event.connect_after (window_key_press_event);
 
@@ -303,9 +308,7 @@ public class Contacts.App : Gtk.Application {
   }
 
   public override void startup () {
-
     ensure_eds_accounts ();
-    contacts_store = new Store ();
     base.startup ();
   }
 
@@ -332,6 +335,7 @@ public class Contacts.App : Gtk.Application {
         app_menu_created = true;
       }
 
+      /* FIXME: setup code won't work for now */
       if (!settings.get_boolean ("did-initial-setup")) {
         if (contacts_store.is_prepared)
           show_setup ();
diff --git a/src/contacts-store.vala b/src/contacts-store.vala
index 4713e4e..b38fd79 100644
--- a/src/contacts-store.vala
+++ b/src/contacts-store.vala
@@ -136,7 +136,7 @@ public class Contacts.Store : GLib.Object {
     write_dont_suggest_db ();
   }
 
-  public Store () {
+  construct {
     contacts = new Gee.ArrayList<Contact>();
 
     dont_suggest_link = new Gee.HashMultiMap<string, string> ();
diff --git a/src/contacts-window.ui b/src/contacts-window.ui
index 1a57a3f..68e4a09 100644
--- a/src/contacts-window.ui
+++ b/src/contacts-window.ui
@@ -163,4 +163,5 @@
       <widget name="done_button"/>
     </widgets>
   </object>
+  <object class="ContactsStore" id="contacts_store" />
 </interface>
diff --git a/src/contacts-window.vala b/src/contacts-window.vala
index 15e2250..edb8154 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -32,6 +32,9 @@ public class Contacts.Window : Gtk.ApplicationWindow {
   [GtkChild]
   private Overlay right_overlay;
 
+  [GtkChild]
+  public Store contacts_store;
+
   /* FIXME: remove from public what it is not needed */
   [GtkChild]
   public Button add_button;


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