1 Search for xfce4 panel plugins in the directories specified
2 in XDG_DATA_DIRS and X_XFCE4_LIB_DIRS. For discussion of the
5 https://bugzilla.xfce.org/show_bug.cgi?id=5455
7 Patch by Mark H Weaver <mhw@netris.org>
9 --- xfce4-panel-4.10.0/panel/panel-module.c.orig 2012-04-28 16:31:35.000000000 -0400
10 +++ xfce4-panel-4.10.0/panel/panel-module.c 2014-12-14 01:31:55.728107386 -0500
12 #include <panel/panel-plugin-external-wrapper.h>
13 #include <panel/panel-plugin-external-46.h>
15 -#define PANEL_PLUGINS_LIB_DIR (LIBDIR G_DIR_SEPARATOR_S "panel" G_DIR_SEPARATOR_S "plugins")
16 -#define PANEL_PLUGINS_LIB_DIR_OLD (LIBDIR G_DIR_SEPARATOR_S "panel-plugins")
17 +#define PANEL_PLUGINS_LIB_DIR_TAIL (G_DIR_SEPARATOR_S "panel" G_DIR_SEPARATOR_S "plugins")
18 +#define PANEL_PLUGINS_LIB_DIR_TAIL_OLD (G_DIR_SEPARATOR_S "panel-plugins")
20 +static const gchar *plugins_lib_dir_tails[] =
22 + PANEL_PLUGINS_LIB_DIR_TAIL,
23 + PANEL_PLUGINS_LIB_DIR_TAIL_OLD
27 typedef enum _PanelModuleRunMode PanelModuleRunMode;
29 /* show a messsage if the old module path key still exists */
30 g_message ("Plugin %s: The \"X-XFCE-Module-Path\" key is "
31 "ignored in \"%s\", the panel will look for the "
32 - "module in %s. See bug #5455 why this decision was made",
33 - name, filename, PANEL_PLUGINS_LIB_DIR);
34 + "module in DIR%s for each DIR in $X_XFCE4_LIB_DIRS "
35 + "(%s by default). See bug #5455 for discussion.",
36 + name, filename, PANEL_PLUGINS_LIB_DIR_TAIL, LIBDIR);
40 - path = g_module_build_path (PANEL_PLUGINS_LIB_DIR, module_name);
41 - found = g_file_test (path, G_FILE_TEST_EXISTS);
42 + /* search for module */
48 + dirs_string = (gchar *) g_getenv ("X_XFCE4_LIB_DIRS");
50 + dirs_string = LIBDIR;
51 + dirs = g_strsplit (dirs_string, G_SEARCHPATH_SEPARATOR_S, 0);
56 + for (i = 0; !found && dirs[i] != NULL; i++)
57 + for (j = 0; !found && j < G_N_ELEMENTS (plugins_lib_dir_tails); j++)
59 + gchar *dir = g_strconcat (dirs[i], plugins_lib_dir_tails[j], NULL);
62 + path = g_module_build_path (dir, module_name);
63 + found = g_file_test (path, G_FILE_TEST_EXISTS);
69 - /* deprecated location for module plugin directories */
71 - path = g_module_build_path (PANEL_PLUGINS_LIB_DIR_OLD, module_name);
72 - found = g_file_test (path, G_FILE_TEST_EXISTS);
79 --- xfce4-panel-4.10.0/panel/panel-module-factory.c.orig 2012-04-28 16:31:35.000000000 -0400
80 +++ xfce4-panel-4.10.0/panel/panel-module-factory.c 2014-12-13 23:55:27.439404812 -0500
82 #define PANEL_PLUGINS_DATA_DIR (DATADIR G_DIR_SEPARATOR_S "panel" G_DIR_SEPARATOR_S "plugins")
83 #define PANEL_PLUGINS_DATA_DIR_OLD (DATADIR G_DIR_SEPARATOR_S "panel-plugins")
85 +static const gchar *plugins_data_dir_tails[] =
87 + (G_DIR_SEPARATOR_S "xfce4" G_DIR_SEPARATOR_S "panel" G_DIR_SEPARATOR_S "plugins"),
88 + (G_DIR_SEPARATOR_S "xfce4" G_DIR_SEPARATOR_S "panel-plugins")
92 static void panel_module_factory_finalize (GObject *object);
94 panel_module_factory_load_modules (PanelModuleFactory *factory,
95 gboolean warn_if_known)
97 + const gchar * const * system_data_dirs;
100 panel_return_if_fail (PANEL_IS_MODULE_FACTORY (factory));
102 + system_data_dirs = g_get_system_data_dirs ();
103 + for (i = 0; system_data_dirs[i] != NULL; i++)
104 + for (j = 0; j < G_N_ELEMENTS (plugins_data_dir_tails); j++)
108 + dir = g_strconcat (system_data_dirs[i], plugins_data_dir_tails[j], NULL);
109 + panel_module_factory_load_modules_dir (factory, dir, warn_if_known);
113 /* load from the new and old location */
114 panel_module_factory_load_modules_dir (factory, PANEL_PLUGINS_DATA_DIR, warn_if_known);
115 panel_module_factory_load_modules_dir (factory, PANEL_PLUGINS_DATA_DIR_OLD, warn_if_known);