aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-01-30 12:11:32 -0600
committerTed Gould <ted@canonical.com>2009-01-30 12:11:32 -0600
commit722c621bc26aea8dc83a60097f3f8e7bea3ea68b (patch)
tree19e0f93cfffef4d83702debf61d42b4f9adb8d6c
parent17bc0dab5a61d41e1a57755f7b2d1cdbe79e90da (diff)
parent21a212b200cfec762cf7405454b69410e7ba630a (diff)
downloadlibayatana-indicator-722c621bc26aea8dc83a60097f3f8e7bea3ea68b.tar.gz
libayatana-indicator-722c621bc26aea8dc83a60097f3f8e7bea3ea68b.tar.bz2
libayatana-indicator-722c621bc26aea8dc83a60097f3f8e7bea3ea68b.zip
Listener interface for signalling an indicator
-rw-r--r--libindicate/listener.c22
-rw-r--r--libindicate/listener.h3
-rw-r--r--tests/im-client.c8
3 files changed, 32 insertions, 1 deletions
diff --git a/libindicate/listener.c b/libindicate/listener.c
index 31fdf4b..c659147 100644
--- a/libindicate/listener.c
+++ b/libindicate/listener.c
@@ -598,7 +598,27 @@ indicate_listener_get_property (IndicateListener * listener, IndicateListenerSer
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);
+ org_freedesktop_indicator_get_indicator_property_async (proxyt->proxy , INDICATE_LISTENER_INDICATOR_ID(indicator), property, get_property_cb, get_property_data);
return;
}
+static void
+listener_display_cb (DBusGProxy *proxy, GError *error, gpointer userdata)
+{
+ if (error != NULL) {
+ g_warning("Listener display caused an error: %s", error->message);
+ }
+ return;
+}
+
+void
+indicate_listener_display (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator)
+{
+ IndicateListenerPrivate * priv = INDICATE_LISTENER_GET_PRIVATE(listener);
+
+ proxy_t * proxyt = g_hash_table_lookup(priv->proxies_working, server);
+
+ org_freedesktop_indicator_show_indicator_to_user_async (proxyt->proxy, INDICATE_LISTENER_INDICATOR_ID(indicator), listener_display_cb, NULL);
+
+ return;
+}
diff --git a/libindicate/listener.h b/libindicate/listener.h
index bc2332f..4cec7e4 100644
--- a/libindicate/listener.h
+++ b/libindicate/listener.h
@@ -60,6 +60,9 @@ void indicate_listener_get_property (IndicateListener * liste
gchar * property,
indicate_listener_get_property_cb callback,
gpointer data);
+void indicate_listener_display (IndicateListener * listener,
+ IndicateListenerServer * server,
+ IndicateListenerIndicator * indicator);
diff --git a/tests/im-client.c b/tests/im-client.c
index 43635f0..9e6bc77 100644
--- a/tests/im-client.c
+++ b/tests/im-client.c
@@ -2,6 +2,12 @@
#include <glib.h>
#include "libindicate/indicator-message.h"
+static void
+display (IndicateIndicator * indicator, gpointer data)
+{
+ g_debug("Ah, I've been displayed");
+}
+
int
main (int argc, char ** argv)
{
@@ -17,6 +23,8 @@ main (int argc, char ** argv)
indicate_indicator_set_property(INDICATE_INDICATOR(indicator), "time", "11:12");
+ g_signal_connect(G_OBJECT(indicator), INDICATE_INDICATOR_SIGNAL_DISPLAY, G_CALLBACK(display), NULL);
+
g_main_loop_run(g_main_loop_new(NULL, FALSE));
return 0;