[clutter-gst] remove most of remaining Clutter deprecation warnings



commit d591ca0b4e465e76e68f244810db5ab3140cdc25
Author: Lionel Landwerlin <llandwerlin gmail com>
Date:   Wed Jan 30 15:19:33 2013 +0000

    remove most of remaining Clutter deprecation warnings
    
    Apart from ClutterMedia/ClutterTexture because that would break API.

 examples/video-player.c          |   81 +++++++++++++++++++++++++------------
 examples/video-sink-navigation.c |   11 ++---
 examples/video-sink.c            |    4 +-
 tests/test-alpha.c               |   32 ++++++++++-----
 tests/test-rgb-upload.c          |    4 +-
 tests/test-start-stop.c          |    4 +-
 tests/test-yuv-upload.c          |    4 +-
 7 files changed, 89 insertions(+), 51 deletions(-)
---
diff --git a/examples/video-player.c b/examples/video-player.c
index 6d3689f..2686483 100644
--- a/examples/video-player.c
+++ b/examples/video-player.c
@@ -88,6 +88,29 @@ controls_timeout_cb (gpointer data)
   return FALSE;
 }
 
+static ClutterTimeline *
+_actor_animate (ClutterActor         *actor,
+                ClutterAnimationMode  mode,
+                guint                 duration,
+                const gchar          *first_property,
+                ...)
+{
+  va_list args;
+
+  clutter_actor_save_easing_state (actor);
+  clutter_actor_set_easing_mode (actor, mode);
+  clutter_actor_set_easing_duration (actor, duration);
+
+  va_start (args, first_property);
+  g_object_set_valist (G_OBJECT (actor), first_property, args);
+  va_end (args);
+
+  clutter_actor_restore_easing_state (actor);
+
+  return CLUTTER_TIMELINE (clutter_actor_get_transition (actor,
+                                                         first_property));
+}
+
 static void
 show_controls (VideoApp *app, gboolean vis)
 {
@@ -110,9 +133,9 @@ show_controls (VideoApp *app, gboolean vis)
       app->controls_showing = TRUE;
 
       clutter_stage_show_cursor (CLUTTER_STAGE (app->stage));
-      clutter_actor_animate (app->control, CLUTTER_EASE_OUT_QUINT, 250,
-                             "opacity", 224,
-                             NULL);
+      _actor_animate (app->control, CLUTTER_EASE_OUT_QUINT, 250,
+                      "opacity", 224,
+                      NULL);
 
       return;
     }
@@ -122,9 +145,9 @@ show_controls (VideoApp *app, gboolean vis)
       app->controls_showing = FALSE;
 
       clutter_stage_hide_cursor (CLUTTER_STAGE (app->stage));
-      clutter_actor_animate (app->control, CLUTTER_EASE_OUT_QUINT, 250,
-                             "opacity", 0,
-                             NULL);
+      _actor_animate (app->control, CLUTTER_EASE_OUT_QUINT, 250,
+                      "opacity", 0,
+                      NULL);
       return;
     }
 }
@@ -154,11 +177,11 @@ toggle_pause_state (VideoApp *app)
 }
 
 static void
-reset_animation (ClutterAnimation *animation,
+reset_animation (ClutterTimeline  *animation,
                  VideoApp         *app)
 {
   if (app->vtexture)
-    clutter_actor_set_rotation (app->vtexture, CLUTTER_Y_AXIS, 0.0, 0, 0, 0);
+    clutter_actor_set_rotation_angle (app->vtexture, CLUTTER_Y_AXIS, 0.0);
 }
 
 static gboolean
@@ -215,8 +238,7 @@ input_cb (ClutterStage *stage,
 
     case CLUTTER_KEY_PRESS:
       {
-        ClutterVertex center = { 0, };
-        ClutterAnimation *animation = NULL;
+        ClutterTimeline *animation = NULL;
 
         switch (clutter_event_get_key_symbol (event))
           {
@@ -241,16 +263,14 @@ input_cb (ClutterStage *stage,
             if (app->vtexture == NULL)
               break;
 
-            center.x = clutter_actor_get_width (app->vtexture) / 2;
+            clutter_actor_set_pivot_point (app->vtexture, 0.5, 0);
+
+            animation = _actor_animate (app->vtexture, CLUTTER_LINEAR, 500,
+                                        "rotation-angle-y", 360.0, NULL);
 
-            animation =
-              clutter_actor_animate (app->vtexture, CLUTTER_LINEAR, 500,
-                                     "rotation-angle-y", 360.0,
-                                     "fixed::rotation-center-y", &center,
-                                     NULL);
             g_signal_connect_after (animation, "completed",
-                              G_CALLBACK (reset_animation),
-                              app);
+                                    G_CALLBACK (reset_animation),
+                                    app);
             handled = TRUE;
             break;
 
@@ -355,6 +375,15 @@ on_video_texture_eos (ClutterMedia *media,
     }
 }
 
+static ClutterActor *
+_new_rectangle_with_color (ClutterColor *color)
+{
+  ClutterActor *actor = clutter_actor_new ();
+  clutter_actor_set_background_color (actor, color);
+
+  return actor;
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -393,7 +422,7 @@ main (int argc, char *argv[])
     }
 
   stage = clutter_stage_new ();
-  clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
+  clutter_actor_set_background_color (stage, &stage_color);
   clutter_actor_set_size (stage, 768, 576);
   clutter_stage_set_minimum_size (CLUTTER_STAGE (stage), 640, 480);
   if (opt_fullscreen)
@@ -469,7 +498,7 @@ main (int argc, char *argv[])
                 NULL);
 
   /* Create the control UI */
-  app->control = clutter_group_new ();
+  app->control = clutter_actor_new ();
 
   app->control_bg =
     clutter_texture_new_from_file ("vid-panel.png", NULL);
@@ -480,9 +509,9 @@ main (int argc, char *argv[])
 
   g_assert (app->control_bg && app->control_play && app->control_pause);
 
-  app->control_seek1   = clutter_rectangle_new_with_color (&control_color1);
-  app->control_seek2   = clutter_rectangle_new_with_color (&control_color2);
-  app->control_seekbar = clutter_rectangle_new_with_color (&control_color1);
+  app->control_seek1   = _new_rectangle_with_color (&control_color1);
+  app->control_seek2   = _new_rectangle_with_color (&control_color2);
+  app->control_seekbar = _new_rectangle_with_color (&control_color1);
   clutter_actor_set_opacity (app->control_seekbar, 0x99);
 
   app->control_label =
@@ -521,9 +550,9 @@ main (int argc, char *argv[])
   position_controls (app, app->control);
 
   clutter_stage_hide_cursor (CLUTTER_STAGE (stage));
-  clutter_actor_animate (app->control, CLUTTER_EASE_OUT_QUINT, 1000,
-                         "opacity", 0,
-                         NULL);
+  _actor_animate (app->control, CLUTTER_EASE_OUT_QUINT, 1000,
+                  "opacity", 0,
+                  NULL);
 
   /* Hook up other events */
   g_signal_connect (stage, "event", G_CALLBACK (input_cb), app);
diff --git a/examples/video-sink-navigation.c b/examples/video-sink-navigation.c
index 5ccace6..248e780 100644
--- a/examples/video-sink-navigation.c
+++ b/examples/video-sink-navigation.c
@@ -132,18 +132,15 @@ main (int argc, char *argv[])
   clutter_actor_add_constraint_with_name (texture, "size", constraint);
 
   /* Rotate a bit */
-  clutter_actor_set_rotation (texture, CLUTTER_Z_AXIS,
-			      45.0,
-			      clutter_actor_get_width (stage) / 2,
-			      clutter_actor_get_height (stage) / 2,
-			      0.0);
+  clutter_actor_set_pivot_point (texture, 0.5, 0.5);
+  clutter_actor_set_rotation_angle (texture, CLUTTER_Z_AXIS, 45.0);
 
   /* start the timeline */
   clutter_timeline_start (timeline);
 
-  clutter_group_add (CLUTTER_GROUP (stage), texture);
+  clutter_actor_add_child (stage, texture);
   // clutter_actor_set_opacity (texture, 0x11);
-  clutter_actor_show_all (stage);
+  clutter_actor_show (stage);
 
   clutter_main();
 
diff --git a/examples/video-sink.c b/examples/video-sink.c
index b233906..9e2e504 100644
--- a/examples/video-sink.c
+++ b/examples/video-sink.c
@@ -125,9 +125,9 @@ main (int argc, char *argv[])
   /* start the timeline */
   clutter_timeline_start (timeline);
 
-  clutter_group_add (CLUTTER_GROUP (stage), texture);
+  clutter_actor_add_child (stage, texture);
   // clutter_actor_set_opacity (texture, 0x11);
-  clutter_actor_show_all (stage);
+  clutter_actor_show (stage);
 
   clutter_main();
 
diff --git a/tests/test-alpha.c b/tests/test-alpha.c
index e1e78e6..359ba0a 100644
--- a/tests/test-alpha.c
+++ b/tests/test-alpha.c
@@ -110,11 +110,11 @@ main (int argc, char *argv[])
 
   const ClutterColor     stage_color     = {128,   0, 192, 255};
   const ClutterColor     rectangle_color = { 96,   0,   0, 255};
-  const ClutterGeometry  rectangle_geom  = {110,  70, 100, 100};
+  const ClutterRect      rectangle_geom  = { {110,  70}, {100, 100}};
   ClutterActor          *stage;
   ClutterActor          *texture;
   ClutterActor          *rectangle;
-  ClutterAnimation      *animation;
+  ClutterTransition     *animation;
 
   GstPipeline           *pipeline;
   GstElement            *src;
@@ -142,10 +142,16 @@ main (int argc, char *argv[])
 
   stage = clutter_stage_new ();
   clutter_actor_set_size (stage, 320.0f, 240.0f);
-  clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
+  clutter_actor_set_background_color (stage, &stage_color);
 
-  rectangle = clutter_rectangle_new_with_color (&rectangle_color);
-  clutter_actor_set_geometry (rectangle, &rectangle_geom);
+  rectangle = clutter_actor_new ();
+  clutter_actor_set_background_color (rectangle, &rectangle_color);
+  clutter_actor_set_position (rectangle,
+                              rectangle_geom.origin.x,
+                              rectangle_geom.origin.y);
+  clutter_actor_set_size (rectangle,
+                          rectangle_geom.size.width,
+                          rectangle_geom.size.height);
 
   /* We need to set certain props on the target texture currently for
    * efficient/corrent playback onto the texture (which sucks a bit)
@@ -199,12 +205,18 @@ main (int argc, char *argv[])
 
   clutter_actor_add_child (stage, rectangle);
   clutter_actor_add_child (stage, texture);
-  clutter_actor_show_all (stage);
+  clutter_actor_show (stage);
 
-  animation = clutter_actor_animate (texture, CLUTTER_LINEAR, 6000,
-                                     "opacity", 0xff,
-                                     NULL);
-  clutter_animation_set_loop (animation, TRUE);
+  clutter_actor_save_easing_state (texture);
+  clutter_actor_set_easing_mode (texture, CLUTTER_LINEAR);
+  clutter_actor_set_easing_duration (texture, 6000);
+
+  clutter_actor_set_opacity (texture, 0xff);
+
+  clutter_actor_restore_easing_state (texture);
+
+  animation = clutter_actor_get_transition (texture, "opacity");
+  clutter_timeline_set_repeat_count (CLUTTER_TIMELINE (animation), -1);
 
   clutter_main();
 
diff --git a/tests/test-rgb-upload.c b/tests/test-rgb-upload.c
index 5a324d5..aeccf8f 100644
--- a/tests/test-rgb-upload.c
+++ b/tests/test-rgb-upload.c
@@ -173,8 +173,8 @@ main (int argc, char *argv[])
     g_critical("Could not link elements");
   gst_element_set_state (GST_ELEMENT(pipeline), GST_STATE_PLAYING);
 
-  clutter_group_add (CLUTTER_GROUP (stage), texture);
-  clutter_actor_show_all (stage);
+  clutter_actor_add_child (stage, texture);
+  clutter_actor_show (stage);
 
   clutter_main();
 
diff --git a/tests/test-start-stop.c b/tests/test-start-stop.c
index 7b6efab..b7b6938 100644
--- a/tests/test-start-stop.c
+++ b/tests/test-start-stop.c
@@ -142,7 +142,7 @@ main (int argc, char *argv[])
   g_assert (error == CLUTTER_INIT_SUCCESS);
 
   stage = clutter_stage_new ();
-  clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
+  clutter_actor_set_background_color (stage, &stage_color);
 
   video = clutter_gst_video_texture_new ();
   g_assert (CLUTTER_GST_IS_VIDEO_TEXTURE(video));
@@ -161,7 +161,7 @@ main (int argc, char *argv[])
   clutter_media_set_playing (CLUTTER_MEDIA(video), TRUE);
 
   clutter_actor_add_child (stage, video);
-  clutter_actor_show_all (stage);
+  clutter_actor_show (stage);
   clutter_main ();
 
   return EXIT_SUCCESS;
diff --git a/tests/test-yuv-upload.c b/tests/test-yuv-upload.c
index 1b8b02b..682733e 100644
--- a/tests/test-yuv-upload.c
+++ b/tests/test-yuv-upload.c
@@ -155,9 +155,9 @@ main (int argc, char *argv[])
     g_critical("Could not link elements");
   gst_element_set_state (GST_ELEMENT(pipeline), GST_STATE_PLAYING);
 
-  clutter_group_add (CLUTTER_GROUP (stage), texture);
+  clutter_actor_add_child (stage, texture);
   /* clutter_actor_set_opacity (texture, 0x11); */
-  clutter_actor_show_all (stage);
+  clutter_actor_show (stage);
 
   clutter_main();
 



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