[gnome-contacts] Contacts.Window: add main overlay for notifications



commit 98d507e0f966370c1c5b9473c20fc32e9e278d0b
Author: Erick Pérez Castellanos <erick red gmail com>
Date:   Thu Aug 15 11:11:15 2013 -0400

    Contacts.Window: add main overlay for notifications

 src/contacts-app.vala    |   23 +++++++++--------------
 src/contacts-window.vala |   15 +++++++++++++++
 2 files changed, 24 insertions(+), 14 deletions(-)
---
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index 80ad9f1..3b5a5dd 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -26,7 +26,6 @@ public class Contacts.App : Gtk.Application {
   public Store contacts_store;
 
   public Contacts.Window window;
-  private Gtk.Overlay overlay;
 
   private ListPane list_pane;
 
@@ -245,12 +244,7 @@ public class Contacts.App : Gtk.Application {
 
     var grid = new Grid();
 
-    overlay = new Gtk.Overlay ();
-    Gdk.RGBA transparent = { 0, 0, 0, 0 };
-    overlay.override_background_color (0, transparent);
-    overlay.add (grid);
-
-    window.add (overlay);
+    window.add_main_child (grid);
 
     list_pane = new ListPane (contacts_store);
     list_pane.selection_changed.connect (selection_changed);
@@ -275,14 +269,13 @@ public class Contacts.App : Gtk.Application {
     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);
 
     grid.attach (right_overlay, 1, 1, 1, 1);
 
-    overlay.show_all ();
-
     window.add_button.clicked.connect (app.new_contact);
 
     window.select_button.toggled.connect (() => {
@@ -321,6 +314,8 @@ public class Contacts.App : Gtk.Application {
         contacts_pane.set_edit_mode (false);
       });
 
+    window.show_all ();
+
     window.edit_button.hide ();
     window.done_button.hide ();
   }
@@ -397,7 +392,7 @@ public class Contacts.App : Gtk.Application {
     notification.add (l);
 
     notification.show_all ();
-    overlay.add_overlay (notification);
+    window.add_notification (notification);
   }
 
   public void new_contact () {
@@ -431,7 +426,7 @@ public class Contacts.App : Gtk.Application {
     g.add (b);
 
     notification.show_all ();
-    overlay.add_overlay (notification);
+    window.add_notification (notification);
 
     /* signal handlers */
     b.clicked.connect ( () => {
@@ -463,7 +458,7 @@ public class Contacts.App : Gtk.Application {
     g.add (b);
 
     notification.show_all ();
-    overlay.add_overlay (notification);
+    window.add_notification (notification);
 
     /* signal handlers */
     bool really_delete = true;
@@ -517,7 +512,7 @@ public class Contacts.App : Gtk.Application {
         contact.show ();
         show_contact (contact);
       });
-    overlay.add_overlay (notification);
+    window.add_notification (notification);
   }
 
   private static string individual_id = null;
@@ -553,7 +548,7 @@ public class Contacts.App : Gtk.Application {
       notification.dismiss ();
       operation.undo.begin ();
     });
-    overlay.add_overlay (notification);
+    window.add_notification (notification);
   }
 
   public override int command_line (ApplicationCommandLine command_line) {
diff --git a/src/contacts-window.vala b/src/contacts-window.vala
index 67c38b0..d670c79 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -27,6 +27,7 @@ using Folks;
 
 public class Contacts.Window : Gtk.ApplicationWindow {
   private HeaderBar right_toolbar;
+  private Overlay overlay;
 
   /* FIXME: remove from public what it is not needed */
   public HeaderBar left_toolbar;
@@ -95,6 +96,12 @@ public class Contacts.Window : Gtk.ApplicationWindow {
 
     titlebar.show_all ();
     set_titlebar (titlebar);
+
+    overlay = new Gtk.Overlay ();
+    Gdk.RGBA transparent = { 0, 0, 0, 0 };
+    overlay.override_background_color (0, transparent);
+
+    add (overlay);
   }
 
   public void activate_selection_mode (bool active) {
@@ -114,4 +121,12 @@ public class Contacts.Window : Gtk.ApplicationWindow {
       left_toolbar.set_title (_("All Contacts"));
     }
   }
+
+  public void add_main_child (Widget child) {
+    overlay.add (child);
+  }
+
+  public void add_notification (Widget notification) {
+    overlay.add_overlay (notification);
+  }
 }


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