commit b35bcf304849d167c6a900794f68c07b7400a66f
Author: Hib Eris <hib@hiberis.nl>
Date:   Sat Dec 13 22:31:40 2008 +0100

    Make use of gconf optional.

diff --git a/configure.ac b/configure.ac
index e50c404..2d9a026 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,7 +95,45 @@ PKG_CHECK_MODULES(LIBDOCUMENT, gtk+-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIR
 PKG_CHECK_MODULES(LIBVIEW, gtk+-2.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
 PKG_CHECK_MODULES(BACKEND, gtk+-2.0 >= $GTK_REQUIRED)
 PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-2.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
-PKG_CHECK_MODULES(SHELL_CORE, libxml-2.0 >= $LIBXML_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gtk+-unix-print-2.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED gthread-2.0 gconf-2.0)
+
+gconf_reqs="
+	gconf-2.0
+"
+shell_core_reqs="
+	libxml-2.0 >= $LIBXML_REQUIRED
+	gtk+-2.0 >= $GTK_REQUIRED
+	gtk+-unix-print-2.0 >= $GTK_REQUIRED
+	gio-2.0 >= $GLIB_REQUIRED
+	gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED
+	gthread-2.0
+"
+
+AC_ARG_WITH(gconf,
+	[AC_HELP_STRING([--without-gconf], [Do not use gconf.])],
+	[],
+	[with_gconf=check]
+)
+if test "x$with_gconf" != xno
+then
+	PKG_CHECK_MODULES(GCONF, $gconf_reqs,
+		with_gconf=yes,
+		if test "x$with_gconf" = xcheck
+		then
+			with_gconf=no
+			AC_MSG_WARN(GConf use is disabled since required library $gconf_reqs is not found)
+		else
+			AC_MSG_FAILURE(gconf test failed: $GCONF_PKG_ERRORS (--without-gconf to disable))
+		fi
+	)
+fi
+
+if test "x$with_gconf" != xno
+then
+	AC_DEFINE([WITH_GCONF], [1], [Use gconf.])
+	shell_core_reqs="$shell_core_reqs $gconf_reqs"
+fi
+
+PKG_CHECK_MODULES(SHELL_CORE, $shell_core_reqs)
 
 PKG_CHECK_MODULES(SMCLIENT, gtk+-2.0 gthread-2.0)
 AC_SUBST(SMCLIENT_CFLAGS)
@@ -536,6 +574,7 @@ AC_OUTPUT
 
 echo "
 Configure summary:
+	Gconf Support......:  $with_gconf
 	Keyring Support....:  $WITH_KEYRING
 	DBUS Support.......:  $enable_dbus
 	Nautilus Plugin....:  $HAVE_NAUTILUS
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 523a8c6..3e206fd 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -43,8 +43,9 @@
 #else
 #include <gtk/gtkprintunixdialog.h>
 #endif
+#if WITH_GCONF
 #include <gconf/gconf-client.h>
-
+#endif
 #include "egg-editable-toolbar.h"
 #include "egg-toolbar-editor.h"
 #include "egg-toolbars-model.h"
@@ -341,7 +342,9 @@ ev_window_setup_action_sensitivity (EvWindow *ev_window)
 	gboolean has_pages = FALSE;
 	gboolean can_find = FALSE;
 
+#if WITH_GCONF
 	GConfClient *client;
+#endif
 
 	if (document) {
 		has_document = TRUE;
@@ -364,10 +367,12 @@ ev_window_setup_action_sensitivity (EvWindow *ev_window)
 		can_find = TRUE;
 	}
 
+#if WITH_GCONF	
 	client = gconf_client_get_default ();
 	override_restrictions = gconf_client_get_bool (client, 
 						       GCONF_OVERRIDE_RESTRICTIONS, 
 						       NULL);
+#endif
 	if (!override_restrictions && info && info->fields_mask & EV_DOCUMENT_INFO_PERMISSIONS) {
 		ok_to_print = (info->permissions & EV_DOCUMENT_PERMISSIONS_OK_TO_PRINT);
 		ok_to_copy = (info->permissions & EV_DOCUMENT_PERMISSIONS_OK_TO_COPY);
@@ -376,7 +381,7 @@ ev_window_setup_action_sensitivity (EvWindow *ev_window)
 	if (has_document && !EV_IS_FILE_EXPORTER(document))
 		ok_to_print = FALSE;
 
-	
+#if WITH_GCONF	
 	if (gconf_client_get_bool (client, GCONF_LOCKDOWN_SAVE, NULL)) {
 		ok_to_copy = FALSE;
 	}
@@ -386,6 +391,7 @@ ev_window_setup_action_sensitivity (EvWindow *ev_window)
 	}
 
 	g_object_unref (client);
+#endif
 
 	/* File menu */
 	ev_window_set_action_sensitive (ev_window, "FileOpenCopy", has_document);
