From a5194a3488d376824e046b09b93816004d7c5c20 Mon Sep 17 00:00:00 2001 From: Stefan Gehn Date: Wed, 17 Dec 2008 14:12:21 +0000 Subject: [PATCH] - Unify search-paths for plugins and themes in both gkrellm and gkrellmd on win32 --- server/plugins.c | 4 ++-- src/gkrellm.h | 4 ++-- src/gui.c | 22 ++++++++++++++++++++++ src/plugins.c | 22 ++++++++++++++++++++++ 4 files changed, 48 insertions(+), 4 deletions(-) diff --git a/server/plugins.c b/server/plugins.c index 9c38066..4190f59 100644 --- a/server/plugins.c +++ b/server/plugins.c @@ -277,12 +277,12 @@ gkrellmd_plugins_load(void) install_path = g_win32_get_package_installation_directory_of_module(NULL); if (install_path != NULL) { - path = g_build_filename(install_path, "plugins-gkrellmd", NULL); + path = g_build_filename(install_path, "lib", "gkrellm2", "plugins-gkrellmd", NULL); g_free(install_path); } #else // deprecated since glib 2.16.0 - path = g_win32_get_package_installation_subdirectory(NULL, NULL, "plugins-gkrellmd"); + path = g_win32_get_package_installation_subdirectory(NULL, NULL, "lib/gkrellm2/plugins-gkrellmd"); #endif if (path) { diff --git a/src/gkrellm.h b/src/gkrellm.h index 4059585..3414b90 100644 --- a/src/gkrellm.h +++ b/src/gkrellm.h @@ -131,9 +131,9 @@ #else #undef LOCAL_THEMES_DIR -#define SYSTEM_THEMES_DIR "./themes" +#undef SYSTEM_THEMES_DIR #undef LOCAL_PLUGINS_DIR -#define SYSTEM_PLUGINS_DIR "./plugins" +#undef SYSTEM_PLUGINS_DIR #endif diff --git a/src/gui.c b/src/gui.c index d8785fc..afb03e9 100644 --- a/src/gui.c +++ b/src/gui.c @@ -1445,6 +1445,28 @@ gkrellm_make_themes_list(void) theme_dir = gtk_rc_get_theme_dir(); add_themes_to_list(theme_dir, TRUE); +#if defined(WIN32) + theme_dir = NULL; +#if GLIB_CHECK_VERSION(2,16,0) + gchar *install_path; + install_path = g_win32_get_package_installation_directory_of_module(NULL); + if (install_path != NULL) + { + theme_dir = g_build_filename(install_path, "share", "gkrellm2", "themes", NULL); + g_free(install_path); + } +#else + // deprecated since glib 2.16.0 + path = g_win32_get_package_installation_subdirectory(NULL, NULL, "share/gkrellm2/themes"); +#endif + if (theme_dir) + { + add_themes_to_list(theme_dir, FALSE); + g_free(theme_dir); + theme_dir = NULL; + } +#endif + #if defined(LOCAL_THEMES_DIR) add_themes_to_list(LOCAL_THEMES_DIR, FALSE); #endif diff --git a/src/plugins.c b/src/plugins.c index ef5e361..8f1c8cf 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -1264,6 +1264,28 @@ gkrellm_plugins_load(void) scan_for_plugins(path); g_free(path); +#if defined(WIN32) + path = NULL; +#if GLIB_CHECK_VERSION(2,16,0) + gchar *install_path; + install_path = g_win32_get_package_installation_directory_of_module(NULL); + if (install_path != NULL) + { + path = g_build_filename(install_path, "lib", "gkrellm2", "plugins", NULL); + g_free(install_path); + } +#else + // deprecated since glib 2.16.0 + path = g_win32_get_package_installation_subdirectory(NULL, NULL, "lib/gkrellm2/plugins"); +#endif + if (path) + { + scan_for_plugins(path); + g_free(path); + } +#endif + + #if defined(LOCAL_PLUGINS_DIR) scan_for_plugins(LOCAL_PLUGINS_DIR); #endif