[Xfce4-commits] <xfce4-panel:master> Also load desktop files from xfce4/panel/plugins (bug #7013).
Nick Schermer
noreply at xfce.org
Sun Dec 19 20:30:01 CET 2010
Updating branch refs/heads/master
to d304b5357f44c33f218c5bfe4bf61d0932d9f385 (commit)
from 15ab32f5d39586ae214ceb9d20c31762ecb85dc2 (commit)
commit d304b5357f44c33f218c5bfe4bf61d0932d9f385
Author: Nick Schermer <nick at xfce.org>
Date: Sun Dec 19 20:21:42 2010 +0100
Also load desktop files from xfce4/panel/plugins (bug #7013).
The new library location is $libdir/xfce4/panel/plugins, so
for consistency we now also load desktop files from
$datadir/xfce4/panel/plugins.
The old location ($datadir/xfce4/panel-plugins) is still supported
so we don't break 4.6 plugins.
panel/panel-module-factory.c | 29 ++++++++++++++++++++++-------
1 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/panel/panel-module-factory.c b/panel/panel-module-factory.c
index ef302f9..1433dba 100644
--- a/panel/panel-module-factory.c
+++ b/panel/panel-module-factory.c
@@ -38,13 +38,14 @@
#include <panel/panel-module.h>
#include <panel/panel-module-factory.h>
-#define PANEL_PLUGINS_DATA_DIR DATADIR G_DIR_SEPARATOR_S "panel-plugins"
+#define PANEL_PLUGINS_DATA_DIR (DATADIR G_DIR_SEPARATOR_S "panel" G_DIR_SEPARATOR_S "plugins")
+#define PANEL_PLUGINS_DATA_DIR_OLD (DATADIR G_DIR_SEPARATOR_S "panel-plugins")
static void panel_module_factory_finalize (GObject *object);
static void panel_module_factory_load_modules (PanelModuleFactory *factory,
- gboolean first_time);
+ gboolean warn_if_known);
static gboolean panel_module_factory_modules_cleanup (gpointer key,
gpointer value,
gpointer user_data);
@@ -138,8 +139,9 @@ panel_module_factory_finalize (GObject *object)
static void
-panel_module_factory_load_modules (PanelModuleFactory *factory,
- gboolean first_time)
+panel_module_factory_load_modules_dir (PanelModuleFactory *factory,
+ const gchar *path,
+ gboolean warn_if_known)
{
GDir *dir;
const gchar *name, *p;
@@ -148,7 +150,7 @@ panel_module_factory_load_modules (PanelModuleFactory *factory,
gchar *internal_name;
/* try to open the directory */
- dir = g_dir_open (PANEL_PLUGINS_DATA_DIR, 0, NULL);
+ dir = g_dir_open (path, 0, NULL);
if (G_UNLIKELY (dir == NULL))
return;
@@ -165,7 +167,7 @@ panel_module_factory_load_modules (PanelModuleFactory *factory,
continue;
/* create the full .desktop filename */
- filename = g_build_filename (PANEL_PLUGINS_DATA_DIR, name, NULL);
+ filename = g_build_filename (path, name, NULL);
/* find the dot in the name, this cannot
* fail since it pasted the .desktop suffix check */
@@ -177,7 +179,7 @@ panel_module_factory_load_modules (PanelModuleFactory *factory,
/* check if the modules name is already loaded */
if (g_hash_table_lookup (factory->modules, internal_name) != NULL)
{
- if (first_time)
+ if (warn_if_known)
{
g_debug ("Another plugin already registered with "
"the internal name \"%s\".", internal_name);
@@ -214,6 +216,19 @@ panel_module_factory_load_modules (PanelModuleFactory *factory,
+static void
+panel_module_factory_load_modules (PanelModuleFactory *factory,
+ gboolean warn_if_known)
+{
+ panel_return_if_fail (PANEL_IS_MODULE_FACTORY (factory));
+
+ /* load from the new and old location */
+ panel_module_factory_load_modules_dir (factory, PANEL_PLUGINS_DATA_DIR, warn_if_known);
+ panel_module_factory_load_modules_dir (factory, PANEL_PLUGINS_DATA_DIR_OLD, warn_if_known);
+}
+
+
+
static gboolean
panel_module_factory_modules_cleanup (gpointer key,
gpointer value,
More information about the Xfce4-commits
mailing list