Skip to content

Replace some deprecated functions and small fixes #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 2, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 14 additions & 17 deletions arc-clock/arc-clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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);

Expand Down Expand Up @@ -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");
Expand All @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions script-viewer/alphas.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@
"alpha" : {"timeline" : "animation", "function" : "smoothstep-dec"}
}
]
},

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

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

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