[gnome-documents] Remove deprecated Clutter API



commit a5f21b95cd67ce485555fa6f7fbdf149bc36560d
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Aug 29 21:26:58 2012 -0400

    Remove deprecated Clutter API
    
    Fixes: https://bugzilla.gnome.org/681526

 configure.ac         |    2 +
 src/embed.js         |   56 ++++++++++++++++++++++++++++++++-----------------
 src/notifications.js |    6 ++++-
 src/searchbar.js     |    8 +++++-
 4 files changed, 49 insertions(+), 23 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 1f39e1a..6dd8d56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,11 +56,13 @@ GOBJECT_INTROSPECTION_MIN_VERSION=1.31.6
 GDATA_MIN_VERSION=0.13.1
 GOA_MIN_VERSION=3.2.0
 CLUTTER_GTK_MIN_VERSION=1.3.2
+CLUTTER_MIN_VERSION=1.10
 TRACKER_MIN_VERSION=0.13.1
 ZAPOJIT_MIN_VERSION=0.0.2
 
 PKG_CHECK_MODULES(DOCUMENTS,
                   clutter-gtk-1.0 >= $CLUTTER_GTK_MIN_VERSION
+                  clutter-1.0 >= $CLUTTER_MIN_VERSION
                   evince-document-3.0 >= $EVINCE_MIN_VERSION
                   evince-view-3.0 >= $EVINCE_MIN_VERSION
                   gjs-1.0
diff --git a/src/embed.js b/src/embed.js
index eeb878f..a82b4b0 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -56,7 +56,11 @@ const SpinnerBox = new Lang.Class({
                                      valign: Gtk.Align.CENTER });
 
         this.actor = new GtkClutter.Actor({ contents: this.widget,
-                                            opacity: 255 });
+                                            opacity: 255,
+                                            x_align: Clutter.ActorAlign.FILL,
+                                            x_expand: true,
+                                            y_align: Clutter.ActorAlign.FILL,
+                                            y_expand: true });
 
         this._spinner = new Gtk.Spinner({ width_request: _ICON_SIZE,
                                           height_request: _ICON_SIZE,
@@ -84,7 +88,9 @@ const SpinnerBox = new Lang.Class({
 
     moveIn: function() {
         this._clearDelayId();
-        this.actor.raise_top();
+
+        let parent = this.actor.get_parent();
+        parent.set_child_above_sibling(this.actor, null);
 
         Tweener.addTween(this.actor, { opacity: 255,
                                        time: 0.30,
@@ -98,7 +104,8 @@ const SpinnerBox = new Lang.Class({
                                        time: 0.30,
                                        transition: 'easeOutQuad',
                                        onComplete: function () {
-                                           this.actor.lower_bottom();
+                                           let parent = this.actor.get_parent();
+                                           parent.set_child_below_sibling(this.actor, null);
                                        },
                                        onCompleteScope: this });
     },
@@ -151,7 +158,11 @@ const ErrorBox = new Lang.Class({
         this.widget.show_all();
 
         this.actor = new GtkClutter.Actor({ contents: this.widget,
-                                            opacity: 255 });
+                                            opacity: 255,
+                                            x_align: Clutter.ActorAlign.FILL,
+                                            x_expand: true,
+                                            y_align: Clutter.ActorAlign.FILL,
+                                            y_expand: true });
     },
 
     update: function(primary, secondary) {
@@ -163,7 +174,8 @@ const ErrorBox = new Lang.Class({
     },
 
     moveIn: function() {
-        this.actor.raise_top();
+        let parent = this.actor.get_parent();
+        parent.set_child_above_sibling(this.actor, null);
 
         Tweener.addTween(this.actor, { opacity: 255,
                                        time: 0.30,
@@ -175,7 +187,8 @@ const ErrorBox = new Lang.Class({
                                        time: 0.30,
                                        transition: 'easeOutQuad',
                                        onComplete: function () {
-                                           this.actor.lower_bottom();
+                                           let parent = this.actor.get_parent();
+                                           parent.set_child_below_sibling(this.actor, null);
                                        },
                                        onCompleteScope: this });
     }
@@ -215,26 +228,30 @@ const Embed = new Lang.Class({
         this._notebook = new Gtk.Notebook({ show_tabs: false,
                                             show_border: false });
         this._notebook.show();
-        this._notebookActor = new GtkClutter.Actor({ contents: this._notebook });
-        this._viewLayout.add(this._notebookActor, Clutter.BinAlignment.FILL, Clutter.BinAlignment.FILL);
+        this._notebookActor = new GtkClutter.Actor({ contents: this._notebook,
+                                                     x_align: Clutter.ActorAlign.FILL,
+                                                     x_expand: true,
+                                                     y_align: Clutter.ActorAlign.FILL,
+                                                     y_expand: true });
+        this._viewActor.add_child(this._notebookActor);
 
         this._spinnerBox = new SpinnerBox();
-        this._viewLayout.add(this._spinnerBox.actor, Clutter.BinAlignment.FILL, Clutter.BinAlignment.FILL);
-        this._spinnerBox.actor.lower_bottom();
+        this._viewActor.insert_child_below(this._spinnerBox.actor, null);
 
         this._errorBox = new ErrorBox();
-        this._viewLayout.add(this._errorBox.actor, Clutter.BinAlignment.FILL, Clutter.BinAlignment.FILL);
-        this._errorBox.actor.lower_bottom();
+        this._viewActor.insert_child_below(this._errorBox.actor,  null);
 
         // also pack a white background to use for spotlights between window modes
         this._background =
             new Clutter.Rectangle({ color: new Clutter.Color ({ red: 255,
                                                                 blue: 255,
                                                                 green: 255,
-                                                                alpha: 255 }) });
-        this._viewLayout.add(this._background,
-            Clutter.BinAlignment.FILL, Clutter.BinAlignment.FILL);
-        this._background.lower_bottom();
+                                                                alpha: 255 }),
+                                    x_align: Clutter.ActorAlign.FILL,
+                                    x_expand: true,
+                                    y_align: Clutter.ActorAlign.FILL,
+                                    y_expand: true });
+        this._viewActor.insert_child_below(this._background, null);
 
         // create the OSD toolbar for selected items, it's hidden by default
         this._selectionToolbar = new Selections.SelectionToolbar(this._contentsActor);
@@ -242,8 +259,7 @@ const Embed = new Lang.Class({
             Clutter.BinAlignment.FIXED, Clutter.BinAlignment.FIXED);
 
         // pack the OSD notification actor
-        this._viewLayout.add(Global.notificationManager.actor,
-            Clutter.BinAlignment.CENTER, Clutter.BinAlignment.START);
+        this._viewActor.add_child(Global.notificationManager.actor);
 
         // now create the actual content widgets
         this._view = new View.ViewContainer();
@@ -305,14 +321,14 @@ const Embed = new Lang.Class({
                                              time: 0.20,
                                              transition: 'easeInQuad',
                                              onComplete: function() {
-                                                 this._background.lower_bottom();
+                                                 this._viewActor.set_child_below_sibling(this._background, null);
                                              },
                                              onCompleteScope: this });
     },
 
     _windowModeChangeFlash: function() {
         // fade from white when returning to the view anyway
-        this._background.raise_top();
+        this._viewActor.set_child_above_sibling(this._background, null);
         this._background.opacity = 255;
         this._moveOutBackground();
     },
diff --git a/src/notifications.js b/src/notifications.js
index bc6039e..2dd65b4 100644
--- a/src/notifications.js
+++ b/src/notifications.js
@@ -19,6 +19,7 @@
  *
  */
 
+const Clutter = imports.gi.Clutter;
 const Gd = imports.gi.Gd;
 const GLib = imports.gi.GLib;
 const Gtk = imports.gi.Gtk;
@@ -101,7 +102,10 @@ const NotificationManager = new Lang.Class({
                                     row_spacing: 6 });
 
         this.actor = new GtkClutter.Actor({ contents: this.widget,
-                                            opacity: 0 });
+                                            opacity: 0,
+                                            x_align: Clutter.ActorAlign.CENTER,
+                                            y_align: Clutter.ActorAlign.START,
+                                            y_expand: true });
         Utils.alphaGtkWidget(this.actor.get_widget());
 
         this.widget.add(this._grid);
diff --git a/src/searchbar.js b/src/searchbar.js
index 9589101..a122299 100644
--- a/src/searchbar.js
+++ b/src/searchbar.js
@@ -448,7 +448,10 @@ const Dropdown = new Lang.Class({
 
     show: function() {
         this.widget.show_all();
-        this.actor.raise_top();
+
+        let parent = this.actor.get_parent();
+        parent.set_child_above_sibling(this.actor, null);
+
         Tweener.addTween(this.actor, { opacity: 245,
                                        time: 0.20,
                                        transition: 'easeOutQuad' });
@@ -460,7 +463,8 @@ const Dropdown = new Lang.Class({
                                        time: 0.20,
                                        transition: 'easeOutQuad',
                                        onComplete: function() {
-                                           this.actor.lower_bottom();
+                                           let parent = this.actor.get_parent();
+                                           parent.set_child_below_sibling(this.actor, null);
                                        },
                                        onCompleteScope: this });
     }



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