aboutsummaryrefslogtreecommitdiff
path: root/tools/indicator-loader.c
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2013-01-18 19:48:04 +0100
committerLars Uebernickel <lars.uebernickel@canonical.com>2013-01-18 19:48:04 +0100
commit3a33240e301a02fa6ee0aa0bd41780a0e3a28633 (patch)
treeeaf5a30bf60208a38b4c4373de96e59cf63639d3 /tools/indicator-loader.c
parente7966480ecd14bd6cb4c4ec5f527cfe10a1a0b0f (diff)
downloadlibayatana-indicator-3a33240e301a02fa6ee0aa0bd41780a0e3a28633.tar.gz
libayatana-indicator-3a33240e301a02fa6ee0aa0bd41780a0e3a28633.tar.bz2
libayatana-indicator-3a33240e301a02fa6ee0aa0bd41780a0e3a28633.zip
Add IndicatorNg
IndicatorNg is an indicator object that reads an indicator service file and watches the bus for a corresponding service to appear. It turns the menus and actions exported by the service into an indicator entry.
Diffstat (limited to 'tools/indicator-loader.c')
-rw-r--r--tools/indicator-loader.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/tools/indicator-loader.c b/tools/indicator-loader.c
index 560fc45..51d2e46 100644
--- a/tools/indicator-loader.c
+++ b/tools/indicator-loader.c
@@ -24,6 +24,7 @@ License along with this library. If not, see
#include <gtk/gtk.h>
#include <libindicator/indicator-object.h>
+#include <libindicator/indicator-ng.h>
static GHashTable * entry_to_menuitem = NULL;
@@ -129,14 +130,25 @@ load_module (const gchar * name, GtkWidget * menu)
g_debug("Looking at Module: %s", name);
g_return_val_if_fail(name != NULL, FALSE);
- if (!g_str_has_suffix(name, G_MODULE_SUFFIX)) {
- return FALSE;
- }
-
g_debug("Loading Module: %s", name);
/* Build the object for the module */
- IndicatorObject * io = indicator_object_new_from_file(name);
+ IndicatorObject *io;
+ if (g_str_has_suffix(name, G_MODULE_SUFFIX)) {
+ io = indicator_object_new_from_file(name);
+ }
+ else if (g_str_has_suffix(name, ".indicator")) {
+ GError *error = NULL;
+
+ io = INDICATOR_OBJECT(indicator_ng_new(name, &error));
+ if (!io) {
+ g_warning ("could not load indicator from '%s': %s", name, error->message);
+ g_error_free (error);
+ return FALSE;
+ }
+ }
+ else
+ return FALSE;
/* Connect to it's signals */
g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED, G_CALLBACK(entry_added), menu);