#
# Conditional build:
-%bcond_with systemd # rely on systemd for session tracking instead of ConsoleKit
+%bcond_without systemd # use systemd for session tracking instead of ConsoleKit (fallback to ConsoleKit on runtime)
#
Summary: GNOME Control Center
Summary(es.UTF-8): El centro de controle del GNOME
Summary(uk.UTF-8): Центр керування GNOME
Name: gnome-control-center
Version: 3.4.0
-Release: 1
+Release: 2
Epoch: 1
License: GPL v2+
Group: X11/Applications
# PLD-specific patches
Patch0: system-locale-archive-path.patch
Patch1: configure-gettext.patch
+%{?with_systemd:Patch2: systemd-fallback.patch}
URL: http://www.gnome.org/
# use libnm-gtk - will use correct NM version
BuildRequires: NetworkManager-gtk-lib-devel >= 0.9.1.90-2
BuildRequires: gstreamer-devel
BuildRequires: gtk+3-devel >= 3.3.5
BuildRequires: gtk-doc >= 1.9
-BuildRequires: lcms2-devel
BuildRequires: intltool >= 0.40.1
BuildRequires: iso-codes
+BuildRequires: lcms2-devel
BuildRequires: libcanberra-gtk3-devel >= 0.26
BuildRequires: libgnomekbd-devel >= 3.0.0
BuildRequires: libgtop-devel
%setup -q
%patch0 -p1
%patch1 -p1
+%{?with_systemd:%patch2 -p1}
%build
%{__gnome_doc_prepare}
--- /dev/null
+commit 9873a7536844f5c38c2a123be58175c2774e5dcc
+Author: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
+Date: Mon Mar 12 01:12:11 2012 +0100
+
+ Fallback to CK if systemd is not available
+
+ Be nice to distributions where systemd is optional. This will select
+ the code path at runtime depending on whether the system was booted
+ using systemd.
+
+diff --git a/configure.ac b/configure.ac
+index aee97ac..867f061 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -56,7 +56,7 @@ AC_ARG_ENABLE([systemd],
+ [with_systemd=$enableval],
+ [with_systemd=no])
+ if test "$with_systemd" = "yes" ; then
+- SYSTEMD=libsystemd-login
++ SYSTEMD="libsystemd-login libsystemd-daemon"
+ AC_DEFINE(HAVE_SYSTEMD, 1, [Define to 1 if systemd is available])
+ else
+ SYSTEMD=
+diff --git a/panels/user-accounts/um-user.c b/panels/user-accounts/um-user.c
+index f027754..5ebbe29 100644
+--- a/panels/user-accounts/um-user.c
++++ b/panels/user-accounts/um-user.c
+@@ -37,6 +37,11 @@
+
+ #include <gio/gunixoutputstream.h>
+
++#ifdef HAVE_SYSTEMD
++# include <systemd/sd-login.h>
++# include <systemd/sd-daemon.h>
++#endif
++
+ #include "um-user.h"
+ #include "um-account-type.h"
+ #include "um-utils.h"
+@@ -1003,25 +1008,18 @@ um_user_set_password (UmUser *user,
+ }
+ }
+
+-#ifdef HAVE_SYSTEMD
+-
+-#include <systemd/sd-login.h>
+-
+ gboolean
+ um_user_is_logged_in (UmUser *user)
+ {
+- int n_sessions;
+-
+- n_sessions = sd_uid_get_sessions (um_user_get_uid (user), 0, NULL) > 0;
+-
+- return n_sessions > 0;
+-}
++#ifdef HAVE_SYSTEMD
++ if (sd_booted () > 0) {
++ int n_sessions;
+
+-#else
++ n_sessions = sd_uid_get_sessions (um_user_get_uid (user), 0, NULL);
+
+-gboolean
+-um_user_is_logged_in (UmUser *user)
+-{
++ return n_sessions > 0;
++ }
++#endif
+ GVariant *result;
+ GVariantIter *iter;
+ gint n_sessions;
+@@ -1052,8 +1050,6 @@ um_user_is_logged_in (UmUser *user)
+ return n_sessions > 0;
+ }
+
+-#endif
+-
+ void
+ um_user_set_automatic_login (UmUser *user,
+ gboolean enabled)