From 15b1c1488f28e69cee86ff25bf0c95ebf5245add Mon Sep 17 00:00:00 2001
From: Kristian Fiskerstrand <kf@sumptuouscapital.com>
Date: Sat, 30 Jun 2018 22:35:52 +0200
Subject: [PATCH] Make account service optional

---
 configure.ac                                | 6 ++++++
 plugins/background/csd-background-manager.c | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index af5d3a4..a30126e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -166,6 +166,12 @@ else
 fi
 AM_CONDITIONAL(HAVE_GUDEV, test x$have_gudev = xyes)
 
+AC_ARG_ENABLE(accountservice, AS_HELP_STRING([--disable-accountservice],[Disable accountservice]), enable_accountservice=$enableval)
+
+if test x$enable_accountservice = "xyes"; then
+	AC_DEFINE(HAVE_ACCOUNTSERVICE, 1, [define if accountservice is available])
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl - common
 dnl ---------------------------------------------------------------------------
diff --git a/plugins/background/csd-background-manager.c b/plugins/background/csd-background-manager.c
index 282094a..a692c6e 100644
--- a/plugins/background/csd-background-manager.c
+++ b/plugins/background/csd-background-manager.c
@@ -135,9 +135,9 @@ settings_change_event_cb (GSettings            *settings,
 {
         gnome_bg_load_from_preferences (manager->priv->bg,
                                         manager->priv->settings);
-
+#ifdef HAVE_ACCOUNTSERVICE
         gnome_bg_set_accountsservice_background (gnome_bg_get_filename (manager->priv->bg));
-
+#endif
         return FALSE;
 }

diff --git a/plugins/background/csd-background-manager.c
b/plugins/background/csd-background-manager.c
index a692c6e..a99b478 100644
--- a/plugins/background/csd-background-manager.c
+++ b/plugins/background/csd-background-manager.c
@@ -186,8 +186,9 @@ setup_bg (CsdBackgroundManager *manager)
         watch_bg_preferences (manager);
         gnome_bg_load_from_preferences (manager->priv->bg,
                                         manager->priv->settings);
-
+#ifdef HAVE_ACCOUNTSERVICE
         gnome_bg_set_accountsservice_background (gnome_bg_get_filename (manager->priv->bg));
+#endif
 }
