diff options
author | Ted Gould <ted@canonical.com> | 2009-01-15 20:34:39 -0600 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-01-15 20:34:39 -0600 |
commit | 0ff11650f31a7d76e2ad8cd6c951e3e2321089f8 (patch) | |
tree | 765cf56681dafad7b3cd36315a6bc69ed7ab35ca | |
parent | fb5b3301a2b7dcb9239c1c19a6134e2999e04007 (diff) | |
download | libayatana-indicator-0ff11650f31a7d76e2ad8cd6c951e3e2321089f8.tar.gz libayatana-indicator-0ff11650f31a7d76e2ad8cd6c951e3e2321089f8.tar.bz2 libayatana-indicator-0ff11650f31a7d76e2ad8cd6c951e3e2321089f8.zip |
Get the type of the list of indicators that we got, and then set the up to register
-rw-r--r-- | libindicate/listener.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/libindicate/listener.c b/libindicate/listener.c index 1087945..9ca8512 100644 --- a/libindicate/listener.c +++ b/libindicate/listener.c @@ -43,6 +43,7 @@ static void todo_list_add (const gchar * name, DBusGProxy * proxy, IndicateListe static gboolean todo_idle (gpointer data); static void proxy_indicator_added (DBusGProxy * proxy, guint id, const gchar * type, proxy_t * proxyt); static void proxy_get_indicator_list (DBusGProxy * proxy, GArray * indicators, GError * error, gpointer data); +static void proxy_get_indicator_type (DBusGProxy * proxy, gchar * type, GError * error, gpointer data); /* Code */ static void @@ -301,6 +302,11 @@ todo_idle (gpointer data) return TRUE; } +typedef struct { + guint id; + proxy_t * proxyt; +} indicator_type_t; + static void proxy_get_indicator_list (DBusGProxy * proxy, GArray * indicators, GError * error, gpointer data) { @@ -312,15 +318,36 @@ proxy_get_indicator_list (DBusGProxy * proxy, GArray * indicators, GError * erro int i; for (i = 0; i < indicators->len; i++) { - g_debug("Interface %s has an indicator %d", proxyt->name, g_array_index(indicators, guint, i)); + indicator_type_t * itt = g_new(indicator_type_t, 1); + itt->id = g_array_index(indicators, guint, i); + itt->proxyt = proxyt; + + org_freedesktop_indicator_get_indicator_property_async(proxyt->proxy, itt->id, "type", proxy_get_indicator_type, itt); } return; } static void +proxy_get_indicator_type (DBusGProxy * proxy, gchar * type, GError * error, gpointer data) +{ + if (error != NULL) { + g_warning("Get Indicator Type returned error: %s", error->message); + return; + } + + indicator_type_t * itt = (indicator_type_t *)data; + guint id = itt->id; + proxy_t * proxyt = itt->proxyt; + + g_free(itt); + + return proxy_indicator_added(proxy, id, type, proxyt); +} + +static void proxy_indicator_added (DBusGProxy * proxy, guint id, const gchar * type, proxy_t * proxyt) { - g_debug("Interface %s has an indicator %d", proxyt->name, id); + g_debug("Interface %s has an indicator %d of type %s", proxyt->name, id, type); return; } |