Skip to content

Commit 907ee39

Browse files
committed
Merge pull request #3 from efernandesng/master
Replace some deprecated functions and small fixes
2 parents b2bebad + adc9192 commit 907ee39

File tree

5 files changed

+20
-27
lines changed

5 files changed

+20
-27
lines changed

arc-clock/arc-clock.c

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ enum
2525
static double slices[N_HANDS] = { 0.0, };
2626

2727
static ClutterActor *hands[N_HANDS] = { NULL, };
28+
static ClutterColor hands_color[N_HANDS];
2829

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

5253
float radius = clutter_actor_get_width (hand) / 2.0 + 0.5;
5354

54-
ClutterColor hand_color;
55-
clutter_rectangle_get_color (CLUTTER_RECTANGLE (hand), &hand_color);
56-
5755
CoglColor fill_color;
5856
cogl_color_init_from_4ub (&fill_color,
59-
hand_color.red,
60-
hand_color.green,
61-
hand_color.blue,
62-
hand_color.alpha);
57+
hands_color[hand_id].red,
58+
hands_color[hand_id].green,
59+
hands_color[hand_id].blue,
60+
hands_color[hand_id].alpha);
6361

6462
cogl_set_source_color (&fill_color);
6563

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

140138
GError *error = NULL;
141-
clutter_init_with_args (&argc, &argv,
142-
"Arc Clock",
143-
entries,
144-
NULL,
145-
&error);
139+
if (clutter_init_with_args (&argc, &argv,
140+
"Arc Clock",
141+
entries,
142+
NULL,
143+
&error) != CLUTTER_INIT_SUCCESS)
144+
g_error("%s", error->message);
146145

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

157156
for (int i = SECONDS; i < N_HANDS; i++)
158157
{
159-
ClutterColor color;
160-
161-
clutter_color_from_string (&color, colors[i]);
162-
hands[i] = clutter_rectangle_new_with_color (&color);
158+
clutter_color_from_string (&hands_color[i], colors[i]);
159+
hands[i] = clutter_actor_new ();
163160
clutter_actor_set_size (hands[i], (HAND_WIDTH * 3.0) * i, (HAND_WIDTH * 3.0) * i);
164161
clutter_actor_add_constraint (hands[i], clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5));
165162
clutter_actor_add_constraint (hands[i], clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5));
166163
g_signal_connect (hands[i], "paint", G_CALLBACK (hand_paint), NULL);
167164
g_object_set_data (G_OBJECT (hands[i]), "hand-id", GUINT_TO_POINTER (i));
168-
clutter_container_add_actor (CLUTTER_CONTAINER (stage), hands[i]);
165+
clutter_actor_add_child (stage, hands[i]);
169166
}
170167

171168
if (hide_seconds)

script-viewer/alphas.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@
179179
"alpha" : {"timeline" : "animation", "function" : "smoothstep-dec"}
180180
}
181181
]
182-
},
183-
182+
}
184183
]
185184
}
186185
]

script-viewer/behaviours.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# there are inconsistencies in the naming of the nicks of the
2-
# properties:
3-
41
[
52
{
63
"id" : "animation",
@@ -13,7 +10,7 @@
1310
"id" : "root",
1411
"type" : "ClutterGroup",
1512
"x": 0,
16-
"y": 0
13+
"y": 0,
1714
"children" : [
1815
{
1916
"type": "ClutterLabel",
@@ -30,7 +27,7 @@
3027
"y-scale-start" : 1.0,
3128
"y-scale-end" : 0.5,
3229
"alpha" : {"timeline" : "animation", "function" : "sine"}
33-
},
30+
}
3431
]
3532
},
3633

@@ -48,7 +45,7 @@
4845
"angle-start" : 0.0,
4946
"angle-end" : 359.0,
5047
"alpha" : {"timeline" : "animation", "function" : "sine"}
51-
},
48+
}
5249
]
5350
},
5451
{

script-viewer/test-script.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"y" : 50,
4343
"width" : 100,
4444
"height" : 100,
45-
"visible" : true,
45+
"visible" : true
4646
},
4747
{
4848
"id" : "green-button",

script-viewer/text.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
"alpha" : { "timeline" : "animation", "mode" : "linear" }
9797
}
9898
]
99-
},
99+
}
100100
]
101101
}
102102
]

0 commit comments

Comments
 (0)