Re: gtksourceview requires libgnome



Gustavo Giráldez wrote:
Sure, go ahead.  AFAICS, the Gnome dependency is just the usage of
object boilerplate macros and the gnome_util_home_file() function.  So,
it should be pretty easy to drop (and it doesn't make much sense to
depend on Gnome for that functionality anyway).  Just bring in the
patch! :-)

Try the attached code for size.

It removes the libgnome dependency, adding one header file for some stolen code from it. It also makes building the test programs optional (controlled by an --enable-build-tests flag) since test-widget depends on gnome-vfs. This way, a default build will not build the tests and does not need anything from gnome. But, you can build the tests if ya like.

It seemed to work for me, and passed a 'make distcheck.'

One question I have is, should you still put stuff in ~/.gnome2?

-mt
? gtksourceview/gtksourceview-macros.h
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	10 May 2003 07:08:16 -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	10 May 2003 07:08:16 -0000
@@ -26,12 +26,12 @@
 # Dependencies
 GLIB_REQUIRED_VERSION=2.2.0
 GTK_REQUIRED_VERSION=2.2.0
-GNOME_REQUIRED=2.2.0
+GNOME_VFS_REQUIRED_VERSION=2.1.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.
@@ -39,14 +39,26 @@
 
 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([--enable-build-tests],
+					     [enable building of the test programs]),
+[case "${enableval}" in
+  yes) build_tests=true ;;
+  no)  build_tests=false ;;
+  *) AC_MSG_ERROR(bad value ${enableval} for --enable-build-tests) ;;
+esac],[build_tests=false])
+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 +67,6 @@
 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext])
 
 AM_GLIB_GNU_GETTEXT
-AM_GLIB_DEFINE_LOCALEDIR(GNOMELOCALEDIR)
 
 # 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	10 May 2003 07:08:16 -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	10 May 2003 07:08:16 -0000
@@ -1,13 +1,15 @@
 SUBDIRS = language-specs
 
+localedir = $(datadir)/locale
+
 INCLUDES = 				\
 	-DDATADIR=\""$(datadir)"\" 	\
+	-DLOCALEDIR=\""$(localedir)"\"  \
 	-DG_LOG_DOMAIN=\"GtkSourceView\"\
 	-DG_DISABLE_DEPRECATED 		\
 	-DGTK_DISABLE_DEPRECATED 	\
 	-DGDK_DISABLE_DEPRECATED 	\
 	-DGDK_PIXBUF_DISABLE_DEPRECATED	\
-	-DGNOME_DISABLE_DEPRECATED	\
 	-I$(top_srcdir) -I$(srcdir) 	\
 	$(WARN_CFLAGS) 			\
 	$(DEP_CFLAGS)
@@ -47,6 +49,7 @@
 	gtksourcestylescheme.c		\
 	gtksourcemarker.h		\
 	gtksourcemarker.c		\
+	gtksourceview-macros.h    \
 	$(BUILT_SOURCES)
 
 libgtksourceview_1_0_la_LIBADD = $(DEP_LIBS)
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	10 May 2003 07:08:17 -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	10 May 2003 07:08:17 -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"
 
@@ -35,6 +33,8 @@
 #include "gtksourcelanguage.h"
 #include "gtksourcetag.h"
 
+#include "gtksourceview-macros.h"
+
 #define DEFAULT_GCONF_BASE_DIR		"/apps/gtksourceview"
 
 #define DEFAULT_LANGUAGE_DIR		DATADIR "/gtksourceview-1.0/language-specs"
@@ -52,8 +52,7 @@
 	GSList		*language_specs_directories;
 };
 
-
-GNOME_CLASS_BOILERPLATE (GtkSourceLanguagesManager, 
+GTK_SOURCE_VIEW_CLASS_BOILERPLATE (GtkSourceLanguagesManager, 
 			 gtk_source_languages_manager,
 			 GObject, 
 			 G_TYPE_OBJECT)
@@ -196,7 +195,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_strconcat (g_get_home_dir(), 
+						"/", ".gnome2", (USER_LANGUAGE_DIR), 
+						NULL));
 
 		return;
 	}
@@ -336,9 +337,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	10 May 2003 07:08:17 -0000
@@ -18,15 +18,15 @@
  */
 
 #include "gtksourcetagtable.h"
-#include <libgnome/gnome-macros.h>
+#include "gtksourceview-macros.h"
 
 #include "gtksourceview-marshal.h"
 #include "gtksourcetag.h"
 
-GNOME_CLASS_BOILERPLATE (GtkSourceTagTable, 
-			 gtk_source_tag_table,
-			 GtkTextTagTable, 
-			 GTK_TYPE_TEXT_TAG_TABLE)
+GTK_SOURCE_VIEW_CLASS_BOILERPLATE (GtkSourceTagTable, 
+				   gtk_source_tag_table,
+				   GtkTextTagTable, 
+				   GTK_TYPE_TEXT_TAG_TABLE)
 
 struct _GtkSourceTagTablePrivate
 {
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	10 May 2003 07:08:17 -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	10 May 2003 07:08:17 -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
 
#ifndef __GTK_SOURCE_VIEW_MACROS_H__
#define __GTK_SOURCE_VIEW_MACROS_H__

/* Define the boilerplate type stuff to reduce typos and code size.  Defines
 * the get_type method and the parent_class static variable. */
#define GTK_SOURCE_VIEW_REGISTER_TYPE(type, type_as_function,           \
                            parent_type, parent_type_macro)             \
        g_type_register_static (parent_type_macro, #type, &object_info, 0)


#define GTK_SOURCE_VIEW_CLASS_BOILERPLATE(type, type_as_function,       \
                           parent_type, parent_type_macro)              \
static void type_as_function ## _class_init    (type ## Class *klass);  \
static void type_as_function ## _instance_init (type          *object); \
static parent_type ## Class *parent_class = NULL;                       \
static void                                                             \
type_as_function ## _class_init_trampoline (gpointer klass,             \
                                            gpointer data)              \
{                                                                       \
        parent_class = (parent_type ## Class *)g_type_class_ref (       \
                parent_type_macro);                                     \
        type_as_function ## _class_init ((type ## Class *)klass);       \
}                                                                       \
GType                                                                   \
type_as_function ## _get_type (void)                                    \
{                                                                       \
        static GType object_type = 0;                                   \
        if (object_type == 0) {                                         \
                static const GTypeInfo object_info = {                  \
                    sizeof (type ## Class),                             \
                    NULL,               /* base_init */                 \
                    NULL,               /* base_finalize */             \
                    type_as_function ## _class_init_trampoline,         \
                    NULL,               /* class_finalize */            \
                    NULL,               /* class_data */                \
                    sizeof (type),                                      \
                    0,                  /* n_preallocs */               \
                    (GInstanceInitFunc) type_as_function ## _instance_init \
                };                                                      \
                object_type = GTK_SOURCE_VIEW_REGISTER_TYPE             \
                        (type, type_as_function,                        \
                         parent_type, parent_type_macro);               \
        }                                                               \
        return object_type;                                             \
}

#endif /* __GTK_SOURCE_VIEW_MACROS_H__ */

Attachment: pgpBaaHImA3bx.pgp
Description: PGP signature



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