summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2010-01-19 14:37:19 +0000
committerBastien Nocera <hadess@hadess.net>2010-01-19 14:37:19 +0000
commitbfd349f0b9b710b62f9ea6bfda98a9dea5bccbc1 (patch)
tree3b95fd223cbffd11a1fc0b19b02c275482ba016f
parentaae816fe963cbb2eb0e154ffc95e81e6d6893d55 (diff)
downloadgnome-control-center-bfd349f0b9b710b62f9ea6bfda98a9dea5bccbc1.tar.gz
Load extensions from the source tree
If there's none installed system-wide
-rw-r--r--shell/control-center.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/shell/control-center.c b/shell/control-center.c
index 8fa5c2204..0263081f0 100644
--- a/shell/control-center.c
+++ b/shell/control-center.c
@@ -19,6 +19,8 @@
* Author: Thomas Wood <thos@gnome.org>
*/
+#include "config.h"
+
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
@@ -49,6 +51,39 @@ typedef struct
void item_activated_cb (GtkIconView *icon_view, GtkTreePath *path, ShellData *data);
+#ifdef RUN_IN_SOURCE_TREE
+static GList *
+load_panel_plugins_from_source (void)
+{
+ GDir *dir;
+ GList *list;
+ const char *name;
+
+ g_message ("capplets!");
+
+ dir = g_dir_open ("../capplets/", 0, NULL);
+ if (dir == NULL)
+ return NULL;
+
+ while ((name = g_dir_read_name (dir)) != NULL)
+ {
+ char *path;
+ GList *l;
+
+ path = g_strconcat ("../capplets/", name, "/.libs", NULL);
+ g_message ("loading modules in %s", path);
+ l = g_io_modules_load_all_in_directory (path);
+ g_free (path);
+
+ if (l)
+ list = g_list_concat (list, l);
+ }
+ g_dir_close (dir);
+
+ return list;
+}
+#endif
+
static GHashTable *panels = NULL;
static void
@@ -80,6 +115,11 @@ load_panel_plugins (void)
g_debug ("Loaded %d modules", g_list_length (modules));
+#ifdef RUN_IN_SOURCE_TREE
+ if (g_list_length (modules) == 0)
+ modules = load_panel_plugins_from_source ();
+#endif
+
/* find all extensions */
panel_implementations = g_io_extension_point_get_extensions (ep);
for (l = panel_implementations; l != NULL; l = l->next)
@@ -459,8 +499,10 @@ main (int argc, char **argv)
ret = gtk_builder_add_from_file (data->builder, UIDIR "/shell.ui", NULL);
if (ret == 0)
{
+#ifdef RUN_IN_SOURCE_TREE
ret = gtk_builder_add_from_file (data->builder, "shell.ui", NULL);
if (ret == 0)
+#endif
g_error ("Unable to load UI");
}