[telepathy-gabble/master] Load plugins from $GABBLE_PLUGIN_DIR if set

Will Thompson will.thompson at collabora.co.uk
Mon Nov 16 11:43:53 PST 2009


---
 docs/telepathy-gabble.8.in |    4 ++++
 src/plugin-loader.c        |    9 +++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/docs/telepathy-gabble.8.in b/docs/telepathy-gabble.8.in
index e0e0732..4dd9cc6 100644
--- a/docs/telepathy-gabble.8.in
+++ b/docs/telepathy-gabble.8.in
@@ -35,6 +35,10 @@ May be set to "all" for full debug output from the Wocky XMPP library used
 by Gabble, or various undocumented options (which may change from release to
 release) to filter the output. For general Gabble debugging, "net" is
 recommended.
+.TP
+\fBGABBLE_PLUGIN_DIR\fR=\fIdirectory\fR
+If set, and Gabble was compiled with plugin support, plugins will be loaded
+from \fIdirectory\fR rather than from the default directory.
 .SH SEE ALSO
 .IR http://telepathy.freedesktop.org/ ,
 .IR http://telepathy.freedesktop.org/wiki/CategoryGabble ,
diff --git a/src/plugin-loader.c b/src/plugin-loader.c
index 243f9d9..1c29401 100644
--- a/src/plugin-loader.c
+++ b/src/plugin-loader.c
@@ -103,6 +103,7 @@ static void
 gabble_plugin_loader_probe (GabblePluginLoader *self)
 {
   GError *error = NULL;
+  const gchar *directory_name = g_getenv ("GABBLE_PLUGIN_DIR");
   GDir *d;
   const gchar *file;
 
@@ -112,7 +113,11 @@ gabble_plugin_loader_probe (GabblePluginLoader *self)
       return;
     }
 
-  d = g_dir_open (PLUGIN_DIR, 0, &error);
+  if (directory_name == NULL)
+    directory_name = PLUGIN_DIR;
+
+  DEBUG ("probing %s", directory_name);
+  d = g_dir_open (directory_name, 0, &error);
 
   if (d == NULL)
     {
@@ -128,7 +133,7 @@ gabble_plugin_loader_probe (GabblePluginLoader *self)
       if (!g_str_has_suffix (file, G_MODULE_SUFFIX))
         continue;
 
-      path = g_build_filename (PLUGIN_DIR, file, NULL);
+      path = g_build_filename (directory_name, file, NULL);
       plugin_loader_try_to_load (self, path);
       g_free (path);
     }
-- 
1.5.6.5




More information about the telepathy-commits mailing list