[gnome-games] gtali: Check for error when loading image files
- From: Thomas Hindoe Paaboel Andersen <thomashpa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] gtali: Check for error when loading image files
- Date: Wed, 9 Feb 2011 23:28:28 +0000 (UTC)
commit 41f967e1bff7ae5ee15f23627a4ab81070a06919
Author: Thomas Hindoe Paaboel Andersen <phomes gmail com>
Date: Thu Feb 10 00:28:16 2011 +0100
gtali: Check for error when loading image files
gtali/gyahtzee.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/gtali/gyahtzee.c b/gtali/gyahtzee.c
index 3050ddf..4893523 100644
--- a/gtali/gyahtzee.c
+++ b/gtali/gyahtzee.c
@@ -654,6 +654,7 @@ LoadDicePixmaps (void)
int i, j;
char *path, *path_kismet;
const char *dir;
+ GError *error = NULL;
dir = games_runtime_get_directory (GAMES_RUNTIME_GAME_PIXMAP_DIRECTORY);
@@ -670,12 +671,20 @@ LoadDicePixmaps (void)
for (j = 0; j < NUMBER_OF_DICE; j++) {
GdkPixbuf *pixbuf;
- pixbuf = gdk_pixbuf_new_from_file_at_size (path, 60, 60, NULL);
+ pixbuf = gdk_pixbuf_new_from_file_at_size (path, 60, 60, &error);
dicePixmaps[j][i][GAME_YAHTZEE] = gtk_image_new_from_pixbuf (pixbuf);
+ if (error) {
+ g_warning ("Loading dice image %s: %s", path, error->message);
+ g_clear_error (&error);
+ }
g_object_unref (pixbuf);
- pixbuf = gdk_pixbuf_new_from_file_at_size (path_kismet, 60, 60, NULL);
+ pixbuf = gdk_pixbuf_new_from_file_at_size (path_kismet, 60, 60, &error);
dicePixmaps[j][i][GAME_KISMET] = gtk_image_new_from_pixbuf (pixbuf);
+ if (error) {
+ g_warning ("Loading dice image %s: %s", path_kismet, error->message);
+ g_clear_error (&error);
+ }
g_object_unref (pixbuf);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]