From 3fee22546b76d377c6238943f2f0bcfb00c8f79c Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Wed, 28 Jul 2010 12:16:42 -0400 Subject: Port core bits to gdbus Signed-off-by: David Zeuthen --- src/examples/cancel.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/examples') diff --git a/src/examples/cancel.c b/src/examples/cancel.c index 2c6224c..fd94b0e 100644 --- a/src/examples/cancel.c +++ b/src/examples/cancel.c @@ -34,13 +34,23 @@ #include +static gboolean +on_tensec_timeout (gpointer user_data) +{ + GMainLoop *loop = user_data; + g_print ("Ten seconds has passed. Now exiting.\n"); + g_main_loop_quit (loop); + return FALSE; +} + static void check_authorization_cb (PolkitAuthority *authority, GAsyncResult *res, - GMainLoop *loop) + gpointer user_data) { - GError *error; + GMainLoop *loop = user_data; PolkitAuthorizationResult *result; + GError *error; error = NULL; result = polkit_authority_check_authorization_finish (authority, res, &error); @@ -68,7 +78,9 @@ check_authorization_cb (PolkitAuthority *authority, g_print ("Authorization result: %s\n", result_str); } - g_main_loop_quit (loop); + g_print ("Authorization check has been cancelled and the dialog should now be hidden.\n" + "This process will exit in ten seconds.\n"); + g_timeout_add (10000, on_tensec_timeout, loop); } static gboolean -- cgit v1.2.1