[gnome-boxes] notificationbar: Move it out of Clutter.Actor



commit e5acc480d086747914d98d35732dc356507c82dc
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Feb 19 19:33:55 2014 +0000

    notificationbar: Move it out of Clutter.Actor
    
    We can use a Gtk.Overlay to display it.

 src/app.vala             |   13 ++++++++-----
 src/notificationbar.vala |   25 +++++++------------------
 2 files changed, 15 insertions(+), 23 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 170ee7b..0873dc2 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -549,8 +549,14 @@ private class Boxes.App: GLib.Object, Boxes.UI {
         searchbar = new Searchbar ();
         vbox.add (searchbar);
 
+        notificationbar = new Notificationbar ();
+        var notification_overlay = new Gtk.Overlay ();
+        notification_overlay.add_overlay (notificationbar);
+
         embed = new ClutterWidget ();
-        vbox.add (embed);
+        notification_overlay.add (embed);
+
+        vbox.add (notification_overlay);
 
         display_page = new DisplayPage ();
         stack.add_named (display_page, "display-page");
@@ -588,7 +594,6 @@ private class Boxes.App: GLib.Object, Boxes.UI {
         sidebar = new Sidebar ();
         view = new CollectionView ();
         topbar = new Topbar ();
-        notificationbar = new Notificationbar ();
         wizard = new Wizard ();
         properties = new Properties ();
         empty_boxes = new EmptyBoxes ();
@@ -628,9 +633,7 @@ private class Boxes.App: GLib.Object, Boxes.UI {
         hbox.show_all ();
         hbox_actor.hide ();
 
-        below_bin_actor.add_child (notificationbar.actor);
-
-        below_bin_actor.insert_child_below (empty_boxes.actor, notificationbar.actor);
+        below_bin_actor.add_child (empty_boxes.actor);
 
         properties.actor.hide ();
 
diff --git a/src/notificationbar.vala b/src/notificationbar.vala
index a81f062..d90cdf3 100644
--- a/src/notificationbar.vala
+++ b/src/notificationbar.vala
@@ -1,30 +1,19 @@
 // This file is part of GNOME Boxes. License: LGPLv2+
 using Gtk;
 
-private class Boxes.Notificationbar: GLib.Object {
+private class Boxes.Notificationbar: Gtk.Grid {
     public const int DEFAULT_TIMEOUT = 6;
 
-    public Clutter.Actor actor { get { return gtk_actor; } }
-
-    private GtkClutter.Actor gtk_actor;
-    private Gtk.Grid top_grid;
-
     GLib.List<Widget> active_notifications;
 
     public Notificationbar () {
-        active_notifications = new GLib.List<Widget> ();
+        valign = Gtk.Align.START;
+        halign = Gtk.Align.CENTER;
+        get_style_context ().add_class ("boxes-bg");
 
-        top_grid = new Gtk.Grid ();
-        top_grid.show ();
+        show ();
 
-        gtk_actor = new GtkClutter.Actor.with_contents (top_grid);
-        gtk_actor.name = "notificationbar";
-        gtk_actor.x_align = Clutter.ActorAlign.CENTER;
-        gtk_actor.y_align = Clutter.ActorAlign.START;
-        gtk_actor.x_expand = true;
-        gtk_actor.y_expand = true;
-        Gdk.RGBA transparent = { 0, 0, 0, 0};
-        gtk_actor.get_widget ().override_background_color (0, transparent);
+        active_notifications = new GLib.List<Widget> ();
 
         App.app.notify["page"].connect ( () => {
             foreach (var w in active_notifications) {
@@ -90,7 +79,7 @@ private class Boxes.Notificationbar: GLib.Object {
 
     private void add_notification (Widget w) {
         if (App.app.page == AppPage.MAIN)
-            top_grid.attach (w, 0, 0, 1, 1);
+            attach (w, 0, 0, 1, 1);
         else
             App.app.display_page.add_notification (w);
     }


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