[gnome-games/gnibbles-clutter] Added GError handling where needed
- From: Guillaume Béland <guillaubel src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-games/gnibbles-clutter] Added GError handling where needed
- Date: Tue, 4 Aug 2009 18:17:30 +0000 (UTC)
commit 45dc2ad2b36f1bc051c3d2239d623e73bb480571
Author: Guillaume Beland <guillaume beland gmail com>
Date: Tue Aug 4 14:16:55 2009 -0400
Added GError handling where needed
gnibbles/board.c | 13 +++++++------
gnibbles/bonus.c | 6 +++++-
gnibbles/main.c | 8 ++++----
gnibbles/warp.c | 7 ++++++-
gnibbles/worm-clutter.c | 8 ++++++--
5 files changed, 28 insertions(+), 14 deletions(-)
---
diff --git a/gnibbles/board.c b/gnibbles/board.c
index d3d03ce..aad580b 100644
--- a/gnibbles/board.c
+++ b/gnibbles/board.c
@@ -153,7 +153,8 @@ gnibbles_board_load_level (GnibblesBoard *board)
clutter_actor_set_position (CLUTTER_ACTOR (tmp), x_pos, y_pos);
clutter_actor_show (CLUTTER_ACTOR (tmp));
- clutter_container_add_actor (CLUTTER_CONTAINER (board->level), tmp);
+ clutter_container_add_actor (CLUTTER_CONTAINER (board->level),
+ CLUTTER_ACTOR (tmp));
}
}
}
@@ -182,10 +183,10 @@ gnibbles_board_resize (GnibblesBoard *board, gint newtile)
ClutterActor *tmp;
- clutter_actor_set_size (stage,
+ clutter_actor_set_size (CLUTTER_ACTOR (stage),
BOARDWIDTH * newtile,
BOARDHEIGHT * newtile);
- clutter_actor_set_size (board->surface,
+ clutter_actor_set_size (CLUTTER_ACTOR (board->surface),
BOARDWIDTH * newtile,
BOARDHEIGHT * newtile);
@@ -193,11 +194,11 @@ gnibbles_board_resize (GnibblesBoard *board, gint newtile)
for (i = 0; i < count; i++) {
tmp = clutter_group_get_nth_child (CLUTTER_GROUP (board->level), i);
- clutter_actor_get_position (tmp, &x_pos, &y_pos);
- clutter_actor_set_position (tmp,
+ clutter_actor_get_position (CLUTTER_ACTOR (tmp), &x_pos, &y_pos);
+ clutter_actor_set_position (CLUTTER_ACTOR (tmp),
(x_pos / properties->tilesize) * newtile,
(y_pos / properties->tilesize) * newtile);
- clutter_actor_set_size (tmp ,newtile, newtile);
+ clutter_actor_set_size (CLUTTER_ACTOR (tmp), newtile, newtile);
}
}
diff --git a/gnibbles/bonus.c b/gnibbles/bonus.c
index 4206d15..482ffb2 100644
--- a/gnibbles/bonus.c
+++ b/gnibbles/bonus.c
@@ -73,13 +73,17 @@ animate_bonus (ClutterAnimation *animation, ClutterActor *actor)
void
gnibbles_bonus_draw (GnibblesBonus *bonus)
{
+ GError *err = NULL;
+
clutter_actor_set_position (CLUTTER_ACTOR (bonus->actor),
bonus->x * properties->tilesize,
bonus->y * properties->tilesize);
gtk_clutter_texture_set_from_pixbuf (CLUTTER_TEXTURE (bonus->actor),
boni_pixmaps[bonus->type],
- NULL);
+ &err);
+ if (err)
+ gnibbles_error (err->message);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), bonus->actor);
diff --git a/gnibbles/main.c b/gnibbles/main.c
index f04f5b7..6192360 100644
--- a/gnibbles/main.c
+++ b/gnibbles/main.c
@@ -805,7 +805,7 @@ setup_window ()
clutter_widget = gtk_clutter_embed_new ();
stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter_widget));
- clutter_stage_set_color (CLUTTER_STAGE(stage), &stage_color);
+ clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
clutter_stage_set_user_resizable (CLUTTER_STAGE(stage), FALSE);
clutter_actor_set_size (CLUTTER_ACTOR (stage),
@@ -823,11 +823,11 @@ setup_window ()
games_conf_add_window (GTK_WINDOW (window), KEY_PREFERENCES_GROUP);
g_signal_connect (G_OBJECT (window), "destroy",
- G_CALLBACK (gtk_main_quit), NULL);
+ G_CALLBACK (gtk_main_quit), NULL);
g_signal_connect (G_OBJECT (window), "delete_event",
- G_CALLBACK (delete_cb), NULL);
+ G_CALLBACK (delete_cb), NULL);
g_signal_connect (G_OBJECT (window), "window_state_event",
- G_CALLBACK (window_state_cb), NULL);
+ G_CALLBACK (window_state_cb), NULL);
gtk_widget_realize (window);
diff --git a/gnibbles/warp.c b/gnibbles/warp.c
index 578ca4e..ae67db5 100644
--- a/gnibbles/warp.c
+++ b/gnibbles/warp.c
@@ -52,9 +52,14 @@ gnibbles_warp_new (gint t_x, gint t_y, gint t_wx, gint t_wy)
void
gnibbles_warp_draw (GnibblesWarp *warp)
{
+ GError *err = NULL;
+
gtk_clutter_texture_set_from_pixbuf (CLUTTER_TEXTURE (warp->actor),
boni_pixmaps[WARP],
- NULL);
+ &err);
+ if (err)
+ gnibbles_error (err->message);
+
clutter_actor_set_position (CLUTTER_ACTOR (warp->actor),
properties->tilesize * warp->x,
properties->tilesize * warp->y);
diff --git a/gnibbles/worm-clutter.c b/gnibbles/worm-clutter.c
index ac8dae8..c0490c0 100644
--- a/gnibbles/worm-clutter.c
+++ b/gnibbles/worm-clutter.c
@@ -524,7 +524,7 @@ gnibbles_worm_new (guint number, guint t_xhead,
worm->direction = t_direction;
worm->direction_start = t_direction;
worm->length = SLENGTH;
- worm->change = 1; //SLENGTH - 1;
+ worm->change = 1;
gnibbles_worm_queue_empty (worm);
@@ -684,6 +684,7 @@ gnibbles_worm_resize (GnibblesWorm *worm, gint newtile)
gboolean direction;
GValue val = {0,};
ClutterActor *tmp;
+ GError *err = NULL;
count = clutter_group_get_n_children (CLUTTER_GROUP (worm->actors));
@@ -711,7 +712,10 @@ gnibbles_worm_resize (GnibblesWorm *worm, gint newtile)
gtk_clutter_texture_set_from_pixbuf (CLUTTER_TEXTURE (tmp),
worm_pixmaps[worm->number],
- NULL);
+ &err);
+
+ if (err)
+ gnibbles_error (err->message);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]