[gnome-games] gnect: Load images from standard data directory



commit 3d8eb0fa8c0e66c58a7fddbfce21dead6080e998
Author: Robert Ancell <robert ancell canonical com>
Date:   Sun Jan 1 13:24:53 2012 +1100

    gnect: Load images from standard data directory

 gnect/data/Makefile.am |   13 +++++++------
 gnect/src/Makefile.am  |    1 +
 gnect/src/connect4.c   |    3 +--
 gnect/src/gfx.c        |    6 ++----
 4 files changed, 11 insertions(+), 12 deletions(-)
---
diff --git a/gnect/data/Makefile.am b/gnect/data/Makefile.am
index e03af43..493da97 100644
--- a/gnect/data/Makefile.am
+++ b/gnect/data/Makefile.am
@@ -1,6 +1,6 @@
 SUBDIRS = icons
 
-pixmapdir = $(pkgdatadir)/gnect/pixmaps
+pixmapdir = $(datadir)/gnect
 pixmap_DATA = \
     tileset_50x50_sunspot.svg \
     tileset_50x50_catseyes.png \
@@ -12,12 +12,12 @@ pixmap_DATA = \
     bg_nightfall.jpg \
     bg_toplight.png
 
-velenadir      = $(pkgdatadir)/gnect
+velenadir      = $(datadir)/gnect
 velena_DATA    = white_ob.cn4.gz
 
-Games_in_files = gnect.desktop.in.in
-Gamesdir       = $(datadir)/applications
-Games_DATA     = $(Games_in_files:.desktop.in.in=.desktop)
+desktop_in_files = gnect.desktop.in.in
+desktopdir       = $(datadir)/applications
+desktop_DATA     = $(desktop_in_files:.desktop.in.in=.desktop)
 
 schema_in_files = gnect.schemas.in
 if HAVE_GNOME
@@ -29,10 +29,11 @@ man_MANS     = gnect.6
 
 EXTRA_DIST = $(pixmap_DATA) \
              $(velena_DATA) \
+             $(desktop_in_files) \
              $(schema_in_files) \
              $(man_MANS)
 
-DISTCLEANFILES = $(schema_DATA) $(Games_DATA)
+DISTCLEANFILES = $(schema_DATA) $(desktop_DATA)
 
 install-data-local: 
 if GCONF_SCHEMAS_INSTALL
diff --git a/gnect/src/Makefile.am b/gnect/src/Makefile.am
index 8bc36d5..58807fd 100644
--- a/gnect/src/Makefile.am
+++ b/gnect/src/Makefile.am
@@ -28,6 +28,7 @@ gnect_CPPFLAGS = \
 	$(AM_CPPFLAGS)
 
 gnect_CFLAGS = \
+	-DDATA_DIRECTORY=\"$(datadir)/gnect\" \
 	-DSOUND_DIRECTORY=\"$(pkgdatadir)/sounds\" \
 	$(GTK_CFLAGS) \
 	$(CANBERRA_GTK_CFLAGS) \
diff --git a/gnect/src/connect4.c b/gnect/src/connect4.c
index 84fd57a..beb51c8 100644
--- a/gnect/src/connect4.c
+++ b/gnect/src/connect4.c
@@ -112,8 +112,7 @@ init_prg (struct board *board)
   long ob_size, len;
   FILE *h1;
   short x;
-  const char *tmp = games_runtime_get_directory (GAMES_RUNTIME_GAME_DATA_DIRECTORY);
-  char *bookdata = g_build_filename (tmp, WHITE_BOOK, NULL);
+  char *bookdata = g_build_filename (DATA_DIRECTORY, WHITE_BOOK, NULL);
 
   if (!g_file_test (bookdata, G_FILE_TEST_EXISTS)) {
     g_printerr ("velena: required file not found (%s)\n", bookdata);
diff --git a/gnect/src/gfx.c b/gnect/src/gfx.c
index aa26c33..595913b 100644
--- a/gnect/src/gfx.c
+++ b/gnect/src/gfx.c
@@ -254,15 +254,13 @@ gfx_load_error (const gchar * fname)
 gboolean
 gfx_load_pixmaps (void)
 {
-  const char *dname;
   gchar *fname;
   GdkPixbuf *pb_tileset_tmp;
   GdkPixbuf *pb_bground_tmp = NULL;
 
-  dname = games_runtime_get_directory (GAMES_RUNTIME_GAME_PIXMAP_DIRECTORY);
   /* Try the theme pixmaps, fallback to the default and then give up */
   while (TRUE) {
-    fname = g_build_filename (dname, theme[p.theme_id].fname_tileset, NULL);
+    fname = g_build_filename (DATA_DIRECTORY, theme[p.theme_id].fname_tileset, NULL);
     pb_tileset_tmp = gdk_pixbuf_new_from_file (fname, NULL);
     if (pb_tileset_tmp == NULL) {
       if (p.theme_id != 0) {
@@ -286,7 +284,7 @@ gfx_load_pixmaps (void)
   pb_tileset_raw = pb_tileset_tmp;
 
   if (theme[p.theme_id].fname_bground != NULL) {
-    fname = g_build_filename (dname, theme[p.theme_id].fname_bground, NULL);
+    fname = g_build_filename (DATA_DIRECTORY, theme[p.theme_id].fname_bground, NULL);
     pb_bground_tmp = gdk_pixbuf_new_from_file (fname, NULL);
     if (pb_bground_tmp == NULL) {
       gfx_load_error (fname);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]