gnome-games r8173 - trunk/mahjongg



Author: thomashpa
Date: Tue Oct 21 20:32:31 2008
New Revision: 8173
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8173&view=rev

Log:
move mahjongg to use games-runtime for determining directories

Modified:
   trunk/mahjongg/Makefile.am
   trunk/mahjongg/drawing.c
   trunk/mahjongg/mahjongg.c
   trunk/mahjongg/maps.c

Modified: trunk/mahjongg/Makefile.am
==============================================================================
--- trunk/mahjongg/Makefile.am	(original)
+++ trunk/mahjongg/Makefile.am	Tue Oct 21 20:32:31 2008
@@ -2,12 +2,12 @@
 
 NULL =
 
-mapdir = $(pkgdatadir)/mahjongg/maps
+mapdir = $(pkgdatadir)/mahjongg/games
 map_DATA = \
 	mahjongg.map	\
 	$(NULL)
 
-pixmapdir = $(datadir)/pixmaps/mahjongg
+pixmapdir = $(pkgdatadir)/mahjongg/pixmaps
 pixmap_DATA = \
 	smooth.png	\
 	postmodern.svg	\

Modified: trunk/mahjongg/drawing.c
==============================================================================
--- trunk/mahjongg/drawing.c	(original)
+++ trunk/mahjongg/drawing.c	Tue Oct 21 20:32:31 2008
@@ -18,10 +18,10 @@
 #include <config.h>
 
 #include <glib/gi18n.h>
-
 #include <gtk/gtkdrawingarea.h>
 
 #include <libgames-support/games-preimage.h>
+#include <libgames-support/games-runtime.h>
 
 #include "mahjongg.h"
 #include "drawing.h"
@@ -445,12 +445,15 @@
 load_images (gchar * file)
 {
   char *filename;
+  const char *dname;
   GError *error = NULL;
 
   if (tilepreimage)
     g_object_unref (tilepreimage);
 
-  filename = g_build_filename (PIXMAPDIR, file, NULL);
+  dname =  games_runtime_get_directory (GAMES_RUNTIME_GAME_PIXMAP_DIRECTORY);
+
+  filename = g_build_filename (dname, file, NULL);
   tilepreimage = games_preimage_new_from_file (filename, &error);
   g_free (filename);
 
@@ -461,7 +464,7 @@
     g_clear_error (&error);
 
     /* Try the default tileset */
-    filename = g_build_filename (PIXMAPDIR, "postmodern.svg", NULL);
+    filename = g_build_filename (dname, "postmodern.svg", NULL);
     tilepreimage = games_preimage_new_from_file (filename, &error);
     g_free (filename);
 

Modified: trunk/mahjongg/mahjongg.c
==============================================================================
--- trunk/mahjongg/mahjongg.c	(original)
+++ trunk/mahjongg/mahjongg.c	Tue Oct 21 20:32:31 2008
@@ -550,7 +550,7 @@
   struct dirent *e;
   DIR *dir;
   gint itemno = 0;
-  gchar *dname = NULL;
+  const char *dname = NULL;
 
   if (tileset_list) {
     g_list_foreach (tileset_list, (GFunc) g_free, NULL);
@@ -559,11 +559,10 @@
 
   tileset_list = NULL;
 
-  dname = g_build_filename (PIXMAPDIR, NULL);
+  dname = games_runtime_get_directory(GAMES_RUNTIME_GAME_PIXMAP_DIRECTORY);
   dir = opendir (dname);
 
   if (!dir) {
-    g_free (dname);
     return;
   }
 
@@ -594,7 +593,6 @@
   }
 
   closedir (dir);
-  g_free (dname);
 }
 
 static void

Modified: trunk/mahjongg/maps.c
==============================================================================
--- trunk/mahjongg/maps.c	(original)
+++ trunk/mahjongg/maps.c	Tue Oct 21 20:32:31 2008
@@ -31,6 +31,7 @@
 #include <glib/gi18n.h>
 
 #include <libgames-support/games-files.h>
+#include <libgames-support/games-runtime.h>
 
 #include "mahjongg.h"
 #include "maps.h"
@@ -539,6 +540,7 @@
   int i;
   map *m;
   GamesFileList *filelist;
+  const char *dname;
 
   /* Initialise the parser. */
   parser.start_element = parse_start_el;
@@ -555,7 +557,8 @@
   }
 
   /* Now read the remainder in from file. */
-  filelist = games_file_list_new ("*.map", ".", MAPDIR, NULL);
+  dname =  games_runtime_get_directory (GAMES_RUNTIME_GAME_GAMES_DIRECTORY);
+  filelist = games_file_list_new ("*.map", ".", dname, NULL);
   games_file_list_for_each (filelist, (GFunc) load_map_from_file, NULL);
 
   /* FIXME: Ideally we would do this transformation, but the old code 



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