gnome-games r8296 - in trunk/blackjack: data src
- From: chpe svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-games r8296 - in trunk/blackjack: data src
- Date: Sun, 9 Nov 2008 14:06:35 +0000 (UTC)
Author: chpe
Date: Sun Nov 9 14:06:35 2008
New Revision: 8296
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8296&view=rev
Log:
Use games-runtime to locate files.
Modified:
trunk/blackjack/data/Makefile.am
trunk/blackjack/src/chips.cpp
trunk/blackjack/src/game.cpp
trunk/blackjack/src/slot.cpp
trunk/blackjack/src/splash.cpp
Modified: trunk/blackjack/data/Makefile.am
==============================================================================
--- trunk/blackjack/data/Makefile.am (original)
+++ trunk/blackjack/data/Makefile.am Sun Nov 9 14:06:35 2008
@@ -1,4 +1,4 @@
-rulesdir = $(pkgdatadir)/blackjack/rules
+rulesdir = $(pkgdatadir)/blackjack/games
rules_DATA = Ameristar.rules \
Atlantic_City.rules \
Vegas_Downtown.rules \
Modified: trunk/blackjack/src/chips.cpp
==============================================================================
--- trunk/blackjack/src/chips.cpp (original)
+++ trunk/blackjack/src/chips.cpp Sun Nov 9 14:06:35 2008
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <math.h>
#include <libgames-support/games-preimage.h>
+#include <libgames-support/games-runtime.h>
#include "blackjack.h"
#include "chips.h"
@@ -63,15 +64,18 @@
bj_chip_set_size (gint width,
gint height)
{
- const gchar *names[4] = { CHIP_FILENAME_100,
- CHIP_FILENAME_25,
- CHIP_FILENAME_5,
- CHIP_FILENAME_1 };
+ static const gchar *names[4] = { CHIP_FILENAME_100,
+ CHIP_FILENAME_25,
+ CHIP_FILENAME_5,
+ CHIP_FILENAME_1 };
+ const char *pixmapdir;
- for (gint i = 0; i < 4; i++) {
+ pixmapdir = games_runtime_get_directory (GAMES_RUNTIME_GAME_PIXMAP_DIRECTORY);
+
+ for (gint i = 0; i < G_N_ELEMENTS (names); i++) {
gchar *fullname;
- fullname = g_build_filename (PIXMAPDIR, names[i], NULL);
+ fullname = g_build_filename (pixmapdir, names[i], NULL);
if (!fullname)
continue;
Modified: trunk/blackjack/src/game.cpp
==============================================================================
--- trunk/blackjack/src/game.cpp (original)
+++ trunk/blackjack/src/game.cpp Sun Nov 9 14:06:35 2008
@@ -28,6 +28,8 @@
#include <glib/gi18n.h>
#include <glib/gstdio.h>
+#include <libgames-support/games-runtime.h>
+
#include "blackjack.h"
#include "events.h"
#include "draw.h"
@@ -160,8 +162,10 @@
GDir *dir;
G_CONST_RETURN gchar* file_name;
gint n_games = 0;
+ const char *rulesdir;
- dir = g_dir_open (BJ_RULES_DIR, 0, NULL);
+ rulesdir = games_runtime_get_directory (GAMES_RUNTIME_GAME_GAMES_DIRECTORY);
+ dir = g_dir_open (rulesdir, 0, NULL);
if (dir == NULL)
return;
@@ -292,8 +296,10 @@
{
gchar *installed_filename;
BJGameRules *ruleset = NULL;
+ const char *rulesdir;
- installed_filename = g_build_filename (BJ_RULES_DIR, filename, NULL);
+ rulesdir = games_runtime_get_directory (GAMES_RUNTIME_GAME_GAMES_DIRECTORY);
+ installed_filename = g_build_filename (rulesdir, filename, NULL);
if (g_file_test (installed_filename, G_FILE_TEST_EXISTS))
ruleset = bj_game_read_rules (installed_filename);
@@ -332,12 +338,14 @@
static void
bj_game_eval_installed_file (const gchar *file)
{
+ const char *rulesdir;
char *installed_filename;
if (g_file_test (file, G_FILE_TEST_EXISTS))
return;
- installed_filename = g_build_filename (BJ_RULES_DIR, file, NULL);
+ rulesdir = games_runtime_get_directory (GAMES_RUNTIME_GAME_GAMES_DIRECTORY);
+ installed_filename = g_build_filename (rulesdir, file, NULL);
if (g_file_test (installed_filename, G_FILE_TEST_EXISTS)) {
rules = bj_game_read_rules (installed_filename);
Modified: trunk/blackjack/src/slot.cpp
==============================================================================
--- trunk/blackjack/src/slot.cpp (original)
+++ trunk/blackjack/src/slot.cpp Sun Nov 9 14:06:35 2008
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <libgames-support/games-preimage.h>
+#include <libgames-support/games-runtime.h>
#include "blackjack.h"
#include "slot.h"
@@ -50,9 +51,11 @@
bj_slot_set_size (gint width,
gint height)
{
+ const char *pixmapdir;
gchar *name;
- name = g_build_filename (PIXMAPDIR, SLOT_FILENAME, NULL);
+ pixmapdir = games_runtime_get_directory (GAMES_RUNTIME_GAME_PIXMAP_DIRECTORY);
+ name = g_build_filename (pixmapdir, SLOT_FILENAME, NULL);
if (!name)
return;
@@ -78,9 +81,11 @@
void
bj_slot_load_pixmaps (void)
{
+ const char *pixmapdir;
gchar *buffer;
- buffer = g_build_filename (PIXMAPDIR, "baize.png", NULL);
+ pixmapdir = games_runtime_get_directory (GAMES_RUNTIME_GAME_PIXMAP_DIRECTORY);
+ buffer = g_build_filename (pixmapdir, "baize.png", NULL);
default_background_pixmap = get_pixmap (buffer);
g_free (buffer);
}
Modified: trunk/blackjack/src/splash.cpp
==============================================================================
--- trunk/blackjack/src/splash.cpp (original)
+++ trunk/blackjack/src/splash.cpp Sun Nov 9 14:06:35 2008
@@ -21,14 +21,14 @@
* USA
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "splash.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include <libgames-support/games-runtime.h>
+
static GtkWidget *progress = NULL;
static GtkWidget *label = NULL;
static GtkWidget *splash = NULL;
@@ -75,8 +75,10 @@
gchar *image_file;
GtkWidget *splash_pixmap = NULL;
GtkWidget *vbox;
+ const char *pixmapdir;
- image_file = g_build_filename (PIXMAPDIR, "blackjack-splash.png", NULL);
+ pixmapdir = games_runtime_get_directory (GAMES_RUNTIME_GAME_PIXMAP_DIRECTORY);
+ image_file = g_build_filename (pixmapdir, "blackjack-splash.png", NULL);
if (image_file != NULL)
splash_pixmap = gtk_image_new_from_file (image_file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]