aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-01-21 15:13:43 -0600
committerTed Gould <ted@canonical.com>2009-01-21 15:13:43 -0600
commitea69948a6faec897f74cc2323f291e1e0139db9a (patch)
treed2bce3c32fa4613123681b98fa822fc4c97acb86
parent640fb32d5505ec6aa635a3eca93940b9183fd180 (diff)
parent2ed280196fe5d7415ae0759fcea004c775ea9da1 (diff)
downloadlibayatana-indicator-ea69948a6faec897f74cc2323f291e1e0139db9a.tar.gz
libayatana-indicator-ea69948a6faec897f74cc2323f291e1e0139db9a.tar.bz2
libayatana-indicator-ea69948a6faec897f74cc2323f291e1e0139db9a.zip
Adding in listener_get_property
-rw-r--r--debian/changelog6
-rw-r--r--libindicate/listener.c53
-rw-r--r--libindicate/listener.h10
3 files changed, 68 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index a1ff9f4..eee23a3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+indicator-applet (0.1~ppa14) intrepid; urgency=low
+
+ * Adding in listener_get_property
+
+ -- Ted Gould <ted@ubuntu.com> Wed, 21 Jan 2009 15:13:19 -0600
+
indicator-applet (0.1~ppa13) intrepid; urgency=low
* Wrong indicate include directory in package config files
diff --git a/libindicate/listener.c b/libindicate/listener.c
index bf613d6..7510c49 100644
--- a/libindicate/listener.c
+++ b/libindicate/listener.c
@@ -508,3 +508,56 @@ proxy_indicators_free (gpointer data)
g_hash_table_unref(table);
return;
}
+
+typedef struct _get_property_t get_property_t;
+struct _get_property_t {
+ indicate_listener_get_property_cb cb;
+ gpointer data;
+ IndicateListener * listener;
+ IndicateListenerServer * server;
+ IndicateListenerIndicator * indicator;
+ gchar * property;
+};
+
+static void
+get_property_cb (DBusGProxy *proxy, char * OUT_value, GError *error, gpointer userdata)
+{
+ get_property_t * get_property_data = (get_property_t *)userdata;
+
+ if (error != NULL) {
+ g_warning("Unable to get property data: %s", error->message);
+ g_error_free(error);
+ return;
+ }
+
+ get_property_data->cb(get_property_data->listener, get_property_data->server, get_property_data->indicator, get_property_data->property, OUT_value, get_property_data->data);
+
+ g_free(get_property_data->property);
+ g_free(get_property_data);
+
+ return;
+};
+
+void
+indicate_listener_get_property (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, indicate_listener_get_property_cb callback, gpointer data)
+{
+ /* TODO: Do we need to somehow refcount the server/indicator while we're waiting on this? */
+
+ proxy_t * proxyt = g_hash_table_lookup(listener->proxies_working, server);
+ if (proxyt == NULL) {
+ g_error("Trying to get property '%s' on server '%s' that currently isn't set to working.", property, (gchar *)server);
+ return;
+ }
+
+ get_property_t * get_property_data = g_new(get_property_t, 1);
+ get_property_data->cb = callback;
+ get_property_data->data = data;
+ get_property_data->listener = listener;
+ get_property_data->server = server;
+ get_property_data->indicator = indicator;
+ get_property_data->property = g_strdup(property);
+
+ org_freedesktop_indicator_get_indicator_property_async (proxyt->proxy , (guint)indicator, property, get_property_cb, get_property_data);
+ return;
+}
+
diff --git a/libindicate/listener.h b/libindicate/listener.h
index c40bc07..511cdd3 100644
--- a/libindicate/listener.h
+++ b/libindicate/listener.h
@@ -55,8 +55,16 @@ struct _IndicateListenerClass {
GType indicate_listener_get_type (void) G_GNUC_CONST;
+typedef void (*indicate_listener_get_property_cb) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, gchar * propertydata, gpointer data);
+
/* Create a new listener */
-IndicateListener * indicate_listener_new (void);
+IndicateListener * indicate_listener_new (void);
+void indicate_listener_get_property (IndicateListener * listener,
+ IndicateListenerServer * server,
+ IndicateListenerIndicator * indicator,
+ gchar * property,
+ indicate_listener_get_property_cb callback,
+ gpointer data);