aboutsummaryrefslogtreecommitdiff
path: root/libindicate
diff options
context:
space:
mode:
Diffstat (limited to 'libindicate')
-rw-r--r--libindicate/listener.c46
-rw-r--r--libindicate/listener.h16
2 files changed, 58 insertions, 4 deletions
diff --git a/libindicate/listener.c b/libindicate/listener.c
index 4da6d59..f641b56 100644
--- a/libindicate/listener.c
+++ b/libindicate/listener.c
@@ -650,14 +650,22 @@ proxy_indicators_free (gpointer data)
return;
}
+typedef enum _get_property_type get_property_type;
+enum _get_property_type {
+ PROPERTY_TYPE_STRING,
+ PROPERTY_TYPE_TIME,
+ PROPERTY_TYPE_ICON
+};
+
typedef struct _get_property_t get_property_t;
struct _get_property_t {
- indicate_listener_get_property_cb cb;
+ GCallback cb;
gpointer data;
IndicateListener * listener;
IndicateListenerServer * server;
IndicateListenerIndicator * indicator;
gchar * property;
+ get_property_type type;
};
static void
@@ -671,7 +679,19 @@ get_property_cb (DBusGProxy *proxy, char * OUT_value, GError *error, gpointer us
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);
+ switch (get_property_data->type) {
+ case PROPERTY_TYPE_STRING: {
+ indicate_listener_get_property_cb cb = (indicate_listener_get_property_cb)get_property_data->cb;
+ cb(get_property_data->listener, get_property_data->server, get_property_data->indicator, get_property_data->property, OUT_value, get_property_data->data);
+ break;
+ }
+ case PROPERTY_TYPE_ICON: {
+ break;
+ }
+ case PROPERTY_TYPE_TIME: {
+ break;
+ }
+ }
g_free(get_property_data->property);
g_free(get_property_data);
@@ -679,8 +699,8 @@ get_property_cb (DBusGProxy *proxy, char * OUT_value, GError *error, gpointer us
return;
};
-void
-indicate_listener_get_property (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, indicate_listener_get_property_cb callback, gpointer data)
+static void
+get_property_helper (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, GCallback callback, gpointer data, get_property_type prop_type)
{
/* TODO: Do we need to somehow refcount the server/indicator while we're waiting on this? */
IndicateListenerPrivate * priv = INDICATE_LISTENER_GET_PRIVATE(listener);
@@ -703,6 +723,24 @@ indicate_listener_get_property (IndicateListener * listener, IndicateListenerSer
return;
}
+void
+indicate_listener_get_property (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, indicate_listener_get_property_cb callback, gpointer data)
+{
+ return get_property_helper(listener, server, indicator, property, G_CALLBACK(callback), data, PROPERTY_TYPE_STRING);
+}
+
+void
+indicate_listener_get_property_time (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, indicate_listener_get_property_time_cb callback, gpointer data)
+{
+ return get_property_helper(listener, server, indicator, property, G_CALLBACK(callback), data, PROPERTY_TYPE_TIME);
+}
+
+void
+indicate_listener_get_property_icon (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, indicate_listener_get_property_icon_cb callback, gpointer data)
+{
+ return get_property_helper(listener, server, indicator, property, G_CALLBACK(callback), data, PROPERTY_TYPE_ICON);
+}
+
static void
listener_display_cb (DBusGProxy *proxy, GError *error, gpointer userdata)
{
diff --git a/libindicate/listener.h b/libindicate/listener.h
index 3d8c7ef..ed40630 100644
--- a/libindicate/listener.h
+++ b/libindicate/listener.h
@@ -33,6 +33,8 @@ License version 3 and version 2.1 along with this program. If not, see
#include <glib.h>
#include <glib-object.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
#include "indicator.h"
#include "server.h"
@@ -79,6 +81,8 @@ 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);
+typedef void (*indicate_listener_get_property_time_cb) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, GTimeVal * propertydata, gpointer data);
+typedef void (*indicate_listener_get_property_icon_cb) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, GdkPixbuf * propertydata, gpointer data);
typedef void (*indicate_listener_get_server_property_cb) (IndicateListener * listener, IndicateListenerServer * server, gchar * value, gpointer data);
/* Create a new listener */
@@ -90,6 +94,18 @@ void indicate_listener_get_property (IndicateListener * l
gchar * property,
indicate_listener_get_property_cb callback,
gpointer data);
+void indicate_listener_get_property_time (IndicateListener * listener,
+ IndicateListenerServer * server,
+ IndicateListenerIndicator * indicator,
+ gchar * property,
+ indicate_listener_get_property_time_cb callback,
+ gpointer data);
+void indicate_listener_get_property_icon (IndicateListener * listener,
+ IndicateListenerServer * server,
+ IndicateListenerIndicator * indicator,
+ gchar * property,
+ indicate_listener_get_property_icon_cb callback,
+ gpointer data);
void indicate_listener_display (IndicateListener * listener,
IndicateListenerServer * server,
IndicateListenerIndicator * indicator);