[gnome-games] gnobots2: Load images from standard data directory
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] gnobots2: Load images from standard data directory
- Date: Sun, 1 Jan 2012 03:17:39 +0000 (UTC)
commit b03543043c306a0a3b4d03c922e076020804bc4c
Author: Robert Ancell <robert ancell canonical com>
Date: Sun Jan 1 13:33:12 2012 +1100
gnobots2: Load images from standard data directory
gnobots2/data/Makefile.am | 6 +++---
gnobots2/src/Makefile.am | 1 +
gnobots2/src/gameconfig.c | 5 +++--
gnobots2/src/graphics.c | 15 ++++++---------
gnobots2/src/properties.c | 7 ++++---
5 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/gnobots2/data/Makefile.am b/gnobots2/data/Makefile.am
index 46d6710..89a207b 100644
--- a/gnobots2/data/Makefile.am
+++ b/gnobots2/data/Makefile.am
@@ -21,18 +21,18 @@ cursor_files = \
cursor-up.png \
cursor-up-right.png
-pixmapdir = $(pkgdatadir)/gnobots2/pixmaps
+pixmapdir = $(datadir)/gnobots2/pixmaps
pixmap_DATA = yahoo.png \
aieee.png \
splat.png
-themedir = $(pkgdatadir)/gnobots2/themes
+themedir = $(datadir)/gnobots2/themes
theme_DATA = gnomes.png \
robots.svg \
boo.svg \
ufo.svg
-configdir = $(pkgdatadir)/gnobots2/games
+configdir = $(datadir)/gnobots2/games
config_DATA = robots2.cfg \
robots2_easy.cfg \
classic_robots.cfg \
diff --git a/gnobots2/src/Makefile.am b/gnobots2/src/Makefile.am
index 5bfb00c..d40c0a5 100644
--- a/gnobots2/src/Makefile.am
+++ b/gnobots2/src/Makefile.am
@@ -39,6 +39,7 @@ gnobots2_CPPFLAGS = \
$(AM_CPPFLAGS)
gnobots2_CFLAGS = \
+ -DDATA_DIRECTORY=\"$(datadir)/gnobots2\" \
-DSOUND_DIRECTORY=\"$(pkgdatadir)/sounds\" \
$(GTK_CFLAGS) \
$(CANBERRA_GTK_CFLAGS) \
diff --git a/gnobots2/src/gameconfig.c b/gnobots2/src/gameconfig.c
index 0bec365..cb430dd 100644
--- a/gnobots2/src/gameconfig.c
+++ b/gnobots2/src/gameconfig.c
@@ -217,9 +217,9 @@ load_game_configs (void)
const gchar *dent;
GDir *dir;
gchar *buffer;
- const char *dname;
+ gchar *dname;
- dname = games_runtime_get_directory (GAMES_RUNTIME_GAME_GAMES_DIRECTORY);
+ dname = g_build_filename (DATA_DIRECTORY, "games", NULL);
if (game_configs != NULL) {
free_game_configs ();
@@ -259,6 +259,7 @@ load_game_configs (void)
num_configs++;
}
}
+ g_free (dname);
g_dir_close (dir);
diff --git a/gnobots2/src/graphics.c b/gnobots2/src/graphics.c
index 50e0a80..7fc94fd 100644
--- a/gnobots2/src/graphics.c
+++ b/gnobots2/src/graphics.c
@@ -173,20 +173,17 @@ static gboolean
load_bubble_graphics (void)
{
gchar *buffer = NULL;
- const char *dname;
- dname = games_runtime_get_directory (GAMES_RUNTIME_GAME_PIXMAP_DIRECTORY);
-
- buffer = g_build_filename (dname, "yahoo.png", NULL);
+ buffer = g_build_filename (DATA_DIRECTORY, "pixmaps", "yahoo.png", NULL);
if (!load_bubble_graphic (buffer, &yahoo_pixbuf))
return FALSE;
g_free (buffer);
- buffer = g_build_filename (dname, "aieee.png", NULL);
+ buffer = g_build_filename (DATA_DIRECTORY, "pixmaps", "aieee.png", NULL);
if (!load_bubble_graphic (buffer, &aieee_pixbuf))
return FALSE;
- buffer = g_build_filename (dname, "splat.png", NULL);
+ buffer = g_build_filename (DATA_DIRECTORY, "pixmaps", "splat.png", NULL);
if (!load_bubble_graphic (buffer, &splat_pixbuf))
return FALSE;
@@ -206,14 +203,13 @@ load_bubble_graphics (void)
gboolean
load_game_graphics (void)
{
- gchar *filename;
- const char *themedir;
+ gchar *themedir, *filename;
if (theme_preimage != NULL) {
free_game_graphics ();
}
- themedir = games_runtime_get_directory (GAMES_RUNTIME_GAME_THEME_DIRECTORY);
+ themedir = g_build_filename (DATA_DIRECTORY, "themes", NULL);
filename = games_find_similar_file (properties_theme_name (), themedir);
theme_preimage = games_preimage_new_from_file (filename, NULL);
@@ -224,6 +220,7 @@ load_game_graphics (void)
theme_preimage = games_preimage_new_from_file (filename, NULL);
g_free (filename);
}
+ g_free (themedir);
if (!load_bubble_graphics ())
return FALSE;
diff --git a/gnobots2/src/properties.c b/gnobots2/src/properties.c
index 56a4611..54de13b 100644
--- a/gnobots2/src/properties.c
+++ b/gnobots2/src/properties.c
@@ -343,13 +343,14 @@ fill_typemenu (GtkWidget * menu)
static GtkWidget *
make_theme_menu (void)
{
- const char *pixmapdir;
+ gchar *dir;
if (theme_list)
g_object_unref (theme_list);
- pixmapdir = games_runtime_get_directory (GAMES_RUNTIME_GAME_THEME_DIRECTORY);
- theme_list = games_file_list_new_images (pixmapdir, NULL);
+ dir = g_build_filename (DATA_DIRECTORY, "themes", NULL);
+ theme_list = games_file_list_new_images (dir, NULL);
+ g_free (dir);
games_file_list_transform_basename (theme_list);
/* FIXME: Get rid of the bubbles images from the list (preferably by
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]