[gnome-nibbles] Switch away from some deprecated clutter calls



commit 20f18c9ece36c3ae764b9c844497179fe6900bb4
Author: Bryan Quigley <bryanquigs src gnome org>
Date:   Sun Apr 28 00:56:29 2013 -0400

    Switch away from some deprecated clutter calls

 src/board.c |   18 +++++++++---------
 src/main.c  |    6 +++---
 src/warp.c  |    2 +-
 src/worm.c  |   28 ++++++++++++++--------------
 4 files changed, 27 insertions(+), 27 deletions(-)
---
diff --git a/src/board.c b/src/board.c
index d41e77b..ee7901a 100644
--- a/src/board.c
+++ b/src/board.c
@@ -70,7 +70,7 @@ gnibbles_board_new (void)
   clutter_actor_set_size (CLUTTER_ACTOR (board->surface),
                           properties->tilesize * BOARDWIDTH,
                           properties->tilesize * BOARDHEIGHT);
-  clutter_container_add_actor (CLUTTER_CONTAINER (stage),
+  clutter_actor_add_child (stage,
                                CLUTTER_ACTOR (board->surface));
   clutter_actor_show (CLUTTER_ACTOR (board->surface));
 
@@ -87,11 +87,11 @@ gnibbles_board_load_level (GnibblesBoard *board)
   GError *error = NULL;
 
   if (board->level) {
-    clutter_group_remove_all (CLUTTER_GROUP (board->level));
-    clutter_container_remove_actor (CLUTTER_CONTAINER (stage), board->level);
+    clutter_actor_remove_all_children (board->level);
+    clutter_actor_remove_child (stage, board->level);
   }
 
-  board->level = clutter_group_new ();
+  board->level = clutter_actor_new ();
 
   /* Load wall_pixmaps onto the surface*/
   for (i = 0; i < BOARDHEIGHT; i++) {
@@ -171,14 +171,14 @@ gnibbles_board_load_level (GnibblesBoard *board)
 
         clutter_actor_set_position (CLUTTER_ACTOR (tmp), x_pos, y_pos);
         clutter_actor_show (CLUTTER_ACTOR (tmp));
-        clutter_container_add_actor (CLUTTER_CONTAINER (board->level),
+        clutter_actor_add_child (board->level,
                                      CLUTTER_ACTOR (tmp));
       }
     }
   }
 
-  clutter_container_add_actor (CLUTTER_CONTAINER (stage), board->level);
-  clutter_actor_raise (board->level, board->surface);
+  clutter_actor_add_child (stage, board->level);
+  clutter_actor_set_child_above_sibling (stage, board->level, board->surface);
 
   clutter_actor_set_opacity (board->level, 0);
   clutter_actor_set_scale (CLUTTER_ACTOR (board->level), 0.2, 0.2);
@@ -209,10 +209,10 @@ gnibbles_board_rescale (GnibblesBoard *board, gint tilesize)
                           board->width,
                           board->height);
 
-  count = clutter_group_get_n_children (CLUTTER_GROUP (board->level));
+  count = clutter_actor_get_n_children (board->level);
 
   for (i = 0; i < count; i++) {
-    tmp = clutter_group_get_nth_child (CLUTTER_GROUP (board->level), i);
+    tmp = clutter_actor_get_child_at_index (board->level, i);
     clutter_actor_get_position (CLUTTER_ACTOR (tmp), &x_pos, &y_pos);
     clutter_actor_set_position (CLUTTER_ACTOR (tmp),
                                 (x_pos / properties->tilesize) * tilesize,
diff --git a/src/main.c b/src/main.c
index 69b8cef..8555e9e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -273,7 +273,7 @@ new_game (void)
 
   for (i = 0; i < properties->numworms; i++) {
     if (!clutter_actor_get_stage (worms[i]->actors))
-      clutter_container_add_actor (CLUTTER_CONTAINER (stage), worms[i]->actors);
+      clutter_actor_add_child (stage, worms[i]->actors);
     gnibbles_worm_show (worms[i]);
   }
 
@@ -395,7 +395,7 @@ restart_game (gpointer data)
 
   for (i = 0; i < properties->numworms; i++) {
     if (!clutter_actor_get_stage (worms[i]->actors))
-      clutter_container_add_actor (CLUTTER_CONTAINER (stage), worms[i]->actors);
+      clutter_actor_add_child (stage, worms[i]->actors);
     gnibbles_worm_show (worms[i]);
   }
 
@@ -663,7 +663,7 @@ setup_window (void)
   clutter_widget = gtk_clutter_embed_new ();
   stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter_widget));
 
-  clutter_stage_set_color (CLUTTER_STAGE(stage), &stage_color);
+  clutter_actor_set_background_color (stage, &stage_color);
 
   clutter_actor_set_size (CLUTTER_ACTOR (stage),
                           properties->tilesize * BOARDWIDTH,
diff --git a/src/warp.c b/src/warp.c
index 09f0826..1149a31 100644
--- a/src/warp.c
+++ b/src/warp.c
@@ -90,7 +90,7 @@ gnibbles_warp_draw (GnibblesWarp *warp)
   clutter_actor_set_position (CLUTTER_ACTOR (warp->actor),
                               properties->tilesize * warp->x,
                               properties->tilesize * warp->y);
-  clutter_container_add_actor (CLUTTER_CONTAINER (stage), warp->actor);
+  clutter_actor_add_child (stage, warp->actor);
   clutter_actor_set_opacity (warp->actor, 0);
   clutter_actor_set_scale (warp->actor, 2.0, 2.0);
   //g_signal_connect_after (
diff --git a/src/worm.c b/src/worm.c
index a4eec24..fa4f4d3 100644
--- a/src/worm.c
+++ b/src/worm.c
@@ -164,7 +164,7 @@ gnibbles_worm_add_actor (GnibblesWorm *worm)
                               worm->xhead * properties->tilesize,
                               worm->yhead * properties->tilesize);
 
-  clutter_container_add_actor (CLUTTER_CONTAINER (worm->actors), actor);
+  clutter_actor_add_child (worm->actors, actor);
   worm->list = g_list_prepend (worm->list, actor);
   board->walls[worm->xhead][worm->yhead] = WORMCHAR + worm->number;
 }
@@ -176,7 +176,7 @@ gnibbles_worm_remove_actor (GnibblesWorm *worm)
   board->walls[worm->xtail][worm->ytail] = EMPTYCHAR;
   clutter_actor_hide (actor);
   worm->list = g_list_delete_link (worm->list, g_list_last (worm->list));
-  clutter_container_remove_actor (CLUTTER_CONTAINER (worm->actors), actor);
+  clutter_actor_remove_child (worm->actors, actor);
 }
 
 gboolean
@@ -469,7 +469,7 @@ gnibbles_worm_move_tail_pointer (GnibblesWorm *worm)
 static void
 gnibbles_worm_animate_death (GnibblesWorm *worm)
 {
-  ClutterActor *group = clutter_group_new ();
+  ClutterActor *group = clutter_actor_new ();
   ClutterActor *tmp = NULL;
   GError *error = NULL;
 
@@ -489,7 +489,7 @@ gnibbles_worm_animate_death (GnibblesWorm *worm)
     clutter_actor_set_size (CLUTTER_ACTOR (tmp),
                             properties->tilesize,
                             properties->tilesize);
-    clutter_container_add_actor (CLUTTER_CONTAINER (group), tmp);
+    clutter_actor_add_child (group , tmp);
   }
 
   worm->length = g_list_length (worm->list);
@@ -498,11 +498,11 @@ gnibbles_worm_animate_death (GnibblesWorm *worm)
 
   clutter_actor_set_opacity (CLUTTER_ACTOR (worm->actors), 0x00);
 
-  clutter_group_remove_all (CLUTTER_GROUP (worm->actors));
+  clutter_actor_remove_all_children (worm->actors);
   g_list_free (worm->list);
   worm->list = NULL;
 
-  clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
+  clutter_actor_add_child (stage, group);
 
   clutter_actor_animate (group, CLUTTER_EASE_OUT_QUAD, 310,
                          "opacity", 0,
@@ -520,7 +520,7 @@ gnibbles_worm_new (guint number)
 {
   GnibblesWorm *worm = g_new (GnibblesWorm, 1);
 
-  worm->actors = clutter_group_new ();
+  worm->actors = clutter_actor_new ();
   worm->list = NULL;
   worm->number = number;
   worm->lives = SLIVES;
@@ -541,7 +541,7 @@ gnibbles_worm_set_start (GnibblesWorm *worm, guint t_xhead,
   g_list_free (worm->list);
   worm->list = NULL;
 
-  clutter_group_remove_all (CLUTTER_GROUP (worm->actors));
+  clutter_actor_remove_all_children (worm->actors);
 
   worm->xhead = t_xhead;
   worm->yhead = t_yhead;
@@ -624,7 +624,7 @@ gnibbles_worm_destroy (GnibblesWorm *worm)
   while (worm->list)
     gnibbles_worm_remove_actor (worm);
 
-  clutter_group_remove_all (CLUTTER_GROUP (worm->actors));
+  clutter_actor_remove_all_children (worm->actors);
 
   g_free (worm);
 }
@@ -643,10 +643,10 @@ gnibbles_worm_rescale (GnibblesWorm *worm, gint tilesize)
   if (!worm->actors)
     return;
 
-  count = clutter_group_get_n_children (CLUTTER_GROUP (worm->actors));
+  count = clutter_actor_get_n_children (worm->actors);
 
   for (i = 0; i < count; i++) {
-    tmp = clutter_group_get_nth_child (CLUTTER_GROUP (worm->actors), i);
+    tmp = clutter_actor_get_child_at_index (worm->actors, i);
     clutter_actor_get_position (tmp, &x_pos, &y_pos);
 
     clutter_actor_set_position (tmp,
@@ -696,7 +696,7 @@ gnibbles_worm_reduce_tail (GnibblesWorm *worm, gint erasesize)
   gint i;
   gfloat x,y;
   ClutterActor *tmp = NULL;
-  ClutterActor *group = clutter_group_new ();
+  ClutterActor *group = clutter_actor_new ();
   GError *error = NULL;
 
   if (erasesize) {
@@ -716,12 +716,12 @@ gnibbles_worm_reduce_tail (GnibblesWorm *worm, gint erasesize)
       clutter_actor_set_size (CLUTTER_ACTOR (tmp),
                               properties->tilesize,
                               properties->tilesize);
-      clutter_container_add_actor (CLUTTER_CONTAINER (group), tmp);
+      clutter_actor_add_child (group , tmp);
 
       gnibbles_worm_move_tail_pointer (worm);
     }
     worm->length -= erasesize;
-    clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
+    clutter_actor_add_child (stage, group);
 
     clutter_actor_animate (group, CLUTTER_EASE_OUT_EXPO, 850,
                            "opacity", 0,


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