[gnome-session] make gconf support optional
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] make gconf support optional
- Date: Mon, 6 Aug 2012 20:53:04 +0000 (UTC)
commit 8baf35dcf989da7faa0dda48e0bbc5aa65ce4f07
Author: Marc-Antoine Perennou <Marc-Antoine Perennou com>
Date: Tue Jun 19 12:11:37 2012 +0200
make gconf support optional
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine Perennou com>
https://bugzilla.gnome.org/show_bug.cgi?id=678394
configure.ac | 22 +++++++++++++++++++++-
gnome-session/gsm-autostart-app.c | 14 ++++++++++++++
2 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 88db1d2..b0a3fa2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,13 +66,32 @@ PKG_CHECK_MODULES(ICE, ice)
PKG_CHECK_MODULES(XEXT, xext xau)
PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 >= $DBUS_GLIB_REQUIRED)
-PKG_CHECK_MODULES(GCONF, gconf-2.0)
PKG_CHECK_MODULES(EGG_SMCLIENT, gtk+-3.0)
PKG_CHECK_MODULES(GL_TEST, xcomposite gl)
dnl ====================================================================
+dnl Check for gconf
+dnl ====================================================================
+AC_ARG_ENABLE([gconf],
+ AS_HELP_STRING([--enable-gconf], [Support gconf-based autostart]),
+ [enable_gconf=$enableval],
+ [enable_gconf=auto])
+
+PKG_CHECK_MODULES(GCONF, gconf-2.0, [have_gconf=yes], [have_gconf=no])
+
+if test x$enable_gconf = xauto ; then
+ enable_gconf=$have_gconf
+elif test x$enable_gconf = xyes -a x$have_gconf = xno ; then
+ AC_MSG_ERROR([GConf support explicitly required, but gconf not found])
+fi
+
+if test x$enable_gconf = xyes ; then
+ AC_DEFINE([HAVE_GCONF], [1], [Define if we support gconf-based autostart])
+fi
+
+dnl ====================================================================
dnl Check for systemd
dnl ====================================================================
AC_ARG_ENABLE([systemd],
@@ -353,6 +372,7 @@ echo "
Maintainer mode: ${USE_MAINTAINER_MODE}
Use *_DISABLE_DEPRECATED: ${enable_deprecation_flags}
+ GConf support: ${enable_gconf}
Session tracking: ${session_tracking}
IPv6 support: ${have_full_ipv6}
Backtrace support: ${have_backtrace}
diff --git a/gnome-session/gsm-autostart-app.c b/gnome-session/gsm-autostart-app.c
index 8959ac6..7478dff 100644
--- a/gnome-session/gsm-autostart-app.c
+++ b/gnome-session/gsm-autostart-app.c
@@ -29,7 +29,9 @@
#include <glib.h>
#include <gio/gio.h>
+#ifdef HAVE_GCONF
#include <gconf/gconf-client.h>
+#endif
#include "gsm-autostart-app.h"
#include "gsm-util.h"
@@ -43,7 +45,9 @@ enum {
GSM_CONDITION_NONE = 0,
GSM_CONDITION_IF_EXISTS = 1,
GSM_CONDITION_UNLESS_EXISTS = 2,
+#ifdef HAVE_GCONF
GSM_CONDITION_GNOME = 3,
+#endif
GSM_CONDITION_GSETTINGS = 4,
GSM_CONDITION_IF_SESSION = 5,
GSM_CONDITION_UNLESS_SESSION = 6,
@@ -171,8 +175,10 @@ parse_condition_string (const char *condition_string,
kind = GSM_CONDITION_IF_EXISTS;
} else if (!g_ascii_strncasecmp (condition_string, "unless-exists", len) && key) {
kind = GSM_CONDITION_UNLESS_EXISTS;
+#ifdef HAVE_GCONF
} else if (!g_ascii_strncasecmp (condition_string, "GNOME", len)) {
kind = GSM_CONDITION_GNOME;
+#endif
} else if (!g_ascii_strncasecmp (condition_string, "GSettings", len)) {
kind = GSM_CONDITION_GSETTINGS;
} else if (!g_ascii_strncasecmp (condition_string, "GNOME3", len)) {
@@ -267,6 +273,7 @@ unless_exists_condition_cb (GFileMonitor *monitor,
}
}
+#ifdef HAVE_GCONF
static void
gconf_condition_cb (GConfClient *client,
guint cnxn_id,
@@ -298,6 +305,7 @@ gconf_condition_cb (GConfClient *client,
g_signal_emit (app, signals[CONDITION_CHANGED], 0, condition);
}
}
+#endif
static void
gsettings_condition_cb (GSettings *settings,
@@ -458,6 +466,7 @@ setup_condition_monitor (GsmAutostartApp *app)
g_file_monitor_cancel (app->priv->condition_monitor);
}
+#ifdef HAVE_GCONF
if (app->priv->condition_notify_id > 0) {
GConfClient *client;
client = gconf_client_get_default ();
@@ -465,6 +474,7 @@ setup_condition_monitor (GsmAutostartApp *app)
app->priv->condition_notify_id);
app->priv->condition_notify_id = 0;
}
+#endif
if (app->priv->condition_string == NULL) {
return;
@@ -520,6 +530,7 @@ setup_condition_monitor (GsmAutostartApp *app)
g_object_unref (file);
g_free (file_path);
+#ifdef HAVE_GCONF
} else if (kind == GSM_CONDITION_GNOME) {
GConfClient *client;
char *dir;
@@ -541,6 +552,7 @@ setup_condition_monitor (GsmAutostartApp *app)
gconf_condition_cb,
app, NULL, NULL);
g_object_unref (client);
+#endif
} else if (kind == GSM_CONDITION_GSETTINGS) {
disabled = !setup_gsettings_condition_monitor (app, key);
} else if (kind == GSM_CONDITION_IF_SESSION) {
@@ -856,12 +868,14 @@ is_conditionally_disabled (GsmApp *app)
file_path = g_build_filename (g_get_user_config_dir (), key, NULL);
disabled = g_file_test (file_path, G_FILE_TEST_EXISTS);
g_free (file_path);
+#ifdef HAVE_GCONF
} else if (kind == GSM_CONDITION_GNOME) {
GConfClient *client;
client = gconf_client_get_default ();
g_assert (GCONF_IS_CLIENT (client));
disabled = !gconf_client_get_bool (client, key, NULL);
g_object_unref (client);
+#endif
} else if (kind == GSM_CONDITION_GSETTINGS &&
priv->condition_settings != NULL) {
char **elems;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]