From 2adf895800d7dcf96aba23a2b28c49c158dd2dc5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 30 Jan 2009 11:27:48 -0600 Subject: Adding an interface to call back to an indicator and display it. --- libindicate/listener.c | 22 +++++++++++++++++++++- libindicate/listener.h | 3 +++ 2 files changed, 24 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3 From 21a212b200cfec762cf7405454b69410e7ba630a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 30 Jan 2009 12:10:50 -0600 Subject: Adding a print message for when the indicator is signaled --- tests/im-client.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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 #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; -- cgit v1.2.3