[gnome-games] glines: Load images from standard data directory
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] glines: Load images from standard data directory
- Date: Sun, 1 Jan 2012 03:17:50 +0000 (UTC)
commit af5dbf087dfd8723ec7f05e817091516f510adae
Author: Robert Ancell <robert ancell canonical com>
Date: Sun Jan 1 13:50:58 2012 +1100
glines: Load images from standard data directory
glines/data/Makefile.am | 8 ++++----
glines/src/Makefile.am | 1 +
glines/src/glines.c | 15 +++++++--------
3 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/glines/data/Makefile.am b/glines/data/Makefile.am
index 96ef9db..ed28c78 100644
--- a/glines/data/Makefile.am
+++ b/glines/data/Makefile.am
@@ -1,12 +1,12 @@
SUBDIRS = icons
-uidir = $(pkgdatadir)/glines/
+uidir = $(datadir)/glines/
ui_DATA = \
glines.ui \
glines-preferences.ui
-pixmapdir = $(pkgdatadir)/glines/pixmaps
-pixmap_DATA = \
+themedir = $(datadir)/glines/themes
+theme_DATA = \
balls.svg \
shapes.svg
@@ -23,7 +23,7 @@ desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop)
@INTLTOOL_DESKTOP_RULE@
EXTRA_DIST = \
- $(pixmap_DATA) \
+ $(theme_DATA) \
$(gsettings_in_file) \
$(man_MANS) \
$(ui_DATA)
diff --git a/glines/src/Makefile.am b/glines/src/Makefile.am
index 637939f..9a1d1d6 100644
--- a/glines/src/Makefile.am
+++ b/glines/src/Makefile.am
@@ -9,6 +9,7 @@ glines_CPPFLAGS = \
$(AM_CPPFLAGS)
glines_CFLAGS = \
+ -DDATA_DIRECTORY=\"$(datadir)/glines\" \
$(GMODULE_CFLAGS) \
$(GTK_CFLAGS) \
$(AM_CFLAGS)
diff --git a/glines/src/glines.c b/glines/src/glines.c
index 9f1da3d..6039a46 100644
--- a/glines/src/glines.c
+++ b/glines/src/glines.c
@@ -188,17 +188,15 @@ load_image (gchar * fname)
{
GamesPreimage *preimage;
gchar *path;
- const char *dirname;
GError *error = NULL;
- dirname = games_runtime_get_directory (GAMES_RUNTIME_GAME_PIXMAP_DIRECTORY);
- path = g_build_filename (dirname, fname, NULL);
+ path = g_build_filename (DATA_DIRECTORY, "themes", fname, NULL);
if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
warning_message = g_strdup_printf (_("Unable to locate file:\n%s\n\n"
"The default theme will be loaded instead."),
fname);
- path = g_build_filename (dirname, "balls.svg", NULL);
+ path = g_build_filename (DATA_DIRECTORY, "themes", "balls.svg", NULL);
if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
g_free (warning_message);
warning_message = g_strdup_printf (_("Unable to locate file:\n%s\n\n"
@@ -1313,13 +1311,14 @@ set_selection (GtkWidget * widget, char *data)
static GtkWidget *
fill_menu (void)
{
- const char *pixmap_dir;
+ gchar *pixmap_dir;
if (theme_file_list)
g_object_unref (theme_file_list);
- pixmap_dir = games_runtime_get_directory (GAMES_RUNTIME_GAME_PIXMAP_DIRECTORY);
+ pixmap_dir = g_build_filename (DATA_DIRECTORY, "themes", NULL);
theme_file_list = games_file_list_new_images (pixmap_dir, NULL);
+ g_free (pixmap_dir);
games_file_list_transform_basename (theme_file_list);
return games_file_list_create_widget (theme_file_list, ball_filename,
@@ -1353,7 +1352,7 @@ game_props_callback (void)
GtkWidget *fast_moves_checkbutton;
if (!pref_dialog) {
- ui_path = g_build_filename (games_runtime_get_directory (GAMES_RUNTIME_GAME_DATA_DIRECTORY), "glines-preferences.ui", NULL);
+ ui_path = g_build_filename (DATA_DIRECTORY, "glines-preferences.ui", NULL);
builder_preferences = gtk_builder_new ();
gtk_builder_add_from_file (builder_preferences, ui_path, &error);
g_free (ui_path);
@@ -1544,7 +1543,7 @@ main (int argc, char *argv[])
gtk_window_set_default_icon_name ("glines");
- ui_path = g_build_filename (games_runtime_get_directory (GAMES_RUNTIME_GAME_DATA_DIRECTORY), "glines.ui", NULL);
+ ui_path = g_build_filename (DATA_DIRECTORY, "glines.ui", NULL);
builder = gtk_builder_new ();
gtk_builder_add_from_file (builder, ui_path, &error);
g_free (ui_path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]