gnome-games r8105 - trunk/gnotravex
- From: thomashpa svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-games r8105 - trunk/gnotravex
- Date: Sun, 19 Oct 2008 10:40:50 +0000 (UTC)
Author: thomashpa
Date: Sun Oct 19 10:40:50 2008
New Revision: 8105
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8105&view=rev
Log:
Use white background if loading the pixmap fails in gnotravex
Modified:
trunk/gnotravex/gnotravex.c
Modified: trunk/gnotravex/gnotravex.c
==============================================================================
--- trunk/gnotravex/gnotravex.c (original)
+++ trunk/gnotravex/gnotravex.c Sun Oct 19 10:40:50 2008
@@ -262,7 +262,7 @@
static void set_fullscreen_actions (gboolean is_fullscreen);
static void fullscreen_cb (GtkAction * action);
static gboolean window_state_cb (GtkWidget * widget, GdkEventWindowState * event);
-static void load_pixmaps (void);
+static void load_default_background (void);
static GtkAction *new_game_action;
static GtkAction *pause_action;
@@ -477,7 +477,7 @@
coloured_tiles = games_conf_get_boolean (NULL, KEY_SHOW_COLOURS, NULL);
click_to_move = games_conf_get_boolean (NULL, KEY_CLICK_MOVE, NULL);
- load_pixmaps ();
+ load_default_background ();
create_window ();
space = gtk_drawing_area_new ();
@@ -1972,35 +1972,34 @@
return FALSE;
}
-static GdkPixmap *
-get_pixmap (const char *filename)
+static void
+load_default_background (void)
{
- GdkPixmap *ret;
- GdkPixbuf *im;
+
+ GdkPixmap *pm;
+ GdkPixbuf *pb;
char *path;
+ const char * filename = "baize.png";
GError *error = NULL;
path = g_build_filename (PIXMAPDIR, filename, NULL);
- im = gdk_pixbuf_new_from_file (path, &error);
- if (im != NULL) {
- gdk_pixbuf_render_pixmap_and_mask_for_colormap (im,
- gdk_colormap_get_system
- (), &ret, NULL, 127);
- gdk_pixbuf_unref (im);
- } else {
+ pb = gdk_pixbuf_new_from_file (path, &error);
+ if (pb == NULL) {
g_warning ("Error loading file '%s': %s\n", path, error->message);
g_error_free (error);
- ret = NULL;
- }
+ pb = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
+ FALSE,
+ 8,1,1);
+ gdk_pixbuf_fill (pb, 0xffffffff);
+ }
+ gdk_pixbuf_render_pixmap_and_mask_for_colormap (pb,
+ gdk_colormap_get_system (),
+ &pm, NULL, 127);
+ gdk_pixbuf_unref (pb);
g_free (path);
- return ret;
-}
+ default_background_pixmap = pm;
-static void
-load_pixmaps (void)
-{
- default_background_pixmap = get_pixmap ("baize.png");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]