[Spice-devel] [PATCH spice-gtk] Fix building with policykit < 0.101

Marc-André Lureau mlureau at redhat.com
Fri Feb 24 05:56:14 PST 2012


ack

----- Mensaje original -----
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> ---
>  configure.ac                           |    2 ++
>  gtk/spice-client-glib-usb-acl-helper.c |   19 +++++++++++++++++++
>  2 files changed, 21 insertions(+), 0 deletions(-)
> 
> 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)
>  {
> --
> 1.7.7.6
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list