Re: gtksourceview requires libgnome



Hi Gustavo,

Gustavo Giráldez wrote:
I see the default behavior is to not build the test programs.  I'd like
it to be the other way around, and call the option
--disable-build-tests.  If you want you can still disable the build
automatically by testing for the presence of gnome-vfs, if configure
failing with no special options is your concern.

I made the change, but didn't do any conditional checking for gnome-vfs. So, the default build will just use gnome-vfs.


Also, instead of adding a new header file, I would prefer to not use
boilerplate macros at all, and define the class initialization functions
in the source files, just as it's done for most of the other classes.

Done.


More comments inserted in the patch (some hunks snipped).

I believe I fixed all concerns in the attached patch. Let me know how it fits.

-mt
Index: Makefile.am
===================================================================
RCS file: /cvs/gnome/gtksourceview/Makefile.am,v
retrieving revision 1.3
diff -u -r1.3 Makefile.am
--- Makefile.am	4 May 2003 22:43:56 -0000	1.3
+++ Makefile.am	12 May 2003 17:34:38 -0000
@@ -1,4 +1,10 @@
-SUBDIRS = gtksourceview tests po
+if BUILD_TESTS
+MAYBE_TESTS = tests
+else
+MAYBE_TESTS = 
+endif
+
+SUBDIRS = gtksourceview po $(MAYBE_TESTS)
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = gtksourceview-1.0.pc
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gtksourceview/configure.in,v
retrieving revision 1.7
diff -u -r1.7 configure.in
--- configure.in	5 May 2003 03:17:13 -0000	1.7
+++ configure.in	12 May 2003 17:34:39 -0000
@@ -26,27 +26,43 @@
 # Dependencies
 GLIB_REQUIRED_VERSION=2.2.0
 GTK_REQUIRED_VERSION=2.2.0
-GNOME_REQUIRED=2.2.0
+GNOME_VFS_REQUIRED_VERSION=1.5.3
 LIBXML_REQUIRED_VERSION=2.5.0
 
 AC_SUBST(GLIB_REQUIRED_VERSION)
 AC_SUBST(GTK_REQUIRED_VERSION)
-AC_SUBST(GNOME_REQUIRED)
+AC_SUBST(GNOME_VFS_REQUIRED_VERSION)
 AC_SUBST(LIBXML_REQUIRED_VERSION)
 
 # Pull glib-genmarshal & co.
 AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
 
+# Environment
+GNOME_COMMON_INIT
+GNOME_COMPILE_WARNINGS(error)
+
 PKG_CHECK_MODULES(DEP,
 	gtk+-2.0 >= $GTK_REQUIRED_VERSION
-	libgnome-2.0 >= $GNOME_REQUIRED
 	libxml-2.0 >= $LIBXML_REQUIRED_VERSION)
 AC_SUBST(DEP_CFLAGS)
 AC_SUBST(DEP_LIBS)
 
-# Environment
-GNOME_COMMON_INIT
-GNOME_COMPILE_WARNINGS(error)
+# Do we build optional tests? (they require gnome-vfs)
+AC_ARG_ENABLE(build_tests,AC_HELP_STRING([--disable-build-tests],
+					     [disable building of the test programs]),
+[case "${enableval}" in
+  yes) build_tests=false ;;
+  no)  build_tests=true ;;
+  *) AC_MSG_ERROR(bad value ${enableval} for --disable-build-tests) ;;
+esac],[build_tests=true])
+AM_CONDITIONAL(BUILD_TESTS, test x$build_tests = xtrue)
+
+if test x$build_tests = xtrue; then
+	PKG_CHECK_MODULES(TESTS,
+		gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED_VERSION)
+	AC_SUBST(TESTS_CFLAGS)
+	AC_SUBST(TESTS_LIBS)
+fi
 
 # I18N stuff
 ALL_LINGUAS="es"
@@ -55,7 +71,12 @@
 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext])
 
 AM_GLIB_GNU_GETTEXT
-AM_GLIB_DEFINE_LOCALEDIR(GNOMELOCALEDIR)
+AM_GLIB_DEFINE_LOCALEDIR(LOCALEDIR)
+
+# configuration files
+CONF_DIR=.gnome2
+AC_SUBST(CONF_DIR)
+AC_DEFINE_UNQUOTED(CONF_DIR, "$CONF_DIR", [Directory for configuration files])
 
 # Output files
 AC_CONFIG_FILES([
Index: gtksourceview-1.0.pc.in
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview-1.0.pc.in,v
retrieving revision 1.2
diff -u -r1.2 gtksourceview-1.0.pc.in
--- gtksourceview-1.0.pc.in	2 May 2003 17:27:43 -0000	1.2
+++ gtksourceview-1.0.pc.in	12 May 2003 17:34:39 -0000
@@ -6,6 +6,6 @@
 Name: @PACKAGE_NAME@
 Description: GTK+ 2.0 Source Editing Widget
 Version: @PACKAGE_VERSION@
-Requires: glib-2.0 gdk-2.0 gtk+-2.0 libxml-2.0 libgnome-2.0
+Requires: glib-2.0 gdk-2.0 gtk+-2.0 libxml-2.0
 Libs: -L${libdir} -lgtksourceview-1.0
 Cflags: -I${includedir}/gtksourceview-1.0
Index: gtksourceview/Makefile.am
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview/Makefile.am,v
retrieving revision 1.10
diff -u -r1.10 Makefile.am
--- gtksourceview/Makefile.am	4 May 2003 22:43:57 -0000	1.10
+++ gtksourceview/Makefile.am	12 May 2003 17:34:39 -0000
@@ -7,7 +7,6 @@
 	-DGTK_DISABLE_DEPRECATED 	\
 	-DGDK_DISABLE_DEPRECATED 	\
 	-DGDK_PIXBUF_DISABLE_DEPRECATED	\
-	-DGNOME_DISABLE_DEPRECATED	\
 	-I$(top_srcdir) -I$(srcdir) 	\
 	$(WARN_CFLAGS) 			\
 	$(DEP_CFLAGS)
Index: gtksourceview/gtksourcelanguage-private.h
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview/gtksourcelanguage-private.h,v
retrieving revision 1.2
diff -u -r1.2 gtksourcelanguage-private.h
--- gtksourceview/gtksourcelanguage-private.h	2 May 2003 17:27:50 -0000	1.2
+++ gtksourceview/gtksourcelanguage-private.h	12 May 2003 17:34:39 -0000
@@ -20,8 +20,6 @@
 #ifndef __GTK_SOURCE_LANGUAGE_PRIVATE_H__
 #define __GTK_SOURCE_LANGUAGE_PRIVATE_H__
 
-#include <gconf/gconf-client.h>
-
 #include "gtksourcelanguagesmanager.h"
 
 G_BEGIN_DECLS
Index: gtksourceview/gtksourcelanguagesmanager.c
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview/gtksourcelanguagesmanager.c,v
retrieving revision 1.2
diff -u -r1.2 gtksourcelanguagesmanager.c
--- gtksourceview/gtksourcelanguagesmanager.c	2 May 2003 17:27:51 -0000	1.2
+++ gtksourceview/gtksourcelanguagesmanager.c	12 May 2003 17:34:39 -0000
@@ -24,8 +24,6 @@
 #include <string.h>
 
 #include <libxml/xmlreader.h>
-#include <libgnome/gnome-util.h>
-#include <libgnome/gnome-macros.h>
 
 #include "gtksourcelanguagesmanager.h"
 
@@ -52,12 +50,10 @@
 	GSList		*language_specs_directories;
 };
 
+static GObjectClass *parent_class = NULL;
 
-GNOME_CLASS_BOILERPLATE (GtkSourceLanguagesManager, 
-			 gtk_source_languages_manager,
-			 GObject, 
-			 G_TYPE_OBJECT)
-
+static void  gtk_source_languages_manager_class_init		(GtkSourceLanguagesManagerClass *klass);
+static void  gtk_source_languages_manager_instance_init	(GtkSourceLanguagesManager *lm);
 static void	 gtk_source_languages_manager_finalize	 	(GObject 		   *object);
 
 static void	 slist_deep_free 				(GSList 		   *list);
@@ -76,6 +72,35 @@
 static void	 gtk_source_languages_manager_set_specs_dirs	(GtkSourceLanguagesManager *lm,
 								 const GSList 		   *dirs);
 
+GType
+gtk_source_languages_manager_get_type (void)
+{
+	static GType languages_manager_type = 0;
+
+  	if (languages_manager_type == 0)
+    	{
+      		static const GTypeInfo our_info =
+      		{
+        		sizeof (GtkSourceLanguagesManagerClass),
+        		NULL,		/* base_init */
+        		NULL,		/* base_finalize */
+        		(GClassInitFunc) gtk_source_languages_manager_class_init,
+        		NULL,           /* class_finalize */
+        		NULL,           /* class_data */
+        		sizeof (GtkSourceLanguagesManager),
+        		0,              /* n_preallocs */
+        		(GInstanceInitFunc) gtk_source_languages_manager_instance_init
+      		};
+
+      		languages_manager_type = g_type_register_static (G_TYPE_OBJECT,
+                					    "GtkSourceLanguagesManager",
+							    &our_info,
+							    0);
+    	}
+
+	return languages_manager_type;
+}
+
 static void
 gtk_source_languages_manager_class_init (GtkSourceLanguagesManagerClass *klass)
 {
@@ -196,7 +221,9 @@
 					g_strdup (DEFAULT_LANGUAGE_DIR));
 		lm->priv->language_specs_directories = 
 			g_slist_prepend (lm->priv->language_specs_directories,
-					gnome_util_home_file (USER_LANGUAGE_DIR));
+					g_build_filename (g_get_home_dir(), 
+						".gnome2", (USER_LANGUAGE_DIR), 
+						NULL));
 
 		return;
 	}
@@ -336,9 +363,11 @@
 	while (file_name != NULL)
 	{
 		gchar *full_path = g_build_filename (directory, file_name, NULL);
-
+		gchar *last_dot = strrchr (full_path, '.');
+		
 		if (!g_file_test (full_path, G_FILE_TEST_IS_DIR) && 
-		    (strcmp (g_extension_pointer (full_path), "lang") == 0))
+		    last_dot && 
+		    (strcmp (last_dot + 1, "lang") == 0))
 			filenames = g_slist_prepend (filenames, full_path);
 		else
 			g_free (full_path);
Index: gtksourceview/gtksourcetagtable.c
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview/gtksourcetagtable.c,v
retrieving revision 1.2
diff -u -r1.2 gtksourcetagtable.c
--- gtksourceview/gtksourcetagtable.c	2 May 2003 17:27:53 -0000	1.2
+++ gtksourceview/gtksourcetagtable.c	12 May 2003 17:34:39 -0000
@@ -18,16 +18,10 @@
  */
 
 #include "gtksourcetagtable.h"
-#include <libgnome/gnome-macros.h>
 
 #include "gtksourceview-marshal.h"
 #include "gtksourcetag.h"
 
-GNOME_CLASS_BOILERPLATE (GtkSourceTagTable, 
-			 gtk_source_tag_table,
-			 GtkTextTagTable, 
-			 GTK_TYPE_TEXT_TAG_TABLE)
-
 struct _GtkSourceTagTablePrivate
 {
 	gulong tag_added_id;
@@ -41,9 +35,42 @@
 	LAST_SIGNAL
 };
 
+static GtkTextTagTableClass *parent_class = NULL;
+
+static void  gtk_source_tag_table_class_init		(GtkSourceTagTableClass *klass);
+static void  gtk_source_tag_table_instance_init	(GtkSourceTagTable *lm);
 static void	 gtk_source_tag_table_finalize		(GObject 			*object);
 
 static guint signals[LAST_SIGNAL] = { 0 };
+
+GType
+gtk_source_tag_table_get_type (void)
+{
+	static GType tag_table_type = 0;
+
+  	if (tag_table_type == 0)
+    	{
+      		static const GTypeInfo our_info =
+      		{
+        		sizeof (GtkSourceTagTableClass),
+        		NULL,		/* base_init */
+        		NULL,		/* base_finalize */
+        		(GClassInitFunc) gtk_source_tag_table_class_init,
+        		NULL,           /* class_finalize */
+        		NULL,           /* class_data */
+        		sizeof (GtkSourceTagTable),
+        		0,              /* n_preallocs */
+        		(GInstanceInitFunc) gtk_source_tag_table_instance_init
+      		};
+
+      		tag_table_type = g_type_register_static (G_TYPE_OBJECT,
+                					    "GtkSourceTagTable",
+							    &our_info,
+							    0);
+    	}
+
+	return tag_table_type;
+}
 
 static void
 gtk_source_tag_table_class_init (GtkSourceTagTableClass *klass)
Index: gtksourceview/gtksourceview-i18n.c
===================================================================
RCS file: /cvs/gnome/gtksourceview/gtksourceview/gtksourceview-i18n.c,v
retrieving revision 1.2
diff -u -r1.2 gtksourceview-i18n.c
--- gtksourceview/gtksourceview-i18n.c	2 May 2003 17:27:53 -0000	1.2
+++ gtksourceview/gtksourceview-i18n.c	12 May 2003 17:34:39 -0000
@@ -32,7 +32,7 @@
 	static gboolean initialized = FALSE;
 
 	if (!initialized) {
-		bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+		bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
 		bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 		initialized = TRUE;
 	}
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/gnome/gtksourceview/tests/Makefile.am,v
retrieving revision 1.3
diff -u -r1.3 Makefile.am
--- tests/Makefile.am	4 May 2003 22:44:01 -0000	1.3
+++ tests/Makefile.am	12 May 2003 17:34:40 -0000
@@ -8,7 +8,8 @@
 	-DGNOME_DISABLE_DEPRECATED	\
 	-I$(top_srcdir) -I$(srcdir) 	\
 	$(WARN_CFLAGS) 			\
-	$(DEP_CFLAGS)
+	$(DEP_CFLAGS)                  \
+	$(TESTS_CFLAGS)
 
 # testing executables
 noinst_PROGRAMS = test-widget testregion
@@ -17,7 +18,8 @@
 
 test_widget_LDADD = 			\
 	$(top_builddir)/gtksourceview/libgtksourceview-1.0.la \
-	$(DEP_LIBS)
+	$(DEP_LIBS)                     \
+	$(TESTS_LIBS)
 
 testregion_SOURCES = testregion.c
 

Attachment: pgpekQdQXvjF7.pgp
Description: PGP signature



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