aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-01-15 23:11:56 -0600
committerTed Gould <ted@canonical.com>2009-01-15 23:11:56 -0600
commitfe3addbe95bcd54af249b315ee8d10be71005be8 (patch)
treeca2b3e43e0e82a898ad3396f2c9d86f9f34c59f9
parent0d1e01e34d94b47b8785cac9138f529c1fcc55b9 (diff)
downloadlibayatana-indicator-fe3addbe95bcd54af249b315ee8d10be71005be8.tar.gz
libayatana-indicator-fe3addbe95bcd54af249b315ee8d10be71005be8.tar.bz2
libayatana-indicator-fe3addbe95bcd54af249b315ee8d10be71005be8.zip
Changing the test to do the printing by itself instead of using the debug messages in the class itself
-rw-r--r--libindicate/listener.c10
-rw-r--r--libindicate/tests/listen-and-print.c35
2 files changed, 40 insertions, 5 deletions
diff --git a/libindicate/listener.c b/libindicate/listener.c
index 75c7649..2c1f3b3 100644
--- a/libindicate/listener.c
+++ b/libindicate/listener.c
@@ -53,7 +53,7 @@ static void proxy_indicators_free (gpointer data);
static void
indicate_listener_class_init (IndicateListenerClass * class)
{
- g_debug("Listener Class Initialized");
+ /* g_debug("Listener Class Initialized"); */
GObjectClass * gobj;
gobj = G_OBJECT_CLASS(class);
@@ -107,7 +107,7 @@ indicate_listener_class_init (IndicateListenerClass * class)
static void
indicate_listener_init (IndicateListener * listener)
{
- g_debug("Listener Object Initialized");
+ /* g_debug("Listener Object Initialized"); */
GError *error = NULL;
/* Get the buses */
@@ -208,7 +208,7 @@ dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, c
bus_name = "session";
}
- g_debug("Name change on %s bus: '%s' from '%s' to '%s'", bus_name, name, prev, new);
+ /* g_debug("Name change on %s bus: '%s' from '%s' to '%s'", bus_name, name, prev, new); */
if (prev != NULL && prev[0] == '\0') {
todo_list_add(name, proxy, listener);
@@ -261,7 +261,7 @@ todo_list_add (const gchar * name, DBusGProxy * proxy, IndicateListener * listen
bus = listener->session_bus;
bus_name = "session";
}
- g_debug ("Adding on %s bus: %s", bus_name, name);
+ /* g_debug ("Adding on %s bus: %s", bus_name, name); */
proxy_todo_t todo;
todo.name = g_strdup(name);
@@ -370,7 +370,7 @@ proxy_get_indicator_type (DBusGProxy * proxy, gchar * type, GError * error, gpoi
static void
proxy_indicator_added (DBusGProxy * proxy, guint id, const gchar * type, proxy_t * proxyt)
{
- g_debug("Interface %s has an indicator %d of type %s", proxyt->name, id, type);
+ /* g_debug("Interface %s has an indicator %d of type %s", proxyt->name, id, type); */
if (proxyt->indicators == NULL) {
proxyt->indicators = g_hash_table_new_full(g_str_hash, g_str_equal,
diff --git a/libindicate/tests/listen-and-print.c b/libindicate/tests/listen-and-print.c
index 772e4f1..381fdf2 100644
--- a/libindicate/tests/listen-and-print.c
+++ b/libindicate/tests/listen-and-print.c
@@ -2,6 +2,35 @@
#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)
@@ -10,6 +39,12 @@ main (int argc, char ** argv)
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;