aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-07-09 20:49:26 -0500
committerTed Gould <ted@gould.cx>2010-07-09 20:49:26 -0500
commit5b41b1e87608bab6bacb62ea95dd1c0964ba8706 (patch)
tree2d17b99ee5360205a5fb7323cc7fc9bc3f01accb
parent018bf0e6f77b80643712712cf814b1fadbff288d (diff)
downloadayatana-indicator-application-5b41b1e87608bab6bacb62ea95dd1c0964ba8706.tar.gz
ayatana-indicator-application-5b41b1e87608bab6bacb62ea95dd1c0964ba8706.tar.bz2
ayatana-indicator-application-5b41b1e87608bab6bacb62ea95dd1c0964ba8706.zip
Some more error handling and better debug messages.
-rw-r--r--tests/test-approver.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/tests/test-approver.c b/tests/test-approver.c
index 127dc67..df06df2 100644
--- a/tests/test-approver.c
+++ b/tests/test-approver.c
@@ -37,6 +37,7 @@ static void _notification_approver_server_approve_item (void);
GMainLoop * main_loop = NULL;
DBusGConnection * session_bus = NULL;
DBusGProxy * bus_proxy = NULL;
+gboolean passed = FALSE;
G_DEFINE_TYPE (TestApprover, test_approver, G_TYPE_OBJECT);
@@ -72,6 +73,7 @@ check_for_service (gpointer user_data)
g_debug("Checking for Watcher");
if (owner_count > 100) {
+ g_warning("Couldn't find watcher after 100 tries.");
g_main_loop_quit(main_loop);
return FALSE;
}
@@ -79,7 +81,7 @@ check_for_service (gpointer user_data)
owner_count++;
gboolean has_owner = FALSE;
- org_freedesktop_DBus_name_has_owner(bus_proxy, "org.test", &has_owner, NULL);
+ org_freedesktop_DBus_name_has_owner(bus_proxy, NOTIFICATION_WATCHER_DBUS_ADDR, &has_owner, NULL);
if (has_owner) {
const char * cats = NULL;
@@ -89,7 +91,15 @@ check_for_service (gpointer user_data)
NOTIFICATION_WATCHER_DBUS_IFACE);
g_debug("Registering Approver");
- org_kde_StatusNotifierWatcher_register_notification_approver (proxy, APPROVER_PATH, &cats, NULL);
+ GError * error = NULL;
+ org_kde_StatusNotifierWatcher_register_notification_approver (proxy, APPROVER_PATH, &cats, &error);
+
+ if (error != NULL) {
+ g_warning("Unable to register approver: %s", error->message);
+ g_error_free(error);
+ g_main_loop_quit(main_loop);
+ }
+
return FALSE;
}
@@ -99,10 +109,17 @@ check_for_service (gpointer user_data)
int
main (int argc, char ** argv)
{
+ GError * error = NULL;
+
g_type_init();
g_debug("Initing");
- session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
+ session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
+ if (error != NULL) {
+ g_warning("Unable to get session bus: %s", error->message);
+ g_error_free(error);
+ return -1;
+ }
TestApprover * approver = g_object_new(TEST_APPROVER_TYPE, NULL);
@@ -115,5 +132,9 @@ main (int argc, char ** argv)
g_object_unref(approver);
+ if (!passed) {
+ return -1;
+ }
+
return 0;
}