[gnome-contacts] Contacts.Window: make more chrome internal



commit 767dacd69468532359dc6f6003ac5819da5c6b09
Author: Erick Pérez Castellanos <erick red gmail com>
Date:   Thu Aug 15 11:22:56 2013 -0400

    Contacts.Window: make more chrome internal

 src/contacts-app.vala    |   31 ++++++++-----------------------
 src/contacts-window.vala |   30 +++++++++++++++++++++---------
 2 files changed, 29 insertions(+), 32 deletions(-)
---
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index 3b5a5dd..0b1ceb8 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -28,9 +28,7 @@ public class Contacts.App : Gtk.Application {
   public Contacts.Window window;
 
   private ListPane list_pane;
-
   private ContactPane contacts_pane;
-  private Overlay right_overlay;
 
   private bool window_delete_event (Gdk.EventAny event) {
     // Clear the contacts so any changed information is stored
@@ -242,39 +240,26 @@ public class Contacts.App : Gtk.Application {
     window.delete_event.connect (window_delete_event);
     window.key_press_event.connect_after (window_key_press_event);
 
-    var grid = new Grid();
-
-    window.add_main_child (grid);
-
     list_pane = new ListPane (contacts_store);
     list_pane.selection_changed.connect (selection_changed);
     list_pane.link_contacts.connect (link_contacts);
     list_pane.delete_contacts.connect (delete_contacts);
-    list_pane.contacts_marked.connect ((nr_contacts) => {
-       if (nr_contacts == 0)
-         window.left_title = _("Select");
-       else
-         window.left_title = _("%d Selected").printf (nr_contacts);
-      });
-
-    grid.attach (list_pane, 0, 1, 1, 1);
 
-    /* horizontal size group, for the splitted headerbar */
-    var hsize_group = new SizeGroup (SizeGroupMode.HORIZONTAL);
-    hsize_group.add_widget (window.left_toolbar);
-    hsize_group.add_widget (list_pane);
+    window.add_left_child (list_pane);
 
     contacts_pane = new ContactPane (contacts_store);
     contacts_pane.set_hexpand (true);
     contacts_pane.will_delete.connect (delete_contact);
     contacts_pane.contacts_linked.connect (contacts_linked);
 
-    Gdk.RGBA transparent = { 0, 0, 0, 0 };
-    right_overlay = new Overlay ();
-    right_overlay.override_background_color (0, transparent);
-    right_overlay.add (contacts_pane);
+    window.add_right_child (contacts_pane);
 
-    grid.attach (right_overlay, 1, 1, 1, 1);
+    list_pane.contacts_marked.connect ((nr_contacts) => {
+       if (nr_contacts == 0)
+         window.left_title = _("Select");
+       else
+         window.left_title = _("%d Selected").printf (nr_contacts);
+      });
 
     window.add_button.clicked.connect (app.new_contact);
 
diff --git a/src/contacts-window.vala b/src/contacts-window.vala
index d670c79..445a68d 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -19,18 +19,13 @@
 using Gtk;
 using Folks;
 
-/* FIXME: big changes:
- * 1. remove edit_button/done_button from public
- * 2. hide toolbar as well, make public properties to set the title
- * 3. make property virtual prop to change the select bar header
- * 4. this will remove the window.edit_button from contacts-app.vala */
-
 public class Contacts.Window : Gtk.ApplicationWindow {
+  private HeaderBar left_toolbar;
   private HeaderBar right_toolbar;
   private Overlay overlay;
+  private Grid grid;
 
   /* FIXME: remove from public what it is not needed */
-  public HeaderBar left_toolbar;
   public Button add_button;
   public Gd.HeaderToggleButton select_button;
 
@@ -102,6 +97,9 @@ public class Contacts.Window : Gtk.ApplicationWindow {
     overlay.override_background_color (0, transparent);
 
     add (overlay);
+
+    grid = new Grid();
+    overlay.add (grid);
   }
 
   public void activate_selection_mode (bool active) {
@@ -122,8 +120,22 @@ public class Contacts.Window : Gtk.ApplicationWindow {
     }
   }
 
-  public void add_main_child (Widget child) {
-    overlay.add (child);
+  public void add_left_child (Widget child) {
+    grid.attach (child, 0, 1, 1, 1);
+
+    /* horizontal size group, for the splitted headerbar */
+    var hsize_group = new SizeGroup (SizeGroupMode.HORIZONTAL);
+    hsize_group.add_widget (left_toolbar);
+    hsize_group.add_widget (child);
+  }
+
+  public void add_right_child (Widget child) {
+    Gdk.RGBA transparent = { 0, 0, 0, 0 };
+    var right_overlay = new Overlay ();
+    right_overlay.override_background_color (0, transparent);
+    right_overlay.add (child);
+
+    grid.attach (right_overlay, 1, 1, 1, 1);
   }
 
   public void add_notification (Widget notification) {


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