about summary refs log tree commit diff
path: root/src/system-settings/nm-polkit-helpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/system-settings/nm-polkit-helpers.h')
-rw-r--r--src/system-settings/nm-polkit-helpers.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/system-settings/nm-polkit-helpers.h b/src/system-settings/nm-polkit-helpers.h
index c26fcc2c..a37c2eeb 100644
--- a/src/system-settings/nm-polkit-helpers.h
+++ b/src/system-settings/nm-polkit-helpers.h
@@ -16,12 +16,13 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
  * (C) Copyright 2008 Novell, Inc.
- * (C) Copyright 2008 Red Hat, Inc.
+ * (C) Copyright 2008 - 2010 Red Hat, Inc.
  */
 
 #ifndef NM_POLKIT_HELPERS_H
 #define NM_POLKIT_HELPERS_H
 
+#include <config.h>
 #include <polkit/polkit.h>
 
 #define NM_SYSCONFIG_POLICY_ACTION_CONNECTION_MODIFY    "org.freedesktop.network-manager-settings.system.modify"
@@ -29,4 +30,18 @@
 #define NM_SYSCONFIG_POLICY_ACTION_WIFI_SHARE_OPEN      "org.freedesktop.network-manager-settings.system.wifi.share.open"
 #define NM_SYSCONFIG_POLICY_ACTION_HOSTNAME_MODIFY      "org.freedesktop.network-manager-settings.system.hostname.modify"
 
+/* Fix for polkit 0.97 and later */
+#if !HAVE_POLKIT_AUTHORITY_GET_SYNC
+static inline PolkitAuthority *
+polkit_authority_get_sync (GCancellable *cancellable, GError **error)
+{
+	PolkitAuthority *authority;
+
+	authority = polkit_authority_get ();
+	if (!authority)
+		g_set_error (error, 0, 0, "failed to get the PolicyKit authority");
+	return authority;
+}
+#endif
+
 #endif /* NM_POLKIT_HELPERS_H */