[gnome-photos] Remove deprecated Clutter API



commit 40d9fa4ab598789d286257a1562d60738ee5565b
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Aug 9 17:20:16 2012 +0200

    Remove deprecated Clutter API

 src/photos-embed.c     |   39 ++++++++++++++++++++++-----------------
 src/photos-error-box.c |   26 ++++++++++++++++++++++++--
 2 files changed, 46 insertions(+), 19 deletions(-)
---
diff --git a/src/photos-embed.c b/src/photos-embed.c
index 100fa39..974e409 100644
--- a/src/photos-embed.c
+++ b/src/photos-embed.c
@@ -265,16 +265,27 @@ photos_embed_set_error (PhotosEmbed *self, const gchar *primary, const gchar *se
 
 
 static void
+photos_embed_window_mode_change_flash_completed (PhotosEmbed *self)
+{
+  PhotosEmbedPrivate *priv = self->priv;
+  clutter_actor_set_child_below_sibling (priv->view_actor, priv->background, NULL);
+}
+
+
+static void
 photos_embed_window_mode_change_flash (PhotosEmbed *self)
 {
   PhotosEmbedPrivate *priv = self->priv;
   ClutterAnimation *animation;
 
-  clutter_actor_raise_top (priv->background);
+  clutter_actor_set_child_above_sibling (priv->view_actor, priv->background, NULL);
   clutter_actor_set_opacity (priv->background, 255);
 
   animation = clutter_actor_animate (priv->background, CLUTTER_EASE_IN_QUAD, 200, "opacity", 0, NULL);
-  g_signal_connect_swapped (animation, "completed", G_CALLBACK (clutter_actor_lower_bottom), priv->background);
+  g_signal_connect_swapped (animation,
+                            "completed",
+                            G_CALLBACK (photos_embed_window_mode_change_flash_completed),
+                            self);
 }
 
 
@@ -354,7 +365,8 @@ photos_embed_init (PhotosEmbed *self)
   clutter_box_layout_set_fill (CLUTTER_BOX_LAYOUT (priv->contents_layout), toolbar_actor, TRUE, FALSE);
 
   priv->view_layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, CLUTTER_BIN_ALIGNMENT_CENTER);
-  priv->view_actor = clutter_box_new (priv->view_layout);
+  priv->view_actor = clutter_actor_new ();
+  clutter_actor_set_layout_manager (priv->view_actor, priv->view_layout);
   clutter_box_layout_set_expand (CLUTTER_BOX_LAYOUT (priv->contents_layout), priv->view_actor, TRUE);
   clutter_box_layout_set_fill (CLUTTER_BOX_LAYOUT (priv->contents_layout), priv->view_actor, TRUE, TRUE);
   clutter_container_add_actor (CLUTTER_CONTAINER (priv->contents_actor), priv->view_actor);
@@ -365,26 +377,19 @@ photos_embed_init (PhotosEmbed *self)
   gtk_widget_show (priv->notebook);
 
   priv->notebook_actor = gtk_clutter_actor_new_with_contents (priv->notebook);
-  clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (priv->view_layout),
-                          priv->notebook_actor,
-                          CLUTTER_BIN_ALIGNMENT_FILL,
-                          CLUTTER_BIN_ALIGNMENT_FILL);
+  clutter_actor_set_x_expand (priv->notebook_actor, TRUE);
+  clutter_actor_set_y_expand (priv->notebook_actor, TRUE);
+  clutter_actor_add_child (priv->view_actor, priv->notebook_actor);
 
   /* TODO: SpinnerBox */
 
   priv->error_box = photos_error_box_new ();
-  clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (priv->view_layout),
-                          priv->error_box,
-                          CLUTTER_BIN_ALIGNMENT_FILL,
-                          CLUTTER_BIN_ALIGNMENT_FILL);
-  clutter_actor_lower_bottom (priv->error_box);
+  clutter_actor_insert_child_below (priv->view_actor, priv->error_box, NULL);
 
   priv->background = clutter_rectangle_new_with_color (&color);
-  clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (priv->view_layout),
-                          priv->background,
-                          CLUTTER_BIN_ALIGNMENT_FILL,
-                          CLUTTER_BIN_ALIGNMENT_FILL);
-  clutter_actor_lower_bottom (priv->background);
+  clutter_actor_set_x_expand (priv->background, TRUE);
+  clutter_actor_set_y_expand (priv->background, TRUE);
+  clutter_actor_insert_child_below (priv->view_actor, priv->background, NULL);
 
   /* TODO: SearchBar.Dropdown,
    *       ...
diff --git a/src/photos-error-box.c b/src/photos-error-box.c
index 3f08c32..e44e91a 100644
--- a/src/photos-error-box.c
+++ b/src/photos-error-box.c
@@ -59,6 +59,9 @@ photos_error_box_init (PhotosErrorBox *self)
   self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, PHOTOS_TYPE_ERROR_BOX, PhotosErrorBoxPrivate);
   priv = self->priv;
 
+  clutter_actor_set_x_expand (CLUTTER_ACTOR (self), TRUE);
+  clutter_actor_set_y_expand (CLUTTER_ACTOR (self), TRUE);
+
   widget = gtk_grid_new ();
   gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
   gtk_widget_set_hexpand (widget, TRUE);
@@ -113,18 +116,37 @@ photos_error_box_new (void)
 void
 photos_error_box_move_in (PhotosErrorBox *self)
 {
-  clutter_actor_raise_top (CLUTTER_ACTOR (self));
+  ClutterActor *parent;
+
+  parent = clutter_actor_get_parent (CLUTTER_ACTOR (self));
+  if (parent == NULL)
+    return;
+
+  clutter_actor_set_child_above_sibling (parent, CLUTTER_ACTOR (self), NULL);
   clutter_actor_animate (CLUTTER_ACTOR (self), CLUTTER_EASE_OUT_QUAD, 300, "opacity", 255, NULL);
 }
 
 
 void
+photos_error_box_move_out_completed (PhotosErrorBox *self)
+{
+  ClutterActor *parent;
+
+  parent = clutter_actor_get_parent (CLUTTER_ACTOR (self));
+  if (parent == NULL)
+    return;
+
+  clutter_actor_set_child_below_sibling (parent, CLUTTER_ACTOR (self), NULL);
+}
+
+
+void
 photos_error_box_move_out (PhotosErrorBox *self)
 {
   ClutterAnimation *animation;
 
   animation = clutter_actor_animate (CLUTTER_ACTOR (self), CLUTTER_EASE_OUT_QUAD, 300, "opacity", 0, NULL);
-  g_signal_connect_swapped (animation, "completed", G_CALLBACK (clutter_actor_lower_bottom), self);
+  g_signal_connect_swapped (animation, "completed", G_CALLBACK (photos_error_box_move_out_completed), self);
 }
 
 



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