summaryrefslogtreecommitdiff
path: root/recipes/libglade/files
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/libglade/files
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/libglade/files')
-rw-r--r--recipes/libglade/files/glade-cruft.patch100
-rw-r--r--recipes/libglade/files/gtk-2.0.m4196
-rw-r--r--recipes/libglade/files/no-deprecation.patch10
-rw-r--r--recipes/libglade/files/no-xml2.patch499
4 files changed, 805 insertions, 0 deletions
diff --git a/recipes/libglade/files/glade-cruft.patch b/recipes/libglade/files/glade-cruft.patch
new file mode 100644
index 0000000000..0fceccf0c4
--- /dev/null
+++ b/recipes/libglade/files/glade-cruft.patch
@@ -0,0 +1,100 @@
+diff -ur libglade-2.4.0~/configure.in libglade-2.4.0/configure.in
+--- libglade-2.4.0~/configure.in 2004-05-17 12:38:31.000000000 +0100
++++ libglade-2.4.0/configure.in 2004-07-28 16:53:09.000000000 +0100
+@@ -147,6 +147,18 @@
+ AM_CONDITIONAL(HAVE_PYTHON, $have_python)
+ AC_SUBST(PYTHON)
+
++AC_MSG_CHECKING([for cruft in libgtk])
++AC_TRY_LINK([
++#include <gtk/gtk.h>
++#include <stdio.h>
++], [ gtk_tree_get_type (); return 0; ],
++ [ AC_MSG_RESULT(yes)
++ have_cruft=yes ],
++ [ AC_MSG_RESULT(no)
++ AC_DEFINE(DISABLE_CRUFT,,[leave out support for old, broken widgets])
++ have_cruft=no ])
++AC_SUBST(DISABLE_CRUFT)
++
+ dnl add debugging options ...
+ changequote(,)dnl
+ if test "x$GCC" = xyes; then
+Only in libglade-2.4.0: configure.in.orig
+diff -ur libglade-2.4.0~/glade/glade-gtk.c libglade-2.4.0/glade/glade-gtk.c
+--- libglade-2.4.0~/glade/glade-gtk.c 2004-03-13 13:47:35.000000000 +0000
++++ libglade-2.4.0/glade/glade-gtk.c 2004-07-28 16:53:52.000000000 +0100
+@@ -213,6 +213,8 @@
+ gtk_clist_column_titles_hide (GTK_CLIST (w));
+ }
+
++#ifndef DISABLE_CRUFT
++
+ static void
+ tree_set_selection_mode (GladeXML *xml, GtkWidget *w,
+ const char *name, const char *value)
+@@ -238,6 +240,8 @@
+ gtk_tree_set_view_lines (GTK_TREE (w), BOOL (value));
+ }
+
++#endif
++
+ static void
+ list_set_selection_mode (GladeXML *xml, GtkWidget *w,
+ const char *name, const char *value)
+@@ -254,6 +258,7 @@
+ gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (w), BOOL (value));
+ }
+
++#ifndef DISABLE_CRUFT
+ static void
+ text_set_text (GladeXML *xml, GtkWidget *w,
+ const char *name, const char *value)
+@@ -262,6 +267,7 @@
+
+ gtk_editable_insert_text (GTK_EDITABLE (w), value, -1, &pos);
+ }
++#endif
+
+ static void
+ radio_menu_item_set_group (GladeXML *xml, GtkWidget *w,
+@@ -1125,13 +1131,17 @@
+ glade_register_custom_prop (GTK_TYPE_CLIST, "selection_mode", clist_set_selection_mode);
+ glade_register_custom_prop (GTK_TYPE_CLIST, "shadow_type", clist_set_shadow_type);
+ glade_register_custom_prop (GTK_TYPE_CLIST, "show_titles", clist_set_show_titles);
++#ifndef DISABLE_CRUFT
+ glade_register_custom_prop (GTK_TYPE_TREE, "selection_mode", tree_set_selection_mode);
+ glade_register_custom_prop (GTK_TYPE_TREE, "view_mode", tree_set_view_mode);
+ glade_register_custom_prop (GTK_TYPE_TREE, "view_line", tree_set_view_line);
++#endif
+ glade_register_custom_prop (GTK_TYPE_LIST, "selection_mode", list_set_selection_mode);
+ glade_register_custom_prop (GTK_TYPE_CHECK_MENU_ITEM, "always_show_toggle",
+ check_menu_item_set_always_show_toggle);
++#ifndef DISABLE_CRUFT
+ glade_register_custom_prop (GTK_TYPE_TEXT, "text", text_set_text);
++#endif
+ glade_register_custom_prop (GTK_TYPE_RADIO_MENU_ITEM, "group",
+ radio_menu_item_set_group);
+ glade_register_custom_prop (GTK_TYPE_TOOLBAR, "tooltips", toolbar_set_tooltips);
+@@ -1288,8 +1298,10 @@
+ glade_standard_build_children, NULL);
+ glade_register_widget (GTK_TYPE_TEAROFF_MENU_ITEM, glade_standard_build_widget,
+ NULL, NULL);
++#ifndef DISABLE_CRUFT
+ glade_register_widget (GTK_TYPE_TEXT, glade_standard_build_widget,
+ NULL, NULL);
++#endif
+ glade_register_widget (GTK_TYPE_TEXT_VIEW, glade_standard_build_widget,
+ NULL, NULL);
+ glade_register_widget (GTK_TYPE_TIPS_QUERY, glade_standard_build_widget,
+@@ -1304,8 +1316,10 @@
+ glade_standard_build_children, NULL);
+ glade_register_widget (GTK_TYPE_TOOL_BUTTON, glade_standard_build_widget,
+ NULL, NULL);
++#ifndef DISABLE_CRUFT
+ glade_register_widget (GTK_TYPE_TREE, glade_standard_build_widget,
+ NULL, NULL);
++#endif
+ glade_register_widget (GTK_TYPE_TREE_VIEW, glade_standard_build_widget,
+ NULL, NULL);
+ glade_register_widget (GTK_TYPE_VBUTTON_BOX, glade_standard_build_widget,
diff --git a/recipes/libglade/files/gtk-2.0.m4 b/recipes/libglade/files/gtk-2.0.m4
new file mode 100644
index 0000000000..a0c53ac11f
--- /dev/null
+++ b/recipes/libglade/files/gtk-2.0.m4
@@ -0,0 +1,196 @@
+# Configure paths for GTK+
+# Owen Taylor 1997-2001
+
+dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
+dnl pass to pkg-config
+dnl
+AC_DEFUN(AM_PATH_GTK_2_0,
+[dnl
+dnl Get the cflags and libraries from pkg-config
+dnl
+AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
+ , enable_gtktest=yes)
+
+ pkg_config_args=gtk+-2.0
+ for module in . $4
+ do
+ case "$module" in
+ gthread)
+ pkg_config_args="$pkg_config_args gthread-2.0"
+ ;;
+ esac
+ done
+
+ no_gtk=""
+
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+
+ if test x$PKG_CONFIG != xno ; then
+ if pkg-config --atleast-pkgconfig-version 0.7 ; then
+ :
+ else
+ echo *** pkg-config too old; version 0.7 or better required.
+ no_gtk=yes
+ PKG_CONFIG=no
+ fi
+ else
+ no_gtk=yes
+ fi
+
+ min_gtk_version=ifelse([$1], ,2.0.0,$1)
+ AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
+
+ if test x$PKG_CONFIG != xno ; then
+ ## don't try to run the test against uninstalled libtool libs
+ if $PKG_CONFIG --uninstalled $pkg_config_args; then
+ echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
+ enable_gtktest=no
+ fi
+
+ if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
+ :
+ else
+ no_gtk=yes
+ fi
+ fi
+
+ if test x"$no_gtk" = x ; then
+ GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
+ GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
+ gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ if test "x$enable_gtktest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GTK_CFLAGS"
+ LIBS="$GTK_LIBS $LIBS"
+dnl
+dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
+dnl checks the results of pkg-config to some extent)
+dnl
+ rm -f conf.gtktest
+ AC_TRY_RUN([
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main ()
+{
+ int major, minor, micro;
+ char *tmp_version;
+
+ system ("touch conf.gtktest");
+
+ /* HP/UX 9 (%@#!) writes to sscanf strings */
+ tmp_version = g_strdup("$min_gtk_version");
+ if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+ printf("%s, bad version string\n", "$min_gtk_version");
+ exit(1);
+ }
+
+ if ((gtk_major_version != $gtk_config_major_version) ||
+ (gtk_minor_version != $gtk_config_minor_version) ||
+ (gtk_micro_version != $gtk_config_micro_version))
+ {
+ printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
+ $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
+ gtk_major_version, gtk_minor_version, gtk_micro_version);
+ printf ("*** was found! If pkg-config was correct, then it is best\n");
+ printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
+ printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+ printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+ printf("*** required on your system.\n");
+ printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
+ printf("*** to point to the correct configuration files\n");
+ }
+ else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
+ (gtk_minor_version != GTK_MINOR_VERSION) ||
+ (gtk_micro_version != GTK_MICRO_VERSION))
+ {
+ printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
+ GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
+ printf("*** library (version %d.%d.%d)\n",
+ gtk_major_version, gtk_minor_version, gtk_micro_version);
+ }
+ else
+ {
+ if ((gtk_major_version > major) ||
+ ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
+ ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
+ {
+ return 0;
+ }
+ else
+ {
+ printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
+ gtk_major_version, gtk_minor_version, gtk_micro_version);
+ printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
+ major, minor, micro);
+ printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
+ printf("***\n");
+ printf("*** If you have already installed a sufficiently new version, this error\n");
+ printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
+ printf("*** being found. The easiest way to fix this is to remove the old version\n");
+ printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
+ printf("*** correct copy of pkg-config. (In this case, you will have to\n");
+ printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+ printf("*** so that the correct libraries are found at run-time))\n");
+ }
+ }
+ return 1;
+}
+],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ if test "x$no_gtk" = x ; then
+ AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
+ ifelse([$2], , :, [$2])
+ else
+ AC_MSG_RESULT(no)
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** A new enough version of pkg-config was not found."
+ echo "*** See http://pkgconfig.sourceforge.net"
+ else
+ if test -f conf.gtktest ; then
+ :
+ else
+ echo "*** Could not run GTK+ test program, checking why..."
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GTK_CFLAGS"
+ LIBS="$LIBS $GTK_LIBS"
+ AC_TRY_LINK([
+#include <gtk/gtk.h>
+#include <stdio.h>
+], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
+ [ echo "*** The test program compiled, but did not run. This usually means"
+ echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
+ echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
+ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ echo "*** is required on your system"
+ echo "***"
+ echo "*** If you have an old version installed, it is best to remove it, although"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
+ [ echo "*** The test program failed to compile or link. See the file config.log for the"
+ echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ GTK_CFLAGS=""
+ GTK_LIBS=""
+ ifelse([$3], , :, [$3])
+ fi
+ AC_SUBST(GTK_CFLAGS)
+ AC_SUBST(GTK_LIBS)
+ rm -f conf.gtktest
+])
diff --git a/recipes/libglade/files/no-deprecation.patch b/recipes/libglade/files/no-deprecation.patch
new file mode 100644
index 0000000000..9ef8f0738e
--- /dev/null
+++ b/recipes/libglade/files/no-deprecation.patch
@@ -0,0 +1,10 @@
+--- libglade-2.5.1/glade/Makefile.am.old 2006-04-25 21:03:25.000000000 +0100
++++ libglade-2.5.1/glade/Makefile.am 2006-04-25 21:03:45.000000000 +0100
+@@ -30,7 +30,6 @@
+ -I$(top_srcdir) \
+ $(LIBGLADE_CFLAGS) \
+ -DGLADE_LIBDIR=\""$(libdir)"\" \
+- -DG_DISABLE_DEPRECATED \
+ -DGDK_DISABLE_DEPRECATED \
+ -DGDK_PIXBUF_DISABLE_DEPRECATED \
+ -DGTK_DISABLE_DEPRECATED \
diff --git a/recipes/libglade/files/no-xml2.patch b/recipes/libglade/files/no-xml2.patch
new file mode 100644
index 0000000000..1c2e215b8d
--- /dev/null
+++ b/recipes/libglade/files/no-xml2.patch
@@ -0,0 +1,499 @@
+diff -urN libglade-2.4.2.orig/configure.in libglade-2.4.2/configure.in
+--- libglade-2.4.2.orig/configure.in 2005-02-11 12:42:58.000000000 +0100
++++ libglade-2.4.2/configure.in 2005-03-22 01:22:00.000000000 +0100
+@@ -52,11 +52,33 @@
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+
+ PKG_CHECK_MODULES(LIBGLADE, [dnl
+- libxml-2.0 >= required_libxml_version dnl
+ atk >= required_atk_version dnl
+ gtk+-2.0 >= required_gtk_version dnl
+ glib-2.0 >= required_glib_version])
+
++disable_xml2=no
++AC_ARG_WITH([libxml2],
++ AC_HELP_STRING([--without-libxml2], [Don't use libxml2, use Glib's GMarkupParser instead]),
++ [disable_xml2=yes],
++ [disable_xml2=no])
++
++AC_MSG_CHECKING([if we are using libxml2])
++if test "x$disable_xml2" == "xno"; then
++ AC_MSG_RESULT(yes)
++ PKG_CHECK_MODULES(XML2, libxml-2.0 >= 2.4.10)
++ PKGCFG_REQUIRE_LIBXML2="libxml-2.0"
++ LIBGLADE_CFLAGS="$LIBGLADE_CFLAGS $XML2_CFLAGS"
++ LIBGLADE_LIBS="$LIBGLADE_LIBS $XML2_LIBS"
++else
++ LIBGLADE_CFLAGS="$LIBGLADE_CFLAGS -DUSE_GMARKUP_PARSER"
++ PKGCFG_REQUIRE_LIBXML2=""
++ AC_MSG_RESULT(no)
++fi
++
++AC_SUBST(XML2_LIBS)
++AC_SUBST(XML2_CFLAGS)
++AC_SUBST(PKGCFG_REQUIRE_LIBXML2)
++
+ AC_MSG_CHECKING([for native Win32])
+ case "$host" in
+ *-*-mingw*)
+@@ -116,6 +138,21 @@
+ fi
+ fi
+
++if test "x$disable_xml2" == "xyes"; then
++ echo "*****************************************************"
++ echo " You chose to disable libxml2 and use Glib's"
++ echo " GMarkupParser instead."
++ echo
++ echo " Please bear in mind that using libglade with"
++ echo " GMarkupParser is an experimental feature only."
++ echo
++ echo " Please post problems or success stories to"
++ echo " the glade-devel mailing list. Thank you."
++ echo "*****************************************************"
++fi
++
++
++
+ GTK_DOC_CHECK(1.0)
+
+ dnl gettext stuff ... there is no message catalog for libglade -- libglade
+diff -urN libglade-2.4.2.orig/glade/glade-parser.c libglade-2.4.2/glade/glade-parser.c
+--- libglade-2.4.2.orig/glade/glade-parser.c 2004-11-11 11:56:13.000000000 +0100
++++ libglade-2.4.2/glade/glade-parser.c 2005-03-22 01:20:00.000000000 +0100
+@@ -34,7 +34,15 @@
+ # define dgettext(Domain, String) (String)
+ #endif
+
+-#include <libxml/parser.h>
++#ifdef USE_GMARKUP_PARSER
++# include <zlib.h>
++#else
++# include <libxml/parser.h>
++#endif
++
++#ifdef USE_GMARKUP_PARSER
++# define xmlChar gchar
++#endif
+
+ #include "glade-parser.h"
+ #include "glade-private.h"
+@@ -508,7 +516,9 @@
+ case PARSER_START:
+ if (!strcmp(name, "glade-interface")) {
+ state->state = PARSER_GLADE_INTERFACE;
+-#if 0
++
++#ifndef USE_GMARKUP_PARSER
++ #if 0
+ /* check for correct XML namespace */
+ for (i = 0; attrs && attrs[i] != NULL; i += 2) {
+ if (!strcmp(attrs[i], "xmlns") &&
+@@ -518,7 +528,9 @@
+ g_warning("unknown attribute `%s' for <glade-interface>",
+ attrs[i]);
+ }
++ #endif
+ #endif
++
+ } else {
+ g_warning("Expected <glade-interface>. Got <%s>.", name);
+ state->prev_state = state->state;
+@@ -1063,12 +1075,18 @@
+ }
+ }
+
++#ifndef USE_GMARKUP_PARSER
++
+ static xmlEntityPtr
+ glade_parser_get_entity(GladeParseState *state, const xmlChar *name)
+ {
+ return xmlGetPredefinedEntity(name);
+ }
+
++#endif /* !defined(USE_GMARKUP_PARSER) */
++
++#ifndef USE_GMARKUP_PARSER
++
+ static void
+ glade_parser_warning(GladeParseState *state, const char *msg, ...)
+ {
+@@ -1079,6 +1097,10 @@
+ va_end(args);
+ }
+
++#endif /* !defined(USE_GMARKUP_PARSER) */
++
++#ifndef USE_GMARKUP_PARSER
++
+ static void
+ glade_parser_error(GladeParseState *state, const char *msg, ...)
+ {
+@@ -1089,6 +1111,10 @@
+ va_end(args);
+ }
+
++#endif /* !defined(USE_GMARKUP_PARSER) */
++
++#ifndef USE_GMARKUP_PARSER
++
+ static void
+ glade_parser_fatal_error(GladeParseState *state, const char *msg, ...)
+ {
+@@ -1099,6 +1125,10 @@
+ va_end(args);
+ }
+
++#endif /* !defined(USE_GMARKUP_PARSER) */
++
++#ifndef USE_GMARKUP_PARSER
++
+ static xmlSAXHandler glade_parser = {
+ (internalSubsetSAXFunc)NULL, /* internalSubset */
+ (isStandaloneSAXFunc)NULL, /* isStandalone */
+@@ -1126,6 +1156,82 @@
+ (fatalErrorSAXFunc)glade_parser_fatal_error, /* fatalError */
+ };
+
++#else /* USE_GMARKUP_PARSER */
++
++static void
++glade_parser_start_element_wrapper(GMarkupParseContext *context,
++ const gchar *name,
++ const gchar **attr_names,
++ const gchar **attr_values,
++ gpointer state,
++ GError **error)
++{
++ guint i = 0;
++
++ /* Pack attribute names/values from two separate
++ * arrays (GMarkupParser style) into one single
++ * array (libxml SAXParser style). This is not
++ * very efficient, but we do it to make the
++ * GMarkupParser code as little invasive as
++ * possible. */
++
++ while (attr_names[i] != NULL) {
++ ++i;
++ }
++
++ if (1)
++ {
++ const gchar *attr[(i*2)+1];
++ guint j, k;
++
++ for (j=0, k=0; k < i; j += 2)
++ {
++ attr[j] = attr_names[k];
++ attr[j+1] = attr_values[k];
++ ++k;
++ }
++ attr[i*2] = NULL;
++
++ glade_parser_start_element((GladeParseState*)state, name, attr);
++ }
++}
++
++static void
++glade_parser_end_element_wrapper(GMarkupParseContext *context,
++ const gchar *name,
++ gpointer state,
++ GError **err)
++{
++ glade_parser_end_element((GladeParseState*)state, name);
++}
++
++static void
++glade_parser_characters_wrapper(GMarkupParseContext *context,
++ const gchar *chars,
++ gsize len,
++ gpointer state,
++ GError **err)
++{
++ glade_parser_characters((GladeParseState*)state, chars, (int) len);
++}
++
++static void
++glade_parser_error(GMarkupParseContext *context, GError *err, gpointer data)
++{
++ g_log("Glade-Parser", G_LOG_LEVEL_CRITICAL, "%s", err->message);
++}
++
++static const GMarkupParser glade_parser = {
++ glade_parser_start_element_wrapper, /* element open */
++ glade_parser_end_element_wrapper, /* element close */
++ glade_parser_characters_wrapper, /* text content */
++ NULL, /* passthrough */
++ glade_parser_error, /* parse error */
++};
++
++#endif /* USE_GMARKUP_PARSER */
++
++
+ static void
+ widget_info_free(GladeWidgetInfo *info)
+ {
+@@ -1191,6 +1297,9 @@
+ *
+ * Returns: the GladeInterface structure for the XML file.
+ */
++
++#ifndef USE_GMARKUP_PARSER
++
+ GladeInterface *
+ glade_parser_parse_file(const gchar *file, const gchar *domain)
+ {
+@@ -1222,6 +1331,31 @@
+ return state.interface;
+ }
+
++#else /* defined(USE_GMARKUP_PARSER) */
++
++GladeInterface *
++glade_parser_parse_file(const gchar *file, const gchar *domain)
++{
++ GladeInterface *interface;
++ GError *err = NULL;
++ gchar *content = NULL;
++ gsize clen;
++
++ if (!g_file_get_contents(file, &content, &clen, &err)) {
++ g_warning("could not load glade file: %s", err->message);
++ g_error_free(err);
++ return NULL;
++ }
++
++ interface = glade_parser_parse_buffer(content, (gint) clen, domain);
++
++ g_free(content);
++
++ return interface;
++}
++
++#endif /* USE_GMARKUP_PARSER */
++
+ /**
+ * glade_parser_parse_buffer
+ * @buffer: a buffer in memory containing XML data.
+@@ -1237,6 +1371,9 @@
+ *
+ * Returns: the GladeInterface structure for the XML buffer.
+ */
++
++#ifndef USE_GMARKUP_PARSER
++
+ GladeInterface *
+ glade_parser_parse_buffer(const gchar *buffer, gint len, const gchar *domain)
+ {
+@@ -1263,6 +1400,161 @@
+ return state.interface;
+ }
+
++#else /* defined(USE_GMARKUP_PARSER) */
++
++
++static GladeInterface *
++glade_parser_parse_buffer_internal(const gchar *buffer, gint len, const gchar *domain)
++{
++ GMarkupParseContext *context;
++ GladeParseState state = { 0 };
++ GError *err = NULL;
++
++ state.interface = NULL;
++ if (domain)
++ state.domain = domain;
++ else
++ state.domain = textdomain(NULL);
++
++ /* FIXME: This strstr() is not safe, as it ignores the len
++ * argument and assumes the buffer is NUL-terminated */
++ if (strstr(buffer, "<?xml") == NULL) {
++ g_warning("No XML header found in document!");
++ return NULL;
++ }
++
++ context = g_markup_parse_context_new(&glade_parser, (GMarkupParseFlags) 0, &state, NULL);
++
++ glade_parser_start_document(&state);
++
++ if (!g_markup_parse_context_parse(context, buffer, (gssize) len, &err)) {
++ g_warning("document not well formed: %s", err->message);
++ g_error_free(err);
++ if (state.interface)
++ glade_interface_destroy (state.interface);
++ return NULL;
++ }
++
++ glade_parser_end_document(&state);
++
++ if (state.state != PARSER_FINISH) {
++ g_warning("did not finish in PARSER_FINISH state!");
++
++ if (state.interface)
++ glade_interface_destroy(state.interface);
++
++ return NULL;
++ }
++
++ return state.interface;
++}
++
++struct _gzip_rfc1952_hdr
++{
++ guint8 id1, id2, cm, flags;
++ guint32 mtime;
++ guint8 xflags;
++ guint8 os;
++};
++
++static GladeInterface *
++glade_parser_parse_gzipped_buffer(const gchar *buffer, gint len, const gchar *domain)
++{
++ struct _gzip_rfc1952_hdr *hdr = (struct _gzip_rfc1952_hdr*)buffer;
++ struct z_stream_s zstream;
++ GladeInterface *interface;
++ const guint8 *cbuf; /* start of compressed data */
++ guint8 *decompress_buf;
++ gulong decompress_len = 0;
++ gint ret;
++
++ g_assert(hdr != NULL && hdr->id1 == 0x1f && hdr->id2 == 0x8b);
++
++ if (hdr->cm != Z_DEFLATED) {
++ g_warning("Unknown decompression method %u", (guint) hdr->cm);
++ return NULL;
++ }
++
++ /* Uncompressed size (modulo 2^32) is last
++ * 4 bytes of gzipped file, and little endian.
++ * See RFC 1952 */
++ decompress_len = GUINT32_FROM_LE(*((guint32*)(((guint8*)buffer) + len - 4)));
++
++ /* paranoid mode: glade files > 5MB are unlikely */
++ g_return_val_if_fail(decompress_len < 5*1024*1024, NULL);
++
++ decompress_buf = g_malloc0(decompress_len + 1); /* +1 for NUL-terminator */
++
++ /* find start of compressed data, skipping header stuff */
++ cbuf = (guint8*)buffer + 10;
++ if (hdr->flags & 0x04) {
++ guint16 xlen = GUINT16_FROM_LE(*((guint16*)cbuf));
++ cbuf += xlen + 2;
++ }
++ if (hdr->flags & 0x08) {
++ guint16 onamelen = strlen(cbuf);
++ cbuf += onamelen + 1;
++ }
++ if (hdr->flags & 0x10) {
++ guint16 commentlen = strlen(cbuf);
++ cbuf += commentlen + 1;
++ }
++ if (hdr->flags & 0x02)
++ {
++ cbuf += 2; /* skip header CRC16 */
++ }
++
++ zstream.next_in = (void*)cbuf;
++ zstream.avail_in = (uLongf) len - ((void*)cbuf-(void*)buffer) - 4 - 4 +1;
++ zstream.next_out = decompress_buf;
++ zstream.avail_out= decompress_len;
++ zstream.zalloc = Z_NULL;
++ zstream.zfree = Z_NULL;
++ zstream.opaque = Z_NULL;
++
++ ret = inflateInit2(&zstream, -MAX_WBITS);
++
++ if (ret != Z_OK) {
++ g_warning("inflateInit2() failed. zlib error code: %d", ret);
++ g_free(decompress_buf);
++ return NULL;
++ }
++
++ ret = inflate(&zstream, Z_FINISH);
++
++ if (ret != Z_STREAM_END) {
++ g_warning("zlib decompression failed. zlib error code: %d", ret);
++ g_free(decompress_buf);
++ return NULL;
++ }
++
++ interface = glade_parser_parse_buffer_internal(decompress_buf, decompress_len, domain);
++
++ g_free(decompress_buf);
++
++ return interface;
++}
++
++GladeInterface *
++glade_parser_parse_buffer(const gchar *buffer, gint len, const gchar *domain)
++{
++ g_return_val_if_fail(buffer != NULL, NULL);
++ g_return_val_if_fail(len > 0, NULL);
++
++ /* Check if buffer is gzipped */
++ if (buffer[0] == 0x1f && buffer[1] == (gchar)0x8b) {
++ return glade_parser_parse_gzipped_buffer(buffer, len, domain);
++ }
++
++ /* Buffer is cleartext. */
++ return glade_parser_parse_buffer_internal(buffer, len, domain);
++}
++
++#endif /* USE_GMARKUP_PARSER */
++
++
++#ifndef USE_GMARKUP_PARSER
++
+ static void
+ dump_widget(xmlNode *parent, GladeWidgetInfo *info, gint indent)
+ {
+@@ -1382,6 +1674,8 @@
+ xmlNodeAddContent(widget, " ");
+ }
+
++#endif /* !defined(USE_GMARKUP_PARSER) */
++
+ /**
+ * glade_interface_dump
+ * @interface: the GladeInterface
+@@ -1390,6 +1684,9 @@
+ * This function dumps the contents of a GladeInterface into a file as
+ * XML. It is intended mainly as a debugging tool.
+ */
++
++#ifndef USE_GMARKUP_PARSER
++
+ void
+ glade_interface_dump(GladeInterface *interface, const gchar *filename)
+ {
+@@ -1428,6 +1725,17 @@
+ xmlFreeDoc(doc);
+ }
+
++#else /* defined(USE_GMARKUP_PARSER) */
++
++void
++glade_interface_dump(GladeInterface *interface, const gchar *filename)
++{
++ g_warning("glade_interface_dump() is only available with libxml2.");
++}
++
++#endif /* USE_GMARKUP_PARSER */
++
++
+ #if 0
+ int
+ main(int argc, char **argv) {
+diff -urN libglade-2.4.2.orig/libglade-2.0.pc.in libglade-2.4.2/libglade-2.0.pc.in
+--- libglade-2.4.2.orig/libglade-2.0.pc.in 2001-12-12 15:28:23.000000000 +0100
++++ libglade-2.4.2/libglade-2.0.pc.in 2005-03-22 01:20:00.000000000 +0100
+@@ -11,7 +11,7 @@
+ Name: Libglade
+ Description: a library for dynamically loading GLADE interface files
+ Version: @VERSION@
+-Requires: gtk+-2.0 libxml-2.0
++Requires: gtk+-2.0 @PKGCFG_REQUIRE_LIBXML2@
+ Libs: -L${libdir} -lglade-2.0
+ Cflags: -I${includedir}/libglade-2.0
+