diff options
author | Ted Gould <ted@canonical.com> | 2009-01-16 00:04:05 -0600 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-01-16 00:04:05 -0600 |
commit | 2b6ce30681688304f321b1717cac0891882e773e (patch) | |
tree | 74f95250e94e33ed40bde5c636f6063fb0c11e80 /libindicate/tests | |
parent | 8a2369b420ee625f07d3d6882c07464fc5b27cb8 (diff) | |
parent | df1713a31e272324244419c0b7b6fbf9b3179069 (diff) | |
download | libayatana-indicator-2b6ce30681688304f321b1717cac0891882e773e.tar.gz libayatana-indicator-2b6ce30681688304f321b1717cac0891882e773e.tar.bz2 libayatana-indicator-2b6ce30681688304f321b1717cac0891882e773e.zip |
Building the listener object that listens to all of the folks on DBus and turns that into a usable interface for indicator display folks. A lot of code to make things simple :)
Diffstat (limited to 'libindicate/tests')
-rw-r--r-- | libindicate/tests/Makefile.am | 14 | ||||
-rw-r--r-- | libindicate/tests/listen-and-print.c | 51 |
2 files changed, 64 insertions, 1 deletions
diff --git a/libindicate/tests/Makefile.am b/libindicate/tests/Makefile.am index 814a50b..208da5b 100644 --- a/libindicate/tests/Makefile.am +++ b/libindicate/tests/Makefile.am @@ -1,7 +1,8 @@ noinst_PROGRAMS = \ indicate-and-crash \ - indicate-alot + indicate-alot \ + listen-and-print indicate_and_crash_SOURCES = \ indicate-and-crash.c @@ -24,3 +25,14 @@ indicate_alot_CFLAGS = \ indicate_alot_LDADD = \ ../libindicate.la \ $(LIBINDICATE_LIBS) + +listen_and_print_SOURCES = \ + listen-and-print.c + +listen_and_print_CFLAGS = \ + -I $(srcdir)/../.. \ + $(LIBINDICATE_CFLAGS) + +listen_and_print_LDADD = \ + ../libindicate.la \ + $(LIBINDICATE_LIBS) diff --git a/libindicate/tests/listen-and-print.c b/libindicate/tests/listen-and-print.c new file mode 100644 index 0000000..9ad2cc8 --- /dev/null +++ b/libindicate/tests/listen-and-print.c @@ -0,0 +1,51 @@ + +#include <glib.h> +#include "libindicate/listener.h" + +static void +indicator_added (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * type, gpointer data) +{ + g_debug("Indicator Added: %s %d %s", (gchar *)server, (guint)indicator, type); +} + +static void +indicator_removed (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * type, gpointer data) +{ + g_debug("Indicator Removed: %s %d %s", (gchar *)server, (guint)indicator, type); +} + +static void +indicator_modified (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * type, gchar * property, gpointer data) +{ + g_debug("Indicator Modified: %s %d %s %s", (gchar *)server, (guint)indicator, type, property); +} + +static void +server_added (IndicateListener * listener, IndicateListenerServer * server, gpointer data) +{ + g_debug("Indicator Server Added: %s", (gchar *)server); +} + +static void +server_removed (IndicateListener * listener, IndicateListenerServer * server, gpointer data) +{ + g_debug("Indicator Server Removed: %s", (gchar *)server); +} + +int +main (int argc, char ** argv) +{ + g_type_init(); + + IndicateListener * listener = indicate_listener_new(); + + g_signal_connect(listener, "indicator-added", G_CALLBACK(indicator_added), NULL); + g_signal_connect(listener, "indicator-removed", G_CALLBACK(indicator_removed), NULL); + g_signal_connect(listener, "indicator-modified", G_CALLBACK(indicator_modified), NULL); + g_signal_connect(listener, "server-added", G_CALLBACK(server_added), NULL); + g_signal_connect(listener, "server-removed", G_CALLBACK(server_removed), NULL); + + g_main_loop_run(g_main_loop_new(NULL, FALSE)); + + return 0; +} |