diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-04-27 11:24:32 +0100 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-04-27 11:24:32 +0100 |
commit | 342d7fa70b8f9cbf8f0ab9078060e17daf4316e2 (patch) | |
tree | dbfe3d4e603a4dbf0b35f250609837630dfc029f | |
parent | 6b8963819568c2792a2e4b68d855d7009b04520d (diff) |
passing-status: set status, then clear it, then leave
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r-- | telepathy-ytstenut-glib/tests/passing-status.c | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/telepathy-ytstenut-glib/tests/passing-status.c b/telepathy-ytstenut-glib/tests/passing-status.c index a8aa818..e9f0db6 100644 --- a/telepathy-ytstenut-glib/tests/passing-status.c +++ b/telepathy-ytstenut-glib/tests/passing-status.c @@ -39,7 +39,7 @@ getoutofhere (void) } static gboolean -timeout_cb (gpointer data) +leave_timeout_cb (gpointer data) { g_print ("Let's go!\n"); g_object_unref (data); @@ -48,6 +48,42 @@ timeout_cb (gpointer data) } static void +advertise_clear_status_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) +{ + TpYtsStatus *status = TP_YTS_STATUS (source_object); + GError *error = NULL; + + if (!tp_yts_status_advertise_status_finish (status, result, &error)) + { + g_printerr ("Failed to advertise status: %s\n", error->message); + getoutofhere (); + } + else + { + g_print ("Cleared status fine...\n"); + g_timeout_add_seconds (3, leave_timeout_cb, status); + } + + g_clear_error (&error); +} + +static gboolean +timeout_cb (gpointer data) +{ + TpYtsStatus *status = data; + + g_print ("Clearing status\n"); + + tp_yts_status_advertise_status_async (status, + "urn:ytstenut:capabilities:yts-caps-cats", + "passing.status", /* this should be the same as the client name */ + NULL, NULL, advertise_clear_status_cb, NULL); + return FALSE; +} + +static void advertise_status_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) @@ -63,7 +99,7 @@ advertise_status_cb (GObject *source_object, else { g_print ("Advertised status fine...\n"); - g_timeout_add_seconds (10, timeout_cb, status); + g_timeout_add_seconds (3, timeout_cb, status); } g_clear_error (&error); @@ -96,7 +132,7 @@ status_ensured_cb (GObject *source_object, * status. */ tp_yts_status_advertise_status_async (status, "urn:ytstenut:capabilities:yts-caps-cats", - "service.name", + "passing.status", /* this should be the same as the client name */ "<status xmlns='urn:ytstenut:status' from-service='service.name' " "capability='urn:ytstenut:capabilities:yts-caps-cats' " "activity='looking-at-cats-ooooooh'><look>at how cute they " |