[gnome-contacts] Move store to app and pass down to list and contact panes



commit 659d4dbf69af1c5e04a6c29d83c8e085607f7d5c
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Jun 30 10:20:37 2011 +0200

    Move store to app and pass down to list and contact panes

 src/contacts-app.vala          |    6 ++++--
 src/contacts-contact-pane.vala |    5 ++++-
 src/contacts-list-pane.vala    |    5 ++---
 3 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index 509b527..40dca34 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -21,6 +21,7 @@ using Gtk;
 using Folks;
 
 public class Contacts.App : Window {
+  private Store contacts_store;
   private ListPane list_pane;
   private ContactPane contacts_pane;
 
@@ -47,12 +48,13 @@ public class Contacts.App : Window {
     var grid = new Grid();
     add (grid);
 
-    list_pane = new ListPane ();
+    contacts_store = new Store ();
+    list_pane = new ListPane (contacts_store);
     list_pane.selection_changed.connect (selection_changed);
 
     grid.attach (list_pane, 0, 0, 1, 2);
 
-    contacts_pane = new ContactPane ();
+    contacts_pane = new ContactPane (contacts_store);
     contacts_pane.set_hexpand (true);
     grid.attach (contacts_pane, 1, 0, 1, 2);
 
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 0fa992b..d0315ca 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -231,6 +231,7 @@ public class Contacts.ContactPane : EventBox {
     NOTES,
     EDIT
   }
+  private Store contacts_store;
   private Contact? selected_contact;
   private Persona? editing_persona;
   private DisplayMode display_mode;
@@ -705,7 +706,9 @@ public class Contacts.ContactPane : EventBox {
     }
   }
 
-  public ContactPane () {
+  public ContactPane (Store contacts_store) {
+    this.contacts_store = contacts_store;
+
     get_style_context ().add_class ("contact-pane");
 
     var grid = new Grid ();
diff --git a/src/contacts-list-pane.vala b/src/contacts-list-pane.vala
index a93d4df..2c28bc1 100644
--- a/src/contacts-list-pane.vala
+++ b/src/contacts-list-pane.vala
@@ -401,9 +401,8 @@ public class Contacts.ListPane : Frame {
     selection_changed (contact);
   }
 
-  public ListPane () {
-    contacts_store = new Store ();
-
+  public ListPane (Store contacts_store) {
+    this.contacts_store = contacts_store;
     var toolbar = new Toolbar ();
     toolbar.get_style_context ().add_class (STYLE_CLASS_PRIMARY_TOOLBAR);
     toolbar.set_icon_size (IconSize.MENU);



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