[Spice-commits] configure.ac gtk/spice-client-glib-usb-acl-helper.c

Hans de Goede jwrdegoede at kemper.freedesktop.org
Fri Feb 24 06:05:02 PST 2012


 configure.ac                           |    2 ++
 gtk/spice-client-glib-usb-acl-helper.c |   19 +++++++++++++++++++
 2 files changed, 21 insertions(+)

New commits:
commit 5f08a2de35a6f5e6e032b767e02e392661bc383b
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Fri Feb 24 13:12:36 2012 +0100

    Fix building with policykit < 0.101
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>

diff --git a/configure.ac b/configure.ac
index 6e8c8e3..1d24773 100644
--- a/configure.ac
+++ b/configure.ac
@@ -384,6 +384,8 @@ if test "x$have_usbredir" = "xyes" && test "x$enable_polkit" != "xno"; then
   # Check for polkit_authority_get_sync()
   AC_CHECK_LIB([polkit-gobject-1], [polkit_authority_get_sync], ac_have_pk_auth_get_sync="1", ac_have_pk_auth_get_sync="0")
   AC_DEFINE_UNQUOTED(HAVE_POLKIT_AUTHORITY_GET_SYNC, $ac_have_pk_auth_get_sync, [Define if you have a polkit with polkit_authority_get_sync()])
+  AC_CHECK_LIB([polkit-gobject-1], [polkit_authorization_result_get_dismissed], ac_have_pk_authorization_result_get_dismissed="1", ac_have_pk_authorization_result_get_dismissed="0")
+  AC_DEFINE_UNQUOTED(HAVE_POLKIT_AUTHORIZATION_RESULT_GET_DISMISSED, $ac_have_pk_authorization_result_get_dismissed, [Define if you have a polkit with polkit_authorization_result_get_dismissed()])
 else
   AM_CONDITIONAL(WITH_POLKIT, false)
 fi
diff --git a/gtk/spice-client-glib-usb-acl-helper.c b/gtk/spice-client-glib-usb-acl-helper.c
index aaa1180..4317bdc 100644
--- a/gtk/spice-client-glib-usb-acl-helper.c
+++ b/gtk/spice-client-glib-usb-acl-helper.c
@@ -161,6 +161,25 @@ static void cleanup()
     g_main_loop_quit(loop);
 }
 
+/* Not available in polkit < 0.101 */
+#if !HAVE_POLKIT_AUTHORIZATION_RESULT_GET_DISMISSED
+static gboolean
+polkit_authorization_result_get_dismissed(PolkitAuthorizationResult *result)
+{
+    gboolean ret;
+    PolkitDetails *details;
+
+    g_return_val_if_fail(POLKIT_IS_AUTHORIZATION_RESULT(result), FALSE);
+
+    ret = FALSE;
+    details = polkit_authorization_result_get_details(result);
+    if (details != NULL && polkit_details_lookup(details, "polkit.dismissed"))
+        ret = TRUE;
+
+    return ret;
+}
+#endif
+
 static void check_authorization_cb(PolkitAuthority *authority,
                                    GAsyncResult *res, gpointer data)
 {


More information about the Spice-commits mailing list