diff options
author | Richard Hughes <richard@hughsie.com> | 2010-08-10 15:51:35 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2010-08-10 15:51:35 +0100 |
commit | 0660e5d20788ba0876400236965df87d8a789be3 (patch) | |
tree | f195359ca3a86ba011e82ebac812aec2e310e354 | |
parent | 23a1694d69d700d339881b6680f022a60f4c1c8a (diff) |
Fix compile with the latest PolicyKit release
-rw-r--r-- | configure.ac | 17 | ||||
-rw-r--r-- | src/up-polkit.c | 10 |
2 files changed, 24 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 51933be..a9461f7 100644 --- a/configure.ac +++ b/configure.ac @@ -150,9 +150,20 @@ PKG_CHECK_MODULES(DBUS_GLIB, [dbus-glib-1 >= 0.76]) AC_SUBST(DBUS_GLIB_CFLAGS) AC_SUBST(DBUS_GLIB_LIBS) -PKG_CHECK_MODULES(POLKIT, [polkit-gobject-1 >= 0.91]) -AC_SUBST(POLKIT_CFLAGS) -AC_SUBST(POLKIT_LIBS) +# polkit >= 0.97 uses polkit_authority_get_sync() rather than +# polkit_authority_get +PKG_CHECK_MODULES(POLKIT, \ + polkit-gobject-1 >= 0.97, + has_new_polkit=yes, + has_new_polkit=no) +if test x$has_new_polkit = xno; then + PKG_CHECK_MODULES(POLKIT, \ + polkit-backend-1 \ + polkit-gobject-1 >= 0.91) +else + AC_DEFINE(USE_SECURITY_POLKIT_NEW, 1, [if we should use PolicyKit's new API]) +fi + PKG_CHECK_MODULES(GIO, [gio-2.0 >= 2.16.1]) AC_SUBST(GIO_CFLAGS) diff --git a/src/up-polkit.c b/src/up-polkit.c index 3611afb..d7760dd 100644 --- a/src/up-polkit.c +++ b/src/up-polkit.c @@ -240,7 +240,17 @@ up_polkit_init (UpPolkit *polkit) } goto out; } + +#ifdef USE_SECURITY_POLKIT_NEW + polkit->priv->authority = polkit_authority_get_sync (NULL, &error); + if (polkit->priv->authority == NULL) { + g_error ("failed to get pokit authority: %s", error->message); + g_error_free (error); + goto out; + } +#else polkit->priv->authority = polkit_authority_get (); +#endif out: return; } |