Hi again, Gustavo, Gustavo Giráldez wrote:
I believe I fixed all concerns in the attached patch. Let me know how it fits.Looking good. A couple of remaining issues: + The logic for the --disable-build-tests option is reversed. configure sets $enableval to "no" when you pass --disable-* and "yes" or the given argument when you pass --enable-*[=arg] (arg being optional)
Whoops. I tested out the current patch, it seems to do what's right.
+ I changed my mind about the CONF_DIR variable (you're not actually using it anyway in the code :-). Please just put a #define USERCONF_DIR (or something like that) in gtksourcelanguagesmanager.c and use that, instead of defining it in configure.in. I *think* Gnome will eventually move to the XDG directory spec, so in the future that value would be taken from some environment variable at runtime.
Whoops again. All right, I put the #define in and actually used it this time.
+ Please write a ChangeLog entry
Done. This one feels good. :) -mt
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtksourceview/ChangeLog,v
retrieving revision 1.41
diff -u -r1.41 ChangeLog
--- ChangeLog 9 May 2003 09:43:22 -0000 1.41
+++ ChangeLog 12 May 2003 22:52:40 -0000
@@ -1,3 +1,15 @@
+2003-05-12 Michael Terry <mterry fastmail fm>
+
+ * Makefile.am, configure.in, gtksourceview-1.0.pc.in,
+ gtksourceview/Makefile.am,
+ gtksourceview/gtksourcelanguage-private.h,
+ gtksourceview/gtksourcelanguagesmanager.c,
+ gtksourceview/gtksourcetagtable.c,
+ gtksourceview/gtksourceview-i18n.c, tests/Makefile.am:
+ Removed dependency on libgnome from gtksourceview code.
+ * configure.in: Allowed the tests to not be built, via a
+ --disable-build-tests configure flag.
+
2003-05-08 Paolo Maggi <paolo maggi polito it>
* gtksourceview/gtksourcebuffer.c
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 22:52:40 -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 22:52:40 -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=2.2.0
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=true ;;
+ no) build_tests=false ;;
+ *) 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,7 @@
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)
# 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 22:52:40 -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 22:52:41 -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 22:52:41 -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 22:52:41 -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"
@@ -39,6 +37,7 @@
#define DEFAULT_LANGUAGE_DIR DATADIR "/gtksourceview-1.0/language-specs"
#define USER_LANGUAGE_DIR "gtksourceview-1.0/language-specs"
+#define USER_CONFIG_BASE_DIR ".gnome2"
enum {
PROP_0,
@@ -52,12 +51,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 +73,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 +222,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(),
+ USER_CONFIG_BASE_DIR, USER_LANGUAGE_DIR,
+ NULL));
return;
}
@@ -336,9 +364,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 22:52:41 -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 22:52:41 -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 22:52:41 -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:
pgpN9OOLuimtM.pgp
Description: PGP signature