Permalink
Browse files

Merge pull request #3 from efernandesng/master

Replace some deprecated functions and small fixes
  • Loading branch information...
2 parents b2bebad + adc9192 commit 907ee3984f26087000312fc1cd15c8c43c7b0ed2 @ebassi ebassi committed Mar 2, 2014
Showing with 20 additions and 27 deletions.
  1. +14 −17 arc-clock/arc-clock.c
  2. +1 −2 script-viewer/alphas.json
  3. +3 −6 script-viewer/behaviours.json
  4. +1 −1 script-viewer/test-script.json
  5. +1 −1 script-viewer/text.json
View
@@ -25,6 +25,7 @@ enum
static double slices[N_HANDS] = { 0.0, };
static ClutterActor *hands[N_HANDS] = { NULL, };
+static ClutterColor hands_color[N_HANDS];
static const char *colors[N_HANDS] = {
"#4e9a06",
@@ -51,15 +52,12 @@ hand_paint (ClutterActor *hand)
float radius = clutter_actor_get_width (hand) / 2.0 + 0.5;
- ClutterColor hand_color;
- clutter_rectangle_get_color (CLUTTER_RECTANGLE (hand), &hand_color);
-
CoglColor fill_color;
cogl_color_init_from_4ub (&fill_color,
- hand_color.red,
- hand_color.green,
- hand_color.blue,
- hand_color.alpha);
+ hands_color[hand_id].red,
+ hands_color[hand_id].green,
+ hands_color[hand_id].blue,
+ hands_color[hand_id].alpha);
cogl_set_source_color (&fill_color);
@@ -138,11 +136,12 @@ main (int argc, char *argv[])
clutter_x11_set_use_argb_visual (TRUE);
GError *error = NULL;
- clutter_init_with_args (&argc, &argv,
- "Arc Clock",
- entries,
- NULL,
- &error);
+ if (clutter_init_with_args (&argc, &argv,
+ "Arc Clock",
+ entries,
+ NULL,
+ &error) != CLUTTER_INIT_SUCCESS)
+ g_error("%s", error->message);
ClutterActor *stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Arc Clock");
@@ -156,16 +155,14 @@ main (int argc, char *argv[])
for (int i = SECONDS; i < N_HANDS; i++)
{
- ClutterColor color;
-
- clutter_color_from_string (&color, colors[i]);
- hands[i] = clutter_rectangle_new_with_color (&color);
+ clutter_color_from_string (&hands_color[i], colors[i]);
+ hands[i] = clutter_actor_new ();
clutter_actor_set_size (hands[i], (HAND_WIDTH * 3.0) * i, (HAND_WIDTH * 3.0) * i);
clutter_actor_add_constraint (hands[i], clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5));
clutter_actor_add_constraint (hands[i], clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5));
g_signal_connect (hands[i], "paint", G_CALLBACK (hand_paint), NULL);
g_object_set_data (G_OBJECT (hands[i]), "hand-id", GUINT_TO_POINTER (i));
- clutter_container_add_actor (CLUTTER_CONTAINER (stage), hands[i]);
+ clutter_actor_add_child (stage, hands[i]);
}
if (hide_seconds)
@@ -179,8 +179,7 @@
"alpha" : {"timeline" : "animation", "function" : "smoothstep-dec"}
}
]
- },
-
+ }
]
}
]
@@ -1,6 +1,3 @@
-# there are inconsistencies in the naming of the nicks of the
-# properties:
-
[
{
"id" : "animation",
@@ -13,7 +10,7 @@
"id" : "root",
"type" : "ClutterGroup",
"x": 0,
- "y": 0
+ "y": 0,
"children" : [
{
"type": "ClutterLabel",
@@ -30,7 +27,7 @@
"y-scale-start" : 1.0,
"y-scale-end" : 0.5,
"alpha" : {"timeline" : "animation", "function" : "sine"}
- },
+ }
]
},
@@ -48,7 +45,7 @@
"angle-start" : 0.0,
"angle-end" : 359.0,
"alpha" : {"timeline" : "animation", "function" : "sine"}
- },
+ }
]
},
{
@@ -42,7 +42,7 @@
"y" : 50,
"width" : 100,
"height" : 100,
- "visible" : true,
+ "visible" : true
},
{
"id" : "green-button",
View
@@ -96,7 +96,7 @@
"alpha" : { "timeline" : "animation", "mode" : "linear" }
}
]
- },
+ }
]
}
]

0 comments on commit 907ee39

Please sign in to comment.