mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-04-04 15:30:44 +02:00
Fix compile with the latest PolicyKit release
This commit is contained in:
parent
23a1694d69
commit
0660e5d207
2 changed files with 24 additions and 3 deletions
17
configure.ac
17
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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue