[Xfce4-commits] [xfce/xfce4-session] 09/10: Fix build with --disable-polkit
noreply at xfce.org
noreply at xfce.org
Thu Aug 28 17:53:10 CEST 2014
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository xfce/xfce4-session.
commit b1ee368dcf54e4335b42f657839bfe6359af8326
Author: Eric Koegel <eric.koegel at gmail.com>
Date: Sun Aug 10 19:54:50 2014 +0300
Fix build with --disable-polkit
---
xfce4-session/xfsm-systemd.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/xfce4-session/xfsm-systemd.c b/xfce4-session/xfsm-systemd.c
index a2f5b37..8f80873 100644
--- a/xfce4-session/xfsm-systemd.c
+++ b/xfce4-session/xfsm-systemd.c
@@ -20,9 +20,11 @@
#include <config.h>
#include <gio/gio.h>
-#include <polkit/polkit.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
+#ifdef HAVE_POLKIT
+#include <polkit/polkit.h>
+#endif
#include <libxfsm/xfsm-util.h>
#include <xfce4-session/xfsm-systemd.h>
@@ -55,9 +57,10 @@ struct _XfsmSystemdClass
struct _XfsmSystemd
{
GObject __parent__;
-
+#ifdef HAVE_POLKIT
PolkitAuthority *authority;
PolkitSubject *subject;
+#endif
};
@@ -80,8 +83,10 @@ xfsm_systemd_class_init (XfsmSystemdClass *klass)
static void
xfsm_systemd_init (XfsmSystemd *systemd)
{
+#ifdef HAVE_POLKIT
systemd->authority = polkit_authority_get_sync (NULL, NULL);
systemd->subject = polkit_unix_process_new_for_owner (getpid(), 0, -1);
+#endif
}
@@ -89,10 +94,12 @@ xfsm_systemd_init (XfsmSystemd *systemd)
static void
xfsm_systemd_finalize (GObject *object)
{
+#ifdef HAVE_POLKIT
XfsmSystemd *systemd = XFSM_SYSTEMD (object);
g_object_unref (G_OBJECT (systemd->authority));
g_object_unref (G_OBJECT (systemd->subject));
+#endif
(*G_OBJECT_CLASS (xfsm_systemd_parent_class)->finalize) (object);
}
@@ -120,11 +127,14 @@ xfsm_systemd_can_method (XfsmSystemd *systemd,
const gchar *method,
GError **error)
{
+#ifdef HAVE_POLKIT
PolkitAuthorizationResult *res;
GError *local_error = NULL;
+#endif
*can_method = FALSE;
+#ifdef HAVE_POLKIT
res = polkit_authority_check_authorization_sync (systemd->authority,
systemd->subject,
method,
@@ -143,6 +153,7 @@ xfsm_systemd_can_method (XfsmSystemd *systemd,
|| polkit_authorization_result_get_is_challenge (res);
g_object_unref (G_OBJECT (res));
+#endif
return TRUE;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list