aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorMike Kestner <mkestner@src.gnome.org>2002-11-01 05:30:57 +0800
committerMike Kestner <mkestner@src.gnome.org>2002-11-01 05:30:57 +0800
commit613453b1095e325149b8d37e5731d415e1d5f9bd (patch)
tree1c0d7f9be4d4a87aa67d8e185ae2bb23d02254b7 /e-util
parentec242d6c30d7bf056c8f59710b8576c942f93583 (diff)
downloadgsoc2013-evolution-613453b1095e325149b8d37e5731d415e1d5f9bd.tar
gsoc2013-evolution-613453b1095e325149b8d37e5731d415e1d5f9bd.tar.gz
gsoc2013-evolution-613453b1095e325149b8d37e5731d415e1d5f9bd.tar.bz2
gsoc2013-evolution-613453b1095e325149b8d37e5731d415e1d5f9bd.tar.lz
gsoc2013-evolution-613453b1095e325149b8d37e5731d415e1d5f9bd.tar.xz
gsoc2013-evolution-613453b1095e325149b8d37e5731d415e1d5f9bd.tar.zst
gsoc2013-evolution-613453b1095e325149b8d37e5731d415e1d5f9bd.zip
merging the gal-2 branch back to the trunk.
merging the gal-2 branch back to the trunk. svn path=/trunk/; revision=18471
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-bit-array.c5
-rw-r--r--e-util/e-i18n.h31
-rw-r--r--e-util/e-marshal.list44
-rw-r--r--e-util/e-sorter-array.c2
-rw-r--r--e-util/e-sorter-array.h5
-rw-r--r--e-util/e-sorter.c4
-rw-r--r--e-util/e-text-event-processor-types.h14
-rw-r--r--e-util/e-text-event-processor.c7
-rw-r--r--e-util/e-util.c566
-rw-r--r--e-util/e-util.h213
-rw-r--r--e-util/e-xml-utils.c329
-rw-r--r--e-util/e-xml-utils.h12
12 files changed, 145 insertions, 1087 deletions
diff --git a/e-util/e-bit-array.c b/e-util/e-bit-array.c
index 9dd8a17b60..66a7c38af2 100644
--- a/e-util/e-bit-array.c
+++ b/e-util/e-bit-array.c
@@ -1,5 +1,5 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
+/*
* e-bit-array.c
* Copyright 2000, 2001, Ximian, Inc.
*
@@ -148,6 +148,7 @@ eba_destroy (GtkObject *object)
eba = E_BIT_ARRAY (object);
g_free(eba->data);
+ eba->data = NULL;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
@@ -425,5 +426,7 @@ e_bit_array_new (int count)
EBitArray *eba = gtk_type_new (e_bit_array_get_type ());
eba->bit_count = count;
eba->data = g_new0(guint32, (eba->bit_count + 31) / 32);
+ gtk_object_ref (GTK_OBJECT (eba));
+ gtk_object_sink (GTK_OBJECT (eba));
return eba;
}
diff --git a/e-util/e-i18n.h b/e-util/e-i18n.h
index 48c9f90458..2bc8b93a04 100644
--- a/e-util/e-i18n.h
+++ b/e-util/e-i18n.h
@@ -1,5 +1,5 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
+/*
* e-i18n.h
* Copyright 2000, 2001, Ximian, Inc.
*
@@ -35,13 +35,13 @@
#ifndef __E_I18N_H__
#define __E_I18N_H__
-#include <glib.h>
-#include <libgnome/gnome-defs.h>
+#include <libgnome/gnome-i18n.h>
-BEGIN_GNOME_DECLS
+G_BEGIN_DECLS
#ifdef ENABLE_NLS
-# include <libintl.h>
+ /* this function is defined in e-util.c */
+ extern char *e_gettext (const char *msgid);
# undef _
# ifdef GNOME_EXPLICIT_TRANSLATION_DOMAIN
# define _(String) dgettext (GNOME_EXPLICIT_TRANSLATION_DOMAIN, String)
@@ -70,25 +70,6 @@ BEGIN_GNOME_DECLS
# define E_I18N_DOMAIN ""
#endif
-/*
- * Do not remove the following define, nor do surround it with ifdefs.
- *
- * If you get any `redefined' errors, it means that you are including
- * -incorrectly- a header file provided by gnome-libs before this file.
- * To correctly solve this issue include this file before any libgnome/
- * libgnomeui headers
- */
-
-#define __GNOME_I18N_H__ 1
-
-
-/* This is copied staight out of the prototypes for gnome-i18n.h */
-const char *gnome_i18n_get_language(void);
-GList *gnome_i18n_get_language_list (const gchar *category_name);
-void gnome_i18n_set_preferred_language (const char *val);
-const char *gnome_i18n_get_preferred_language (void);
-void gnome_i18n_init (void);
-
-END_GNOME_DECLS
+G_END_DECLS
#endif /* __E_I18N_H__ */
diff --git a/e-util/e-marshal.list b/e-util/e-marshal.list
new file mode 100644
index 0000000000..2907768ff4
--- /dev/null
+++ b/e-util/e-marshal.list
@@ -0,0 +1,44 @@
+BOOLEAN:INT,INT,OBJECT,INT,INT,UINT
+BOOLEAN:INT,POINTER,INT,OBJECT,INT,INT,UINT
+BOOLEAN:NONE
+BOOLEAN:OBJECT
+BOOLEAN:OBJECT,DOUBLE,DOUBLE,BOOLEAN
+BOOLEAN:POINTER,POINTER,INT,INT,INT
+BOOLEAN:POINTER,POINTER,POINTER,INT,INT,INT
+BOOLEAN:STRING,INT
+DOUBLE:OBJECT,DOUBLE,DOUBLE,BOOLEAN
+INT:INT
+INT:INT,INT,BOXED
+INT:INT,POINTER,INT,BOXED
+INT:OBJECT,BOXED
+NONE:BOXED
+NONE:BOXED,INT
+NONE:BOXED,INT,INT
+NONE:DOUBLE
+NONE:INT
+NONE:INT,INT
+NONE:INT,INT,BOXED
+NONE:INT,INT,OBJECT
+NONE:INT,INT,OBJECT,INT,INT,BOXED,UINT,UINT
+NONE:INT,INT,OBJECT,POINTER,UINT,UINT
+NONE:INT,INT,OBJECT,UINT
+NONE:INT,INT,STRING,STRING
+NONE:INT,INT,STRING,STRING,POINTER
+NONE:INT,POINTER
+NONE:INT,POINTER,INT,BOXED
+NONE:INT,POINTER,INT,OBJECT
+NONE:INT,POINTER,INT,OBJECT,BOXED,UINT,UINT
+NONE:INT,POINTER,INT,OBJECT,INT,INT,BOXED,UINT,UINT
+NONE:INT,POINTER,INT,OBJECT,UINT
+NONE:INT,STRING
+NONE:OBJECT
+NONE:OBJECT,DOUBLE,DOUBLE,BOOLEAN
+NONE:POINTER,BOOLEAN
+NONE:POINTER,BOOLEAN,BOOLEAN,BOOLEAN
+NONE:POINTER,INT
+NONE:POINTER,INT,INT
+NONE:POINTER,INT,INT,INT
+NONE:POINTER,POINTER
+NONE:POINTER,POINTER,INT
+OBJECT:OBJECT,DOUBLE,DOUBLE,BOOLEAN
+POINTER:NONE
diff --git a/e-util/e-sorter-array.c b/e-util/e-sorter-array.c
index 11a40a9ca9..ffc4d355df 100644
--- a/e-util/e-sorter-array.c
+++ b/e-util/e-sorter-array.c
@@ -1,5 +1,5 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
+/*
* e-sorter-array.c
* Copyright 2000, 2001, Ximian, Inc.
*
diff --git a/e-util/e-sorter-array.h b/e-util/e-sorter-array.h
index a80534c0e5..803b67052a 100644
--- a/e-util/e-sorter-array.h
+++ b/e-util/e-sorter-array.h
@@ -27,9 +27,8 @@
#include <gtk/gtkobject.h>
#include <gal/util/e-sorter.h>
#include <glib.h>
-#include <libgnome/gnome-defs.h>
-BEGIN_GNOME_DECLS
+G_BEGIN_DECLS
#define E_SORTER_ARRAY_TYPE (e_sorter_array_get_type ())
#define E_SORTER_ARRAY(o) (GTK_CHECK_CAST ((o), E_SORTER_ARRAY_TYPE, ESorterArray))
@@ -73,6 +72,6 @@ void e_sorter_array_set_count (ESorterArray *esa,
void e_sorter_array_append (ESorterArray *esa,
int count);
-END_GNOME_DECLS
+G_END_DECLS
#endif /* _E_SORTER_ARRAY_H_ */
diff --git a/e-util/e-sorter.c b/e-util/e-sorter.c
index 4f6c8e069a..2040241abe 100644
--- a/e-util/e-sorter.c
+++ b/e-util/e-sorter.c
@@ -1,5 +1,5 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
+/*
* e-sorter.c
* Copyright 2000, 2001, Ximian, Inc.
*
@@ -34,7 +34,7 @@
static GtkObjectClass *parent_class;
-#define ES_CLASS(es) ((ESorterClass *)((GtkObject *)(es))->klass)
+#define ES_CLASS(es) ((ESorterClass *)((GTypeInstance *)(es))->g_class)
static gint es_model_to_sorted (ESorter *es, int row);
static gint es_sorted_to_model (ESorter *es, int row);
diff --git a/e-util/e-text-event-processor-types.h b/e-util/e-text-event-processor-types.h
index 0881438cec..5cb3f198d7 100644
--- a/e-util/e-text-event-processor-types.h
+++ b/e-util/e-text-event-processor-types.h
@@ -24,12 +24,11 @@
#ifndef __E_TEXT_EVENT_PROCESSOR_TYPES_H__
#define __E_TEXT_EVENT_PROCESSOR_TYPES_H__
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
+#include <glib/gmacros.h>
-#include <gdk/gdktypes.h>
+G_BEGIN_DECLS
+
+#include <gdk/gdkevents.h>
typedef union _ETextEventProcessorEvent ETextEventProcessorEvent;
@@ -128,9 +127,6 @@ typedef enum _ETextEventProcessorCaps {
E_TEP_CAPS_TITLE
} ETextEventProcessorCaps;
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
+G_END_DECLS
#endif /* __E_TEXT_EVENT_PROCESSOR_TYPES_H__ */
diff --git a/e-util/e-text-event-processor.c b/e-util/e-text-event-processor.c
index b24ce2433a..c8b9437714 100644
--- a/e-util/e-text-event-processor.c
+++ b/e-util/e-text-event-processor.c
@@ -110,11 +110,10 @@ e_text_event_processor_init (ETextEventProcessor *tep)
gint
e_text_event_processor_handle_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event)
{
- if (E_TEXT_EVENT_PROCESSOR_CLASS(GTK_OBJECT(tep)->klass)->event) {
- return E_TEXT_EVENT_PROCESSOR_CLASS(GTK_OBJECT(tep)->klass)->event(tep, event);
- } else {
+ if (E_TEXT_EVENT_PROCESSOR_CLASS (GTK_OBJECT_GET_CLASS (tep))->event)
+ return E_TEXT_EVENT_PROCESSOR_CLASS(GTK_OBJECT_GET_CLASS (tep))->event(tep, event);
+ else
return 0;
- }
}
/* Set_arg handler for the text item */
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 87a320597b..135386f1cf 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -23,8 +23,8 @@
#include <config.h>
#include "e-util.h"
+#include "e-i18n.h"
-#include <gal/widgets/e-unicode.h>
#include <glib.h>
#include <gtk/gtkobject.h>
#include <errno.h>
@@ -37,7 +37,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
-#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-util.h>
#include <math.h>
@@ -323,552 +322,10 @@ e_read_uri(const char *uri)
}
#endif
-typedef gint (*GtkSignal_INT__INT_INT_POINTER) (GtkObject * object,
- gint arg1,
- gint arg2,
- gpointer arg3,
- gpointer user_data);
+/* Include build marshalers */
-void
-e_marshal_INT__INT_INT_POINTER (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_INT__INT_INT_POINTER rfunc;
- gint *return_val;
- return_val = GTK_RETLOC_INT (args[3]);
- rfunc = (GtkSignal_INT__INT_INT_POINTER) func;
- *return_val = (*rfunc) (object,
- GTK_VALUE_INT (args[0]),
- GTK_VALUE_INT (args[1]),
- GTK_VALUE_POINTER (args[2]),
- func_data);
-}
-
-typedef gint (*GtkSignal_INT__INT_POINTER_INT_POINTER) (GtkObject * object,
- gint arg1,
- gpointer arg2,
- gint arg3,
- gpointer arg4,
- gpointer user_data);
-
-void
-e_marshal_INT__INT_POINTER_INT_POINTER (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_INT__INT_POINTER_INT_POINTER rfunc;
- gint *return_val;
- return_val = GTK_RETLOC_INT (args[4]);
- rfunc = (GtkSignal_INT__INT_POINTER_INT_POINTER) func;
- *return_val = (*rfunc) (object,
- GTK_VALUE_INT (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_INT (args[2]),
- GTK_VALUE_POINTER (args[3]),
- func_data);
-}
-
-typedef void (*GtkSignal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL) (GtkObject * object,
- GtkObject *arg1,
- gdouble arg2,
- gdouble arg3,
- gboolean arg4,
- gpointer user_data);
-
-void
-e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL rfunc;
- rfunc = (GtkSignal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL) func;
- (*rfunc) (object,
- GTK_VALUE_OBJECT (args[0]),
- GTK_VALUE_DOUBLE (args[1]),
- GTK_VALUE_DOUBLE (args[2]),
- GTK_VALUE_BOOL (args[3]),
- func_data);
-}
-
-typedef gdouble (*GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL) (GtkObject * object,
- GtkObject *arg1,
- gdouble arg2,
- gdouble arg3,
- gboolean arg4,
- gpointer user_data);
-
-void
-e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL rfunc;
- gdouble *return_val;
- return_val = GTK_RETLOC_DOUBLE (args[4]);
- rfunc = (GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL) func;
- *return_val = (*rfunc) (object,
- GTK_VALUE_OBJECT (args[0]),
- GTK_VALUE_DOUBLE (args[1]),
- GTK_VALUE_DOUBLE (args[2]),
- GTK_VALUE_BOOL (args[3]),
- func_data);
-}
-
-typedef gdouble (*GtkSignal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL) (GtkObject * object,
- GtkObject *arg1,
- gdouble arg2,
- gdouble arg3,
- gboolean arg4,
- gpointer user_data);
-
-void
-e_marshal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL rfunc;
- gboolean *return_val;
- return_val = GTK_RETLOC_BOOL (args[4]);
- rfunc = (GtkSignal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL) func;
- *return_val = (*rfunc) (object,
- GTK_VALUE_OBJECT (args[0]),
- GTK_VALUE_DOUBLE (args[1]),
- GTK_VALUE_DOUBLE (args[2]),
- GTK_VALUE_BOOL (args[3]),
- func_data);
-}
-
-typedef void (*GtkSignal_NONE__INT_INT_POINTER_POINTER_INT_INT) (GtkObject * object,
- gint arg1,
- gint arg2,
- gpointer arg3,
- gpointer arg4,
- gint arg5,
- gint arg6,
- gpointer user_data);
-void
-e_marshal_NONE__INT_INT_POINTER_POINTER_INT_INT (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_NONE__INT_INT_POINTER_POINTER_INT_INT rfunc;
- rfunc = (GtkSignal_NONE__INT_INT_POINTER_POINTER_INT_INT) func;
- (*rfunc) (object,
- GTK_VALUE_INT (args[0]), GTK_VALUE_INT (args[1]),
- GTK_VALUE_POINTER (args[2]),
- GTK_VALUE_POINTER (args[3]),
- GTK_VALUE_INT (args[4]), GTK_VALUE_INT (args[5]), func_data);
-}
-
-typedef void (*GtkSignal_NONE__INT_POINTER_INT_POINTER_POINTER_INT_INT) (GtkObject * object,
- gint arg1,
- gpointer arg2,
- gint arg3,
- gpointer arg4,
- gpointer arg5,
- gint arg6,
- gint arg7,
- gpointer user_data);
-void
-e_marshal_NONE__INT_POINTER_INT_POINTER_POINTER_INT_INT (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_NONE__INT_POINTER_INT_POINTER_POINTER_INT_INT rfunc;
- rfunc = (GtkSignal_NONE__INT_POINTER_INT_POINTER_POINTER_INT_INT) func;
- (*rfunc) (object,
- GTK_VALUE_INT (args[0]), GTK_VALUE_POINTER (args[1]), GTK_VALUE_INT (args[2]),
- GTK_VALUE_POINTER (args[3]),
- GTK_VALUE_POINTER (args[4]),
- GTK_VALUE_INT (args[5]), GTK_VALUE_INT (args[6]), func_data);
-}
-
-typedef void (*GtkSignal_NONE__INT_INT_POINTER_INT) (GtkObject * object,
- gint arg1,
- gint arg2,
- gpointer arg3,
- gint arg4, gpointer user_data);
-void
-e_marshal_NONE__INT_INT_POINTER_INT (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_NONE__INT_INT_POINTER_INT rfunc;
- rfunc = (GtkSignal_NONE__INT_INT_POINTER_INT) func;
- (*rfunc) (object,
- GTK_VALUE_INT (args[0]), GTK_VALUE_INT (args[1]),
- GTK_VALUE_POINTER (args[2]), GTK_VALUE_INT (args[3]), func_data);
-}
-
-typedef void (*GtkSignal_NONE__INT_POINTER_INT_POINTER_INT) (GtkObject * object,
- gint arg1,
- gpointer arg2,
- gint arg3,
- gpointer arg4,
- gint arg5, gpointer user_data);
-void
-e_marshal_NONE__INT_POINTER_INT_POINTER_INT (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_NONE__INT_POINTER_INT_POINTER_INT rfunc;
- rfunc = (GtkSignal_NONE__INT_POINTER_INT_POINTER_INT) func;
- (*rfunc) (object,
- GTK_VALUE_INT (args[0]), GTK_VALUE_POINTER (args[1]), GTK_VALUE_INT (args[2]),
- GTK_VALUE_POINTER (args[3]), GTK_VALUE_INT (args[4]), func_data);
-}
-
-typedef gboolean (*GtkSignal_BOOL__INT_INT_POINTER_INT_INT_INT) (GtkObject * object,
- gint arg1,
- gint arg2,
- gpointer arg3,
- gint arg4,
- gint arg5,
- gint arg6,
- gpointer user_data);
-void
-e_marshal_BOOL__INT_INT_POINTER_INT_INT_INT (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_BOOL__INT_INT_POINTER_INT_INT_INT rfunc;
- gboolean *return_val;
- return_val = GTK_RETLOC_BOOL (args[6]);
- rfunc = (GtkSignal_BOOL__INT_INT_POINTER_INT_INT_INT) func;
- *return_val = (*rfunc) (object,
- GTK_VALUE_INT (args[0]),
- GTK_VALUE_INT (args[1]),
- GTK_VALUE_POINTER (args[2]),
- GTK_VALUE_INT (args[3]),
- GTK_VALUE_INT (args[4]),
- GTK_VALUE_INT (args[5]), func_data);
-}
-
-typedef gboolean (*GtkSignal_BOOL__INT_POINTER_INT_POINTER_INT_INT_INT) (GtkObject * object,
- gint arg1,
- gpointer arg2,
- gint arg3,
- gpointer arg4,
- gint arg5,
- gint arg6,
- gint arg7,
- gpointer user_data);
-void
-e_marshal_BOOL__INT_POINTER_INT_POINTER_INT_INT_INT (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_BOOL__INT_POINTER_INT_POINTER_INT_INT_INT rfunc;
- gboolean *return_val;
- return_val = GTK_RETLOC_BOOL (args[7]);
- rfunc = (GtkSignal_BOOL__INT_POINTER_INT_POINTER_INT_INT_INT) func;
- *return_val = (*rfunc) (object,
- GTK_VALUE_INT (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_INT (args[2]),
- GTK_VALUE_POINTER (args[3]),
- GTK_VALUE_INT (args[4]),
- GTK_VALUE_INT (args[5]),
- GTK_VALUE_INT (args[6]), func_data);
-}
-
-typedef void (*GtkSignal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT) (GtkObject *
- object,
- gint arg1,
- gint arg2,
- gpointer
- arg3,
- gint arg4,
- gint arg5,
- gpointer
- arg6,
- gint arg7,
- gint arg8,
- gpointer
- user_data);
-
-void
-e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg * args)
-{
- GtkSignal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT rfunc;
- rfunc = (GtkSignal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT) func;
- (*rfunc) (object,
- GTK_VALUE_INT (args[0]), GTK_VALUE_INT (args[1]),
- GTK_VALUE_POINTER (args[2]),
- GTK_VALUE_INT (args[3]),
- GTK_VALUE_INT (args[4]),
- GTK_VALUE_POINTER (args[5]),
- GTK_VALUE_INT (args[6]), GTK_VALUE_INT (args[7]), func_data);
-}
-
-typedef void (*GtkSignal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_INT_INT) (GtkObject *
- object,
- gint arg1,
- gpointer arg2,
- gint arg3,
- gpointer arg4,
- gint arg5,
- gint arg6,
- gpointer arg7,
- gint arg8,
- gint arg9,
- gpointer user_data);
-
-void
-e_marshal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_INT_INT (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg * args)
-{
- GtkSignal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_INT_INT rfunc;
- rfunc = (GtkSignal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_INT_INT) func;
- (*rfunc) (object,
- GTK_VALUE_INT (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_INT (args[2]),
- GTK_VALUE_POINTER (args[3]),
- GTK_VALUE_INT (args[4]),
- GTK_VALUE_INT (args[5]),
- GTK_VALUE_POINTER (args[6]),
- GTK_VALUE_INT (args[7]), GTK_VALUE_INT (args[8]), func_data);
-}
-
-typedef void (*GtkSignal_NONE__POINTER_POINTER_INT) (GtkObject *, gpointer,
- gpointer, gint, gpointer);
-
-void
-e_marshal_NONE__POINTER_POINTER_INT (GtkObject * object, GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_NONE__POINTER_POINTER_INT rfunc;
- rfunc = (GtkSignal_NONE__POINTER_POINTER_INT) func;
- (*rfunc) (object, GTK_VALUE_POINTER (args[0]), GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_INT (args[2]), func_data);
-}
-
-typedef void (*GtkSignal_NONE__INT_POINTER_INT_POINTER) (GtkObject *, gint, gpointer,
- gint, gpointer, gpointer);
-
-void
-e_marshal_NONE__INT_POINTER_INT_POINTER (GtkObject * object, GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_NONE__INT_POINTER_INT_POINTER rfunc;
- rfunc = (GtkSignal_NONE__INT_POINTER_INT_POINTER) func;
- (*rfunc) (object, GTK_VALUE_INT (args[0]), GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_INT (args[2]), GTK_VALUE_POINTER (args[3]), func_data);
-}
-
-typedef void (*GtkSignal_NONE__POINTER_POINTER_POINTER_POINTER) (GtkObject *,
- gpointer, gpointer, gpointer, gpointer,
- gpointer);
-
-void
-e_marshal_NONE__POINTER_POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_NONE__POINTER_POINTER_POINTER_POINTER rfunc;
- rfunc = (GtkSignal_NONE__POINTER_POINTER_POINTER_POINTER) func;
- (*rfunc) (object, GTK_VALUE_POINTER (args[0]), GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_POINTER (args[2]), GTK_VALUE_POINTER (args[3]), func_data);
-}
-
-typedef int (*GtkSignal_INT__POINTER_POINTER) (GtkObject *,
- gpointer, gpointer,
- gpointer user_data);
-void
-e_marshal_INT__POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_INT__POINTER_POINTER rfunc;
- int *return_val;
-
- rfunc = (GtkSignal_INT__POINTER_POINTER) func;
- return_val = GTK_RETLOC_INT (args[2]);
-
- *return_val = (*rfunc) (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_POINTER (args[1]),
- func_data);
-}
-
-typedef int (*GtkSignal_INT__POINTER_POINTER_POINTER) (GtkObject *,
- gpointer, gpointer, gpointer,
- gpointer user_data);
-void
-e_marshal_INT__POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_INT__POINTER_POINTER_POINTER rfunc;
- int *return_val;
-
- rfunc = (GtkSignal_INT__POINTER_POINTER_POINTER) func;
- return_val = GTK_RETLOC_INT (args[3]);
-
- *return_val = (*rfunc) (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_POINTER (args[2]),
- func_data);
-}
-
-typedef int (*GtkSignal_INT__POINTER_POINTER_POINTER_POINTER) (GtkObject *,
- gpointer, gpointer, gpointer, gpointer,
- gpointer user_data);
-void
-e_marshal_INT__POINTER_POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_INT__POINTER_POINTER_POINTER_POINTER rfunc;
- int *return_val;
-
- rfunc = (GtkSignal_INT__POINTER_POINTER_POINTER_POINTER) func;
- return_val = GTK_RETLOC_INT (args[4]);
-
- *return_val = (*rfunc) (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_POINTER (args[2]),
- GTK_VALUE_POINTER (args[3]),
- func_data);
-}
-
-
-typedef int (*GtkSignal_INT__POINTER_POINTER_POINTER_POINTER_POINTER) (GtkObject *,
- gpointer, gpointer, gpointer, gpointer, gpointer,
- gpointer user_data);
-void
-e_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_INT__POINTER_POINTER_POINTER_POINTER_POINTER rfunc;
- int *return_val;
-
- rfunc = (GtkSignal_INT__POINTER_POINTER_POINTER_POINTER_POINTER) func;
- return_val = GTK_RETLOC_INT (args[4]);
-
- *return_val = (*rfunc) (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_POINTER (args[2]),
- GTK_VALUE_POINTER (args[3]),
- GTK_VALUE_POINTER (args[4]),
- func_data);
-}
-
-typedef void (*GtkSignal_NONE__POINTER_POINTER_POINTER_BOOL) (GtkObject *,
- gpointer, gpointer, gpointer, gboolean,
- gpointer user_data);
-
-void
-e_marshal_NONE__POINTER_POINTER_POINTER_BOOL (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_NONE__POINTER_POINTER_POINTER_BOOL rfunc;
-
- rfunc = (GtkSignal_NONE__POINTER_POINTER_POINTER_BOOL) func;
-
- (*rfunc) (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_POINTER (args[2]),
- GTK_VALUE_BOOL (args[3]),
- func_data);
-}
-
-void
-e_marshal_NONE__POINTER_INT_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- (* (void (*)(GtkObject *, gpointer, int, int, int, gpointer)) func)
- (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_INT (args[1]),
- GTK_VALUE_INT (args[2]),
-
- GTK_VALUE_INT (args[3]),
- func_data);
-}
-
-typedef int (*GtkSignal_INT__OBJECT_POINTER) (GtkObject *,
- GtkObject *, gpointer,
- gpointer user_data);
-void
-e_marshal_INT__OBJECT_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_INT__OBJECT_POINTER rfunc;
- int *return_val;
-
- rfunc = (GtkSignal_INT__OBJECT_POINTER) func;
- return_val = GTK_RETLOC_INT (args[2]);
-
- *return_val = (*rfunc) (object,
- GTK_VALUE_OBJECT (args[0]),
- GTK_VALUE_POINTER (args[1]),
- func_data);
-}
-
-typedef void (*GtkSignal_NONE__DOUBLE) (GtkObject *,
- gdouble,
- gpointer user_data);
-void
-e_marshal_NONE__DOUBLE (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_NONE__DOUBLE rfunc;
-
- rfunc = (GtkSignal_NONE__DOUBLE) func;
-
- (*rfunc) (object,
- GTK_VALUE_DOUBLE (args[0]),
- func_data);
-}
-
-typedef gboolean (*GtkSignal_BOOL__STRING_INT) (GtkObject *,
- char *,
- gint,
- gpointer user_data);
-
-void
-e_marshal_BOOL__STRING_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_BOOL__STRING_INT rfunc;
- gboolean *return_val;
-
- rfunc = (GtkSignal_BOOL__STRING_INT) func;
- return_val = GTK_RETLOC_BOOL (args[2]);
-
- *return_val = (*rfunc) (object,
- GTK_VALUE_STRING (args[0]),
- GTK_VALUE_INT (args[1]),
- func_data);
-}
+#include "e-marshal.h"
+#include "e-marshal.c"
gchar**
e_strsplit (const gchar *string,
@@ -1666,3 +1123,18 @@ e_strdupv (const gchar **str_array)
return NULL;
}
}
+
+char *
+e_gettext (const char *msgid)
+{
+ static gboolean initialized = FALSE;
+
+ if (!initialized) {
+ bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ initialized = TRUE;
+ }
+
+ return dgettext (GETTEXT_PACKAGE, msgid);
+}
+
diff --git a/e-util/e-util.h b/e-util/e-util.h
index 1c558f485e..b7a30d3dd3 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -25,7 +25,7 @@
#define _E_UTIL_H_
#include <sys/types.h>
-#include <gtk/gtktypeutils.h>
+#include <glib-object.h>
#include <limits.h>
#ifdef __cplusplus
@@ -33,24 +33,30 @@ extern "C" {
#pragma }
#endif /* __cplusplus */
+#include <gal/util/e-marshal.h>
+
#define E_MAKE_TYPE(l,str,t,ci,i,parent) \
-GtkType l##_get_type(void)\
+GType l##_get_type(void)\
{\
- static GtkType type = 0;\
- if (!type){\
- GtkTypeInfo info = {\
- str,\
- sizeof (t),\
- sizeof (t##Class),\
- (GtkClassInitFunc) ci,\
- (GtkObjectInitFunc) i,\
- NULL, /* reserved 1 */\
- NULL, /* reserved 2 */\
- (GtkClassInitFunc) NULL\
- };\
- type = gtk_type_unique (parent, &info);\
- }\
- return type;\
+ static GType type = 0; \
+ if (!type){ \
+ static GTypeInfo const object_info = { \
+ sizeof (t##Class), \
+ \
+ (GBaseInitFunc) NULL, \
+ (GBaseFinalizeFunc) NULL, \
+ \
+ (GClassInitFunc) ci, \
+ (GClassFinalizeFunc) NULL, \
+ NULL, /* class_data */ \
+ \
+ sizeof (t), \
+ 0, /* n_preallocs */ \
+ (GInstanceInitFunc) i, \
+ }; \
+ type = g_type_register_static (parent, str, &object_info, 0); \
+ } \
+ return type; \
}
@@ -110,7 +116,7 @@ GtkType l##_get_type(void)\
}
-#if 1
+#if 0
# define E_OBJECT_CLASS_ADD_SIGNALS(oc,sigs,last) \
gtk_object_class_add_signals (oc, sigs, last)
# define E_OBJECT_CLASS_TYPE(oc) (oc)->type
@@ -160,33 +166,33 @@ gchar **e_strdupv (cons
typedef int (*ESortCompareFunc) (const void *first,
const void *second,
gpointer closure);
-void e_sort (void *base,
- size_t nmemb,
- size_t size,
- ESortCompareFunc compare,
- gpointer closure);
-void e_bsearch (const void *key,
- const void *base,
- size_t nmemb,
- size_t size,
- ESortCompareFunc compare,
- gpointer closure,
- size_t *start,
- size_t *end);
-size_t e_strftime_fix_am_pm (char *s,
- size_t max,
- const char *fmt,
- const struct tm *tm);
-
-size_t e_strftime (char *s,
- size_t max,
- const char *fmt,
- const struct tm *tm);
-
+void e_sort (void *base,
+ size_t nmemb,
+ size_t size,
+ ESortCompareFunc compare,
+ gpointer closure);
+void e_bsearch (const void *key,
+ const void *base,
+ size_t nmemb,
+ size_t size,
+ ESortCompareFunc compare,
+ gpointer closure,
+ size_t *start,
+ size_t *end);
+size_t e_strftime_fix_am_pm (char *s,
+ size_t max,
+ const char *fmt,
+ const struct tm *tm);
+
+size_t e_strftime (char *s,
+ size_t max,
+ const char *fmt,
+ const struct tm *tm);
/* String to/from double conversion functions */
-gdouble e_flexible_strtod (const gchar *nptr,
- gchar **endptr);
+gdouble e_flexible_strtod (const gchar *nptr,
+ gchar **endptr);
+
/* 29 bytes should enough for all possible values that
* g_ascii_dtostr can produce with the %.17g format.
* Then add 10 for good measure */
@@ -201,127 +207,6 @@ gchar *e_ascii_dtostr (gcha
gchar *e_strdup_append_strings (gchar *first_string,
...);
-/* Marshallers */
-void e_marshal_INT__INT_INT_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_INT__INT_POINTER_INT_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#define e_marshal_NONE__INT_INT_POINTER_POINTER_UINT_UINT e_marshal_NONE__INT_INT_POINTER_POINTER_INT_INT
-void e_marshal_NONE__INT_INT_POINTER_POINTER_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#define e_marshal_NONE__INT_POINTER_INT_POINTER_POINTER_UINT_UINT e_marshal_NONE__INT_POINTER_INT_POINTER_POINTER_INT_INT
-void e_marshal_NONE__INT_POINTER_INT_POINTER_POINTER_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#define e_marshal_NONE__INT_INT_POINTER_UINT e_marshal_NONE__INT_INT_POINTER_INT
-void e_marshal_NONE__INT_INT_POINTER_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#define e_marshal_NONE__INT_POINTER_INT_POINTER_UINT e_marshal_NONE__INT_POINTER_INT_POINTER_INT
-void e_marshal_NONE__INT_POINTER_INT_POINTER_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#define e_marshal_BOOL__INT_INT_POINTER_INT_INT_UINT e_marshal_BOOL__INT_INT_POINTER_INT_INT_INT
-void e_marshal_BOOL__INT_INT_POINTER_INT_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#define e_marshal_BOOL__INT_POINTER_INT_POINTER_INT_INT_UINT e_marshal_BOOL__INT_POINTER_INT_POINTER_INT_INT_INT
-void e_marshal_BOOL__INT_POINTER_INT_POINTER_INT_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#define e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_UINT_UINT e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT
-void e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#define e_marshal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_UINT_UINT e_marshal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_INT_INT
-void e_marshal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_NONE__POINTER_POINTER_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_NONE__INT_POINTER_INT_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_NONE__POINTER_POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_INT__POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_INT__POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_INT__POINTER_POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_NONE__POINTER_POINTER_POINTER_BOOL (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_NONE__POINTER_INT_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_INT__OBJECT_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_NONE__DOUBLE (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#define e_marshal_BOOL__STRING_ENUM e_marshal_BOOL__STRING_INT
-void e_marshal_BOOL__STRING_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/e-util/e-xml-utils.c b/e-util/e-xml-utils.c
index f80d6f0b93..4bc1b9e7d7 100644
--- a/e-util/e-xml-utils.c
+++ b/e-util/e-xml-utils.c
@@ -42,9 +42,9 @@
#include <fcntl.h>
#include <errno.h>
#include <math.h>
-
-#include <parser.h>
-#include <xmlmemory.h>
+#include <string.h>
+#include <libxml/parser.h>
+#include <libxml/xmlmemory.h>
#include "gal/util/e-i18n.h"
#include "gal/util/e-util.h"
@@ -104,7 +104,7 @@ e_xml_get_child_by_name_by_lang (const xmlNode *parent,
static xmlNode *
e_xml_get_child_by_name_by_lang_list_with_score (const xmlNode *parent,
const gchar *name,
- GList *lang_list,
+ const GList *lang_list,
gint *best_lang_score)
{
xmlNodePtr best_node = NULL, node;
@@ -117,7 +117,7 @@ e_xml_get_child_by_name_by_lang_list_with_score (const xmlNode *parent,
}
lang = xmlGetProp (node, "xml:lang");
if (lang != NULL) {
- GList *l;
+ const GList *l;
gint i;
for (l = lang_list, i = 0;
@@ -149,7 +149,7 @@ e_xml_get_child_by_name_by_lang_list_with_score (const xmlNode *parent,
xmlNode *
e_xml_get_child_by_name_by_lang_list (const xmlNode *parent,
const gchar *name,
- GList *lang_list)
+ const GList *lang_list)
{
gint best_lang_score = INT_MAX;
@@ -441,320 +441,3 @@ e_xml_get_translated_string_prop_by_name (const xmlNode *parent, const xmlChar *
}
-/* Replacement for xmlSaveFile */
-
-static void xmlNodeDump (xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, int format);
-
-
-static void
-xmlAttrDump (xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur)
-{
- xmlChar *value;
-
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- fprintf(stderr, "xmlAttrDump : property == NULL\n");
-#endif
- return;
- }
-
- xmlBufferWriteChar (buf, " ");
- if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
- xmlBufferWriteCHAR (buf, cur->ns->prefix);
- xmlBufferWriteChar (buf, ":");
- }
-
- xmlBufferWriteCHAR (buf, cur->name);
- value = xmlNodeListGetString (doc, cur->val, 0);
- if (value) {
- xmlBufferWriteChar (buf, "=");
- xmlBufferWriteQuotedString (buf, value);
- xmlFree (value);
- } else {
- xmlBufferWriteChar (buf, "=\"\"");
- }
-}
-
-static void
-xmlAttrListDump (xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur)
-{
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- fprintf(stderr, "xmlAttrListDump : property == NULL\n");
-#endif
- return;
- }
-
- while (cur != NULL) {
- xmlAttrDump (buf, doc, cur);
- cur = cur->next;
- }
-}
-
-static void
-xmlNodeListDump (xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, int format)
-{
- int i;
-
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- fprintf(stderr, "xmlNodeListDump : node == NULL\n");
-#endif
- return;
- }
-
- while (cur != NULL) {
- if ((format) && (xmlIndentTreeOutput) &&
- (cur->type == XML_ELEMENT_NODE))
- for (i = 0; i < level; i++)
- xmlBufferWriteChar (buf, " ");
- xmlNodeDump (buf, doc, cur, level, format);
- if (format) {
- xmlBufferWriteChar (buf, "\n");
- }
- cur = cur->next;
- }
-}
-
-static void
-xmlNodeDump (xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, int format)
-{
- int i;
- xmlNodePtr tmp;
-
- if (cur == NULL) {
-#ifdef DEBUG_TREE
- fprintf(stderr, "xmlNodeDump : node == NULL\n");
-#endif
- return;
- }
-
- if (cur->type == XML_TEXT_NODE) {
- if (cur->content != NULL) {
- xmlChar *buffer;
-
-#ifndef XML_USE_BUFFER_CONTENT
- buffer = xmlEncodeEntitiesReentrant (doc, cur->content);
-#else
- buffer = xmlEncodeEntitiesReentrant (doc, xmlBufferContent (cur->content));
-#endif
- if (buffer != NULL) {
- xmlBufferWriteCHAR (buf, buffer);
- xmlFree (buffer);
- }
- }
- return;
- }
-
- if (cur->type == XML_PI_NODE) {
- if (cur->content != NULL) {
- xmlBufferWriteChar (buf, "<?");
- xmlBufferWriteCHAR (buf, cur->name);
- if (cur->content != NULL) {
- xmlBufferWriteChar (buf, " ");
-#ifndef XML_USE_BUFFER_CONTENT
- xmlBufferWriteCHAR (buf, cur->content);
-#else
- xmlBufferWriteCHAR (buf, xmlBufferContent (cur->content));
-#endif
- }
- xmlBufferWriteChar (buf, "?>");
- }
- return;
- }
-
- if (cur->type == XML_COMMENT_NODE) {
- if (cur->content != NULL) {
- xmlBufferWriteChar (buf, "<!--");
-#ifndef XML_USE_BUFFER_CONTENT
- xmlBufferWriteCHAR (buf, cur->content);
-#else
- xmlBufferWriteCHAR (buf, xmlBufferContent (cur->content));
-#endif
- xmlBufferWriteChar (buf, "-->");
- }
- return;
- }
-
- if (cur->type == XML_ENTITY_REF_NODE) {
- xmlBufferWriteChar (buf, "&");
- xmlBufferWriteCHAR (buf, cur->name);
- xmlBufferWriteChar (buf, ";");
- return;
- }
-
- if (cur->type == XML_CDATA_SECTION_NODE) {
- xmlBufferWriteChar (buf, "<![CDATA[");
- if (cur->content != NULL)
-#ifndef XML_USE_BUFFER_CONTENT
- xmlBufferWriteCHAR (buf, cur->content);
-#else
- xmlBufferWriteCHAR (buf, xmlBufferContent(cur->content));
-#endif
- xmlBufferWriteChar (buf, "]]>");
- return;
- }
-
- if (format == 1) {
- tmp = cur->childs;
- while (tmp != NULL) {
- if ((tmp->type == XML_TEXT_NODE) ||
- (tmp->type == XML_ENTITY_REF_NODE)) {
- format = 0;
- break;
- }
- tmp = tmp->next;
- }
- }
-
- xmlBufferWriteChar (buf, "<");
- if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
- xmlBufferWriteCHAR (buf, cur->ns->prefix);
- xmlBufferWriteChar (buf, ":");
- }
-
- xmlBufferWriteCHAR (buf, cur->name);
-
- if (cur->properties != NULL)
- xmlAttrListDump (buf, doc, cur->properties);
-
- if ((cur->content == NULL) && (cur->childs == NULL) &&
- (!xmlSaveNoEmptyTags)) {
- xmlBufferWriteChar (buf, "/>");
- return;
- }
-
- xmlBufferWriteChar (buf, ">");
- if (cur->content != NULL) {
- xmlChar *buffer;
-
-#ifndef XML_USE_BUFFER_CONTENT
- buffer = xmlEncodeEntitiesReentrant (doc, cur->content);
-#else
- buffer = xmlEncodeEntitiesReentrant (doc, xmlBufferContent (cur->content));
-#endif
- if (buffer != NULL) {
- xmlBufferWriteCHAR (buf, buffer);
- xmlFree (buffer);
- }
- }
-
- if (cur->childs != NULL) {
- if (format)
- xmlBufferWriteChar (buf, "\n");
-
- xmlNodeListDump (buf, doc, cur->childs, (level >= 0 ? level + 1 : -1), format);
- if ((xmlIndentTreeOutput) && (format))
- for (i = 0; i < level; i++)
- xmlBufferWriteChar (buf, " ");
- }
-
- xmlBufferWriteChar (buf, "</");
- if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
- xmlBufferWriteCHAR (buf, cur->ns->prefix);
- xmlBufferWriteChar (buf, ":");
- }
-
- xmlBufferWriteCHAR (buf, cur->name);
- xmlBufferWriteChar (buf, ">");
-}
-
-static void
-xmlDocContentDump (xmlBufferPtr buf, xmlDocPtr cur)
-{
- xmlBufferWriteChar (buf, "<?xml version=");
-
- if (cur->version != NULL)
- xmlBufferWriteQuotedString (buf, cur->version);
- else
- xmlBufferWriteChar (buf, "\"1.0\"");
-
- if ((cur->encoding != NULL) &&
- (strcasecmp (cur->encoding, "UTF-8") != 0)) {
- xmlBufferWriteChar (buf, " encoding=");
- xmlBufferWriteQuotedString (buf, cur->encoding);
- }
-
- switch (cur->standalone) {
- case 1:
- xmlBufferWriteChar (buf, " standalone=\"yes\"");
- break;
- }
-
- xmlBufferWriteChar (buf, "?>\n");
- if (cur->root != NULL) {
- xmlNodePtr child = cur->root;
-
- while (child != NULL) {
- xmlNodeDump (buf, cur, child, 0, 1);
- xmlBufferWriteChar (buf, "\n");
- child = child->next;
- }
- }
-}
-
-int
-e_xml_save_file (const char *filename, xmlDocPtr doc)
-{
- char *filesave, *slash;
- size_t n, written = 0;
- xmlBufferPtr buf;
- int errnosave;
- int ret, fd;
- ssize_t w;
-
- filesave = alloca (strlen (filename) + 5);
- slash = strrchr (filename, '/');
- if (slash)
- sprintf (filesave, "%.*s.#%s", slash - filename + 1, filename, slash + 1);
- else
- sprintf (filesave, ".#%s", filename);
-
- fd = open (filesave, O_WRONLY | O_CREAT | O_TRUNC, 0600);
- if (fd == -1)
- return -1;
-
- if (!(buf = xmlBufferCreate ())) {
- close (fd);
- unlink (filesave);
- errno = ENOMEM;
- return -1;
- }
-
- xmlDocContentDump (buf, doc);
-
- n = buf->use;
- do {
- do {
- w = write (fd, buf->content + written, n - written);
- } while (w == -1 && errno == EINTR);
-
- if (w > 0)
- written += w;
- } while (w != -1 && written < n);
-
- xmlBufferFree (buf);
-
- if (written < n || fsync (fd) == -1) {
- errnosave = errno;
- close (fd);
- unlink (filesave);
- errno = errnosave;
- return -1;
- }
-
- while ((ret = close (fd)) == -1 && errno == EINTR)
- ;
-
- if (ret == -1)
- return -1;
-
- if (rename (filesave, filename) == -1) {
- errnosave = errno;
- unlink (filesave);
- errno = errnosave;
- return -1;
- }
-
- return 0;
-}
diff --git a/e-util/e-xml-utils.h b/e-util/e-xml-utils.h
index b0811da013..ad16b10ea6 100644
--- a/e-util/e-xml-utils.h
+++ b/e-util/e-xml-utils.h
@@ -24,11 +24,10 @@
#ifndef __E_XML_UTILS__
#define __E_XML_UTILS__
-#include <libgnome/gnome-defs.h>
#include <glib.h>
-#include <gnome-xml/tree.h>
+#include <libxml/tree.h>
-BEGIN_GNOME_DECLS
+G_BEGIN_DECLS
xmlNode *e_xml_get_child_by_name (const xmlNode *parent,
const xmlChar *child_name);
@@ -39,7 +38,7 @@ xmlNode *e_xml_get_child_by_name_by_lang (const xmlNode *parent,
/* lang_list set to NULL means use the current locale. */
xmlNode *e_xml_get_child_by_name_by_lang_list (const xmlNode *parent,
const gchar *name,
- GList *lang_list);
+ const GList *lang_list);
xmlNode *e_xml_get_child_by_name_no_lang (const xmlNode *parent,
const gchar *name);
@@ -95,9 +94,6 @@ void e_xml_set_string_prop_by_name (xmlNode *parent,
gchar *e_xml_get_translated_string_prop_by_name (const xmlNode *parent,
const xmlChar *prop_name);
-
-int e_xml_save_file (const char *filename, xmlDocPtr doc);
-
-END_GNOME_DECLS
+G_END_DECLS
#endif /* __E_XML_UTILS__ */