[nautilus-actions] Do not compile with GConf library when disabled



commit 48cfe7744eaefa4458f38ee25d57342f63d1f5bd
Author: Pierre Wieser <pwieser trychlos org>
Date:   Wed Feb 16 01:05:13 2011 +0100

    Do not compile with GConf library when disabled

 ChangeLog                     |   13 ++++++++++++
 src/api/na-gconf-monitor.h    |    2 +
 src/api/na-gconf-utils.h      |    2 +
 src/core/na-gconf-migration.c |    4 +++
 src/core/na-gconf-monitor.c   |    2 +
 src/core/na-gconf-utils.c     |    4 +++
 src/io-gconf/Makefile.am      |    4 +++
 src/io-xml/naxml-reader.c     |   24 +++++++++++++++++++++-
 src/utils/Makefile.am         |   44 +++++++++++++++++++++++++---------------
 9 files changed, 81 insertions(+), 18 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 201a9f3..8b03fae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2011-02-15 Pierre Wieser <pwieser trychlos org>
+
+	Do not compile with GConf library when disabled
+
+	* src/api/na-gconf-monitor.h:
+	* src/api/na-gconf-utils.h:
+	* src/core/na-gconf-migration.c:
+	* src/core/na-gconf-monitor.c:
+	* src/core/na-gconf-utils.c:
+	* src/io-gconf/Makefile.am:
+	* src/io-xml/naxml-reader.c:
+	* src/utils/Makefile.am: Updated accordingly.
+
 2011-02-14 Pierre Wieser <pwieser trychlos org>
 
 	Add --enable-gconf configure argument
diff --git a/src/api/na-gconf-monitor.h b/src/api/na-gconf-monitor.h
index 3f6b2c0..56abdd4 100644
--- a/src/api/na-gconf-monitor.h
+++ b/src/api/na-gconf-monitor.h
@@ -31,6 +31,7 @@
 #ifndef __NAUTILUS_ACTIONS_API_NA_GCONF_MONITOR_H__
 #define __NAUTILUS_ACTIONS_API_NA_GCONF_MONITOR_H__
 
+#ifdef HAVE_GCONF
 #ifndef NA_DISABLE_DEPRECATED
 /**
  * SECTION: gconf-monitor
@@ -84,4 +85,5 @@ void            na_gconf_monitor_release_monitors( GList *monitors );
 G_END_DECLS
 
 #endif /* NA_DISABLE_DEPRECATED */
+#endif /* HAVE_GCONF */
 #endif /* __NAUTILUS_ACTIONS_API_NA_GCONF_MONITOR_H__ */
diff --git a/src/api/na-gconf-utils.h b/src/api/na-gconf-utils.h
index c54297f..7640908 100644
--- a/src/api/na-gconf-utils.h
+++ b/src/api/na-gconf-utils.h
@@ -31,6 +31,7 @@
 #ifndef __NAUTILUS_ACTIONS_API_NA_GCONF_UTILS_H__
 #define __NAUTILUS_ACTIONS_API_NA_GCONF_UTILS_H__
 
+#ifdef HAVE_GCONF
 /**
  * SECTION: gconf-utils
  * @title: GConf Misc
@@ -76,4 +77,5 @@ gchar   *na_gconf_utils_slist_to_string  ( GSList *slist );
 
 G_END_DECLS
 
+#endif /* HAVE_GCONF */
 #endif /* __NAUTILUS_ACTIONS_API_NA_GCONF_UTILS_H__ */
diff --git a/src/core/na-gconf-migration.c b/src/core/na-gconf-migration.c
index 1a42938..5f932f4 100644
--- a/src/core/na-gconf-migration.c
+++ b/src/core/na-gconf-migration.c
@@ -49,6 +49,7 @@ void
 na_gconf_migration_run( void )
 {
 	static const gchar *thisfn = "na_gconf_migration_run";
+#ifdef HAVE_GCONF
 	gchar *out, *err;
 	GError *error;
 
@@ -66,4 +67,7 @@ na_gconf_migration_run( void )
 		g_free( out );
 		g_free( err );
 	}
+#else
+	g_debug( "%s: GConf support is disabled, no migration" );
+#endif /* HAVE_GCONF */
 }
diff --git a/src/core/na-gconf-monitor.c b/src/core/na-gconf-monitor.c
index 38c1eb9..76e9efa 100644
--- a/src/core/na-gconf-monitor.c
+++ b/src/core/na-gconf-monitor.c
@@ -34,6 +34,7 @@
 
 #include <api/na-gconf-monitor.h>
 
+#ifdef HAVE_GCONF
 #ifndef NA_DISABLE_DEPRECATED
 
 /* private class data
@@ -310,3 +311,4 @@ release_monitor( NAGConfMonitor *monitor )
 }
 
 #endif /* NA_DISABLE_DEPRECATED */
+#endif /* HAVE_GCONF */
diff --git a/src/core/na-gconf-utils.c b/src/core/na-gconf-utils.c
index 23ff024..b80b2b9 100644
--- a/src/core/na-gconf-utils.c
+++ b/src/core/na-gconf-utils.c
@@ -32,6 +32,8 @@
 #include <config.h>
 #endif
 
+#ifdef HAVE_GCONF
+
 #include <string.h>
 
 #include <api/na-core-utils.h>
@@ -830,3 +832,5 @@ sync_gconf( GConfClient *gconf, gchar **message )
 	return( ret );
 }
 #endif /* NA_DISABLE_DEPRECATED */
+
+#endif /* HAVE_GCONF */
diff --git a/src/io-gconf/Makefile.am b/src/io-gconf/Makefile.am
index 5c9caf5..73e5de0 100644
--- a/src/io-gconf/Makefile.am
+++ b/src/io-gconf/Makefile.am
@@ -26,6 +26,8 @@
 #   Pierre Wieser <pwieser trychlos org>
 #   ... and many others (see AUTHORS)
 
+if HAVE_GCONF
+
 pkglib_LTLIBRARIES = libna-io-gconf.la
 
 AM_CPPFLAGS += \
@@ -56,3 +58,5 @@ libna_io_gconf_la_LDFLAGS = \
 	-no-undefined										\
 	-avoid-version										\
 	$(NULL)
+
+endif
diff --git a/src/io-xml/naxml-reader.c b/src/io-xml/naxml-reader.c
index 59e890f..13d21c4 100644
--- a/src/io-xml/naxml-reader.c
+++ b/src/io-xml/naxml-reader.c
@@ -169,6 +169,7 @@ static guint         reader_parse_xmldoc( NAXMLReader *reader );
 static guint         iter_on_root_children( NAXMLReader *reader, xmlNode *root );
 static guint         iter_on_list_children( NAXMLReader *reader, xmlNode *first );
 
+static gchar        *slist_to_string( GSList *slist );
 static gchar        *build_key_node_list( NAXMLKeyStr *strlist );
 static gchar        *build_root_node_list( void );
 static gchar        *get_value_from_child_node( xmlNode *node, const gchar *child );
@@ -1227,7 +1228,7 @@ dump_read_value( NAXMLReader *reader, xmlNode *node, const NADataDef *def )
 					}
 				}
 			}
-			string = na_gconf_utils_slist_to_string( slist );
+			string = slist_to_string( slist );
 			na_core_utils_slist_free( slist );
 			break;
 
@@ -1240,6 +1241,27 @@ dump_read_value( NAXMLReader *reader, xmlNode *node, const NADataDef *def )
 }
 
 static gchar *
+slist_to_string( GSList *slist )
+{
+	GSList *is;
+	GString *str = g_string_new( "[" );
+	gboolean first;
+
+	first = TRUE;
+	for( is = slist ; is ; is = is->next ){
+		if( !first ){
+			str = g_string_append( str, "," );
+		}
+		str = g_string_append( str, ( const gchar * ) is->data );
+		first = FALSE;
+	}
+
+	str = g_string_append( str, "]" );
+
+	return( g_string_free( str, FALSE ));
+}
+
+static gchar *
 build_key_node_list( NAXMLKeyStr *strlist )
 {
 	NAXMLKeyStr *next;
diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am
index 9d7c121..2d2e25a 100644
--- a/src/utils/Makefile.am
+++ b/src/utils/Makefile.am
@@ -33,14 +33,9 @@ bin_PROGRAMS = \
 	$(NULL)
 
 pkglibexec_PROGRAMS = \
-	na-delete-xmltree											\
 	na-print-schemas											\
 	$(NULL)
 
-pkglibexec_SCRIPTS = \
-	na-gconf2key.sh												\
-	$(NULL)
-
 AM_CPPFLAGS += \
 	-I $(top_srcdir)											\
 	-I $(top_srcdir)/src										\
@@ -89,28 +84,47 @@ nautilus_actions_run_LDADD = \
 	$(NAUTILUS_ACTIONS_LIBS)									\
 	$(NULL)
 
-na_delete_xmltree_SOURCES = \
-	na-delete-xmltree.c											\
+na_print_schemas_SOURCES = \
+	na-print-schemas.c											\
 	console-utils.c												\
 	console-utils.h												\
 	$(NULL)
 
-na_delete_xmltree_LDADD = \
+na_print_schemas_LDADD = \
 	$(top_builddir)/src/core/libna-core.la						\
 	$(NAUTILUS_ACTIONS_LIBS)									\
 	$(NULL)
 
-na_print_schemas_SOURCES = \
-	na-print-schemas.c											\
+EXTRA_DIST = \
+	na-gconf2key.sh.in											\
+	$(NULL)
+
+CLEANFILES = \
+	$(BUILT_SOURCES)											\
+	$(NULL)
+
+# If GConf support is enabled, then also build the migration tools
+
+if HAVE_GCONF
+pkglibexec_PROGRAMS += \
+	na-delete-xmltree											\
+	$(NULL)
+
+na_delete_xmltree_SOURCES = \
+	na-delete-xmltree.c											\
 	console-utils.c												\
 	console-utils.h												\
 	$(NULL)
 
-na_print_schemas_LDADD = \
+na_delete_xmltree_LDADD = \
 	$(top_builddir)/src/core/libna-core.la						\
 	$(NAUTILUS_ACTIONS_LIBS)									\
 	$(NULL)
 
+pkglibexec_SCRIPTS = \
+	na-gconf2key.sh												\
+	$(NULL)
+
 do_subst = sed \
 		-e 's,[ ]PACKAGE[@],$(PACKAGE),g'						\
 		-e 's,[ ]PACKAGE_NAME[@],$(PACKAGE_NAME),g'				\
@@ -125,11 +139,7 @@ do_subst = sed \
 	$(do_subst) < $< > $@
 	chmod a+x $@
 
-EXTRA_DIST = \
-	na-gconf2key.sh.in											\
-	$(NULL)
-
-CLEANFILES = \
-	$(BUILT_SOURCES)											\
+CLEANFILES += \
 	$(pkglibexec_SCRIPTS)										\
 	$(NULL)
+endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]