[gnome-boxes] DisplayPage: Add space for notifications



commit 82645c137ebca252051ce60e205e8473186361d9
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Oct 29 21:48:17 2012 +0100

    DisplayPage: Add space for notifications
    
    We add a grid where notifications can be packed in the display
    page. This is below the overlay toolbar (if its visible) and
    above the spice view.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679106
    
    Flesh out comment

 src/display-page.vala |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/display-page.vala b/src/display-page.vala
index 4381ea3..f6b7b3e 100644
--- a/src/display-page.vala
+++ b/src/display-page.vala
@@ -31,6 +31,7 @@ private class Boxes.DisplayPage: GLib.Object {
     private Box box;
     private DisplayToolbar overlay_toolbar;
     private EventBox overlay_toolbar_box;
+    private Grid notification_grid;
     private DisplayToolbar toolbar;
     private uint toolbar_hide_id;
     private uint toolbar_show_id;
@@ -114,12 +115,31 @@ private class Boxes.DisplayPage: GLib.Object {
         overlay_toolbar_box.valign = Gtk.Align.START;
         overlay_toolbar_box.vexpand = false;
 
+        notification_grid = new Grid ();
+        notification_grid.valign = Gtk.Align.START;
+        notification_grid.halign = Gtk.Align.CENTER;
+        notification_grid.vexpand = false;
+
+        // We need one expanding row, or otherwise in the case
+        // where overlay_toolbar_box is hidden we will get zero
+        // expanding rows, which means all empty rows get
+        // to divide all remaining space, so the notifications
+        // are centered
+        var empty_grid = new Grid ();
+        empty_grid.vexpand = true;
+
         grid.attach (event_box, 0, 0, 1, 3);
         grid.attach (overlay_toolbar_box, 0, 0, 1, 1);
+        grid.attach (notification_grid, 0, 1, 1, 1);
+        grid.attach (empty_grid, 0, 2, 1, 1);
 
         box.show_all ();
     }
 
+    public void add_notification (Widget w) {
+        notification_grid.attach (w, 0, 0, 1, 1);
+    }
+
     public void get_size (out int width, out int height) {
         int tb_height;
 



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