commit e98750014c6715783c9035449502a2620230c6ed Author: phantomjinx <p.g.richard...@phantomjinx.co.uk> Date: Sat Dec 11 23:20:24 2010 +0000
Replace SCRIPTDIR constant with get_script_dir() function * Relies on scripts being installed in order for conversions to work while developing. Changes scripts directory to act in the same manner as images and data directories. * Relies on initialisation in directories.c configure.in | 2 ++ libgtkpod/Makefile.am | 1 + libgtkpod/directories.c | 9 ++++++++- libgtkpod/directories.h | 2 ++ libgtkpod/misc.c | 4 +--- libgtkpod/prefs.c | 7 ++++--- plugins/core_preferences/core_prefs.c | 3 ++- plugins/coverweb/Makefile.am | 1 + plugins/media_player/Makefile.am | 1 + plugins/mserv/Makefile.am | 1 + plugins/playlist_display/Makefile.am | 1 + plugins/repository_editor/repository_editor.c | 4 ++-- src/Makefile.am | 3 ++- 13 files changed, 28 insertions(+), 11 deletions(-) --- diff --git a/configure.in b/configure.in index 7bdf4c0..946f68c 100644 --- a/configure.in +++ b/configure.in @@ -278,12 +278,14 @@ gtkpod_doc_dir='$(datadir)/$(PACKAGE)/doc' gtkpod_ui_dir='$(gtkpod_data_dir)/ui' gtkpod_glade_dir='$(gtkpod_data_dir)/glade' gtkpod_image_dir='$(datadir)/$(PACKAGE)/icons' +gtkpod_script_dir='$(datadir)/$(PACKAGE)/scripts' AC_SUBST(gtkpod_plugin_dir) AC_SUBST(gtkpod_data_dir) AC_SUBST(gtkpod_doc_dir) AC_SUBST(gtkpod_ui_dir) AC_SUBST(gtkpod_glade_dir) AC_SUBST(gtkpod_image_dir) +AC_SUBST(gtkpod_script_dir) m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) diff --git a/libgtkpod/Makefile.am b/libgtkpod/Makefile.am index b9e0c9e..2e24a78 100644 --- a/libgtkpod/Makefile.am +++ b/libgtkpod/Makefile.am @@ -45,6 +45,7 @@ AM_CFLAGS = \ -DGTKPOD_UI_DIR=\""$(gtkpod_ui_dir)"\" \ -DGTKPOD_GLADE_DIR=\""$(gtkpod_glade_dir)"\" \ -DGTKPOD_IMAGE_DIR=\""$(gtkpod_image_dir)"\" \ + -DGTKPOD_SCRIPT_DIR=\""$(gtkpod_script_dir)"\" \ $(LIBGTKPOD_CFLAGS) libgtkpod_la_LDFLAGS = $(LIBGTKPOD_LDFLAGS) -version-info $(LIBGTKPOD_SO_VERSION) -no-undefined diff --git a/libgtkpod/directories.c b/libgtkpod/directories.c index cc6044b..2f421f5 100644 --- a/libgtkpod/directories.c +++ b/libgtkpod/directories.c @@ -43,6 +43,7 @@ static gchar *icondir = NULL; static gchar *plugindir = NULL; static gchar *uidir = NULL; static gchar *gladedir = NULL; +static gchar *scriptdir = NULL; void init_directories(char *argv[]) { // g_printf("argv[0] = %s\n", argv[0]); @@ -52,6 +53,7 @@ void init_directories(char *argv[]) { uidir = init_dir(argv, "data/ui", GTKPOD_UI_DIR); gladedir = init_dir(argv, "data/glade", GTKPOD_GLADE_DIR); plugindir = init_dir(argv, "plugins", GTKPOD_PLUGIN_DIR); + scriptdir = init_dir(argv, "scripts", GTKPOD_SCRIPT_DIR); gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), icondir); gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), GTKPOD_IMAGE_DIR); @@ -67,6 +69,7 @@ static void debug_print_directories() { g_printf("glade directory: %s\n", get_glade_dir()); g_printf("icon directory: %s\n", get_icon_dir()); g_printf("plugin directory: %s\n", get_plugin_dir()); + g_printf("script directory: %s\n", get_script_dir()); } #endif @@ -109,7 +112,7 @@ static gchar * init_dir(char *argv[], gchar *localdir, gchar *fullinstalldir) { newdir = fullinstalldir; else { USING_LOCAL = TRUE; - g_printf("Using local %s file since program was started from source directory:\n%s\n", localdir, newdir); + g_printf("Using local %s directory since program was started from source directory:\n%s\n", localdir, newdir); } return newdir; @@ -146,3 +149,7 @@ gchar * get_ui_dir() { gchar * get_plugin_dir() { return plugindir; } + +gchar * get_script_dir() { + return scriptdir; +} diff --git a/libgtkpod/directories.h b/libgtkpod/directories.h index d34f19f..f71533e 100644 --- a/libgtkpod/directories.h +++ b/libgtkpod/directories.h @@ -29,4 +29,6 @@ gchar * get_ui_dir(); gchar * get_plugin_dir(); +gchar * get_script_dir(); + #endif /* DIRECTORIES_H_ */ diff --git a/libgtkpod/misc.c b/libgtkpod/misc.c index 03ae28d..7638e32 100644 --- a/libgtkpod/misc.c +++ b/libgtkpod/misc.c @@ -45,12 +45,10 @@ ffla | This program is distributed in the hope that it will be useful, #include "prefs.h" #include "misc_track.h" #include "file_convert.h" +#include "directories.h" #define DEBUG_MISC 0 -/* where to find the scripts */ -const gchar *SCRIPTDIR = PACKAGE_DATA_DIR G_DIR_SEPARATOR_S PACKAGE G_DIR_SEPARATOR_S "scripts" G_DIR_SEPARATOR_S; - /*------------------------------------------------------------------*\ * * * Functions for blocking widgets (block input) * diff --git a/libgtkpod/prefs.c b/libgtkpod/prefs.c index 51a034f..b38dd25 100644 --- a/libgtkpod/prefs.c +++ b/libgtkpod/prefs.c @@ -84,6 +84,7 @@ #include "misc.h" #include "misc_conversion.h" #include "clientserver.h" +#include "directories.h" /* some public key names used several times */ const gchar *KEY_CONCAL_AUTOSYNC = "concal_autosync"; @@ -172,17 +173,17 @@ static void set_default_preferences() { prefs_set_int("delete_database", TRUE); prefs_set_string("initial_mountpoint", "/media/ipod"); - str = g_build_filename(SCRIPTDIR, "convert-ogg2mp3.sh", NULL); + str = g_build_filename(get_script_dir(), "convert-2mp3.sh", NULL); prefs_set_string("path_conv_ogg", str); g_free(str); prefs_set_int("convert_ogg", TRUE); - str = g_build_filename(SCRIPTDIR, "convert-flac2mp3.sh", NULL); + str = g_build_filename(get_script_dir(), "convert-2mp3.sh", NULL); prefs_set_string("path_conv_flac", str); g_free(str); prefs_set_int("convert_flac", TRUE); - str = g_build_filename(SCRIPTDIR, "convert-wav2mp3.sh", NULL); + str = g_build_filename(get_script_dir(), "convert-2mp3.sh", NULL); prefs_set_string("path_conv_wav", str); g_free(str); prefs_set_int("convert_wav", FALSE); diff --git a/plugins/core_preferences/core_prefs.c b/plugins/core_preferences/core_prefs.c index 0178c77..0a98de6 100644 --- a/plugins/core_preferences/core_prefs.c +++ b/plugins/core_preferences/core_prefs.c @@ -32,6 +32,7 @@ #include "libgtkpod/charset.h" #include "libgtkpod/misc.h" #include "libgtkpod/file_convert.h" +#include "libgtkpod/directories.h" #include "core_prefs.h" #include "plugin.h" @@ -633,7 +634,7 @@ G_MODULE_EXPORT void on_cache_size_value_changed (GtkSpinButton *sender, gpointe G_MODULE_EXPORT void on_target_format_changed (GtkComboBox *sender, gpointer e) { gint index = gtk_combo_box_get_active (sender); - gchar *script = g_build_filename (SCRIPTDIR, conv_scripts[index], NULL); + gchar *script = g_build_filename (get_script_dir(), conv_scripts[index], NULL); gint i; for (i = 0; i < COUNTOF (conv_paths); i++) diff --git a/plugins/coverweb/Makefile.am b/plugins/coverweb/Makefile.am index 162630d..9b277b5 100644 --- a/plugins/coverweb/Makefile.am +++ b/plugins/coverweb/Makefile.am @@ -36,6 +36,7 @@ AM_CPPFLAGS = \ -DGTKPOD_IMAGE_DIR=\"$(gtkpod_image_dir)\" \ -DGTKPOD_GLADE_DIR=\"$(gtkpod_glade_dir)\" \ -DGTKPOD_UI_DIR=\"$(gtkpod_ui_dir)\" \ + -DGTKPOD_SCRIPT_DIR=\""$(gtkpod_script_dir)"\" \ -DPACKAGE_DATA_DIR=\"$(datadir)\" \ -DPACKAGE_SRC_DIR=\"$(srcdir)\" \ $(GTKPOD_CFLAGS) \ diff --git a/plugins/media_player/Makefile.am b/plugins/media_player/Makefile.am index cb51c05..8f3032a 100644 --- a/plugins/media_player/Makefile.am +++ b/plugins/media_player/Makefile.am @@ -34,6 +34,7 @@ AM_CPPFLAGS = \ -DGTKPOD_DATA_DIR=\"$(gtkpod_data_dir)\" \ -DGTKPOD_PLUGIN_DIR=\"$(gtkpod_plugin_dir)\" \ -DGTKPOD_IMAGE_DIR=\"$(gtkpod_image_dir)\" \ + -DGTKPOD_SCRIPT_DIR=\""$(gtkpod_script_dir)"\" \ -DGTKPOD_GLADE_DIR=\"$(gtkpod_glade_dir)\" \ -DGTKPOD_UI_DIR=\"$(gtkpod_ui_dir)\" \ -DPACKAGE_DATA_DIR=\"$(datadir)\" \ diff --git a/plugins/mserv/Makefile.am b/plugins/mserv/Makefile.am index be63b86..9bbb01e 100644 --- a/plugins/mserv/Makefile.am +++ b/plugins/mserv/Makefile.am @@ -32,6 +32,7 @@ AM_CPPFLAGS = \ -DGTKPOD_DATA_DIR=\"$(gtkpod_data_dir)\" \ -DGTKPOD_PLUGIN_DIR=\"$(gtkpod_plugin_dir)\" \ -DGTKPOD_IMAGE_DIR=\"$(gtkpod_image_dir)\" \ + -DGTKPOD_SCRIPT_DIR=\""$(gtkpod_script_dir)"\" \ -DGTKPOD_GLADE_DIR=\"$(gtkpod_glade_dir)\" \ -DGTKPOD_UI_DIR=\"$(gtkpod_ui_dir)\" \ -DPACKAGE_DATA_DIR=\"$(datadir)\" \ diff --git a/plugins/playlist_display/Makefile.am b/plugins/playlist_display/Makefile.am index d075c3e..7e5f421 100644 --- a/plugins/playlist_display/Makefile.am +++ b/plugins/playlist_display/Makefile.am @@ -32,6 +32,7 @@ AM_CPPFLAGS = \ -DGTKPOD_DATA_DIR=\"$(gtkpod_data_dir)\" \ -DGTKPOD_PLUGIN_DIR=\"$(gtkpod_plugin_dir)\" \ -DGTKPOD_IMAGE_DIR=\"$(gtkpod_image_dir)\" \ + -DGTKPOD_SCRIPT_DIR=\""$(gtkpod_script_dir)"\" \ -DGTKPOD_GLADE_DIR=\"$(gtkpod_glade_dir)\" \ -DGTKPOD_UI_DIR=\"$(gtkpod_ui_dir)\" \ -DPACKAGE_DATA_DIR=\"$(datadir)\" \ diff --git a/plugins/repository_editor/repository_editor.c b/plugins/repository_editor/repository_editor.c index 7c6ca41..f578b91 100644 --- a/plugins/repository_editor/repository_editor.c +++ b/plugins/repository_editor/repository_editor.c @@ -796,9 +796,9 @@ static void ipod_sync_button_clicked(iPodSyncType type) { g_free(key); text - = g_markup_printf_escaped(_("<i>Have a look at the scripts provided in '%s'. If you write a new script or improve an existing one, please send it to jcsjcs at users.sourceforge.net for inclusion into the next release.</i>"), SCRIPTDIR); + = g_markup_printf_escaped(_("<i>Have a look at the scripts provided in '%s'. If you write a new script or improve an existing one, please send it to jcsjcs at users.sourceforge.net for inclusion into the next release.</i>"), get_script_dir()); - newpath = fileselection_select_script(oldpath, SCRIPTDIR, title, text); + newpath = fileselection_select_script(oldpath, get_script_dir(), title, text); g_free(oldpath); g_free(text); diff --git a/src/Makefile.am b/src/Makefile.am index 56f25a8..64984de 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,7 +15,8 @@ AM_CFLAGS = \ -DGTKPOD_DOC_DIR=\""$(gtkpod_doc_dir)"\" \ -DGTKPOD_UI_DIR=\""$(gtkpod_ui_dir)"\" \ -DGTKPOD_GLADE_DIR=\""$(gtkpod_glade_dir)"\" \ - -DGTKPOD_IMAGE_DIR=\""$(gtkpod_image_dir)"\" + -DGTKPOD_IMAGE_DIR=\""$(gtkpod_image_dir)"\" \ + -DGTKPOD_SCRIPT_DIR=\""$(gtkpod_script_dir)"\" ------------------------------------------------------------------------------ Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL, new data types, scalar functions, improved concurrency, built-in packages, OCI, SQL*Plus, data movement tools, best practices and more. http://p.sf.net/sfu/oracle-sfdev2dev _______________________________________________ gtkpod-cvs2 mailing list gtkpod-cvs2@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2