Skip to content

Commit

Permalink
check for polkit_authority_get_sync
Browse files Browse the repository at this point in the history
polkit_authority_get_sync does not exist in policykit 0.96 which is still
widely used. Use the depricated function polkit_authority_get on older
versions.
  • Loading branch information
poelzi committed Apr 12, 2011
1 parent 0cee86c commit 30d819c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Expand Up @@ -34,6 +34,10 @@ endif(ENABLE_DBUS)

pkg_check_modules(GIO gio-2.0 REQUIRED)

if(POLKIT_FOUND)
INCLUDE (CheckLibraryExists)
CHECK_LIBRARY_EXISTS(polkit-gobject-1 polkit_authority_get_sync "" POLKIT_HAVE_GET_SYNC)
endif(POLKIT_FOUND)

# FIXME: libproc should export more symbols
# find libproc
Expand Down
1 change: 1 addition & 0 deletions src/config.h.tmpl
Expand Up @@ -29,6 +29,7 @@
#cmakedefine ENABLE_DBUS
#cmakedefine DEVELOP_DBUS_SESSION
#cmakedefine POLKIT_FOUND
#cmakedefine POLKIT_HAVE_GET_SYNC
#cmakedefine DEVELOP_MODE
#ifdef DEVELOP_MODE
#define RELEASE_AGENT ${CMAKE_CURRENT_BINARY_DIR}/src/ulatencyd_cleanup.lua
Expand Down
4 changes: 4 additions & 0 deletions src/core.c
Expand Up @@ -1809,7 +1809,11 @@ int core_init() {
#endif

#ifdef POLKIT_FOUND
#ifdef POLKIT_HAVE_GET_SYNC
U_polkit_authority = polkit_authority_get_sync (NULL, NULL);
#else
U_polkit_authority = polkit_authority_get();
#endif
#endif
// delay stack
delay_stack = g_ptr_array_new_with_free_func(free);
Expand Down

0 comments on commit 30d819c

Please sign in to comment.