Skip to content

Commit

Permalink
Merge pull request #3 from efernandesng/master
Browse files Browse the repository at this point in the history
Replace some deprecated functions and small fixes
  • Loading branch information
ebassi committed Mar 2, 2014
2 parents b2bebad + adc9192 commit 907ee39
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 27 deletions.
31 changes: 14 additions & 17 deletions arc-clock/arc-clock.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ enum
static double slices[N_HANDS] = { 0.0, }; static double slices[N_HANDS] = { 0.0, };


static ClutterActor *hands[N_HANDS] = { NULL, }; static ClutterActor *hands[N_HANDS] = { NULL, };
static ClutterColor hands_color[N_HANDS];


static const char *colors[N_HANDS] = { static const char *colors[N_HANDS] = {
"#4e9a06", "#4e9a06",
Expand All @@ -51,15 +52,12 @@ hand_paint (ClutterActor *hand)


float radius = clutter_actor_get_width (hand) / 2.0 + 0.5; 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; CoglColor fill_color;
cogl_color_init_from_4ub (&fill_color, cogl_color_init_from_4ub (&fill_color,
hand_color.red, hands_color[hand_id].red,
hand_color.green, hands_color[hand_id].green,
hand_color.blue, hands_color[hand_id].blue,
hand_color.alpha); hands_color[hand_id].alpha);


cogl_set_source_color (&fill_color); cogl_set_source_color (&fill_color);


Expand Down Expand Up @@ -138,11 +136,12 @@ main (int argc, char *argv[])
clutter_x11_set_use_argb_visual (TRUE); clutter_x11_set_use_argb_visual (TRUE);


GError *error = NULL; GError *error = NULL;
clutter_init_with_args (&argc, &argv, if (clutter_init_with_args (&argc, &argv,
"Arc Clock", "Arc Clock",
entries, entries,
NULL, NULL,
&error); &error) != CLUTTER_INIT_SUCCESS)
g_error("%s", error->message);


ClutterActor *stage = clutter_stage_new (); ClutterActor *stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Arc Clock"); clutter_stage_set_title (CLUTTER_STAGE (stage), "Arc Clock");
Expand All @@ -156,16 +155,14 @@ main (int argc, char *argv[])


for (int i = SECONDS; i < N_HANDS; i++) for (int i = SECONDS; i < N_HANDS; i++)
{ {
ClutterColor color; clutter_color_from_string (&hands_color[i], colors[i]);

hands[i] = clutter_actor_new ();
clutter_color_from_string (&color, colors[i]);
hands[i] = clutter_rectangle_new_with_color (&color);
clutter_actor_set_size (hands[i], (HAND_WIDTH * 3.0) * i, (HAND_WIDTH * 3.0) * i); 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_X_AXIS, 0.5));
clutter_actor_add_constraint (hands[i], clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_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_signal_connect (hands[i], "paint", G_CALLBACK (hand_paint), NULL);
g_object_set_data (G_OBJECT (hands[i]), "hand-id", GUINT_TO_POINTER (i)); 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) if (hide_seconds)
Expand Down
3 changes: 1 addition & 2 deletions script-viewer/alphas.json
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@
"alpha" : {"timeline" : "animation", "function" : "smoothstep-dec"} "alpha" : {"timeline" : "animation", "function" : "smoothstep-dec"}
} }
] ]
}, }

] ]
} }
] ]
9 changes: 3 additions & 6 deletions script-viewer/behaviours.json
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,3 @@
# there are inconsistencies in the naming of the nicks of the
# properties:

[ [
{ {
"id" : "animation", "id" : "animation",
Expand All @@ -13,7 +10,7 @@
"id" : "root", "id" : "root",
"type" : "ClutterGroup", "type" : "ClutterGroup",
"x": 0, "x": 0,
"y": 0 "y": 0,
"children" : [ "children" : [
{ {
"type": "ClutterLabel", "type": "ClutterLabel",
Expand All @@ -30,7 +27,7 @@
"y-scale-start" : 1.0, "y-scale-start" : 1.0,
"y-scale-end" : 0.5, "y-scale-end" : 0.5,
"alpha" : {"timeline" : "animation", "function" : "sine"} "alpha" : {"timeline" : "animation", "function" : "sine"}
}, }
] ]
}, },


Expand All @@ -48,7 +45,7 @@
"angle-start" : 0.0, "angle-start" : 0.0,
"angle-end" : 359.0, "angle-end" : 359.0,
"alpha" : {"timeline" : "animation", "function" : "sine"} "alpha" : {"timeline" : "animation", "function" : "sine"}
}, }
] ]
}, },
{ {
Expand Down
2 changes: 1 addition & 1 deletion script-viewer/test-script.json
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"y" : 50, "y" : 50,
"width" : 100, "width" : 100,
"height" : 100, "height" : 100,
"visible" : true, "visible" : true
}, },
{ {
"id" : "green-button", "id" : "green-button",
Expand Down
2 changes: 1 addition & 1 deletion script-viewer/text.json
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"alpha" : { "timeline" : "animation", "mode" : "linear" } "alpha" : { "timeline" : "animation", "mode" : "linear" }
} }
] ]
}, }
] ]
} }
] ]

0 comments on commit 907ee39

Please sign in to comment.