summaryrefslogtreecommitdiff
path: root/src/examples
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2010-07-28 12:16:42 -0400
committerDavid Zeuthen <davidz@redhat.com>2010-07-28 12:16:42 -0400
commit3fee22546b76d377c6238943f2f0bcfb00c8f79c (patch)
tree827b071bf6d922421dea3d53220de0c8f0ffbeae /src/examples
parent779c0153fc0bd3c2e302dac1979d17638f054229 (diff)
downloadpolkit-3fee22546b76d377c6238943f2f0bcfb00c8f79c.tar.gz
Port core bits to gdbus
Signed-off-by: David Zeuthen <davidz@redhat.com>
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/cancel.c18
1 files changed, 15 insertions, 3 deletions
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 <polkit/polkit.h>
+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