diff options
184 files changed, 2090 insertions, 3955 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__ */ diff --git a/widgets/menus/gal-define-views-dialog.c b/widgets/menus/gal-define-views-dialog.c index d692077d45..5eb08aac4b 100644 --- a/widgets/menus/gal-define-views-dialog.c +++ b/widgets/menus/gal-define-views-dialog.c @@ -26,7 +26,8 @@ #include "gal-define-views-dialog.h" #include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-stock.h> +#include <gtk/gtksignal.h> +#include <gtk/gtk.h> #include "gal-define-views-model.h" #include "gal-view-new-dialog.h" #include <gal/e-table/e-table-scrolled.h> @@ -225,7 +226,7 @@ gal_define_views_dialog_init (GalDefineViewsDialog *dialog) dialog->collection = NULL; - gui = glade_xml_new_with_domain (GAL_GLADEDIR "/gal-define-views.glade", NULL, E_I18N_DOMAIN); + gui = glade_xml_new (GAL_GLADEDIR "/gal-define-views.glade", NULL, PACKAGE); dialog->gui = gui; widget = glade_xml_get_widget(gui, "table-top"); @@ -238,8 +239,8 @@ gal_define_views_dialog_init (GalDefineViewsDialog *dialog) gtk_widget_unref(widget); gnome_dialog_append_buttons(GNOME_DIALOG(dialog), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, + GTK_STOCK_OK, + GTK_STOCK_CANCEL, NULL); gdvd_connect_signal(dialog, "button-new", "clicked", GTK_SIGNAL_FUNC(gdvd_button_new_callback)); @@ -264,7 +265,9 @@ gal_define_views_dialog_destroy (GtkObject *object) { GalDefineViewsDialog *gal_define_views_dialog = GAL_DEFINE_VIEWS_DIALOG(object); - gtk_object_unref(GTK_OBJECT(gal_define_views_dialog->gui)); + if (gal_define_views_dialog->gui) + gtk_object_unref(GTK_OBJECT(gal_define_views_dialog->gui)); + gal_define_views_dialog->gui = NULL; if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); diff --git a/widgets/menus/gal-define-views-model.c b/widgets/menus/gal-define-views-model.c index ca54e19c8d..eb41f3b84a 100644 --- a/widgets/menus/gal-define-views-model.c +++ b/widgets/menus/gal-define-views-model.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * gal-define-views-model.c * Copyright 2000, 2001, Ximian, Inc. * @@ -22,9 +22,9 @@ */ #include <config.h> -#include <gnome-xml/tree.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/tree.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include "gal-define-views-model.h" #define PARENT_TYPE e_table_model_get_type() @@ -49,7 +49,9 @@ gdvm_destroy(GtkObject *object) { GalDefineViewsModel *model = GAL_DEFINE_VIEWS_MODEL(object); - gtk_object_unref(GTK_OBJECT(model->collection)); + if (model->collection) + gtk_object_unref(GTK_OBJECT(model->collection)); + model->collection = NULL; if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); diff --git a/widgets/menus/gal-view-collection.c b/widgets/menus/gal-view-collection.c index 675c926bc1..acc96ccb1b 100644 --- a/widgets/menus/gal-view-collection.c +++ b/widgets/menus/gal-view-collection.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * gal-view-collection.c * Copyright 2000, 2001, Ximian, Inc. * @@ -27,8 +27,7 @@ #include <ctype.h> #include <string.h> #include <gtk/gtksignal.h> -#include <gnome-xml/parser.h> -#include <libgnome/gnome-defs.h> +#include <libxml/parser.h> #include <libgnome/gnome-util.h> #include <gal/util/e-util.h> #include <gal/util/e-xml-utils.h> @@ -158,21 +157,23 @@ gal_view_collection_destroy (GtkObject *object) for (i = 0; i < collection->view_count; i++) { gal_view_collection_item_free (collection->view_data[i]); } - g_free(collection->view_data); - collection->view_count = 0; + g_free (collection->view_data); collection->view_data = NULL; + collection->view_count = 0; - e_free_object_list(collection->factory_list); + e_free_object_list (collection->factory_list); collection->factory_list = NULL; for (i = 0; i < collection->removed_view_count; i++) { gal_view_collection_item_free (collection->removed_view_data[i]); } g_free(collection->removed_view_data); + collection->removed_view_data = NULL; collection->removed_view_count = 0; - collection->removed_view_data = NULL; g_free(collection->system_dir); + collection->system_dir = NULL; + g_free(collection->local_dir); collection->system_dir = NULL; collection->local_dir = NULL; @@ -200,7 +201,7 @@ gal_view_collection_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (GalViewCollectionClass, display_view), - gtk_marshal_NONE__OBJECT, + e_marshal_NONE__OBJECT, GTK_TYPE_NONE, 1, GAL_VIEW_TYPE); gal_view_collection_signals [CHANGED] = @@ -241,7 +242,7 @@ gal_view_collection_init (GalViewCollection *collection) * gal_view_collection_get_type: * */ -guint +GtkType gal_view_collection_get_type (void) { static guint type = 0; @@ -836,3 +837,4 @@ gal_view_collection_set_default_view (GalViewCollection *collection, const char gal_view_collection_changed (collection); collection->default_view_built_in = FALSE; } + diff --git a/widgets/menus/gal-view-collection.h b/widgets/menus/gal-view-collection.h index 68e7cae4b7..8ce6d1be82 100644 --- a/widgets/menus/gal-view-collection.h +++ b/widgets/menus/gal-view-collection.h @@ -26,10 +26,8 @@ #include <gtk/gtkobject.h> #include <gal/menus/gal-view-factory.h> -#include <libgnome/gnome-defs.h> - -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define GAL_VIEW_COLLECTION_TYPE (gal_view_collection_get_type ()) #define GAL_VIEW_COLLECTION(o) (GTK_CHECK_CAST ((o), GAL_VIEW_COLLECTION_TYPE, GalViewCollection)) @@ -146,7 +144,7 @@ void gal_view_collection_set_default_view (GalViewColl const char *id); -END_GNOME_DECLS +G_END_DECLS #endif /* _GAL_VIEW_COLLECTION_H_ */ diff --git a/widgets/menus/gal-view-etable.c b/widgets/menus/gal-view-etable.c index f81482435d..20b58cfb4a 100644 --- a/widgets/menus/gal-view-etable.c +++ b/widgets/menus/gal-view-etable.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * gal-view-etable.c * Copyright 2000, 2001, Ximian, Inc. * @@ -144,10 +144,15 @@ gal_view_etable_destroy (GtkObject *object) gal_view_etable_detach (view); g_free(view->title); + view->title = NULL; + if (view->spec) gtk_object_unref(GTK_OBJECT(view->spec)); + view->spec = NULL; + if (view->state) gtk_object_unref(GTK_OBJECT(view->state)); + view->state = NULL; if (GTK_OBJECT_CLASS (gal_view_etable_parent_class)->destroy) (* GTK_OBJECT_CLASS (gal_view_etable_parent_class)->destroy) (object); diff --git a/widgets/menus/gal-view-etable.h b/widgets/menus/gal-view-etable.h index 2fd001e583..0768d3ee93 100644 --- a/widgets/menus/gal-view-etable.h +++ b/widgets/menus/gal-view-etable.h @@ -24,7 +24,6 @@ #ifndef _GAL_VIEW_ETABLE_H_ #define _GAL_VIEW_ETABLE_H_ -#include <libgnome/gnome-defs.h> #include <gtk/gtkobject.h> #include <gal/menus/gal-view.h> #include <gal/e-table/e-table-state.h> @@ -32,7 +31,7 @@ #include <gal/e-table/e-table.h> #include <gal/e-table/e-tree.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define GAL_VIEW_ETABLE_TYPE (gal_view_etable_get_type ()) #define GAL_VIEW_ETABLE(o) (GTK_CHECK_CAST ((o), GAL_VIEW_ETABLE_TYPE, GalViewEtable)) @@ -73,6 +72,7 @@ void gal_view_etable_attach_tree (GalViewEtable *view, ETree *tree); void gal_view_etable_detach (GalViewEtable *view); -END_GNOME_DECLS + +G_END_DECLS #endif /* _GAL_VIEW_ETABLE_H_ */ diff --git a/widgets/menus/gal-view-factory-etable.c b/widgets/menus/gal-view-factory-etable.c index 026d085145..1e68c1b4ae 100644 --- a/widgets/menus/gal-view-factory-etable.c +++ b/widgets/menus/gal-view-factory-etable.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * gal-view-factory-etable.c * Copyright 2000, 2001, Ximian, Inc. * @@ -58,6 +58,7 @@ gal_view_factory_etable_destroy (GtkObject *object) if (factory->spec) gtk_object_unref(GTK_OBJECT(factory->spec)); + factory->spec = NULL; if (GTK_OBJECT_CLASS (gal_view_factory_etable_parent_class)->destroy) (* GTK_OBJECT_CLASS (gal_view_factory_etable_parent_class)->destroy) (object); diff --git a/widgets/menus/gal-view-factory.c b/widgets/menus/gal-view-factory.c index 0f0d274b06..7655fd8e90 100644 --- a/widgets/menus/gal-view-factory.c +++ b/widgets/menus/gal-view-factory.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * gal-view-factory.c * Copyright 2000, 2001, Ximian, Inc. * @@ -24,7 +24,7 @@ #include <config.h> #include "gal-view-factory.h" -#define GVF_CLASS(e) ((GalViewFactoryClass *)((GtkObject *)e)->klass) +#define GVF_CLASS(e) ((GalViewFactoryClass *)(GTK_OBJECT_GET_CLASS (e))) #define PARENT_TYPE gtk_object_get_type () @@ -41,7 +41,7 @@ static GtkObjectClass *gal_view_factory_parent_class; * Returns: The title of the factory. */ const char * -gal_view_factory_get_title (GalViewFactory *factory) +gal_view_factory_get_title (GalViewFactory *factory) { g_return_val_if_fail (factory != NULL, 0); g_return_val_if_fail (GAL_IS_VIEW_FACTORY (factory), 0); diff --git a/widgets/menus/gal-view-instance-save-as-dialog.c b/widgets/menus/gal-view-instance-save-as-dialog.c index c00937b46f..5ac6dde416 100644 --- a/widgets/menus/gal-view-instance-save-as-dialog.c +++ b/widgets/menus/gal-view-instance-save-as-dialog.c @@ -26,11 +26,14 @@ #include "gal-view-instance-save-as-dialog.h" #include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-stock.h> #include "gal-define-views-model.h" #include "gal-view-new-dialog.h" #include <gal/e-table/e-table-scrolled.h> #include <gal/util/e-i18n.h> +#include <gtk/gtknotebook.h> +#include <gtk/gtkentry.h> +#include <gtk/gtktogglebutton.h> +#include <gtk/gtkbox.h> static GnomeDialogClass *parent_class = NULL; #define PARENT_TYPE gnome_dialog_get_type() @@ -102,7 +105,7 @@ gvisad_connect_signal(GalViewInstanceSaveAsDialog *dialog, char *widget_name, ch widget = glade_xml_get_widget(dialog->gui, widget_name); if (widget) - gtk_signal_connect(GTK_OBJECT(widget), signal, handler, dialog); + g_signal_connect (G_OBJECT (widget), signal, G_CALLBACK (handler), dialog); } /* Method override implementations */ @@ -284,7 +287,7 @@ gal_view_instance_save_as_dialog_save (GalViewInstanceSaveAsDialog *dialog) { GalView *view = gal_view_instance_get_current_view (dialog->instance); GtkWidget *widget; - char *title; + const char *title; int n; const char *id = NULL; switch (dialog->toggle) { diff --git a/widgets/menus/gal-view-instance.c b/widgets/menus/gal-view-instance.c index 1cc0389f47..ebe823357f 100644 --- a/widgets/menus/gal-view-instance.c +++ b/widgets/menus/gal-view-instance.c @@ -27,8 +27,7 @@ #include <ctype.h> #include <string.h> #include <gtk/gtksignal.h> -#include <gnome-xml/parser.h> -#include <libgnome/gnome-defs.h> +#include <libxml/parser.h> #include <libgnome/gnome-util.h> #include <libgnomeui/gnome-dialog.h> #include <gal/util/e-util.h> @@ -230,7 +229,7 @@ gal_view_instance_init (GalViewInstance *instance) * gal_view_instance_get_type: * */ -guint +GtkType gal_view_instance_get_type (void) { static guint type = 0; @@ -505,7 +504,7 @@ view_item_cb (GtkWidget *widget, static void add_popup_radio_item (EPopupMenu *menu_item, gchar *title, - void (*fn) (GtkWidget *widget, gpointer closure), + GtkSignalFunc fn, gpointer closure, gboolean value) { @@ -522,7 +521,7 @@ add_popup_radio_item (EPopupMenu *menu_item, static void add_popup_menu_item (EPopupMenu *menu_item, gchar *title, - void (*fn) (GtkWidget *widget, gpointer closure), + GtkSignalFunc fn, gpointer closure) { const EPopupMenu menu_item_struct = diff --git a/widgets/menus/gal-view-instance.h b/widgets/menus/gal-view-instance.h index 5e5ea6817e..bc396af231 100644 --- a/widgets/menus/gal-view-instance.h +++ b/widgets/menus/gal-view-instance.h @@ -27,10 +27,8 @@ #include <gtk/gtkobject.h> #include <gal/menus/gal-view-collection.h> #include <gal/widgets/e-popup-menu.h> -#include <libgnome/gnome-defs.h> - -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define GAL_VIEW_INSTANCE_TYPE (gal_view_instance_get_type ()) #define GAL_VIEW_INSTANCE(o) (GTK_CHECK_CAST ((o), GAL_VIEW_INSTANCE_TYPE, GalViewInstance)) @@ -113,7 +111,6 @@ EPopupMenu *gal_view_instance_get_popup_menu (GalViewInstance *inst void gal_view_instance_free_popup_menu (GalViewInstance *instance, EPopupMenu *menu); -END_GNOME_DECLS - +G_END_DECLS #endif /* _GAL_VIEW_INSTANCE_H_ */ diff --git a/widgets/menus/gal-view-new-dialog.c b/widgets/menus/gal-view-new-dialog.c index 41b4ea4c69..6c858d141b 100644 --- a/widgets/menus/gal-view-new-dialog.c +++ b/widgets/menus/gal-view-new-dialog.c @@ -23,7 +23,7 @@ #include <config.h> #include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-stock.h> +#include <gtk/gtk.h> #include "gal-view-new-dialog.h" #include "gal-define-views-model.h" #include <gal/widgets/e-unicode.h> @@ -94,7 +94,7 @@ gal_view_new_dialog_init (GalViewNewDialog *dialog) GladeXML *gui; GtkWidget *widget; - gui = glade_xml_new_with_domain (GAL_GLADEDIR "/gal-view-new-dialog.glade", NULL, PACKAGE); + gui = glade_xml_new (GAL_GLADEDIR "/gal-view-new-dialog.glade", NULL, PACKAGE); dialog->gui = gui; widget = glade_xml_get_widget(gui, "table-top"); @@ -107,8 +107,8 @@ gal_view_new_dialog_init (GalViewNewDialog *dialog) gtk_widget_unref(widget); gnome_dialog_append_buttons(GNOME_DIALOG(dialog), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, + GTK_STOCK_OK, + GTK_STOCK_CANCEL, NULL); gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, TRUE, FALSE); @@ -122,7 +122,9 @@ gal_view_new_dialog_destroy (GtkObject *object) { GalViewNewDialog *gal_view_new_dialog = GAL_VIEW_NEW_DIALOG(object); - gtk_object_unref(GTK_OBJECT(gal_view_new_dialog->gui)); + if (gal_view_new_dialog->gui) + gtk_object_unref(GTK_OBJECT(gal_view_new_dialog->gui)); + gal_view_new_dialog->gui = NULL; if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); diff --git a/widgets/menus/gal-view.c b/widgets/menus/gal-view.c index cfaf5dabaa..0645367fb9 100644 --- a/widgets/menus/gal-view.c +++ b/widgets/menus/gal-view.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * gal-view.c * Copyright 2000, 2001, Ximian, Inc. * @@ -26,7 +26,7 @@ #include "gal-view.h" #include "gal/util/e-util.h" -#define GV_CLASS(e) ((GalViewClass *)((GtkObject *)e)->klass) +#define GV_CLASS(e) ((GalViewClass *)(GTK_OBJECT_GET_CLASS (e))) #define PARENT_TYPE gtk_object_get_type () diff --git a/widgets/menus/gal-view.h b/widgets/menus/gal-view.h index 3d617df25f..e47a4fb6e1 100644 --- a/widgets/menus/gal-view.h +++ b/widgets/menus/gal-view.h @@ -25,7 +25,7 @@ #define _GAL_VIEW_H_ #include <gtk/gtkobject.h> -#include <gnome-xml/tree.h> +#include <libxml/tree.h> #ifdef __cplusplus extern "C" { diff --git a/widgets/misc/e-canvas-background.c b/widgets/misc/e-canvas-background.c index 791caf1bcc..ff09ce0e1d 100644 --- a/widgets/misc/e-canvas-background.c +++ b/widgets/misc/e-canvas-background.c @@ -69,17 +69,11 @@ enum { static void get_color(ECanvasBackground *ecb) { - int n; GnomeCanvasItem *item = GNOME_CANVAS_ITEM (ecb); - - n = 0; - gdk_color_context_get_pixels (item->canvas->cc, - &ecb->priv->color.red, - &ecb->priv->color.green, - &ecb->priv->color.blue, - 1, - &ecb->priv->color.pixel, - &n); + ecb->priv->color.pixel = gnome_canvas_get_color_pixel (item->canvas, + GNOME_CANVAS_COLOR (ecb->priv->color.red >> 8, + ecb->priv->color.green>> 8, + ecb->priv->color.blue>> 8)); } static void @@ -427,11 +421,11 @@ ecb_class_init (GtkObjectClass *object_class) gtk_object_add_arg_type ("ECanvasBackground::fill_color", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FILL_COLOR); - gtk_object_add_arg_type ("ECanvasBackground::fill_color_gdk", GTK_TYPE_GDK_COLOR, + gtk_object_add_arg_type ("ECanvasBackground::fill_color_gdk", GDK_TYPE_COLOR, GTK_ARG_READWRITE, ARG_FILL_COLOR_GDK); gtk_object_add_arg_type ("ECanvasBackground::fill_color_rgba", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_FILL_COLOR_RGBA); - gtk_object_add_arg_type ("ECanvasBackground::fill_stipple", GTK_TYPE_GDK_WINDOW, + gtk_object_add_arg_type ("ECanvasBackground::fill_stipple", GDK_TYPE_WINDOW, GTK_ARG_READWRITE, ARG_FILL_STIPPLE); gtk_object_add_arg_type ("ECanvasBackground::x1", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_X1); diff --git a/widgets/misc/e-canvas-background.h b/widgets/misc/e-canvas-background.h index b0c28e099f..b4da6d679a 100644 --- a/widgets/misc/e-canvas-background.h +++ b/widgets/misc/e-canvas-background.h @@ -24,10 +24,9 @@ #ifndef E_CANVAS_BACKGROUND_H #define E_CANVAS_BACKGROUND_H -#include <libgnome/gnome-defs.h> -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS /* * name type read/write description @@ -67,16 +66,6 @@ struct _ECanvasBackgroundClass { /* Standard Gtk function */ GtkType e_canvas_background_get_type (void); -END_GNOME_DECLS +G_END_DECLS #endif - - - - - - - - - - diff --git a/widgets/misc/e-canvas-utils.c b/widgets/misc/e-canvas-utils.c index 0e7e73d6d0..1bd51d070e 100644 --- a/widgets/misc/e-canvas-utils.c +++ b/widgets/misc/e-canvas-utils.c @@ -143,8 +143,7 @@ show_area_timeout (gpointer data) { DoubsAndCanvas *dac = data; - if (!GTK_OBJECT_DESTROYED(dac->canvas)) - e_canvas_show_area(dac->canvas, dac->x1, dac->y1, dac->x2, dac->y2); + e_canvas_show_area(dac->canvas, dac->x1, dac->y1, dac->x2, dac->y2); gtk_object_unref(GTK_OBJECT(dac->canvas)); g_free(dac); return FALSE; diff --git a/widgets/misc/e-canvas-utils.h b/widgets/misc/e-canvas-utils.h index ad8422772c..5b1a329140 100644 --- a/widgets/misc/e-canvas-utils.h +++ b/widgets/misc/e-canvas-utils.h @@ -1,6 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * e-canvas-utils.h * Copyright 2000, 2001, Ximian, Inc. * * Authors: @@ -24,10 +23,9 @@ #ifndef __E_CANVAS_UTILS__ #define __E_CANVAS_UTILS__ -#include <libgnomeui/gnome-canvas.h> -#include <libgnome/gnome-defs.h> +#include <libgnomecanvas/gnome-canvas.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS void e_canvas_item_move_absolute (GnomeCanvasItem *item, double dx, @@ -52,6 +50,6 @@ gboolean e_canvas_item_area_shown (GnomeCanvasItem *item, double x2, double y2); -END_GNOME_DECLS +G_END_DECLS #endif /* __E_CANVAS_UTILS__ */ diff --git a/widgets/misc/e-canvas-vbox.c b/widgets/misc/e-canvas-vbox.c index 2bbff343ed..8ed70d0be9 100644 --- a/widgets/misc/e-canvas-vbox.c +++ b/widgets/misc/e-canvas-vbox.c @@ -193,9 +193,11 @@ e_canvas_vbox_destroy (GtkObject *object) { ECanvasVbox *vbox = E_CANVAS_VBOX(object); - g_list_foreach(vbox->items, disconnect_item_cb, vbox); - g_list_free(vbox->items); - vbox->items = NULL; + if (vbox->items) { + g_list_foreach(vbox->items, disconnect_item_cb, vbox); + g_list_free(vbox->items); + vbox->items = NULL; + } GTK_OBJECT_CLASS(parent_class)->destroy (object); } @@ -250,8 +252,7 @@ e_canvas_vbox_realize (GnomeCanvasItem *item) static void e_canvas_vbox_remove_item (GnomeCanvasItem *item, ECanvasVbox *vbox) { - if (!GTK_OBJECT_DESTROYED (vbox)) - vbox->items = g_list_remove(vbox->items, item); + vbox->items = g_list_remove(vbox->items, item); } static void @@ -363,14 +364,14 @@ e_canvas_vbox_reflow( GnomeCanvasItem *item, int flags ) void e_canvas_vbox_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item) { - if (E_CANVAS_VBOX_CLASS(GTK_OBJECT(e_canvas_vbox)->klass)->add_item) - (E_CANVAS_VBOX_CLASS(GTK_OBJECT(e_canvas_vbox)->klass)->add_item) (e_canvas_vbox, item); + if (E_CANVAS_VBOX_CLASS(GTK_OBJECT_GET_CLASS(e_canvas_vbox))->add_item) + (E_CANVAS_VBOX_CLASS(GTK_OBJECT_GET_CLASS(e_canvas_vbox))->add_item) (e_canvas_vbox, item); } void e_canvas_vbox_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item) { - if (E_CANVAS_VBOX_CLASS(GTK_OBJECT(e_canvas_vbox)->klass)->add_item_start) - (E_CANVAS_VBOX_CLASS(GTK_OBJECT(e_canvas_vbox)->klass)->add_item_start) (e_canvas_vbox, item); + if (E_CANVAS_VBOX_CLASS(GTK_OBJECT_GET_CLASS(e_canvas_vbox))->add_item_start) + (E_CANVAS_VBOX_CLASS(GTK_OBJECT_GET_CLASS(e_canvas_vbox))->add_item_start) (e_canvas_vbox, item); } diff --git a/widgets/misc/e-canvas-vbox.h b/widgets/misc/e-canvas-vbox.h index 48ba2ade52..eaf671f671 100644 --- a/widgets/misc/e-canvas-vbox.h +++ b/widgets/misc/e-canvas-vbox.h @@ -25,7 +25,7 @@ #define __E_CANVAS_VBOX_H__ #include <gtk/gtktypeutils.h> -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #ifdef __cplusplus extern "C" { diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c index b1d499f521..473e50e4d1 100644 --- a/widgets/misc/e-canvas.c +++ b/widgets/misc/e-canvas.c @@ -130,8 +130,10 @@ e_canvas_init (ECanvas *canvas) { canvas->selection = NULL; canvas->cursor = NULL; +#ifdef GAL_GDK_IM canvas->ic = NULL; canvas->ic_attr = NULL; +#endif canvas->tooltip_window = NULL; } @@ -275,8 +277,13 @@ emit_event (GnomeCanvas *canvas, GdkEvent *event) &ev, &finished); +#ifndef NO_WARNINGS +#warning FIXME - needs thought +#endif +#if 0 if (GTK_OBJECT_DESTROYED (item)) finished = TRUE; +#endif parent = item->parent; gtk_object_unref (GTK_OBJECT (item)); @@ -333,7 +340,7 @@ gnome_canvas_item_invoke_point (GnomeCanvasItem *item, double x, double y, int c y = i.y; #endif - return (* GNOME_CANVAS_ITEM_CLASS (item->object.klass)->point) ( + return (* GNOME_CANVAS_ITEM_CLASS (GTK_OBJECT_GET_CLASS (item))->point) ( item, x, y, cx, cy, actual_item); } @@ -409,11 +416,11 @@ pick_current_item (GnomeCanvas *canvas, GdkEvent *event) /* these fields don't have the same offsets in both types of events */ if (canvas->pick_event.type == GDK_ENTER_NOTIFY) { - x = canvas->pick_event.crossing.x + DISPLAY_X1 (canvas) - canvas->zoom_xofs; - y = canvas->pick_event.crossing.y + DISPLAY_Y1 (canvas) - canvas->zoom_yofs; + x = canvas->pick_event.crossing.x + canvas->scroll_x1 - canvas->zoom_xofs; + y = canvas->pick_event.crossing.y + canvas->scroll_y1 - canvas->zoom_yofs; } else { - x = canvas->pick_event.motion.x + DISPLAY_X1 (canvas) - canvas->zoom_xofs; - y = canvas->pick_event.motion.y + DISPLAY_Y1 (canvas) - canvas->zoom_yofs; + x = canvas->pick_event.motion.x + canvas->scroll_x1 - canvas->zoom_xofs; + y = canvas->pick_event.motion.y + canvas->scroll_y1 - canvas->zoom_yofs; } /* canvas pixel coords */ @@ -635,8 +642,10 @@ e_canvas_focus_in (GtkWidget *widget, GdkEventFocus *event) GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); +#ifdef GAL_GDK_IM if (ecanvas->ic) gdk_im_begin (ecanvas->ic, canvas->layout.bin_window); +#endif if (canvas->focused_item) { full_event.focus_change = *event; @@ -659,8 +668,10 @@ e_canvas_focus_out (GtkWidget *widget, GdkEventFocus *event) GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); +#ifdef GAL_GDK_IM if (ecanvas->ic) gdk_im_end (); +#endif if (canvas->focused_item) { full_event.focus_change = *event; @@ -675,11 +686,11 @@ ec_style_set_recursive (GnomeCanvasItem *item, GtkStyle *previous_style) { guint signal_id = gtk_signal_lookup ("style_set", GTK_OBJECT_TYPE (item)); if (signal_id >= 1) { - GtkSignalQuery *query = gtk_signal_query (signal_id); - if (query->return_val == GTK_TYPE_NONE && query->nparams == 1 && query->params[0] == GTK_TYPE_STYLE) { + GSignalQuery query; + g_signal_query (signal_id, &query); + if (query.return_type == GTK_TYPE_NONE && query.n_params == 1 && query.param_types[0] == GTK_TYPE_STYLE) { gtk_signal_emit (GTK_OBJECT (item), signal_id, previous_style); } - g_free (query); } if (GNOME_IS_CANVAS_GROUP (item) ) { @@ -700,13 +711,16 @@ static void e_canvas_realize (GtkWidget *widget) { gint width, height; +#ifdef GAL_GDK_IM ECanvas *ecanvas = E_CANVAS (widget); +#endif if (GTK_WIDGET_CLASS (parent_class)->realize) (* GTK_WIDGET_CLASS (parent_class)->realize) (widget); gdk_window_set_back_pixmap (GTK_LAYOUT (widget)->bin_window, NULL, FALSE); +#ifdef GAL_GDK_IM if (gdk_im_ready () && (ecanvas->ic_attr = gdk_ic_attr_new ()) != NULL) { GdkEventMask mask; GdkICAttr *attr = ecanvas->ic_attr; @@ -760,7 +774,7 @@ e_canvas_realize (GtkWidget *widget) } else g_warning ("Can't create input context."); } - +#endif } static void @@ -768,10 +782,12 @@ e_canvas_unrealize (GtkWidget *widget) { ECanvas * ecanvas = E_CANVAS (widget); - if (ecanvas->idle_id) + if (ecanvas->idle_id) { g_source_remove(ecanvas->idle_id); - ecanvas->idle_id = 0; + ecanvas->idle_id = 0; + } +#ifdef GAL_GDK_IM if (ecanvas->ic) { gdk_ic_destroy (ecanvas->ic); ecanvas->ic = NULL; @@ -780,6 +796,7 @@ e_canvas_unrealize (GtkWidget *widget) gdk_ic_attr_destroy (ecanvas->ic_attr); ecanvas->ic_attr = NULL; } +#endif if (GTK_WIDGET_CLASS (parent_class)->unrealize) (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); } @@ -1074,7 +1091,8 @@ void e_canvas_popup_tooltip (ECanvas *canvas, GtkWidget *widget, int x, int y) GTK_SIGNAL_FUNC (e_canvas_visibility), canvas); } } - gtk_widget_popup (widget, x, y); + gtk_widget_set_uposition (widget, x, y); + gtk_widget_show (widget); } void e_canvas_hide_tooltip (ECanvas *canvas) diff --git a/widgets/misc/e-canvas.h b/widgets/misc/e-canvas.h index fb0d7398e7..2cda185ef3 100644 --- a/widgets/misc/e-canvas.h +++ b/widgets/misc/e-canvas.h @@ -24,7 +24,7 @@ #ifndef __E_CANVAS_H__ #define __E_CANVAS_H__ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #ifdef __cplusplus extern "C" { @@ -88,10 +88,11 @@ struct _ECanvas int visibility_notify_id; GtkWidget *toplevel; guint visibility_first : 1; - +#ifdef GAL_GDK_IM /* Input context for dead key support */ GdkIC *ic; GdkICAttr *ic_attr; +#endif ECanvasItemGrabCancelled grab_cancelled_cb; guint grab_cancelled_check_id; diff --git a/widgets/misc/e-colors.c b/widgets/misc/e-colors.c index b95d0d2783..3f16437bee 100644 --- a/widgets/misc/e-colors.c +++ b/widgets/misc/e-colors.c @@ -1,10 +1,10 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-colors.c - General color allocation utilities * Copyright 2000, 2001, Ximian, Inc. * * Authors: - * Miguel de Icaza (miguel@kernel.org) + * Miguel de Icaza (miguel@kernel.org) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -29,71 +29,75 @@ #include <gtk/gtkwidget.h> #include "e-colors.h" -static gboolean e_color_inited; -static GdkColorContext *e_color_context; - GdkColor e_white, e_dark_gray, e_black; -int +gulong e_color_alloc (gushort red, gushort green, gushort blue) { - int failed; - - if (!e_color_inited) - e_color_init (); - - return gdk_color_context_get_pixel (e_color_context, - red, green, blue, &failed); + e_color_init (); + + red >>= 8; + green >>= 8; + blue >>= 8; + return gdk_rgb_xpixel_from_rgb ( + ((red & 0xff) << 16) | ((green & 0xff) << 8) | + (blue & 0xff)); } void -e_color_alloc_gdk (GdkColor *c) +e_color_alloc_gdk (GtkWidget *widget, GdkColor *c) { - int failed; - - g_return_if_fail (c != NULL); - - if (!e_color_inited) - e_color_init (); - - c->pixel = gdk_color_context_get_pixel (e_color_context, c->red, c->green, c->blue, &failed); + GdkColormap *map; + + e_color_init (); + + if (widget) + map = gtk_widget_get_colormap (widget); + else /* FIXME: multi depth broken ? */ + map = gtk_widget_get_default_colormap (); + + gdk_rgb_find_color (map, c); } void -e_color_alloc_name (const char *name, GdkColor *c) +e_color_alloc_name (GtkWidget *widget, const char *name, GdkColor *c) { - int failed; - - g_return_if_fail (name != NULL); - g_return_if_fail (c != NULL); - - if (!e_color_inited) - e_color_init (); - + GdkColormap *map; + + e_color_init (); + gdk_color_parse (name, c); - c->pixel = 0; - c->pixel = gdk_color_context_get_pixel (e_color_context, c->red, c->green, c->blue, &failed); + + if (widget) + map = gtk_widget_get_colormap (widget); + else /* FIXME: multi depth broken ? */ + map = gtk_widget_get_default_colormap (); + + gdk_rgb_find_color (map, c); } void e_color_init (void) { - GdkColormap *colormap; + static gboolean e_color_inited = FALSE; /* It's surprisingly easy to end up calling this twice. Survive. */ if (e_color_inited) return; - colormap = gtk_widget_get_default_colormap (); - - /* Initialize the color context */ - e_color_context = gdk_color_context_new ( - gtk_widget_get_default_visual (), colormap); - e_color_inited = TRUE; /* Allocate the default colors */ - gdk_color_white (colormap, &e_white); - gdk_color_black (colormap, &e_black); - e_color_alloc_name ("gray20", &e_dark_gray); + e_white.red = 65535; + e_white.green = 65535; + e_white.blue = 65535; + e_color_alloc_gdk (NULL, &e_white); + + e_black.red = 0; + e_black.green = 0; + e_black.blue = 0; + e_color_alloc_gdk (NULL, &e_black); + + e_color_alloc_name (NULL, "gray20", &e_dark_gray); } + diff --git a/widgets/misc/e-colors.h b/widgets/misc/e-colors.h index 29e96811f1..596fd2b0a5 100644 --- a/widgets/misc/e-colors.h +++ b/widgets/misc/e-colors.h @@ -26,19 +26,19 @@ #include <glib.h> #include <gdk/gdk.h> -#include <libgnome/gnome-defs.h> +#include <gtk/gtkwidget.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS void e_color_init (void); /* Return the pixel value for the given red, green and blue */ -int e_color_alloc (gushort red, gushort green, gushort blue); -void e_color_alloc_name (const char *name, GdkColor *color); -void e_color_alloc_gdk (GdkColor *color); +gulong e_color_alloc (gushort red, gushort green, gushort blue); +void e_color_alloc_name (GtkWidget *widget, const char *name, GdkColor *color); +void e_color_alloc_gdk (GtkWidget *widget, GdkColor *color); extern GdkColor e_white, e_dark_gray, e_black; -END_GNOME_DECLS +G_END_DECLS #endif /* GNOME_APP_LIBS_COLOR_H */ diff --git a/widgets/misc/e-cursors.c b/widgets/misc/e-cursors.c index 3ea1b3c6d1..3b44ab809e 100644 --- a/widgets/misc/e-cursors.c +++ b/widgets/misc/e-cursors.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-cursors.c - cursor handling for gnumeric * Copyright 2000, 2001, Ximian, Inc. * @@ -55,6 +55,7 @@ static CursorDef cursors [] = { { NULL, GDK_INTERNAL_CURSOR, GDK_HAND2, NULL }, { NULL, 10, 10, cursor_hand_open_xpm }, { NULL, 10, 10, cursor_hand_closed_xpm }, + { NULL, GDK_INTERNAL_CURSOR, GDK_XTERM, NULL }, { NULL, 0, 0, NULL } }; @@ -110,6 +111,8 @@ e_cursors_init (void) { int i; + e_color_init (); + for (i = 0; cursors [i].hot_x; i++){ GdkBitmap *bitmap, *mask; diff --git a/widgets/misc/e-cursors.h b/widgets/misc/e-cursors.h index c7f17cbb77..8e751b659d 100644 --- a/widgets/misc/e-cursors.h +++ b/widgets/misc/e-cursors.h @@ -25,9 +25,8 @@ #define GNOME_APP_LIB_CURSORS_H #include <gdk/gdk.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS typedef enum { E_CURSOR_FAT_CROSS, @@ -43,6 +42,7 @@ typedef enum { E_CURSOR_PRESS, E_CURSOR_HAND_OPEN, E_CURSOR_HAND_CLOSED, + E_CURSOR_XTERM, E_CURSOR_NUM_CURSORS } ECursorType; @@ -63,6 +63,6 @@ G_STMT_START { \ GdkCursor *e_cursor_get (ECursorType type); -END_GNOME_DECLS +G_END_DECLS #endif /* GNOME_APP_LIB_CURSORS_H */ diff --git a/widgets/misc/e-gui-utils.c b/widgets/misc/e-gui-utils.c index d70bb829a6..2e486cc312 100644 --- a/widgets/misc/e-gui-utils.c +++ b/widgets/misc/e-gui-utils.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-gui-utils.c * Copyright 2000, 2001, Ximian, Inc. * @@ -28,9 +28,8 @@ #include <gtk/gtkentry.h> #include <gtk/gtksignal.h> #include <libgnomeui/gnome-messagebox.h> -#include <libgnomeui/gnome-stock.h> #include <gdk-pixbuf/gdk-pixbuf.h> -#include <gdk-pixbuf/gnome-canvas-pixbuf.h> +#include <libgnomecanvas/gnome-canvas-pixbuf.h> void e_notice (GtkWindow *window, const char *type, const char *format, ...) @@ -41,7 +40,7 @@ e_notice (GtkWindow *window, const char *type, const char *format, ...) va_start (args, format); str = g_strdup_vprintf (format, args); - dialog = gnome_message_box_new (str, type, GNOME_STOCK_BUTTON_OK, NULL); + dialog = gnome_message_box_new (str, type, GTK_STOCK_OK, NULL); va_end (args); g_free (str); @@ -162,22 +161,24 @@ e_container_change_tab_order_callback(GtkContainer *container, if (GTK_WIDGET_DRAWABLE (child) && GTK_IS_CONTAINER (child) && !GTK_WIDGET_HAS_FOCUS (child)) - if (gtk_container_focus (GTK_CONTAINER (child), direction)) { - gtk_signal_emit_stop_by_name(GTK_OBJECT(container), "focus"); + if (gtk_widget_child_focus (GTK_WIDGET (child), direction)) { + gtk_signal_emit_stop_by_name ( + GTK_OBJECT (container), "focus"); return TRUE; } } } else if (GTK_WIDGET_DRAWABLE (child)) { if (GTK_IS_CONTAINER (child)) { - if (gtk_container_focus (GTK_CONTAINER (child), direction)) { - gtk_signal_emit_stop_by_name(GTK_OBJECT(container), "focus"); + if (gtk_widget_child_focus (GTK_WIDGET (child), direction)) { + gtk_signal_emit_stop_by_name ( + GTK_OBJECT (container), "focus"); return TRUE; } } else if (GTK_WIDGET_CAN_FOCUS (child)) { gtk_widget_grab_focus (child); - gtk_signal_emit_stop_by_name(GTK_OBJECT(container), "focus"); + gtk_signal_emit_stop_by_name (GTK_OBJECT (container), "focus"); return TRUE; } } diff --git a/widgets/misc/e-gui-utils.h b/widgets/misc/e-gui-utils.h index 7cbf774c9e..43b1c0b0f2 100644 --- a/widgets/misc/e-gui-utils.h +++ b/widgets/misc/e-gui-utils.h @@ -28,10 +28,9 @@ #include <gtk/gtkwindow.h> #include <libgnomeui/gnome-messagebox.h> -#include <libgnome/gnome-defs.h> #include <glade/glade-xml.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS void e_popup_menu (GtkMenu *menu, GdkEvent *event); @@ -57,6 +56,6 @@ gboolean e_glade_xml_set_sensitive (GladeXML *gui, char *name, gboolean sensitive); -END_GNOME_DECLS +G_END_DECLS #endif /* GAL_GUI_UTILS_H */ diff --git a/widgets/misc/e-hsv-utils.c b/widgets/misc/e-hsv-utils.c index 20c66daeae..a5007b9b83 100644 --- a/widgets/misc/e-hsv-utils.c +++ b/widgets/misc/e-hsv-utils.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-hsv-utils.c - utilites for manipulating colours in HSV space * Copyright (C) 1995-2001 Seth Nickell, Peter Mattis, Spencer Kimball and Josh MacDonald * diff --git a/widgets/misc/e-hsv-utils.h b/widgets/misc/e-hsv-utils.h index 34f4da615b..bbde282697 100644 --- a/widgets/misc/e-hsv-utils.h +++ b/widgets/misc/e-hsv-utils.h @@ -24,10 +24,9 @@ #ifndef _E_HSV_UTILS_H_ #define _E_HSV_UTILS_H_ -#include <libgnome/gnome-defs.h> #include <gdk/gdk.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS void e_hsv_to_rgb (gdouble h, gdouble s, @@ -48,6 +47,6 @@ void e_hsv_tweak (GdkColor *colour, gdouble delta_s, gdouble delta_v); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_HSV_UTILS_H_ */ diff --git a/widgets/misc/e-popup-menu.c b/widgets/misc/e-popup-menu.c index 1ce38c4d02..1cfae2da63 100644 --- a/widgets/misc/e-popup-menu.c +++ b/widgets/misc/e-popup-menu.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-popup-menu.c * Copyright 2000, 2001, Ximian, Inc. * @@ -25,6 +25,7 @@ #include <config.h> #include <string.h> +#include <gtk/gtkimage.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtkaccellabel.h> #include <gtk/gtklabel.h> @@ -32,13 +33,12 @@ #include <gtk/gtkcheckmenuitem.h> #include <gtk/gtkradiomenuitem.h> #include <gtk/gtksignal.h> -#include <libgnomeui/gtkpixmapmenuitem.h> -#include <libgnomeui/gnome-stock.h> +#include <gtk/gtkimagemenuitem.h> #include "e-popup-menu.h" #include "e-gui-utils.h" -#include <libgnome/gnome-i18n.h> +#include <gal/util/e-i18n.h> /* * Creates an item with an optional icon @@ -47,30 +47,22 @@ static void make_item (GtkMenu *menu, GtkMenuItem *item, const char *name, GtkWidget *pixmap) { GtkWidget *label; - guint label_accel; + + if (*name == '\0') + return; /* * Ugh. This needs to go into Gtk+ */ - label = gtk_accel_label_new (""); - label_accel = gtk_label_parse_uline (GTK_LABEL (label), name); + label = gtk_label_new_with_mnemonic (name); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_widget_show (label); gtk_container_add (GTK_CONTAINER (item), label); - if (label_accel != GDK_VoidSymbol){ - gtk_widget_add_accelerator ( - GTK_WIDGET (item), - "activate_item", - gtk_menu_ensure_uline_accel_group (GTK_MENU (menu)), - label_accel, 0, - GTK_ACCEL_LOCKED); - } - - if (pixmap && GTK_IS_PIXMAP_MENU_ITEM (item)){ + if (pixmap && GTK_IS_IMAGE_MENU_ITEM (item)){ gtk_widget_show (pixmap); - gtk_pixmap_menu_item_set_pixmap (GTK_PIXMAP_MENU_ITEM (item), pixmap); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), pixmap); } } @@ -121,7 +113,7 @@ e_popup_menu_create_with_domain (EPopupMenu *menu_list, else if (menu_list[i].is_radio) item = gtk_radio_menu_item_new (group); else - item = menu_list[i].pixmap_widget ? gtk_pixmap_menu_item_new () : gtk_menu_item_new (); + item = menu_list[i].pixmap_widget ? gtk_image_menu_item_new () : gtk_menu_item_new (); if (menu_list[i].is_toggle || menu_list[i].is_radio) gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), menu_list[i].is_active); if (menu_list[i].is_radio) diff --git a/widgets/misc/e-popup-menu.h b/widgets/misc/e-popup-menu.h index d096efa06d..7289ab5c86 100644 --- a/widgets/misc/e-popup-menu.h +++ b/widgets/misc/e-popup-menu.h @@ -28,9 +28,30 @@ #include <gtk/gtkmenu.h> #include <gtk/gtkwidget.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS + +#define E_POPUP_SEPARATOR { "", NULL, (NULL), NULL, 0 } +#define E_POPUP_TERMINATOR { NULL, NULL, (NULL), NULL, 0 } + + +/* In the following, CC = custom closure */ + +#define E_POPUP_ITEM(name,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 0, 0, 0, 0 } +#define E_POPUP_ITEM_CC(name,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), NULL, (closure), 0, 0, 0, 1 } +#define E_POPUP_SUBMENU(name,submenu,disable_mask) { (name), NULL, NULL, (submenu), (disable_mask), NULL, NULL, 0, 0, 0, 0 } + +#define E_POPUP_PIXMAP_ITEM(name,pixmap,fn,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, NULL, 0, 0, 0, 0 } +#define E_POPUP_PIXMAP_ITEM_CC(name,pixmap,fn,closure,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, (closure), 0, 0, 0, 1 } +#define E_POPUP_PIXMAP_SUBMENU(name,pixmap,submenu,disable_mask) { (name), (pixmap), NULL, (submenu), (disable_mask), NULL, NULL, 0, 0, 0, 0 } + +#define E_POPUP_PIXMAP_WIDGET_ITEM(name,pixmap_widget,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), NULL, 0, 0, 0, 0 } +#define E_POPUP_PIXMAP_WIDGET_ITEM_CC(name,pixmap_widget,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), (closure), 0, 0, 0, 1 } +#define E_POPUP_PIXMAP_WIDGET_SUBMENU(name,pixmap_widget,submenu,disable_mask) { (name), NULL, NULL, (submenu), (disable_mask), (pixmap_widget), NULL, 0, 0, 0, 0 } + + +#define E_POPUP_TOGGLE_ITEM(name,fn,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 1, 0, value, 0 } +#define E_POPUP_TOGGLE_ITEM_CC(name,fn,closure,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, (closure), 1, 0, value, 1 } #define E_POPUP_SEPARATOR { "", NULL, (NULL), NULL, 0 } #define E_POPUP_TERMINATOR { NULL, NULL, (NULL), NULL, 0 } @@ -70,12 +91,14 @@ BEGIN_GNOME_DECLS #define E_POPUP_RADIO_PIXMAP_WIDGET_ITEM(name,pixmap_widget,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), NULL, 0, 1, value, 0 } #define E_POPUP_RADIO_PIXMAP_WIDGET_ITEM_CC(name,pixmap_widget,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), (closure), 0, 1, value, 1 } + typedef struct _EPopupMenu EPopupMenu; struct _EPopupMenu { char *name; - gchar *pixname; - void (*fn) (GtkWidget *widget, void *closure); + char *pixname; + GtkSignalFunc fn; + EPopupMenu *submenu; guint32 disable_mask; @@ -90,7 +113,6 @@ struct _EPopupMenu { guint use_custom_closure : 1; }; - GtkMenu *e_popup_menu_create (EPopupMenu *menu_list, guint32 disable_mask, guint32 hide_mask, @@ -115,6 +137,6 @@ void e_popup_menu_free_1 (EPopupMenu *menu_item); EPopupMenu *e_popup_menu_copy (const EPopupMenu *menu_item); void e_popup_menu_free (EPopupMenu *menu_item); -END_GNOME_DECLS +G_END_DECLS #endif /* E_POPUP_MENU_H */ diff --git a/widgets/misc/e-printable.c b/widgets/misc/e-printable.c index 749c3c2953..e0134e06f5 100644 --- a/widgets/misc/e-printable.c +++ b/widgets/misc/e-printable.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-printable.c * Copyright 2000, 2001, Ximian, Inc. * @@ -55,16 +55,17 @@ e_printable_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (EPrintableClass, print_page), - e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL, - GTK_TYPE_NONE, 4, GTK_TYPE_OBJECT, GTK_TYPE_DOUBLE, GTK_TYPE_DOUBLE, GTK_TYPE_BOOL); + e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOLEAN, + G_TYPE_NONE, 4, G_TYPE_OBJECT, G_TYPE_DOUBLE, + G_TYPE_DOUBLE, G_TYPE_BOOLEAN); e_printable_signals [DATA_LEFT] = gtk_signal_new ("data_left", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (EPrintableClass, data_left), - gtk_marshal_BOOL__NONE, - GTK_TYPE_BOOL, 0, GTK_TYPE_NONE); + e_marshal_BOOLEAN__NONE, + G_TYPE_BOOLEAN, 0, G_TYPE_NONE); e_printable_signals [RESET] = gtk_signal_new ("reset", @@ -72,23 +73,25 @@ e_printable_class_init (GtkObjectClass *object_class) E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (EPrintableClass, reset), gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0, GTK_TYPE_NONE); + G_TYPE_NONE, 0, G_TYPE_NONE); e_printable_signals [HEIGHT] = gtk_signal_new ("height", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (EPrintableClass, height), - e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL, - GTK_TYPE_DOUBLE, 4, GTK_TYPE_OBJECT, GTK_TYPE_DOUBLE, GTK_TYPE_DOUBLE, GTK_TYPE_BOOL); + e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOLEAN, + G_TYPE_DOUBLE, 4, G_TYPE_OBJECT, G_TYPE_DOUBLE, + G_TYPE_DOUBLE, G_TYPE_BOOLEAN); e_printable_signals [WILL_FIT] = gtk_signal_new ("will_fit", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (EPrintableClass, will_fit), - e_marshal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL, - GTK_TYPE_BOOL, 4, GTK_TYPE_OBJECT, GTK_TYPE_DOUBLE, GTK_TYPE_DOUBLE, GTK_TYPE_BOOL); + e_marshal_BOOLEAN__OBJECT_DOUBLE_DOUBLE_BOOLEAN, + G_TYPE_BOOLEAN, 4, G_TYPE_OBJECT, G_TYPE_DOUBLE, + G_TYPE_DOUBLE, G_TYPE_BOOLEAN); E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_printable_signals, LAST_SIGNAL); @@ -100,7 +103,7 @@ e_printable_class_init (GtkObjectClass *object_class) } -guint +GtkType e_printable_get_type (void) { static guint type = 0; diff --git a/widgets/misc/e-printable.h b/widgets/misc/e-printable.h index 471de36c4f..e2f87bdfda 100644 --- a/widgets/misc/e-printable.h +++ b/widgets/misc/e-printable.h @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-printable.h * Copyright 2000, 2001, Ximian, Inc. * @@ -26,9 +26,8 @@ #include <gtk/gtkobject.h> #include <libgnomeprint/gnome-print.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_PRINTABLE_TYPE (e_printable_get_type ()) #define E_PRINTABLE(o) (GTK_CHECK_CAST ((o), E_PRINTABLE_TYPE, EPrintable)) @@ -86,6 +85,6 @@ gboolean e_printable_will_fit (EPrintable *e_printable, gdouble max_height, gboolean quantized); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_PRINTABLE_H_ */ diff --git a/widgets/misc/e-reflow-model.c b/widgets/misc/e-reflow-model.c index 8e75b8249e..b217b186ce 100644 --- a/widgets/misc/e-reflow-model.c +++ b/widgets/misc/e-reflow-model.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-reflow-model.c * Copyright 2000, 2001, Ximian, Inc. * @@ -26,7 +26,7 @@ #include <gtk/gtksignal.h> #include "gal/util/e-util.h" -#define ERM_CLASS(e) ((EReflowModelClass *)((GtkObject *)e)->klass) +#define ERM_CLASS(e) ((EReflowModelClass *)(GTK_OBJECT_GET_CLASS (e))) #define PARENT_TYPE gtk_object_get_type () @@ -193,7 +193,7 @@ e_reflow_model_class_init (GtkObjectClass *object_class) } -guint +GtkType e_reflow_model_get_type (void) { static guint type = 0; diff --git a/widgets/misc/e-reflow-model.h b/widgets/misc/e-reflow-model.h index 512c4587e3..0f479ab5ca 100644 --- a/widgets/misc/e-reflow-model.h +++ b/widgets/misc/e-reflow-model.h @@ -25,7 +25,7 @@ #define _E_REFLOW_MODEL_H_ #include <gtk/gtkobject.h> -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #ifdef __cplusplus extern "C" { diff --git a/widgets/misc/e-reflow.c b/widgets/misc/e-reflow.c index fa0fd42de8..732cca4956 100644 --- a/widgets/misc/e-reflow.c +++ b/widgets/misc/e-reflow.c @@ -414,7 +414,7 @@ set_empty(EReflow *reflow) "width", reflow->minimum_width, "clip", TRUE, "use_ellipsis", TRUE, - "font_gdk", GTK_WIDGET(GNOME_CANVAS_ITEM(reflow)->canvas)->style->font, + "font_gdk", gtk_style_get_font (GTK_WIDGET(GNOME_CANVAS_ITEM(reflow)->canvas)->style), "fill_color", "black", "justification", GTK_JUSTIFY_CENTER, "text", reflow->empty_message, @@ -532,10 +532,10 @@ connect_adjustment (EReflow *reflow, GtkAdjustment *adjustment) reflow->adjustment = adjustment; reflow->adjustment_changed_id = gtk_signal_connect (GTK_OBJECT (adjustment), "changed", - adjustment_changed, reflow); + GTK_SIGNAL_FUNC (adjustment_changed), reflow); reflow->adjustment_value_changed_id = gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - adjustment_changed, reflow); + GTK_SIGNAL_FUNC (adjustment_changed), reflow); gtk_object_ref (GTK_OBJECT (adjustment)); } @@ -675,13 +675,15 @@ e_reflow_destroy (GtkObject *object) reflow->count = 0; reflow->allocated_count = 0; - if (reflow->incarnate_idle_id != 0) + if (reflow->incarnate_idle_id) g_source_remove (reflow->incarnate_idle_id); + reflow->incarnate_idle_id = 0; disconnect_model (reflow); disconnect_selection (reflow); g_free(reflow->empty_message); + reflow->empty_message = NULL; GTK_OBJECT_CLASS(parent_class)->destroy (object); } @@ -1284,8 +1286,17 @@ e_reflow_class_init (EReflowClass *klass) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (EReflowClass, selection_event), - e_marshal_INT__OBJECT_POINTER, - GTK_TYPE_INT, 2, GTK_TYPE_OBJECT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__OBJECT_BOXED, + GTK_TYPE_INT, 2, GTK_TYPE_OBJECT, + GDK_TYPE_EVENT); + + signals [COLUMN_WIDTH_CHANGED] = + gtk_signal_new ("column_width_changed", + GTK_RUN_LAST, + E_OBJECT_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (EReflowClass, column_width_changed), + e_marshal_NONE__DOUBLE, + GTK_TYPE_NONE, 1, GTK_TYPE_DOUBLE); signals [COLUMN_WIDTH_CHANGED] = gtk_signal_new ("column_width_changed", diff --git a/widgets/misc/e-reflow.h b/widgets/misc/e-reflow.h index 7d002a0a69..bd0f3c2ce9 100644 --- a/widgets/misc/e-reflow.h +++ b/widgets/misc/e-reflow.h @@ -24,7 +24,7 @@ #ifndef __E_REFLOW_H__ #define __E_REFLOW_H__ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/widgets/e-reflow-model.h> #include <gal/widgets/e-selection-model.h> #include <gal/util/e-sorter-array.h> diff --git a/widgets/misc/e-selection-model-array.c b/widgets/misc/e-selection-model-array.c index afaa6c6d25..df254cb810 100644 --- a/widgets/misc/e-selection-model-array.c +++ b/widgets/misc/e-selection-model-array.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-selection-model-array.c * Copyright 2000, 2001, Ximian, Inc. * @@ -26,7 +26,7 @@ #include "e-selection-model-array.h" #include "gal/util/e-util.h" -#define ESMA_CLASS(e) ((ESelectionModelArrayClass *)((GtkObject *)e)->klass) +#define ESMA_CLASS(e) ((ESelectionModelArrayClass *)(GTK_OBJECT_GET_CLASS (e))) #define PARENT_TYPE e_selection_model_get_type () diff --git a/widgets/misc/e-selection-model-simple.c b/widgets/misc/e-selection-model-simple.c index 23257d071d..cd9a720e5c 100644 --- a/widgets/misc/e-selection-model-simple.c +++ b/widgets/misc/e-selection-model-simple.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-selection-model-simple.c * Copyright 2000, 2001, Ximian, Inc. * diff --git a/widgets/misc/e-selection-model.c b/widgets/misc/e-selection-model.c index aea1ad9163..6e8f1f7567 100644 --- a/widgets/misc/e-selection-model.c +++ b/widgets/misc/e-selection-model.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-selection-model.c * Copyright 2000, 2001, Ximian, Inc. * @@ -27,7 +27,7 @@ #include "e-selection-model.h" #include "gal/util/e-util.h" -#define ESM_CLASS(e) ((ESelectionModelClass *)((GtkObject *)e)->klass) +#define ESM_CLASS(e) ((ESelectionModelClass *)(GTK_OBJECT_GET_CLASS (e))) #define PARENT_TYPE gtk_object_get_type () @@ -92,11 +92,11 @@ esm_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) break; case ARG_SELECTION_MODE: - GTK_VALUE_ENUM(*arg) = esm->mode; + GTK_VALUE_INT(*arg) = esm->mode; break; case ARG_CURSOR_MODE: - GTK_VALUE_ENUM(*arg) = esm->cursor_mode; + GTK_VALUE_INT(*arg) = esm->cursor_mode; break; } } @@ -113,7 +113,7 @@ esm_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) break; case ARG_SELECTION_MODE: - esm->mode = GTK_VALUE_ENUM(*arg); + esm->mode = GTK_VALUE_INT(*arg); if (esm->mode == GTK_SELECTION_SINGLE) { int cursor_row = e_selection_model_cursor_row(esm); int cursor_col = e_selection_model_cursor_col(esm); @@ -122,7 +122,7 @@ esm_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) break; case ARG_CURSOR_MODE: - esm->cursor_mode = GTK_VALUE_ENUM(*arg); + esm->cursor_mode = GTK_VALUE_INT(*arg); break; } } @@ -203,14 +203,13 @@ e_selection_model_class_init (ESelectionModelClass *klass) klass->move_selection_end = NULL; klass->set_selection_end = NULL; - E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_selection_model_signals, LAST_SIGNAL); gtk_object_add_arg_type ("ESelectionModel::sorter", GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_SORTER); - gtk_object_add_arg_type ("ESelectionModel::selection_mode", GTK_TYPE_ENUM, + gtk_object_add_arg_type ("ESelectionModel::selection_mode", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_SELECTION_MODE); - gtk_object_add_arg_type ("ESelectionModel::cursor_mode", GTK_TYPE_ENUM, + gtk_object_add_arg_type ("ESelectionModel::cursor_mode", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_CURSOR_MODE); } @@ -416,7 +415,6 @@ e_selection_model_do_something (ESelectionModel *selection, break; case GTK_SELECTION_BROWSE: case GTK_SELECTION_MULTIPLE: - case GTK_SELECTION_EXTENDED: if (shift_p) { e_selection_model_set_selection_end (selection, row); } else { @@ -427,6 +425,9 @@ e_selection_model_do_something (ESelectionModel *selection, } } break; + default: + g_assert_not_reached (); + break; } e_selection_model_change_cursor(selection, row, col); gtk_signal_emit(GTK_OBJECT(selection), @@ -506,7 +507,6 @@ e_selection_model_select_as_key_press (ESelectionModel *selection, switch (selection->mode) { case GTK_SELECTION_BROWSE: case GTK_SELECTION_MULTIPLE: - case GTK_SELECTION_EXTENDED: if (shift_p) { e_selection_model_set_selection_end (selection, row); } else if (!ctrl_p) { @@ -517,6 +517,9 @@ e_selection_model_select_as_key_press (ESelectionModel *selection, case GTK_SELECTION_SINGLE: e_selection_model_select_single_row (selection, row); break; + default: + g_assert_not_reached (); + break; } if (row != -1) { e_selection_model_change_cursor(selection, row, col); diff --git a/widgets/misc/e-selection-model.h b/widgets/misc/e-selection-model.h index c9219a7e48..0326aa60e5 100644 --- a/widgets/misc/e-selection-model.h +++ b/widgets/misc/e-selection-model.h @@ -26,7 +26,7 @@ #include <gtk/gtkobject.h> #include <gal/util/e-sorter.h> -#include <gdk/gdktypes.h> +#include <gdk/gdkevents.h> #ifdef __cplusplus extern "C" { diff --git a/widgets/misc/e-unicode.c b/widgets/misc/e-unicode.c index 6a1363d705..0cea6371b4 100644 --- a/widgets/misc/e-unicode.c +++ b/widgets/misc/e-unicode.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-unicode.c - utf-8 support functions for gal * Copyright 2000, 2001, Ximian, Inc. * @@ -39,7 +39,7 @@ #include <gdk/gdkkeysyms.h> #include <gtk/gtkmenuitem.h> #include "e-font.h" -#include <gnome-xml/xmlmemory.h> +#include <libxml/xmlmemory.h> #include <stdlib.h> #include "gal/util/e-iconv.h" @@ -55,6 +55,10 @@ static gint e_canonical_decomposition (gunichar ch, gunichar * buf); static gunichar e_stripped_char (gunichar ch); +#ifndef NO_WARNINGS +#warning FIXME: this has not been ported fully yet - non ASCII people beware. +#endif + /* * This my favourite * @@ -416,12 +420,12 @@ e_utf8_from_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes g_return_val_if_fail (widget, NULL); - ic = e_iconv_from_gdk_font (widget->style->font); + ic = e_iconv_from_gdk_font (gtk_style_get_font (widget->style)); if (ic == (iconv_t) -1) { XFontStruct *xfs; /* If iconv is missing we assume either iso-10646 or iso-8859-1 */ - xfs = GDK_FONT_XFONT (widget->style->font); - if (widget->style->font->type == GDK_FONT_FONTSET || ((xfs->min_byte1 != 0) || (xfs->max_byte1 != 0))) { + xfs = GDK_FONT_XFONT (gtk_style_get_font (widget->style)); + if (gtk_style_get_font (widget->style)->type == GDK_FONT_FONTSET || ((xfs->min_byte1 != 0) || (xfs->max_byte1 != 0))) { gint i; const guchar *ib; guchar * ob, * new; @@ -498,7 +502,7 @@ e_utf8_to_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes) g_return_val_if_fail (widget, NULL); gtk_widget_ensure_style (widget); - ic = e_iconv_to_gdk_font (widget->style->font); + ic = e_iconv_to_gdk_font (gtk_style_get_font (widget->style)); if (ic == (iconv_t) -1) { XFontStruct *xfs; gboolean twobyte; @@ -506,9 +510,9 @@ e_utf8_to_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes) const gchar *u; gunichar uc; /* If iconv is missing we assume either iso-10646 or iso-8859-1 */ - xfs = GDK_FONT_XFONT (widget->style->font); - twobyte = (widget->style->font->type == GDK_FONT_FONTSET || ((xfs->min_byte1 != 0) || (xfs->max_byte1 != 0))); - + xfs = GDK_FONT_XFONT (gtk_style_get_font (widget->style)); + twobyte = (gtk_style_get_font (widget->style)->type == GDK_FONT_FONTSET || ((xfs->min_byte1 != 0) || (xfs->max_byte1 != 0))); + new = g_new (unsigned char, bytes * 4 + 2); u = string; len = 0; @@ -630,50 +634,34 @@ e_utf8_is_ascii (const gchar *string) gchar * e_utf8_gtk_entry_get_text (GtkEntry *entry) { - gchar *s, *u; - - s = gtk_entry_get_text (entry); - if (!s) return NULL; - u = e_utf8_from_gtk_string ((GtkWidget *) entry, s); - return u; + return g_strdup (gtk_entry_get_text (entry)); } gchar * e_utf8_gtk_editable_get_text (GtkEditable *editable) { - return e_utf8_gtk_editable_get_chars(editable, 0, -1); + return gtk_editable_get_chars (editable, 0, -1); } gchar * e_utf8_gtk_editable_get_chars (GtkEditable *editable, gint start, gint end) { - gchar *s, *u; - - s = gtk_editable_get_chars (editable, start, end); - u = e_utf8_from_gtk_string ((GtkWidget *) editable, s); - g_free (s); - return u; + return gtk_editable_get_chars (editable, start, end); } void e_utf8_gtk_editable_insert_text (GtkEditable *editable, const gchar *text, gint length, gint *position) { - gchar *s; - - s = e_utf8_to_gtk_string_sized ((GtkWidget *) editable, text, length); - - gtk_editable_insert_text (editable, s, length, position); - - g_free (s); + gtk_editable_insert_text (editable, text, length, position); } void e_utf8_gtk_editable_set_text (GtkEditable *editable, const gchar *text) { int position; + gtk_editable_delete_text(editable, 0, -1); - if (text) - e_utf8_gtk_editable_insert_text(editable, text, strlen(text), &position); + gtk_editable_insert_text (editable, text, strlen (text), &position); } void @@ -681,14 +669,8 @@ e_utf8_gtk_entry_set_text (GtkEntry *entry, const gchar *text) { if (!text) gtk_entry_set_text(entry, ""); - else { - gchar *s; - - s = e_utf8_to_gtk_string ((GtkWidget *) entry, text); - gtk_entry_set_text (entry, s); - - if (s) g_free (s); - } + else + gtk_entry_set_text (entry, text); } GtkWidget * @@ -894,877 +876,6 @@ e_unicode_get_utf8 (const gchar *text, gunichar *out) } /* - * The following is borrowed from Gtk+ 1.3 - */ - -/* Thanks to Markus G. Kuhn <mkuhn@acm.org> for the ksysym<->Unicode - * mapping functions, from the xterm sources. - */ - -/* These tables could be compressed by contiguous ranges, but the benefit of doing so - * is smallish. It would save about ~1000 bytes total. - */ - -static struct { - unsigned short keysym; - unsigned short ucs; -} gdk_keysym_to_unicode_tab[] = { - { 0x01a1, 0x0104 }, /* Aogonek Ą LATIN CAPITAL LETTER A WITH OGONEK */ - { 0x01a2, 0x02d8 }, /* breve ˘ BREVE */ - { 0x01a3, 0x0141 }, /* Lstroke Ł LATIN CAPITAL LETTER L WITH STROKE */ - { 0x01a5, 0x013d }, /* Lcaron Ľ LATIN CAPITAL LETTER L WITH CARON */ - { 0x01a6, 0x015a }, /* Sacute Ś LATIN CAPITAL LETTER S WITH ACUTE */ - { 0x01a9, 0x0160 }, /* Scaron Š LATIN CAPITAL LETTER S WITH CARON */ - { 0x01aa, 0x015e }, /* Scedilla Ş LATIN CAPITAL LETTER S WITH CEDILLA */ - { 0x01ab, 0x0164 }, /* Tcaron Ť LATIN CAPITAL LETTER T WITH CARON */ - { 0x01ac, 0x0179 }, /* Zacute Ź LATIN CAPITAL LETTER Z WITH ACUTE */ - { 0x01ae, 0x017d }, /* Zcaron Ž LATIN CAPITAL LETTER Z WITH CARON */ - { 0x01af, 0x017b }, /* Zabovedot Ż LATIN CAPITAL LETTER Z WITH DOT ABOVE */ - { 0x01b1, 0x0105 }, /* aogonek ą LATIN SMALL LETTER A WITH OGONEK */ - { 0x01b2, 0x02db }, /* ogonek ˛ OGONEK */ - { 0x01b3, 0x0142 }, /* lstroke ł LATIN SMALL LETTER L WITH STROKE */ - { 0x01b5, 0x013e }, /* lcaron ľ LATIN SMALL LETTER L WITH CARON */ - { 0x01b6, 0x015b }, /* sacute ś LATIN SMALL LETTER S WITH ACUTE */ - { 0x01b7, 0x02c7 }, /* caron ˇ CARON */ - { 0x01b9, 0x0161 }, /* scaron š LATIN SMALL LETTER S WITH CARON */ - { 0x01ba, 0x015f }, /* scedilla ş LATIN SMALL LETTER S WITH CEDILLA */ - { 0x01bb, 0x0165 }, /* tcaron ť LATIN SMALL LETTER T WITH CARON */ - { 0x01bc, 0x017a }, /* zacute ź LATIN SMALL LETTER Z WITH ACUTE */ - { 0x01bd, 0x02dd }, /* doubleacute ˝ DOUBLE ACUTE ACCENT */ - { 0x01be, 0x017e }, /* zcaron ž LATIN SMALL LETTER Z WITH CARON */ - { 0x01bf, 0x017c }, /* zabovedot ż LATIN SMALL LETTER Z WITH DOT ABOVE */ - { 0x01c0, 0x0154 }, /* Racute Ŕ LATIN CAPITAL LETTER R WITH ACUTE */ - { 0x01c3, 0x0102 }, /* Abreve Ă LATIN CAPITAL LETTER A WITH BREVE */ - { 0x01c5, 0x0139 }, /* Lacute Ĺ LATIN CAPITAL LETTER L WITH ACUTE */ - { 0x01c6, 0x0106 }, /* Cacute Ć LATIN CAPITAL LETTER C WITH ACUTE */ - { 0x01c8, 0x010c }, /* Ccaron Č LATIN CAPITAL LETTER C WITH CARON */ - { 0x01ca, 0x0118 }, /* Eogonek Ę LATIN CAPITAL LETTER E WITH OGONEK */ - { 0x01cc, 0x011a }, /* Ecaron Ě LATIN CAPITAL LETTER E WITH CARON */ - { 0x01cf, 0x010e }, /* Dcaron Ď LATIN CAPITAL LETTER D WITH CARON */ - { 0x01d0, 0x0110 }, /* Dstroke Đ LATIN CAPITAL LETTER D WITH STROKE */ - { 0x01d1, 0x0143 }, /* Nacute Ń LATIN CAPITAL LETTER N WITH ACUTE */ - { 0x01d2, 0x0147 }, /* Ncaron Ň LATIN CAPITAL LETTER N WITH CARON */ - { 0x01d5, 0x0150 }, /* Odoubleacute Ő LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */ - { 0x01d8, 0x0158 }, /* Rcaron Ř LATIN CAPITAL LETTER R WITH CARON */ - { 0x01d9, 0x016e }, /* Uring Ů LATIN CAPITAL LETTER U WITH RING ABOVE */ - { 0x01db, 0x0170 }, /* Udoubleacute Ű LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */ - { 0x01de, 0x0162 }, /* Tcedilla Ţ LATIN CAPITAL LETTER T WITH CEDILLA */ - { 0x01e0, 0x0155 }, /* racute ŕ LATIN SMALL LETTER R WITH ACUTE */ - { 0x01e3, 0x0103 }, /* abreve ă LATIN SMALL LETTER A WITH BREVE */ - { 0x01e5, 0x013a }, /* lacute ĺ LATIN SMALL LETTER L WITH ACUTE */ - { 0x01e6, 0x0107 }, /* cacute ć LATIN SMALL LETTER C WITH ACUTE */ - { 0x01e8, 0x010d }, /* ccaron č LATIN SMALL LETTER C WITH CARON */ - { 0x01ea, 0x0119 }, /* eogonek ę LATIN SMALL LETTER E WITH OGONEK */ - { 0x01ec, 0x011b }, /* ecaron ě LATIN SMALL LETTER E WITH CARON */ - { 0x01ef, 0x010f }, /* dcaron ď LATIN SMALL LETTER D WITH CARON */ - { 0x01f0, 0x0111 }, /* dstroke đ LATIN SMALL LETTER D WITH STROKE */ - { 0x01f1, 0x0144 }, /* nacute ń LATIN SMALL LETTER N WITH ACUTE */ - { 0x01f2, 0x0148 }, /* ncaron ň LATIN SMALL LETTER N WITH CARON */ - { 0x01f5, 0x0151 }, /* odoubleacute ő LATIN SMALL LETTER O WITH DOUBLE ACUTE */ - { 0x01f8, 0x0159 }, /* rcaron ř LATIN SMALL LETTER R WITH CARON */ - { 0x01f9, 0x016f }, /* uring ů LATIN SMALL LETTER U WITH RING ABOVE */ - { 0x01fb, 0x0171 }, /* udoubleacute ű LATIN SMALL LETTER U WITH DOUBLE ACUTE */ - { 0x01fe, 0x0163 }, /* tcedilla ţ LATIN SMALL LETTER T WITH CEDILLA */ - { 0x01ff, 0x02d9 }, /* abovedot ˙ DOT ABOVE */ - { 0x02a1, 0x0126 }, /* Hstroke Ħ LATIN CAPITAL LETTER H WITH STROKE */ - { 0x02a6, 0x0124 }, /* Hcircumflex Ĥ LATIN CAPITAL LETTER H WITH CIRCUMFLEX */ - { 0x02a9, 0x0130 }, /* Iabovedot İ LATIN CAPITAL LETTER I WITH DOT ABOVE */ - { 0x02ab, 0x011e }, /* Gbreve Ğ LATIN CAPITAL LETTER G WITH BREVE */ - { 0x02ac, 0x0134 }, /* Jcircumflex Ĵ LATIN CAPITAL LETTER J WITH CIRCUMFLEX */ - { 0x02b1, 0x0127 }, /* hstroke ħ LATIN SMALL LETTER H WITH STROKE */ - { 0x02b6, 0x0125 }, /* hcircumflex ĥ LATIN SMALL LETTER H WITH CIRCUMFLEX */ - { 0x02b9, 0x0131 }, /* idotless ı LATIN SMALL LETTER DOTLESS I */ - { 0x02bb, 0x011f }, /* gbreve ğ LATIN SMALL LETTER G WITH BREVE */ - { 0x02bc, 0x0135 }, /* jcircumflex ĵ LATIN SMALL LETTER J WITH CIRCUMFLEX */ - { 0x02c5, 0x010a }, /* Cabovedot Ċ LATIN CAPITAL LETTER C WITH DOT ABOVE */ - { 0x02c6, 0x0108 }, /* Ccircumflex Ĉ LATIN CAPITAL LETTER C WITH CIRCUMFLEX */ - { 0x02d5, 0x0120 }, /* Gabovedot Ġ LATIN CAPITAL LETTER G WITH DOT ABOVE */ - { 0x02d8, 0x011c }, /* Gcircumflex Ĝ LATIN CAPITAL LETTER G WITH CIRCUMFLEX */ - { 0x02dd, 0x016c }, /* Ubreve Ŭ LATIN CAPITAL LETTER U WITH BREVE */ - { 0x02de, 0x015c }, /* Scircumflex Ŝ LATIN CAPITAL LETTER S WITH CIRCUMFLEX */ - { 0x02e5, 0x010b }, /* cabovedot ċ LATIN SMALL LETTER C WITH DOT ABOVE */ - { 0x02e6, 0x0109 }, /* ccircumflex ĉ LATIN SMALL LETTER C WITH CIRCUMFLEX */ - { 0x02f5, 0x0121 }, /* gabovedot ġ LATIN SMALL LETTER G WITH DOT ABOVE */ - { 0x02f8, 0x011d }, /* gcircumflex ĝ LATIN SMALL LETTER G WITH CIRCUMFLEX */ - { 0x02fd, 0x016d }, /* ubreve ŭ LATIN SMALL LETTER U WITH BREVE */ - { 0x02fe, 0x015d }, /* scircumflex ŝ LATIN SMALL LETTER S WITH CIRCUMFLEX */ - { 0x03a2, 0x0138 }, /* kra ĸ LATIN SMALL LETTER KRA */ - { 0x03a3, 0x0156 }, /* Rcedilla Ŗ LATIN CAPITAL LETTER R WITH CEDILLA */ - { 0x03a5, 0x0128 }, /* Itilde Ĩ LATIN CAPITAL LETTER I WITH TILDE */ - { 0x03a6, 0x013b }, /* Lcedilla Ļ LATIN CAPITAL LETTER L WITH CEDILLA */ - { 0x03aa, 0x0112 }, /* Emacron Ē LATIN CAPITAL LETTER E WITH MACRON */ - { 0x03ab, 0x0122 }, /* Gcedilla Ģ LATIN CAPITAL LETTER G WITH CEDILLA */ - { 0x03ac, 0x0166 }, /* Tslash Ŧ LATIN CAPITAL LETTER T WITH STROKE */ - { 0x03b3, 0x0157 }, /* rcedilla ŗ LATIN SMALL LETTER R WITH CEDILLA */ - { 0x03b5, 0x0129 }, /* itilde ĩ LATIN SMALL LETTER I WITH TILDE */ - { 0x03b6, 0x013c }, /* lcedilla ļ LATIN SMALL LETTER L WITH CEDILLA */ - { 0x03ba, 0x0113 }, /* emacron ē LATIN SMALL LETTER E WITH MACRON */ - { 0x03bb, 0x0123 }, /* gcedilla ģ LATIN SMALL LETTER G WITH CEDILLA */ - { 0x03bc, 0x0167 }, /* tslash ŧ LATIN SMALL LETTER T WITH STROKE */ - { 0x03bd, 0x014a }, /* ENG Ŋ LATIN CAPITAL LETTER ENG */ - { 0x03bf, 0x014b }, /* eng ŋ LATIN SMALL LETTER ENG */ - { 0x03c0, 0x0100 }, /* Amacron Ā LATIN CAPITAL LETTER A WITH MACRON */ - { 0x03c7, 0x012e }, /* Iogonek Į LATIN CAPITAL LETTER I WITH OGONEK */ - { 0x03cc, 0x0116 }, /* Eabovedot Ė LATIN CAPITAL LETTER E WITH DOT ABOVE */ - { 0x03cf, 0x012a }, /* Imacron Ī LATIN CAPITAL LETTER I WITH MACRON */ - { 0x03d1, 0x0145 }, /* Ncedilla Ņ LATIN CAPITAL LETTER N WITH CEDILLA */ - { 0x03d2, 0x014c }, /* Omacron Ō LATIN CAPITAL LETTER O WITH MACRON */ - { 0x03d3, 0x0136 }, /* Kcedilla Ķ LATIN CAPITAL LETTER K WITH CEDILLA */ - { 0x03d9, 0x0172 }, /* Uogonek Ų LATIN CAPITAL LETTER U WITH OGONEK */ - { 0x03dd, 0x0168 }, /* Utilde Ũ LATIN CAPITAL LETTER U WITH TILDE */ - { 0x03de, 0x016a }, /* Umacron Ū LATIN CAPITAL LETTER U WITH MACRON */ - { 0x03e0, 0x0101 }, /* amacron ā LATIN SMALL LETTER A WITH MACRON */ - { 0x03e7, 0x012f }, /* iogonek į LATIN SMALL LETTER I WITH OGONEK */ - { 0x03ec, 0x0117 }, /* eabovedot ė LATIN SMALL LETTER E WITH DOT ABOVE */ - { 0x03ef, 0x012b }, /* imacron ī LATIN SMALL LETTER I WITH MACRON */ - { 0x03f1, 0x0146 }, /* ncedilla ņ LATIN SMALL LETTER N WITH CEDILLA */ - { 0x03f2, 0x014d }, /* omacron ō LATIN SMALL LETTER O WITH MACRON */ - { 0x03f3, 0x0137 }, /* kcedilla ķ LATIN SMALL LETTER K WITH CEDILLA */ - { 0x03f9, 0x0173 }, /* uogonek ų LATIN SMALL LETTER U WITH OGONEK */ - { 0x03fd, 0x0169 }, /* utilde ũ LATIN SMALL LETTER U WITH TILDE */ - { 0x03fe, 0x016b }, /* umacron ū LATIN SMALL LETTER U WITH MACRON */ - { 0x047e, 0x203e }, /* overline ‾ OVERLINE */ - { 0x04a1, 0x3002 }, /* kana_fullstop 。 IDEOGRAPHIC FULL STOP */ - { 0x04a2, 0x300c }, /* kana_openingbracket 「 LEFT CORNER BRACKET */ - { 0x04a3, 0x300d }, /* kana_closingbracket 」 RIGHT CORNER BRACKET */ - { 0x04a4, 0x3001 }, /* kana_comma 、 IDEOGRAPHIC COMMA */ - { 0x04a5, 0x30fb }, /* kana_conjunctive ・ KATAKANA MIDDLE DOT */ - { 0x04a6, 0x30f2 }, /* kana_WO ヲ KATAKANA LETTER WO */ - { 0x04a7, 0x30a1 }, /* kana_a ァ KATAKANA LETTER SMALL A */ - { 0x04a8, 0x30a3 }, /* kana_i ィ KATAKANA LETTER SMALL I */ - { 0x04a9, 0x30a5 }, /* kana_u ゥ KATAKANA LETTER SMALL U */ - { 0x04aa, 0x30a7 }, /* kana_e ェ KATAKANA LETTER SMALL E */ - { 0x04ab, 0x30a9 }, /* kana_o ォ KATAKANA LETTER SMALL O */ - { 0x04ac, 0x30e3 }, /* kana_ya ャ KATAKANA LETTER SMALL YA */ - { 0x04ad, 0x30e5 }, /* kana_yu ュ KATAKANA LETTER SMALL YU */ - { 0x04ae, 0x30e7 }, /* kana_yo ョ KATAKANA LETTER SMALL YO */ - { 0x04af, 0x30c3 }, /* kana_tsu ッ KATAKANA LETTER SMALL TU */ - { 0x04b0, 0x30fc }, /* prolongedsound ー KATAKANA-HIRAGANA PROLONGED SOUND MARK */ - { 0x04b1, 0x30a2 }, /* kana_A ア KATAKANA LETTER A */ - { 0x04b2, 0x30a4 }, /* kana_I イ KATAKANA LETTER I */ - { 0x04b3, 0x30a6 }, /* kana_U ウ KATAKANA LETTER U */ - { 0x04b4, 0x30a8 }, /* kana_E エ KATAKANA LETTER E */ - { 0x04b5, 0x30aa }, /* kana_O オ KATAKANA LETTER O */ - { 0x04b6, 0x30ab }, /* kana_KA カ KATAKANA LETTER KA */ - { 0x04b7, 0x30ad }, /* kana_KI キ KATAKANA LETTER KI */ - { 0x04b8, 0x30af }, /* kana_KU ク KATAKANA LETTER KU */ - { 0x04b9, 0x30b1 }, /* kana_KE ケ KATAKANA LETTER KE */ - { 0x04ba, 0x30b3 }, /* kana_KO コ KATAKANA LETTER KO */ - { 0x04bb, 0x30b5 }, /* kana_SA サ KATAKANA LETTER SA */ - { 0x04bc, 0x30b7 }, /* kana_SHI シ KATAKANA LETTER SI */ - { 0x04bd, 0x30b9 }, /* kana_SU ス KATAKANA LETTER SU */ - { 0x04be, 0x30bb }, /* kana_SE セ KATAKANA LETTER SE */ - { 0x04bf, 0x30bd }, /* kana_SO ソ KATAKANA LETTER SO */ - { 0x04c0, 0x30bf }, /* kana_TA タ KATAKANA LETTER TA */ - { 0x04c1, 0x30c1 }, /* kana_CHI チ KATAKANA LETTER TI */ - { 0x04c2, 0x30c4 }, /* kana_TSU ツ KATAKANA LETTER TU */ - { 0x04c3, 0x30c6 }, /* kana_TE テ KATAKANA LETTER TE */ - { 0x04c4, 0x30c8 }, /* kana_TO ト KATAKANA LETTER TO */ - { 0x04c5, 0x30ca }, /* kana_NA ナ KATAKANA LETTER NA */ - { 0x04c6, 0x30cb }, /* kana_NI ニ KATAKANA LETTER NI */ - { 0x04c7, 0x30cc }, /* kana_NU ヌ KATAKANA LETTER NU */ - { 0x04c8, 0x30cd }, /* kana_NE ネ KATAKANA LETTER NE */ - { 0x04c9, 0x30ce }, /* kana_NO ノ KATAKANA LETTER NO */ - { 0x04ca, 0x30cf }, /* kana_HA ハ KATAKANA LETTER HA */ - { 0x04cb, 0x30d2 }, /* kana_HI ヒ KATAKANA LETTER HI */ - { 0x04cc, 0x30d5 }, /* kana_FU フ KATAKANA LETTER HU */ - { 0x04cd, 0x30d8 }, /* kana_HE ヘ KATAKANA LETTER HE */ - { 0x04ce, 0x30db }, /* kana_HO ホ KATAKANA LETTER HO */ - { 0x04cf, 0x30de }, /* kana_MA マ KATAKANA LETTER MA */ - { 0x04d0, 0x30df }, /* kana_MI ミ KATAKANA LETTER MI */ - { 0x04d1, 0x30e0 }, /* kana_MU ム KATAKANA LETTER MU */ - { 0x04d2, 0x30e1 }, /* kana_ME メ KATAKANA LETTER ME */ - { 0x04d3, 0x30e2 }, /* kana_MO モ KATAKANA LETTER MO */ - { 0x04d4, 0x30e4 }, /* kana_YA ヤ KATAKANA LETTER YA */ - { 0x04d5, 0x30e6 }, /* kana_YU ユ KATAKANA LETTER YU */ - { 0x04d6, 0x30e8 }, /* kana_YO ヨ KATAKANA LETTER YO */ - { 0x04d7, 0x30e9 }, /* kana_RA ラ KATAKANA LETTER RA */ - { 0x04d8, 0x30ea }, /* kana_RI リ KATAKANA LETTER RI */ - { 0x04d9, 0x30eb }, /* kana_RU ル KATAKANA LETTER RU */ - { 0x04da, 0x30ec }, /* kana_RE レ KATAKANA LETTER RE */ - { 0x04db, 0x30ed }, /* kana_RO ロ KATAKANA LETTER RO */ - { 0x04dc, 0x30ef }, /* kana_WA ワ KATAKANA LETTER WA */ - { 0x04dd, 0x30f3 }, /* kana_N ン KATAKANA LETTER N */ - { 0x04de, 0x309b }, /* voicedsound ゛ KATAKANA-HIRAGANA VOICED SOUND MARK */ - { 0x04df, 0x309c }, /* semivoicedsound ゜ KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */ - { 0x05ac, 0x060c }, /* Arabic_comma ، ARABIC COMMA */ - { 0x05bb, 0x061b }, /* Arabic_semicolon ؛ ARABIC SEMICOLON */ - { 0x05bf, 0x061f }, /* Arabic_question_mark ؟ ARABIC QUESTION MARK */ - { 0x05c1, 0x0621 }, /* Arabic_hamza ء ARABIC LETTER HAMZA */ - { 0x05c2, 0x0622 }, /* Arabic_maddaonalef آ ARABIC LETTER ALEF WITH MADDA ABOVE */ - { 0x05c3, 0x0623 }, /* Arabic_hamzaonalef أ ARABIC LETTER ALEF WITH HAMZA ABOVE */ - { 0x05c4, 0x0624 }, /* Arabic_hamzaonwaw ؤ ARABIC LETTER WAW WITH HAMZA ABOVE */ - { 0x05c5, 0x0625 }, /* Arabic_hamzaunderalef إ ARABIC LETTER ALEF WITH HAMZA BELOW */ - { 0x05c6, 0x0626 }, /* Arabic_hamzaonyeh ئ ARABIC LETTER YEH WITH HAMZA ABOVE */ - { 0x05c7, 0x0627 }, /* Arabic_alef ا ARABIC LETTER ALEF */ - { 0x05c8, 0x0628 }, /* Arabic_beh ب ARABIC LETTER BEH */ - { 0x05c9, 0x0629 }, /* Arabic_tehmarbuta ة ARABIC LETTER TEH MARBUTA */ - { 0x05ca, 0x062a }, /* Arabic_teh ت ARABIC LETTER TEH */ - { 0x05cb, 0x062b }, /* Arabic_theh ث ARABIC LETTER THEH */ - { 0x05cc, 0x062c }, /* Arabic_jeem ج ARABIC LETTER JEEM */ - { 0x05cd, 0x062d }, /* Arabic_hah ح ARABIC LETTER HAH */ - { 0x05ce, 0x062e }, /* Arabic_khah خ ARABIC LETTER KHAH */ - { 0x05cf, 0x062f }, /* Arabic_dal د ARABIC LETTER DAL */ - { 0x05d0, 0x0630 }, /* Arabic_thal ذ ARABIC LETTER THAL */ - { 0x05d1, 0x0631 }, /* Arabic_ra ر ARABIC LETTER REH */ - { 0x05d2, 0x0632 }, /* Arabic_zain ز ARABIC LETTER ZAIN */ - { 0x05d3, 0x0633 }, /* Arabic_seen س ARABIC LETTER SEEN */ - { 0x05d4, 0x0634 }, /* Arabic_sheen ش ARABIC LETTER SHEEN */ - { 0x05d5, 0x0635 }, /* Arabic_sad ص ARABIC LETTER SAD */ - { 0x05d6, 0x0636 }, /* Arabic_dad ض ARABIC LETTER DAD */ - { 0x05d7, 0x0637 }, /* Arabic_tah ط ARABIC LETTER TAH */ - { 0x05d8, 0x0638 }, /* Arabic_zah ظ ARABIC LETTER ZAH */ - { 0x05d9, 0x0639 }, /* Arabic_ain ع ARABIC LETTER AIN */ - { 0x05da, 0x063a }, /* Arabic_ghain غ ARABIC LETTER GHAIN */ - { 0x05e0, 0x0640 }, /* Arabic_tatweel ـ ARABIC TATWEEL */ - { 0x05e1, 0x0641 }, /* Arabic_feh ف ARABIC LETTER FEH */ - { 0x05e2, 0x0642 }, /* Arabic_qaf ق ARABIC LETTER QAF */ - { 0x05e3, 0x0643 }, /* Arabic_kaf ك ARABIC LETTER KAF */ - { 0x05e4, 0x0644 }, /* Arabic_lam ل ARABIC LETTER LAM */ - { 0x05e5, 0x0645 }, /* Arabic_meem م ARABIC LETTER MEEM */ - { 0x05e6, 0x0646 }, /* Arabic_noon ن ARABIC LETTER NOON */ - { 0x05e7, 0x0647 }, /* Arabic_ha ه ARABIC LETTER HEH */ - { 0x05e8, 0x0648 }, /* Arabic_waw و ARABIC LETTER WAW */ - { 0x05e9, 0x0649 }, /* Arabic_alefmaksura ى ARABIC LETTER ALEF MAKSURA */ - { 0x05ea, 0x064a }, /* Arabic_yeh ي ARABIC LETTER YEH */ - { 0x05eb, 0x064b }, /* Arabic_fathatan ً ARABIC FATHATAN */ - { 0x05ec, 0x064c }, /* Arabic_dammatan ٌ ARABIC DAMMATAN */ - { 0x05ed, 0x064d }, /* Arabic_kasratan ٍ ARABIC KASRATAN */ - { 0x05ee, 0x064e }, /* Arabic_fatha َ ARABIC FATHA */ - { 0x05ef, 0x064f }, /* Arabic_damma ُ ARABIC DAMMA */ - { 0x05f0, 0x0650 }, /* Arabic_kasra ِ ARABIC KASRA */ - { 0x05f1, 0x0651 }, /* Arabic_shadda ّ ARABIC SHADDA */ - { 0x05f2, 0x0652 }, /* Arabic_sukun ْ ARABIC SUKUN */ - { 0x06a1, 0x0452 }, /* Serbian_dje ђ CYRILLIC SMALL LETTER DJE */ - { 0x06a2, 0x0453 }, /* Macedonia_gje ѓ CYRILLIC SMALL LETTER GJE */ - { 0x06a3, 0x0451 }, /* Cyrillic_io ё CYRILLIC SMALL LETTER IO */ - { 0x06a4, 0x0454 }, /* Ukrainian_ie є CYRILLIC SMALL LETTER UKRAINIAN IE */ - { 0x06a5, 0x0455 }, /* Macedonia_dse ѕ CYRILLIC SMALL LETTER DZE */ - { 0x06a6, 0x0456 }, /* Ukrainian_i і CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */ - { 0x06a7, 0x0457 }, /* Ukrainian_yi ї CYRILLIC SMALL LETTER YI */ - { 0x06a8, 0x0458 }, /* Cyrillic_je ј CYRILLIC SMALL LETTER JE */ - { 0x06a9, 0x0459 }, /* Cyrillic_lje љ CYRILLIC SMALL LETTER LJE */ - { 0x06aa, 0x045a }, /* Cyrillic_nje њ CYRILLIC SMALL LETTER NJE */ - { 0x06ab, 0x045b }, /* Serbian_tshe ћ CYRILLIC SMALL LETTER TSHE */ - { 0x06ac, 0x045c }, /* Macedonia_kje ќ CYRILLIC SMALL LETTER KJE */ - { 0x06ae, 0x045e }, /* Byelorussian_shortu ў CYRILLIC SMALL LETTER SHORT U */ - { 0x06af, 0x045f }, /* Cyrillic_dzhe џ CYRILLIC SMALL LETTER DZHE */ - { 0x06b0, 0x2116 }, /* numerosign № NUMERO SIGN */ - { 0x06b1, 0x0402 }, /* Serbian_DJE Ђ CYRILLIC CAPITAL LETTER DJE */ - { 0x06b2, 0x0403 }, /* Macedonia_GJE Ѓ CYRILLIC CAPITAL LETTER GJE */ - { 0x06b3, 0x0401 }, /* Cyrillic_IO Ё CYRILLIC CAPITAL LETTER IO */ - { 0x06b4, 0x0404 }, /* Ukrainian_IE Є CYRILLIC CAPITAL LETTER UKRAINIAN IE */ - { 0x06b5, 0x0405 }, /* Macedonia_DSE Ѕ CYRILLIC CAPITAL LETTER DZE */ - { 0x06b6, 0x0406 }, /* Ukrainian_I І CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */ - { 0x06b7, 0x0407 }, /* Ukrainian_YI Ї CYRILLIC CAPITAL LETTER YI */ - { 0x06b8, 0x0408 }, /* Cyrillic_JE Ј CYRILLIC CAPITAL LETTER JE */ - { 0x06b9, 0x0409 }, /* Cyrillic_LJE Љ CYRILLIC CAPITAL LETTER LJE */ - { 0x06ba, 0x040a }, /* Cyrillic_NJE Њ CYRILLIC CAPITAL LETTER NJE */ - { 0x06bb, 0x040b }, /* Serbian_TSHE Ћ CYRILLIC CAPITAL LETTER TSHE */ - { 0x06bc, 0x040c }, /* Macedonia_KJE Ќ CYRILLIC CAPITAL LETTER KJE */ - { 0x06be, 0x040e }, /* Byelorussian_SHORTU Ў CYRILLIC CAPITAL LETTER SHORT U */ - { 0x06bf, 0x040f }, /* Cyrillic_DZHE Џ CYRILLIC CAPITAL LETTER DZHE */ - { 0x06c0, 0x044e }, /* Cyrillic_yu ю CYRILLIC SMALL LETTER YU */ - { 0x06c1, 0x0430 }, /* Cyrillic_a а CYRILLIC SMALL LETTER A */ - { 0x06c2, 0x0431 }, /* Cyrillic_be б CYRILLIC SMALL LETTER BE */ - { 0x06c3, 0x0446 }, /* Cyrillic_tse ц CYRILLIC SMALL LETTER TSE */ - { 0x06c4, 0x0434 }, /* Cyrillic_de д CYRILLIC SMALL LETTER DE */ - { 0x06c5, 0x0435 }, /* Cyrillic_ie е CYRILLIC SMALL LETTER IE */ - { 0x06c6, 0x0444 }, /* Cyrillic_ef ф CYRILLIC SMALL LETTER EF */ - { 0x06c7, 0x0433 }, /* Cyrillic_ghe г CYRILLIC SMALL LETTER GHE */ - { 0x06c8, 0x0445 }, /* Cyrillic_ha х CYRILLIC SMALL LETTER HA */ - { 0x06c9, 0x0438 }, /* Cyrillic_i и CYRILLIC SMALL LETTER I */ - { 0x06ca, 0x0439 }, /* Cyrillic_shorti й CYRILLIC SMALL LETTER SHORT I */ - { 0x06cb, 0x043a }, /* Cyrillic_ka к CYRILLIC SMALL LETTER KA */ - { 0x06cc, 0x043b }, /* Cyrillic_el л CYRILLIC SMALL LETTER EL */ - { 0x06cd, 0x043c }, /* Cyrillic_em м CYRILLIC SMALL LETTER EM */ - { 0x06ce, 0x043d }, /* Cyrillic_en н CYRILLIC SMALL LETTER EN */ - { 0x06cf, 0x043e }, /* Cyrillic_o о CYRILLIC SMALL LETTER O */ - { 0x06d0, 0x043f }, /* Cyrillic_pe п CYRILLIC SMALL LETTER PE */ - { 0x06d1, 0x044f }, /* Cyrillic_ya я CYRILLIC SMALL LETTER YA */ - { 0x06d2, 0x0440 }, /* Cyrillic_er р CYRILLIC SMALL LETTER ER */ - { 0x06d3, 0x0441 }, /* Cyrillic_es с CYRILLIC SMALL LETTER ES */ - { 0x06d4, 0x0442 }, /* Cyrillic_te т CYRILLIC SMALL LETTER TE */ - { 0x06d5, 0x0443 }, /* Cyrillic_u у CYRILLIC SMALL LETTER U */ - { 0x06d6, 0x0436 }, /* Cyrillic_zhe ж CYRILLIC SMALL LETTER ZHE */ - { 0x06d7, 0x0432 }, /* Cyrillic_ve в CYRILLIC SMALL LETTER VE */ - { 0x06d8, 0x044c }, /* Cyrillic_softsign ь CYRILLIC SMALL LETTER SOFT SIGN */ - { 0x06d9, 0x044b }, /* Cyrillic_yeru ы CYRILLIC SMALL LETTER YERU */ - { 0x06da, 0x0437 }, /* Cyrillic_ze з CYRILLIC SMALL LETTER ZE */ - { 0x06db, 0x0448 }, /* Cyrillic_sha ш CYRILLIC SMALL LETTER SHA */ - { 0x06dc, 0x044d }, /* Cyrillic_e э CYRILLIC SMALL LETTER E */ - { 0x06dd, 0x0449 }, /* Cyrillic_shcha щ CYRILLIC SMALL LETTER SHCHA */ - { 0x06de, 0x0447 }, /* Cyrillic_che ч CYRILLIC SMALL LETTER CHE */ - { 0x06df, 0x044a }, /* Cyrillic_hardsign ъ CYRILLIC SMALL LETTER HARD SIGN */ - { 0x06e0, 0x042e }, /* Cyrillic_YU Ю CYRILLIC CAPITAL LETTER YU */ - { 0x06e1, 0x0410 }, /* Cyrillic_A А CYRILLIC CAPITAL LETTER A */ - { 0x06e2, 0x0411 }, /* Cyrillic_BE Б CYRILLIC CAPITAL LETTER BE */ - { 0x06e3, 0x0426 }, /* Cyrillic_TSE Ц CYRILLIC CAPITAL LETTER TSE */ - { 0x06e4, 0x0414 }, /* Cyrillic_DE Д CYRILLIC CAPITAL LETTER DE */ - { 0x06e5, 0x0415 }, /* Cyrillic_IE Е CYRILLIC CAPITAL LETTER IE */ - { 0x06e6, 0x0424 }, /* Cyrillic_EF Ф CYRILLIC CAPITAL LETTER EF */ - { 0x06e7, 0x0413 }, /* Cyrillic_GHE Г CYRILLIC CAPITAL LETTER GHE */ - { 0x06e8, 0x0425 }, /* Cyrillic_HA Х CYRILLIC CAPITAL LETTER HA */ - { 0x06e9, 0x0418 }, /* Cyrillic_I И CYRILLIC CAPITAL LETTER I */ - { 0x06ea, 0x0419 }, /* Cyrillic_SHORTI Й CYRILLIC CAPITAL LETTER SHORT I */ - { 0x06eb, 0x041a }, /* Cyrillic_KA К CYRILLIC CAPITAL LETTER KA */ - { 0x06ec, 0x041b }, /* Cyrillic_EL Л CYRILLIC CAPITAL LETTER EL */ - { 0x06ed, 0x041c }, /* Cyrillic_EM М CYRILLIC CAPITAL LETTER EM */ - { 0x06ee, 0x041d }, /* Cyrillic_EN Н CYRILLIC CAPITAL LETTER EN */ - { 0x06ef, 0x041e }, /* Cyrillic_O О CYRILLIC CAPITAL LETTER O */ - { 0x06f0, 0x041f }, /* Cyrillic_PE П CYRILLIC CAPITAL LETTER PE */ - { 0x06f1, 0x042f }, /* Cyrillic_YA Я CYRILLIC CAPITAL LETTER YA */ - { 0x06f2, 0x0420 }, /* Cyrillic_ER Р CYRILLIC CAPITAL LETTER ER */ - { 0x06f3, 0x0421 }, /* Cyrillic_ES С CYRILLIC CAPITAL LETTER ES */ - { 0x06f4, 0x0422 }, /* Cyrillic_TE Т CYRILLIC CAPITAL LETTER TE */ - { 0x06f5, 0x0423 }, /* Cyrillic_U У CYRILLIC CAPITAL LETTER U */ - { 0x06f6, 0x0416 }, /* Cyrillic_ZHE Ж CYRILLIC CAPITAL LETTER ZHE */ - { 0x06f7, 0x0412 }, /* Cyrillic_VE В CYRILLIC CAPITAL LETTER VE */ - { 0x06f8, 0x042c }, /* Cyrillic_SOFTSIGN Ь CYRILLIC CAPITAL LETTER SOFT SIGN */ - { 0x06f9, 0x042b }, /* Cyrillic_YERU Ы CYRILLIC CAPITAL LETTER YERU */ - { 0x06fa, 0x0417 }, /* Cyrillic_ZE З CYRILLIC CAPITAL LETTER ZE */ - { 0x06fb, 0x0428 }, /* Cyrillic_SHA Ш CYRILLIC CAPITAL LETTER SHA */ - { 0x06fc, 0x042d }, /* Cyrillic_E Э CYRILLIC CAPITAL LETTER E */ - { 0x06fd, 0x0429 }, /* Cyrillic_SHCHA Щ CYRILLIC CAPITAL LETTER SHCHA */ - { 0x06fe, 0x0427 }, /* Cyrillic_CHE Ч CYRILLIC CAPITAL LETTER CHE */ - { 0x06ff, 0x042a }, /* Cyrillic_HARDSIGN Ъ CYRILLIC CAPITAL LETTER HARD SIGN */ - { 0x07a1, 0x0386 }, /* Greek_ALPHAaccent Ά GREEK CAPITAL LETTER ALPHA WITH TONOS */ - { 0x07a2, 0x0388 }, /* Greek_EPSILONaccent Έ GREEK CAPITAL LETTER EPSILON WITH TONOS */ - { 0x07a3, 0x0389 }, /* Greek_ETAaccent Ή GREEK CAPITAL LETTER ETA WITH TONOS */ - { 0x07a4, 0x038a }, /* Greek_IOTAaccent Ί GREEK CAPITAL LETTER IOTA WITH TONOS */ - { 0x07a5, 0x03aa }, /* Greek_IOTAdiaeresis Ϊ GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */ - { 0x07a7, 0x038c }, /* Greek_OMICRONaccent Ό GREEK CAPITAL LETTER OMICRON WITH TONOS */ - { 0x07a8, 0x038e }, /* Greek_UPSILONaccent Ύ GREEK CAPITAL LETTER UPSILON WITH TONOS */ - { 0x07a9, 0x03ab }, /* Greek_UPSILONdieresis Ϋ GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */ - { 0x07ab, 0x038f }, /* Greek_OMEGAaccent Ώ GREEK CAPITAL LETTER OMEGA WITH TONOS */ - { 0x07ae, 0x0385 }, /* Greek_accentdieresis ΅ GREEK DIALYTIKA TONOS */ - { 0x07af, 0x2015 }, /* Greek_horizbar ― HORIZONTAL BAR */ - { 0x07b1, 0x03ac }, /* Greek_alphaaccent ά GREEK SMALL LETTER ALPHA WITH TONOS */ - { 0x07b2, 0x03ad }, /* Greek_epsilonaccent έ GREEK SMALL LETTER EPSILON WITH TONOS */ - { 0x07b3, 0x03ae }, /* Greek_etaaccent ή GREEK SMALL LETTER ETA WITH TONOS */ - { 0x07b4, 0x03af }, /* Greek_iotaaccent ί GREEK SMALL LETTER IOTA WITH TONOS */ - { 0x07b5, 0x03ca }, /* Greek_iotadieresis ϊ GREEK SMALL LETTER IOTA WITH DIALYTIKA */ - { 0x07b6, 0x0390 }, /* Greek_iotaaccentdieresis ΐ GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS */ - { 0x07b7, 0x03cc }, /* Greek_omicronaccent ό GREEK SMALL LETTER OMICRON WITH TONOS */ - { 0x07b8, 0x03cd }, /* Greek_upsilonaccent ύ GREEK SMALL LETTER UPSILON WITH TONOS */ - { 0x07b9, 0x03cb }, /* Greek_upsilondieresis ϋ GREEK SMALL LETTER UPSILON WITH DIALYTIKA */ - { 0x07ba, 0x03b0 }, /* Greek_upsilonaccentdieresis ΰ GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS */ - { 0x07bb, 0x03ce }, /* Greek_omegaaccent ώ GREEK SMALL LETTER OMEGA WITH TONOS */ - { 0x07c1, 0x0391 }, /* Greek_ALPHA Α GREEK CAPITAL LETTER ALPHA */ - { 0x07c2, 0x0392 }, /* Greek_BETA Β GREEK CAPITAL LETTER BETA */ - { 0x07c3, 0x0393 }, /* Greek_GAMMA Γ GREEK CAPITAL LETTER GAMMA */ - { 0x07c4, 0x0394 }, /* Greek_DELTA Δ GREEK CAPITAL LETTER DELTA */ - { 0x07c5, 0x0395 }, /* Greek_EPSILON Ε GREEK CAPITAL LETTER EPSILON */ - { 0x07c6, 0x0396 }, /* Greek_ZETA Ζ GREEK CAPITAL LETTER ZETA */ - { 0x07c7, 0x0397 }, /* Greek_ETA Η GREEK CAPITAL LETTER ETA */ - { 0x07c8, 0x0398 }, /* Greek_THETA Θ GREEK CAPITAL LETTER THETA */ - { 0x07c9, 0x0399 }, /* Greek_IOTA Ι GREEK CAPITAL LETTER IOTA */ - { 0x07ca, 0x039a }, /* Greek_KAPPA Κ GREEK CAPITAL LETTER KAPPA */ - { 0x07cb, 0x039b }, /* Greek_LAMBDA Λ GREEK CAPITAL LETTER LAMDA */ - { 0x07cc, 0x039c }, /* Greek_MU Μ GREEK CAPITAL LETTER MU */ - { 0x07cd, 0x039d }, /* Greek_NU Ν GREEK CAPITAL LETTER NU */ - { 0x07ce, 0x039e }, /* Greek_XI Ξ GREEK CAPITAL LETTER XI */ - { 0x07cf, 0x039f }, /* Greek_OMICRON Ο GREEK CAPITAL LETTER OMICRON */ - { 0x07d0, 0x03a0 }, /* Greek_PI Π GREEK CAPITAL LETTER PI */ - { 0x07d1, 0x03a1 }, /* Greek_RHO Ρ GREEK CAPITAL LETTER RHO */ - { 0x07d2, 0x03a3 }, /* Greek_SIGMA Σ GREEK CAPITAL LETTER SIGMA */ - { 0x07d4, 0x03a4 }, /* Greek_TAU Τ GREEK CAPITAL LETTER TAU */ - { 0x07d5, 0x03a5 }, /* Greek_UPSILON Υ GREEK CAPITAL LETTER UPSILON */ - { 0x07d6, 0x03a6 }, /* Greek_PHI Φ GREEK CAPITAL LETTER PHI */ - { 0x07d7, 0x03a7 }, /* Greek_CHI Χ GREEK CAPITAL LETTER CHI */ - { 0x07d8, 0x03a8 }, /* Greek_PSI Ψ GREEK CAPITAL LETTER PSI */ - { 0x07d9, 0x03a9 }, /* Greek_OMEGA Ω GREEK CAPITAL LETTER OMEGA */ - { 0x07e1, 0x03b1 }, /* Greek_alpha α GREEK SMALL LETTER ALPHA */ - { 0x07e2, 0x03b2 }, /* Greek_beta β GREEK SMALL LETTER BETA */ - { 0x07e3, 0x03b3 }, /* Greek_gamma γ GREEK SMALL LETTER GAMMA */ - { 0x07e4, 0x03b4 }, /* Greek_delta δ GREEK SMALL LETTER DELTA */ - { 0x07e5, 0x03b5 }, /* Greek_epsilon ε GREEK SMALL LETTER EPSILON */ - { 0x07e6, 0x03b6 }, /* Greek_zeta ζ GREEK SMALL LETTER ZETA */ - { 0x07e7, 0x03b7 }, /* Greek_eta η GREEK SMALL LETTER ETA */ - { 0x07e8, 0x03b8 }, /* Greek_theta θ GREEK SMALL LETTER THETA */ - { 0x07e9, 0x03b9 }, /* Greek_iota ι GREEK SMALL LETTER IOTA */ - { 0x07ea, 0x03ba }, /* Greek_kappa κ GREEK SMALL LETTER KAPPA */ - { 0x07eb, 0x03bb }, /* Greek_lambda λ GREEK SMALL LETTER LAMDA */ - { 0x07ec, 0x03bc }, /* Greek_mu μ GREEK SMALL LETTER MU */ - { 0x07ed, 0x03bd }, /* Greek_nu ν GREEK SMALL LETTER NU */ - { 0x07ee, 0x03be }, /* Greek_xi ξ GREEK SMALL LETTER XI */ - { 0x07ef, 0x03bf }, /* Greek_omicron ο GREEK SMALL LETTER OMICRON */ - { 0x07f0, 0x03c0 }, /* Greek_pi π GREEK SMALL LETTER PI */ - { 0x07f1, 0x03c1 }, /* Greek_rho ρ GREEK SMALL LETTER RHO */ - { 0x07f2, 0x03c3 }, /* Greek_sigma σ GREEK SMALL LETTER SIGMA */ - { 0x07f3, 0x03c2 }, /* Greek_finalsmallsigma ς GREEK SMALL LETTER FINAL SIGMA */ - { 0x07f4, 0x03c4 }, /* Greek_tau τ GREEK SMALL LETTER TAU */ - { 0x07f5, 0x03c5 }, /* Greek_upsilon υ GREEK SMALL LETTER UPSILON */ - { 0x07f6, 0x03c6 }, /* Greek_phi φ GREEK SMALL LETTER PHI */ - { 0x07f7, 0x03c7 }, /* Greek_chi χ GREEK SMALL LETTER CHI */ - { 0x07f8, 0x03c8 }, /* Greek_psi ψ GREEK SMALL LETTER PSI */ - { 0x07f9, 0x03c9 }, /* Greek_omega ω GREEK SMALL LETTER OMEGA */ -/* 0x08a1 leftradical ? ??? */ -/* 0x08a2 topleftradical ? ??? */ -/* 0x08a3 horizconnector ? ??? */ - { 0x08a4, 0x2320 }, /* topintegral ⌠ TOP HALF INTEGRAL */ - { 0x08a5, 0x2321 }, /* botintegral ⌡ BOTTOM HALF INTEGRAL */ - { 0x08a6, 0x2502 }, /* vertconnector │ BOX DRAWINGS LIGHT VERTICAL */ -/* 0x08a7 topleftsqbracket ? ??? */ -/* 0x08a8 botleftsqbracket ? ??? */ -/* 0x08a9 toprightsqbracket ? ??? */ -/* 0x08aa botrightsqbracket ? ??? */ -/* 0x08ab topleftparens ? ??? */ -/* 0x08ac botleftparens ? ??? */ -/* 0x08ad toprightparens ? ??? */ -/* 0x08ae botrightparens ? ??? */ -/* 0x08af leftmiddlecurlybrace ? ??? */ -/* 0x08b0 rightmiddlecurlybrace ? ??? */ -/* 0x08b1 topleftsummation ? ??? */ -/* 0x08b2 botleftsummation ? ??? */ -/* 0x08b3 topvertsummationconnector ? ??? */ -/* 0x08b4 botvertsummationconnector ? ??? */ -/* 0x08b5 toprightsummation ? ??? */ -/* 0x08b6 botrightsummation ? ??? */ -/* 0x08b7 rightmiddlesummation ? ??? */ - { 0x08bc, 0x2264 }, /* lessthanequal ≤ LESS-THAN OR EQUAL TO */ - { 0x08bd, 0x2260 }, /* notequal ≠ NOT EQUAL TO */ - { 0x08be, 0x2265 }, /* greaterthanequal ≥ GREATER-THAN OR EQUAL TO */ - { 0x08bf, 0x222b }, /* integral ∫ INTEGRAL */ - { 0x08c0, 0x2234 }, /* therefore ∴ THEREFORE */ - { 0x08c1, 0x221d }, /* variation ∝ PROPORTIONAL TO */ - { 0x08c2, 0x221e }, /* infinity ∞ INFINITY */ - { 0x08c5, 0x2207 }, /* nabla ∇ NABLA */ - { 0x08c8, 0x2245 }, /* approximate ≅ APPROXIMATELY EQUAL TO */ -/* 0x08c9 similarequal ? ??? */ - { 0x08cd, 0x21d4 }, /* ifonlyif ⇔ LEFT RIGHT DOUBLE ARROW */ - { 0x08ce, 0x21d2 }, /* implies ⇒ RIGHTWARDS DOUBLE ARROW */ - { 0x08cf, 0x2261 }, /* identical ≡ IDENTICAL TO */ - { 0x08d6, 0x221a }, /* radical √ SQUARE ROOT */ - { 0x08da, 0x2282 }, /* includedin ⊂ SUBSET OF */ - { 0x08db, 0x2283 }, /* includes ⊃ SUPERSET OF */ - { 0x08dc, 0x2229 }, /* intersection ∩ INTERSECTION */ - { 0x08dd, 0x222a }, /* union ∪ UNION */ - { 0x08de, 0x2227 }, /* logicaland ∧ LOGICAL AND */ - { 0x08df, 0x2228 }, /* logicalor ∨ LOGICAL OR */ - { 0x08ef, 0x2202 }, /* partialderivative ∂ PARTIAL DIFFERENTIAL */ - { 0x08f6, 0x0192 }, /* function ƒ LATIN SMALL LETTER F WITH HOOK */ - { 0x08fb, 0x2190 }, /* leftarrow ← LEFTWARDS ARROW */ - { 0x08fc, 0x2191 }, /* uparrow ↑ UPWARDS ARROW */ - { 0x08fd, 0x2192 }, /* rightarrow → RIGHTWARDS ARROW */ - { 0x08fe, 0x2193 }, /* downarrow ↓ DOWNWARDS ARROW */ - { 0x09df, 0x2422 }, /* blank ␢ BLANK SYMBOL */ - { 0x09e0, 0x25c6 }, /* soliddiamond ◆ BLACK DIAMOND */ - { 0x09e1, 0x2592 }, /* checkerboard ▒ MEDIUM SHADE */ - { 0x09e2, 0x2409 }, /* ht ␉ SYMBOL FOR HORIZONTAL TABULATION */ - { 0x09e3, 0x240c }, /* ff ␌ SYMBOL FOR FORM FEED */ - { 0x09e4, 0x240d }, /* cr ␍ SYMBOL FOR CARRIAGE RETURN */ - { 0x09e5, 0x240a }, /* lf ␊ SYMBOL FOR LINE FEED */ - { 0x09e8, 0x2424 }, /* nl  SYMBOL FOR NEWLINE */ - { 0x09e9, 0x240b }, /* vt ␋ SYMBOL FOR VERTICAL TABULATION */ - { 0x09ea, 0x2518 }, /* lowrightcorner ┘ BOX DRAWINGS LIGHT UP AND LEFT */ - { 0x09eb, 0x2510 }, /* uprightcorner ┐ BOX DRAWINGS LIGHT DOWN AND LEFT */ - { 0x09ec, 0x250c }, /* upleftcorner ┌ BOX DRAWINGS LIGHT DOWN AND RIGHT */ - { 0x09ed, 0x2514 }, /* lowleftcorner └ BOX DRAWINGS LIGHT UP AND RIGHT */ - { 0x09ee, 0x253c }, /* crossinglines ┼ BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */ -/* 0x09ef horizlinescan1 ? ??? */ -/* 0x09f0 horizlinescan3 ? ??? */ - { 0x09f1, 0x2500 }, /* horizlinescan5 ─ BOX DRAWINGS LIGHT HORIZONTAL */ -/* 0x09f2 horizlinescan7 ? ??? */ -/* 0x09f3 horizlinescan9 ? ??? */ - { 0x09f4, 0x251c }, /* leftt ├ BOX DRAWINGS LIGHT VERTICAL AND RIGHT */ - { 0x09f5, 0x2524 }, /* rightt ┤ BOX DRAWINGS LIGHT VERTICAL AND LEFT */ - { 0x09f6, 0x2534 }, /* bott ┴ BOX DRAWINGS LIGHT UP AND HORIZONTAL */ - { 0x09f7, 0x252c }, /* topt ┬ BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */ - { 0x09f8, 0x2502 }, /* vertbar │ BOX DRAWINGS LIGHT VERTICAL */ - { 0x0aa1, 0x2003 }, /* emspace EM SPACE */ - { 0x0aa2, 0x2002 }, /* enspace EN SPACE */ - { 0x0aa3, 0x2004 }, /* em3space THREE-PER-EM SPACE */ - { 0x0aa4, 0x2005 }, /* em4space FOUR-PER-EM SPACE */ - { 0x0aa5, 0x2007 }, /* digitspace FIGURE SPACE */ - { 0x0aa6, 0x2008 }, /* punctspace PUNCTUATION SPACE */ - { 0x0aa7, 0x2009 }, /* thinspace THIN SPACE */ - { 0x0aa8, 0x200a }, /* hairspace HAIR SPACE */ - { 0x0aa9, 0x2014 }, /* emdash — EM DASH */ - { 0x0aaa, 0x2013 }, /* endash – EN DASH */ -/* 0x0aac signifblank ? ??? */ - { 0x0aae, 0x2026 }, /* ellipsis … HORIZONTAL ELLIPSIS */ -/* 0x0aaf doubbaselinedot ? ??? */ - { 0x0ab0, 0x2153 }, /* onethird ⅓ VULGAR FRACTION ONE THIRD */ - { 0x0ab1, 0x2154 }, /* twothirds ⅔ VULGAR FRACTION TWO THIRDS */ - { 0x0ab2, 0x2155 }, /* onefifth ⅕ VULGAR FRACTION ONE FIFTH */ - { 0x0ab3, 0x2156 }, /* twofifths ⅖ VULGAR FRACTION TWO FIFTHS */ - { 0x0ab4, 0x2157 }, /* threefifths ⅗ VULGAR FRACTION THREE FIFTHS */ - { 0x0ab5, 0x2158 }, /* fourfifths ⅘ VULGAR FRACTION FOUR FIFTHS */ - { 0x0ab6, 0x2159 }, /* onesixth ⅙ VULGAR FRACTION ONE SIXTH */ - { 0x0ab7, 0x215a }, /* fivesixths ⅚ VULGAR FRACTION FIVE SIXTHS */ - { 0x0ab8, 0x2105 }, /* careof ℅ CARE OF */ - { 0x0abb, 0x2012 }, /* figdash ‒ FIGURE DASH */ - { 0x0abc, 0x2329 }, /* leftanglebracket 〈 LEFT-POINTING ANGLE BRACKET */ - { 0x0abd, 0x002e }, /* decimalpoint . FULL STOP */ - { 0x0abe, 0x232a }, /* rightanglebracket 〉 RIGHT-POINTING ANGLE BRACKET */ -/* 0x0abf marker ? ??? */ - { 0x0ac3, 0x215b }, /* oneeighth ⅛ VULGAR FRACTION ONE EIGHTH */ - { 0x0ac4, 0x215c }, /* threeeighths ⅜ VULGAR FRACTION THREE EIGHTHS */ - { 0x0ac5, 0x215d }, /* fiveeighths ⅝ VULGAR FRACTION FIVE EIGHTHS */ - { 0x0ac6, 0x215e }, /* seveneighths ⅞ VULGAR FRACTION SEVEN EIGHTHS */ - { 0x0ac9, 0x2122 }, /* trademark ™ TRADE MARK SIGN */ - { 0x0aca, 0x2613 }, /* signaturemark ☓ SALTIRE */ -/* 0x0acb trademarkincircle ? ??? */ - { 0x0acc, 0x25c1 }, /* leftopentriangle ◁ WHITE LEFT-POINTING TRIANGLE */ - { 0x0acd, 0x25b7 }, /* rightopentriangle ▷ WHITE RIGHT-POINTING TRIANGLE */ - { 0x0ace, 0x25cb }, /* emopencircle ○ WHITE CIRCLE */ - { 0x0acf, 0x25a1 }, /* emopenrectangle □ WHITE SQUARE */ - { 0x0ad0, 0x2018 }, /* leftsinglequotemark ‘ LEFT SINGLE QUOTATION MARK */ - { 0x0ad1, 0x2019 }, /* rightsinglequotemark ’ RIGHT SINGLE QUOTATION MARK */ - { 0x0ad2, 0x201c }, /* leftdoublequotemark “ LEFT DOUBLE QUOTATION MARK */ - { 0x0ad3, 0x201d }, /* rightdoublequotemark ” RIGHT DOUBLE QUOTATION MARK */ - { 0x0ad4, 0x211e }, /* prescription ℞ PRESCRIPTION TAKE */ - { 0x0ad6, 0x2032 }, /* minutes ′ PRIME */ - { 0x0ad7, 0x2033 }, /* seconds ″ DOUBLE PRIME */ - { 0x0ad9, 0x271d }, /* latincross ✝ LATIN CROSS */ -/* 0x0ada hexagram ? ??? */ - { 0x0adb, 0x25ac }, /* filledrectbullet ▬ BLACK RECTANGLE */ - { 0x0adc, 0x25c0 }, /* filledlefttribullet ◀ BLACK LEFT-POINTING TRIANGLE */ - { 0x0add, 0x25b6 }, /* filledrighttribullet ▶ BLACK RIGHT-POINTING TRIANGLE */ - { 0x0ade, 0x25cf }, /* emfilledcircle ● BLACK CIRCLE */ - { 0x0adf, 0x25a0 }, /* emfilledrect ■ BLACK SQUARE */ - { 0x0ae0, 0x25e6 }, /* enopencircbullet ◦ WHITE BULLET */ - { 0x0ae1, 0x25ab }, /* enopensquarebullet ▫ WHITE SMALL SQUARE */ - { 0x0ae2, 0x25ad }, /* openrectbullet ▭ WHITE RECTANGLE */ - { 0x0ae3, 0x25b3 }, /* opentribulletup △ WHITE UP-POINTING TRIANGLE */ - { 0x0ae4, 0x25bd }, /* opentribulletdown ▽ WHITE DOWN-POINTING TRIANGLE */ - { 0x0ae5, 0x2606 }, /* openstar ☆ WHITE STAR */ - { 0x0ae6, 0x2022 }, /* enfilledcircbullet • BULLET */ - { 0x0ae7, 0x25aa }, /* enfilledsqbullet ▪ BLACK SMALL SQUARE */ - { 0x0ae8, 0x25b2 }, /* filledtribulletup ▲ BLACK UP-POINTING TRIANGLE */ - { 0x0ae9, 0x25bc }, /* filledtribulletdown ▼ BLACK DOWN-POINTING TRIANGLE */ - { 0x0aea, 0x261c }, /* leftpointer ☜ WHITE LEFT POINTING INDEX */ - { 0x0aeb, 0x261e }, /* rightpointer ☞ WHITE RIGHT POINTING INDEX */ - { 0x0aec, 0x2663 }, /* club ♣ BLACK CLUB SUIT */ - { 0x0aed, 0x2666 }, /* diamond ♦ BLACK DIAMOND SUIT */ - { 0x0aee, 0x2665 }, /* heart ♥ BLACK HEART SUIT */ - { 0x0af0, 0x2720 }, /* maltesecross ✠ MALTESE CROSS */ - { 0x0af1, 0x2020 }, /* dagger † DAGGER */ - { 0x0af2, 0x2021 }, /* doubledagger ‡ DOUBLE DAGGER */ - { 0x0af3, 0x2713 }, /* checkmark ✓ CHECK MARK */ - { 0x0af4, 0x2717 }, /* ballotcross ✗ BALLOT X */ - { 0x0af5, 0x266f }, /* musicalsharp ♯ MUSIC SHARP SIGN */ - { 0x0af6, 0x266d }, /* musicalflat ♭ MUSIC FLAT SIGN */ - { 0x0af7, 0x2642 }, /* malesymbol ♂ MALE SIGN */ - { 0x0af8, 0x2640 }, /* femalesymbol ♀ FEMALE SIGN */ - { 0x0af9, 0x260e }, /* telephone ☎ BLACK TELEPHONE */ - { 0x0afa, 0x2315 }, /* telephonerecorder ⌕ TELEPHONE RECORDER */ - { 0x0afb, 0x2117 }, /* phonographcopyright ℗ SOUND RECORDING COPYRIGHT */ - { 0x0afc, 0x2038 }, /* caret ‸ CARET */ - { 0x0afd, 0x201a }, /* singlelowquotemark ‚ SINGLE LOW-9 QUOTATION MARK */ - { 0x0afe, 0x201e }, /* doublelowquotemark „ DOUBLE LOW-9 QUOTATION MARK */ -/* 0x0aff cursor ? ??? */ - { 0x0ba3, 0x003c }, /* leftcaret < LESS-THAN SIGN */ - { 0x0ba6, 0x003e }, /* rightcaret > GREATER-THAN SIGN */ - { 0x0ba8, 0x2228 }, /* downcaret ∨ LOGICAL OR */ - { 0x0ba9, 0x2227 }, /* upcaret ∧ LOGICAL AND */ - { 0x0bc0, 0x00af }, /* overbar ¯ MACRON */ - { 0x0bc2, 0x22a4 }, /* downtack ⊤ DOWN TACK */ - { 0x0bc3, 0x2229 }, /* upshoe ∩ INTERSECTION */ - { 0x0bc4, 0x230a }, /* downstile ⌊ LEFT FLOOR */ - { 0x0bc6, 0x005f }, /* underbar _ LOW LINE */ - { 0x0bca, 0x2218 }, /* jot ∘ RING OPERATOR */ - { 0x0bcc, 0x2395 }, /* quad ⎕ APL FUNCTIONAL SYMBOL QUAD (Unicode 3.0) */ - { 0x0bce, 0x22a5 }, /* uptack ⊥ UP TACK */ - { 0x0bcf, 0x25cb }, /* circle ○ WHITE CIRCLE */ - { 0x0bd3, 0x2308 }, /* upstile ⌈ LEFT CEILING */ - { 0x0bd6, 0x222a }, /* downshoe ∪ UNION */ - { 0x0bd8, 0x2283 }, /* rightshoe ⊃ SUPERSET OF */ - { 0x0bda, 0x2282 }, /* leftshoe ⊂ SUBSET OF */ - { 0x0bdc, 0x22a3 }, /* lefttack ⊣ LEFT TACK */ - { 0x0bfc, 0x22a2 }, /* righttack ⊢ RIGHT TACK */ - { 0x0cdf, 0x2017 }, /* hebrew_doublelowline ‗ DOUBLE LOW LINE */ - { 0x0ce0, 0x05d0 }, /* hebrew_aleph א HEBREW LETTER ALEF */ - { 0x0ce1, 0x05d1 }, /* hebrew_bet ב HEBREW LETTER BET */ - { 0x0ce2, 0x05d2 }, /* hebrew_gimel ג HEBREW LETTER GIMEL */ - { 0x0ce3, 0x05d3 }, /* hebrew_dalet ד HEBREW LETTER DALET */ - { 0x0ce4, 0x05d4 }, /* hebrew_he ה HEBREW LETTER HE */ - { 0x0ce5, 0x05d5 }, /* hebrew_waw ו HEBREW LETTER VAV */ - { 0x0ce6, 0x05d6 }, /* hebrew_zain ז HEBREW LETTER ZAYIN */ - { 0x0ce7, 0x05d7 }, /* hebrew_chet ח HEBREW LETTER HET */ - { 0x0ce8, 0x05d8 }, /* hebrew_tet ט HEBREW LETTER TET */ - { 0x0ce9, 0x05d9 }, /* hebrew_yod י HEBREW LETTER YOD */ - { 0x0cea, 0x05da }, /* hebrew_finalkaph ך HEBREW LETTER FINAL KAF */ - { 0x0ceb, 0x05db }, /* hebrew_kaph כ HEBREW LETTER KAF */ - { 0x0cec, 0x05dc }, /* hebrew_lamed ל HEBREW LETTER LAMED */ - { 0x0ced, 0x05dd }, /* hebrew_finalmem ם HEBREW LETTER FINAL MEM */ - { 0x0cee, 0x05de }, /* hebrew_mem מ HEBREW LETTER MEM */ - { 0x0cef, 0x05df }, /* hebrew_finalnun ן HEBREW LETTER FINAL NUN */ - { 0x0cf0, 0x05e0 }, /* hebrew_nun נ HEBREW LETTER NUN */ - { 0x0cf1, 0x05e1 }, /* hebrew_samech ס HEBREW LETTER SAMEKH */ - { 0x0cf2, 0x05e2 }, /* hebrew_ayin ע HEBREW LETTER AYIN */ - { 0x0cf3, 0x05e3 }, /* hebrew_finalpe ף HEBREW LETTER FINAL PE */ - { 0x0cf4, 0x05e4 }, /* hebrew_pe פ HEBREW LETTER PE */ - { 0x0cf5, 0x05e5 }, /* hebrew_finalzade ץ HEBREW LETTER FINAL TSADI */ - { 0x0cf6, 0x05e6 }, /* hebrew_zade צ HEBREW LETTER TSADI */ - { 0x0cf7, 0x05e7 }, /* hebrew_qoph ק HEBREW LETTER QOF */ - { 0x0cf8, 0x05e8 }, /* hebrew_resh ר HEBREW LETTER RESH */ - { 0x0cf9, 0x05e9 }, /* hebrew_shin ש HEBREW LETTER SHIN */ - { 0x0cfa, 0x05ea }, /* hebrew_taw ת HEBREW LETTER TAV */ - { 0x0da1, 0x0e01 }, /* Thai_kokai ก THAI CHARACTER KO KAI */ - { 0x0da2, 0x0e02 }, /* Thai_khokhai ข THAI CHARACTER KHO KHAI */ - { 0x0da3, 0x0e03 }, /* Thai_khokhuat ฃ THAI CHARACTER KHO KHUAT */ - { 0x0da4, 0x0e04 }, /* Thai_khokhwai ค THAI CHARACTER KHO KHWAI */ - { 0x0da5, 0x0e05 }, /* Thai_khokhon ฅ THAI CHARACTER KHO KHON */ - { 0x0da6, 0x0e06 }, /* Thai_khorakhang ฆ THAI CHARACTER KHO RAKHANG */ - { 0x0da7, 0x0e07 }, /* Thai_ngongu ง THAI CHARACTER NGO NGU */ - { 0x0da8, 0x0e08 }, /* Thai_chochan จ THAI CHARACTER CHO CHAN */ - { 0x0da9, 0x0e09 }, /* Thai_choching ฉ THAI CHARACTER CHO CHING */ - { 0x0daa, 0x0e0a }, /* Thai_chochang ช THAI CHARACTER CHO CHANG */ - { 0x0dab, 0x0e0b }, /* Thai_soso ซ THAI CHARACTER SO SO */ - { 0x0dac, 0x0e0c }, /* Thai_chochoe ฌ THAI CHARACTER CHO CHOE */ - { 0x0dad, 0x0e0d }, /* Thai_yoying ญ THAI CHARACTER YO YING */ - { 0x0dae, 0x0e0e }, /* Thai_dochada ฎ THAI CHARACTER DO CHADA */ - { 0x0daf, 0x0e0f }, /* Thai_topatak ฏ THAI CHARACTER TO PATAK */ - { 0x0db0, 0x0e10 }, /* Thai_thothan ฐ THAI CHARACTER THO THAN */ - { 0x0db1, 0x0e11 }, /* Thai_thonangmontho ฑ THAI CHARACTER THO NANGMONTHO */ - { 0x0db2, 0x0e12 }, /* Thai_thophuthao ฒ THAI CHARACTER THO PHUTHAO */ - { 0x0db3, 0x0e13 }, /* Thai_nonen ณ THAI CHARACTER NO NEN */ - { 0x0db4, 0x0e14 }, /* Thai_dodek ด THAI CHARACTER DO DEK */ - { 0x0db5, 0x0e15 }, /* Thai_totao ต THAI CHARACTER TO TAO */ - { 0x0db6, 0x0e16 }, /* Thai_thothung ถ THAI CHARACTER THO THUNG */ - { 0x0db7, 0x0e17 }, /* Thai_thothahan ท THAI CHARACTER THO THAHAN */ - { 0x0db8, 0x0e18 }, /* Thai_thothong ธ THAI CHARACTER THO THONG */ - { 0x0db9, 0x0e19 }, /* Thai_nonu น THAI CHARACTER NO NU */ - { 0x0dba, 0x0e1a }, /* Thai_bobaimai บ THAI CHARACTER BO BAIMAI */ - { 0x0dbb, 0x0e1b }, /* Thai_popla ป THAI CHARACTER PO PLA */ - { 0x0dbc, 0x0e1c }, /* Thai_phophung ผ THAI CHARACTER PHO PHUNG */ - { 0x0dbd, 0x0e1d }, /* Thai_fofa ฝ THAI CHARACTER FO FA */ - { 0x0dbe, 0x0e1e }, /* Thai_phophan พ THAI CHARACTER PHO PHAN */ - { 0x0dbf, 0x0e1f }, /* Thai_fofan ฟ THAI CHARACTER FO FAN */ - { 0x0dc0, 0x0e20 }, /* Thai_phosamphao ภ THAI CHARACTER PHO SAMPHAO */ - { 0x0dc1, 0x0e21 }, /* Thai_moma ม THAI CHARACTER MO MA */ - { 0x0dc2, 0x0e22 }, /* Thai_yoyak ย THAI CHARACTER YO YAK */ - { 0x0dc3, 0x0e23 }, /* Thai_rorua ร THAI CHARACTER RO RUA */ - { 0x0dc4, 0x0e24 }, /* Thai_ru ฤ THAI CHARACTER RU */ - { 0x0dc5, 0x0e25 }, /* Thai_loling ล THAI CHARACTER LO LING */ - { 0x0dc6, 0x0e26 }, /* Thai_lu ฦ THAI CHARACTER LU */ - { 0x0dc7, 0x0e27 }, /* Thai_wowaen ว THAI CHARACTER WO WAEN */ - { 0x0dc8, 0x0e28 }, /* Thai_sosala ศ THAI CHARACTER SO SALA */ - { 0x0dc9, 0x0e29 }, /* Thai_sorusi ษ THAI CHARACTER SO RUSI */ - { 0x0dca, 0x0e2a }, /* Thai_sosua ส THAI CHARACTER SO SUA */ - { 0x0dcb, 0x0e2b }, /* Thai_hohip ห THAI CHARACTER HO HIP */ - { 0x0dcc, 0x0e2c }, /* Thai_lochula ฬ THAI CHARACTER LO CHULA */ - { 0x0dcd, 0x0e2d }, /* Thai_oang อ THAI CHARACTER O ANG */ - { 0x0dce, 0x0e2e }, /* Thai_honokhuk ฮ THAI CHARACTER HO NOKHUK */ - { 0x0dcf, 0x0e2f }, /* Thai_paiyannoi ฯ THAI CHARACTER PAIYANNOI */ - { 0x0dd0, 0x0e30 }, /* Thai_saraa ะ THAI CHARACTER SARA A */ - { 0x0dd1, 0x0e31 }, /* Thai_maihanakat ั THAI CHARACTER MAI HAN-AKAT */ - { 0x0dd2, 0x0e32 }, /* Thai_saraaa า THAI CHARACTER SARA AA */ - { 0x0dd3, 0x0e33 }, /* Thai_saraam ำ THAI CHARACTER SARA AM */ - { 0x0dd4, 0x0e34 }, /* Thai_sarai ิ THAI CHARACTER SARA I */ - { 0x0dd5, 0x0e35 }, /* Thai_saraii ี THAI CHARACTER SARA II */ - { 0x0dd6, 0x0e36 }, /* Thai_saraue ึ THAI CHARACTER SARA UE */ - { 0x0dd7, 0x0e37 }, /* Thai_sarauee ื THAI CHARACTER SARA UEE */ - { 0x0dd8, 0x0e38 }, /* Thai_sarau ุ THAI CHARACTER SARA U */ - { 0x0dd9, 0x0e39 }, /* Thai_sarauu ู THAI CHARACTER SARA UU */ - { 0x0dda, 0x0e3a }, /* Thai_phinthu ฺ THAI CHARACTER PHINTHU */ - { 0x0dde, 0x0e3e }, /* Thai_maihanakat_maitho ??? */ - { 0x0ddf, 0x0e3f }, /* Thai_baht ฿ THAI CURRENCY SYMBOL BAHT */ - { 0x0de0, 0x0e40 }, /* Thai_sarae เ THAI CHARACTER SARA E */ - { 0x0de1, 0x0e41 }, /* Thai_saraae แ THAI CHARACTER SARA AE */ - { 0x0de2, 0x0e42 }, /* Thai_sarao โ THAI CHARACTER SARA O */ - { 0x0de3, 0x0e43 }, /* Thai_saraaimaimuan ใ THAI CHARACTER SARA AI MAIMUAN */ - { 0x0de4, 0x0e44 }, /* Thai_saraaimaimalai ไ THAI CHARACTER SARA AI MAIMALAI */ - { 0x0de5, 0x0e45 }, /* Thai_lakkhangyao ๅ THAI CHARACTER LAKKHANGYAO */ - { 0x0de6, 0x0e46 }, /* Thai_maiyamok ๆ THAI CHARACTER MAIYAMOK */ - { 0x0de7, 0x0e47 }, /* Thai_maitaikhu ็ THAI CHARACTER MAITAIKHU */ - { 0x0de8, 0x0e48 }, /* Thai_maiek ่ THAI CHARACTER MAI EK */ - { 0x0de9, 0x0e49 }, /* Thai_maitho ้ THAI CHARACTER MAI THO */ - { 0x0dea, 0x0e4a }, /* Thai_maitri ๊ THAI CHARACTER MAI TRI */ - { 0x0deb, 0x0e4b }, /* Thai_maichattawa ๋ THAI CHARACTER MAI CHATTAWA */ - { 0x0dec, 0x0e4c }, /* Thai_thanthakhat ์ THAI CHARACTER THANTHAKHAT */ - { 0x0ded, 0x0e4d }, /* Thai_nikhahit ํ THAI CHARACTER NIKHAHIT */ - { 0x0df0, 0x0e50 }, /* Thai_leksun ๐ THAI DIGIT ZERO */ - { 0x0df1, 0x0e51 }, /* Thai_leknung ๑ THAI DIGIT ONE */ - { 0x0df2, 0x0e52 }, /* Thai_leksong ๒ THAI DIGIT TWO */ - { 0x0df3, 0x0e53 }, /* Thai_leksam ๓ THAI DIGIT THREE */ - { 0x0df4, 0x0e54 }, /* Thai_leksi ๔ THAI DIGIT FOUR */ - { 0x0df5, 0x0e55 }, /* Thai_lekha ๕ THAI DIGIT FIVE */ - { 0x0df6, 0x0e56 }, /* Thai_lekhok ๖ THAI DIGIT SIX */ - { 0x0df7, 0x0e57 }, /* Thai_lekchet ๗ THAI DIGIT SEVEN */ - { 0x0df8, 0x0e58 }, /* Thai_lekpaet ๘ THAI DIGIT EIGHT */ - { 0x0df9, 0x0e59 }, /* Thai_lekkao ๙ THAI DIGIT NINE */ - { 0x0ea1, 0x3131 }, /* Hangul_Kiyeog ㄱ HANGUL LETTER KIYEOK */ - { 0x0ea2, 0x3132 }, /* Hangul_SsangKiyeog ㄲ HANGUL LETTER SSANGKIYEOK */ - { 0x0ea3, 0x3133 }, /* Hangul_KiyeogSios ㄳ HANGUL LETTER KIYEOK-SIOS */ - { 0x0ea4, 0x3134 }, /* Hangul_Nieun ㄴ HANGUL LETTER NIEUN */ - { 0x0ea5, 0x3135 }, /* Hangul_NieunJieuj ㄵ HANGUL LETTER NIEUN-CIEUC */ - { 0x0ea6, 0x3136 }, /* Hangul_NieunHieuh ㄶ HANGUL LETTER NIEUN-HIEUH */ - { 0x0ea7, 0x3137 }, /* Hangul_Dikeud ㄷ HANGUL LETTER TIKEUT */ - { 0x0ea8, 0x3138 }, /* Hangul_SsangDikeud ㄸ HANGUL LETTER SSANGTIKEUT */ - { 0x0ea9, 0x3139 }, /* Hangul_Rieul ㄹ HANGUL LETTER RIEUL */ - { 0x0eaa, 0x313a }, /* Hangul_RieulKiyeog ㄺ HANGUL LETTER RIEUL-KIYEOK */ - { 0x0eab, 0x313b }, /* Hangul_RieulMieum ㄻ HANGUL LETTER RIEUL-MIEUM */ - { 0x0eac, 0x313c }, /* Hangul_RieulPieub ㄼ HANGUL LETTER RIEUL-PIEUP */ - { 0x0ead, 0x313d }, /* Hangul_RieulSios ㄽ HANGUL LETTER RIEUL-SIOS */ - { 0x0eae, 0x313e }, /* Hangul_RieulTieut ㄾ HANGUL LETTER RIEUL-THIEUTH */ - { 0x0eaf, 0x313f }, /* Hangul_RieulPhieuf ㄿ HANGUL LETTER RIEUL-PHIEUPH */ - { 0x0eb0, 0x3140 }, /* Hangul_RieulHieuh ㅀ HANGUL LETTER RIEUL-HIEUH */ - { 0x0eb1, 0x3141 }, /* Hangul_Mieum ㅁ HANGUL LETTER MIEUM */ - { 0x0eb2, 0x3142 }, /* Hangul_Pieub ㅂ HANGUL LETTER PIEUP */ - { 0x0eb3, 0x3143 }, /* Hangul_SsangPieub ㅃ HANGUL LETTER SSANGPIEUP */ - { 0x0eb4, 0x3144 }, /* Hangul_PieubSios ㅄ HANGUL LETTER PIEUP-SIOS */ - { 0x0eb5, 0x3145 }, /* Hangul_Sios ㅅ HANGUL LETTER SIOS */ - { 0x0eb6, 0x3146 }, /* Hangul_SsangSios ㅆ HANGUL LETTER SSANGSIOS */ - { 0x0eb7, 0x3147 }, /* Hangul_Ieung ㅇ HANGUL LETTER IEUNG */ - { 0x0eb8, 0x3148 }, /* Hangul_Jieuj ㅈ HANGUL LETTER CIEUC */ - { 0x0eb9, 0x3149 }, /* Hangul_SsangJieuj ㅉ HANGUL LETTER SSANGCIEUC */ - { 0x0eba, 0x314a }, /* Hangul_Cieuc ㅊ HANGUL LETTER CHIEUCH */ - { 0x0ebb, 0x314b }, /* Hangul_Khieuq ㅋ HANGUL LETTER KHIEUKH */ - { 0x0ebc, 0x314c }, /* Hangul_Tieut ㅌ HANGUL LETTER THIEUTH */ - { 0x0ebd, 0x314d }, /* Hangul_Phieuf ㅍ HANGUL LETTER PHIEUPH */ - { 0x0ebe, 0x314e }, /* Hangul_Hieuh ㅎ HANGUL LETTER HIEUH */ - { 0x0ebf, 0x314f }, /* Hangul_A ㅏ HANGUL LETTER A */ - { 0x0ec0, 0x3150 }, /* Hangul_AE ㅐ HANGUL LETTER AE */ - { 0x0ec1, 0x3151 }, /* Hangul_YA ㅑ HANGUL LETTER YA */ - { 0x0ec2, 0x3152 }, /* Hangul_YAE ㅒ HANGUL LETTER YAE */ - { 0x0ec3, 0x3153 }, /* Hangul_EO ㅓ HANGUL LETTER EO */ - { 0x0ec4, 0x3154 }, /* Hangul_E ㅔ HANGUL LETTER E */ - { 0x0ec5, 0x3155 }, /* Hangul_YEO ㅕ HANGUL LETTER YEO */ - { 0x0ec6, 0x3156 }, /* Hangul_YE ㅖ HANGUL LETTER YE */ - { 0x0ec7, 0x3157 }, /* Hangul_O ㅗ HANGUL LETTER O */ - { 0x0ec8, 0x3158 }, /* Hangul_WA ㅘ HANGUL LETTER WA */ - { 0x0ec9, 0x3159 }, /* Hangul_WAE ㅙ HANGUL LETTER WAE */ - { 0x0eca, 0x315a }, /* Hangul_OE ㅚ HANGUL LETTER OE */ - { 0x0ecb, 0x315b }, /* Hangul_YO ㅛ HANGUL LETTER YO */ - { 0x0ecc, 0x315c }, /* Hangul_U ㅜ HANGUL LETTER U */ - { 0x0ecd, 0x315d }, /* Hangul_WEO ㅝ HANGUL LETTER WEO */ - { 0x0ece, 0x315e }, /* Hangul_WE ㅞ HANGUL LETTER WE */ - { 0x0ecf, 0x315f }, /* Hangul_WI ㅟ HANGUL LETTER WI */ - { 0x0ed0, 0x3160 }, /* Hangul_YU ㅠ HANGUL LETTER YU */ - { 0x0ed1, 0x3161 }, /* Hangul_EU ㅡ HANGUL LETTER EU */ - { 0x0ed2, 0x3162 }, /* Hangul_YI ㅢ HANGUL LETTER YI */ - { 0x0ed3, 0x3163 }, /* Hangul_I ㅣ HANGUL LETTER I */ - { 0x0ed4, 0x11a8 }, /* Hangul_J_Kiyeog ᆨ HANGUL JONGSEONG KIYEOK */ - { 0x0ed5, 0x11a9 }, /* Hangul_J_SsangKiyeog ᆩ HANGUL JONGSEONG SSANGKIYEOK */ - { 0x0ed6, 0x11aa }, /* Hangul_J_KiyeogSios ᆪ HANGUL JONGSEONG KIYEOK-SIOS */ - { 0x0ed7, 0x11ab }, /* Hangul_J_Nieun ᆫ HANGUL JONGSEONG NIEUN */ - { 0x0ed8, 0x11ac }, /* Hangul_J_NieunJieuj ᆬ HANGUL JONGSEONG NIEUN-CIEUC */ - { 0x0ed9, 0x11ad }, /* Hangul_J_NieunHieuh ᆭ HANGUL JONGSEONG NIEUN-HIEUH */ - { 0x0eda, 0x11ae }, /* Hangul_J_Dikeud ᆮ HANGUL JONGSEONG TIKEUT */ - { 0x0edb, 0x11af }, /* Hangul_J_Rieul ᆯ HANGUL JONGSEONG RIEUL */ - { 0x0edc, 0x11b0 }, /* Hangul_J_RieulKiyeog ᆰ HANGUL JONGSEONG RIEUL-KIYEOK */ - { 0x0edd, 0x11b1 }, /* Hangul_J_RieulMieum ᆱ HANGUL JONGSEONG RIEUL-MIEUM */ - { 0x0ede, 0x11b2 }, /* Hangul_J_RieulPieub ᆲ HANGUL JONGSEONG RIEUL-PIEUP */ - { 0x0edf, 0x11b3 }, /* Hangul_J_RieulSios ᆳ HANGUL JONGSEONG RIEUL-SIOS */ - { 0x0ee0, 0x11b4 }, /* Hangul_J_RieulTieut ᆴ HANGUL JONGSEONG RIEUL-THIEUTH */ - { 0x0ee1, 0x11b5 }, /* Hangul_J_RieulPhieuf ᆵ HANGUL JONGSEONG RIEUL-PHIEUPH */ - { 0x0ee2, 0x11b6 }, /* Hangul_J_RieulHieuh ᆶ HANGUL JONGSEONG RIEUL-HIEUH */ - { 0x0ee3, 0x11b7 }, /* Hangul_J_Mieum ᆷ HANGUL JONGSEONG MIEUM */ - { 0x0ee4, 0x11b8 }, /* Hangul_J_Pieub ᆸ HANGUL JONGSEONG PIEUP */ - { 0x0ee5, 0x11b9 }, /* Hangul_J_PieubSios ᆹ HANGUL JONGSEONG PIEUP-SIOS */ - { 0x0ee6, 0x11ba }, /* Hangul_J_Sios ᆺ HANGUL JONGSEONG SIOS */ - { 0x0ee7, 0x11bb }, /* Hangul_J_SsangSios ᆻ HANGUL JONGSEONG SSANGSIOS */ - { 0x0ee8, 0x11bc }, /* Hangul_J_Ieung ᆼ HANGUL JONGSEONG IEUNG */ - { 0x0ee9, 0x11bd }, /* Hangul_J_Jieuj ᆽ HANGUL JONGSEONG CIEUC */ - { 0x0eea, 0x11be }, /* Hangul_J_Cieuc ᆾ HANGUL JONGSEONG CHIEUCH */ - { 0x0eeb, 0x11bf }, /* Hangul_J_Khieuq ᆿ HANGUL JONGSEONG KHIEUKH */ - { 0x0eec, 0x11c0 }, /* Hangul_J_Tieut ᇀ HANGUL JONGSEONG THIEUTH */ - { 0x0eed, 0x11c1 }, /* Hangul_J_Phieuf ᇁ HANGUL JONGSEONG PHIEUPH */ - { 0x0eee, 0x11c2 }, /* Hangul_J_Hieuh ᇂ HANGUL JONGSEONG HIEUH */ - { 0x0eef, 0x316d }, /* Hangul_RieulYeorinHieuh ㅭ HANGUL LETTER RIEUL-YEORINHIEUH */ - { 0x0ef0, 0x3171 }, /* Hangul_SunkyeongeumMieum ㅱ HANGUL LETTER KAPYEOUNMIEUM */ - { 0x0ef1, 0x3178 }, /* Hangul_SunkyeongeumPieub ㅸ HANGUL LETTER KAPYEOUNPIEUP */ - { 0x0ef2, 0x317f }, /* Hangul_PanSios ㅿ HANGUL LETTER PANSIOS */ -/* 0x0ef3 Hangul_KkogjiDalrinIeung ? ??? */ - { 0x0ef4, 0x3184 }, /* Hangul_SunkyeongeumPhieuf ㆄ HANGUL LETTER KAPYEOUNPHIEUPH */ - { 0x0ef5, 0x3186 }, /* Hangul_YeorinHieuh ㆆ HANGUL LETTER YEORINHIEUH */ - { 0x0ef6, 0x318d }, /* Hangul_AraeA ㆍ HANGUL LETTER ARAEA */ - { 0x0ef7, 0x318e }, /* Hangul_AraeAE ㆎ HANGUL LETTER ARAEAE */ - { 0x0ef8, 0x11eb }, /* Hangul_J_PanSios ᇫ HANGUL JONGSEONG PANSIOS */ -/* 0x0ef9 Hangul_J_KkogjiDalrinIeung ? ??? */ - { 0x0efa, 0x11f9 }, /* Hangul_J_YeorinHieuh ᇹ HANGUL JONGSEONG YEORINHIEUH */ - { 0x0eff, 0x20a9 }, /* Korean_Won ₩ WON SIGN */ - { 0x13bc, 0x0152 }, /* OE Œ LATIN CAPITAL LIGATURE OE */ - { 0x13bd, 0x0153 }, /* oe œ LATIN SMALL LIGATURE OE */ - { 0x13be, 0x0178 }, /* Ydiaeresis Ÿ LATIN CAPITAL LETTER Y WITH DIAERESIS */ - { 0x20a0, 0x20a0 }, /* EcuSign ₠ EURO-CURRENCY SIGN */ - { 0x20a1, 0x20a1 }, /* ColonSign ₡ COLON SIGN */ - { 0x20a2, 0x20a2 }, /* CruzeiroSign ₢ CRUZEIRO SIGN */ - { 0x20a3, 0x20a3 }, /* FFrancSign ₣ FRENCH FRANC SIGN */ - { 0x20a4, 0x20a4 }, /* LiraSign ₤ LIRA SIGN */ - { 0x20a5, 0x20a5 }, /* MillSign ₥ MILL SIGN */ - { 0x20a6, 0x20a6 }, /* NairaSign ₦ NAIRA SIGN */ - { 0x20a7, 0x20a7 }, /* PesetaSign ₧ PESETA SIGN */ - { 0x20a8, 0x20a8 }, /* RupeeSign ₨ RUPEE SIGN */ - { 0x20a9, 0x20a9 }, /* WonSign ₩ WON SIGN */ - { 0x20aa, 0x20aa }, /* NewSheqelSign ₪ NEW SHEQEL SIGN */ - { 0x20ab, 0x20ab }, /* DongSign ₫ DONG SIGN */ - { 0x20ac, 0x20ac }, /* EuroSign € EURO SIGN */ - - - /* Following items added to GTK, not in the xterm table */ - - /* Numeric keypad */ - - { 0xFF80 /* Space */, ' ' }, - { 0xFFAA /* Multiply */, '*' }, - { 0xFFAB /* Add */, '+' }, - { 0xFFAD /* Subtract */, '-' }, - { 0xFFAE /* Decimal */, '.' }, - { 0xFFAF /* Divide */, '/' }, - { 0xFFB0 /* 0 */, '0' }, - { 0xFFB1 /* 1 */, '1' }, - { 0xFFB2 /* 2 */, '2' }, - { 0xFFB3 /* 3 */, '3' }, - { 0xFFB4 /* 4 */, '4' }, - { 0xFFB5 /* 5 */, '5' }, - { 0xFFB6 /* 6 */, '6' }, - { 0xFFB7 /* 7 */, '7' }, - { 0xFFB8 /* 8 */, '8' }, - { 0xFFB9 /* 9 */, '9' }, - { 0xFFBD /* Equal */, '=' }, - - /* End numeric keypad */ -}; - -/** - * gdk_keyval_to_unicode: - * @keyval: a GDK key symbol - * - * Convert from a GDK key symbol to the corresponding ISO10646 (Unicode) - * character. - * - * Return value: the corresponding unicode character, or 0 if there - * is no corresponding character. - **/ -guint32 -gdk_keyval_to_unicode (guint keyval) -{ - int min = 0; - int max = sizeof (gdk_keysym_to_unicode_tab) / sizeof (gdk_keysym_to_unicode_tab[0]) - 1; - int mid; - - /* First check for Latin-1 characters (1:1 mapping) */ - if ((keyval >= 0x0020 && keyval <= 0x007e) || - (keyval >= 0x00a0 && keyval <= 0x00ff)) - return keyval; - - /* Also check for directly encoded 24-bit UCS characters: - */ - if ((keyval & 0xff000000) == 0x01000000) - return keyval & 0x00ffffff; - - /* binary search in table */ - while (max >= min) { - mid = (min + max) / 2; - if (gdk_keysym_to_unicode_tab[mid].keysym < keyval) - min = mid + 1; - else if (gdk_keysym_to_unicode_tab[mid].keysym > keyval) - max = mid - 1; - else { - /* found it */ - return gdk_keysym_to_unicode_tab[mid].ucs; - } - } - - /* No matching Unicode value found */ - return 0; -} - -/* * Canonical decomposition * * It is copied here from libunicode, because we do not want malloc diff --git a/widgets/misc/e-unicode.h b/widgets/misc/e-unicode.h index 0782407e89..0a3b3ccafe 100644 --- a/widgets/misc/e-unicode.h +++ b/widgets/misc/e-unicode.h @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-unicode.h - utf-8 support functions for gal * Copyright 2000, 2001, Ximian, Inc. * @@ -30,12 +30,10 @@ #include <gtk/gtkentry.h> #include <gtk/gtkmenu.h> #include <gtk/gtkwidget.h> -#include <libgnome/gnome-defs.h> -#include <gnome-xml/tree.h> -#include <gal/unicode/gunicode.h> +#include <libxml/tree.h> #include <iconv.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define G_UTF8_IN_GAL @@ -128,7 +126,7 @@ guint32 gdk_keyval_to_unicode (guint keys gchar *e_xml_get_translated_utf8_string_prop_by_name (const xmlNode *parent, const xmlChar *prop_name); -END_GNOME_DECLS +G_END_DECLS #endif diff --git a/widgets/misc/test-color.c b/widgets/misc/test-color.c index c61dc26889..364e0644de 100644 --- a/widgets/misc/test-color.c +++ b/widgets/misc/test-color.c @@ -20,6 +20,8 @@ * 02111-1307, USA. */ +#include <config.h> +#include <gal/util/e-i18n.h> #include <gnome.h> #include "widget-color-combo.h" #include "color-palette.h" @@ -39,10 +41,13 @@ main ( gint argc, gchar* argv[] ) GtkWidget * T; ColorGroup *cg; - gnome_init ("tester", "1.0", argc, argv); + gnome_program_init ("tester", "1.0", + LIBGNOMEUI_MODULE, + argc, argv, NULL); dialog = gnome_dialog_new ("TESTER", GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); + cg = color_group_fetch ("fore_color_group", dialog); T = color_palette_new ("Color Palette", NULL, cg); @@ -51,15 +56,17 @@ main ( gint argc, gchar* argv[] ) gtk_widget_show_all (T); cg = color_group_fetch ("fore_color_group", dialog); - T = color_combo_new (cursor_hand_open_xpm, _("Automatic"), - &e_black, cg); + T = color_combo_new ( + gdk_pixbuf_new_from_xpm_data ((char const **)cursor_hand_open_xpm), + _("Automatic"), &e_black, cg); gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ), T, TRUE, TRUE, 5); gtk_widget_show_all (T); cg = color_group_fetch ("back_color_group", dialog); - T = color_combo_new (cursor_hand_open_xpm, _("Automatic"), - &e_black, cg); + T = color_combo_new ( + gdk_pixbuf_new_from_xpm_data ((char const **)cursor_hand_open_xpm), + _("Automatic"), &e_black, cg); gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ), T, TRUE, TRUE, 5); gtk_widget_show_all (T); diff --git a/widgets/table/e-cell-checkbox.c b/widgets/table/e-cell-checkbox.c index 1ce2514b0c..0f842c5507 100644 --- a/widgets/table/e-cell-checkbox.c +++ b/widgets/table/e-cell-checkbox.c @@ -26,7 +26,7 @@ #include <gtk/gtkwindow.h> #include <gtk/gtksignal.h> #include <gdk/gdkkeysyms.h> -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include "e-cell-checkbox.h" #include "gal/util/e-util.h" #include "e-table-item.h" diff --git a/widgets/table/e-cell-checkbox.h b/widgets/table/e-cell-checkbox.h index 7d19b5f3c1..f77f33c5d8 100644 --- a/widgets/table/e-cell-checkbox.h +++ b/widgets/table/e-cell-checkbox.h @@ -24,9 +24,8 @@ #define _E_CELL_CHECKBOX_H_ #include <gal/e-table/e-cell-toggle.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_CHECKBOX_TYPE (e_cell_checkbox_get_type ()) #define E_CELL_CHECKBOX(o) (GTK_CHECK_CAST ((o), E_CELL_CHECKBOX_TYPE, ECellCheckbox)) @@ -45,7 +44,7 @@ typedef struct { GtkType e_cell_checkbox_get_type (void); ECell *e_cell_checkbox_new (void); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_CHECKBOX_H_ */ diff --git a/widgets/table/e-cell-combo.c b/widgets/table/e-cell-combo.c index 70b5d1ccf7..1f54952de7 100644 --- a/widgets/table/e-cell-combo.c +++ b/widgets/table/e-cell-combo.c @@ -55,6 +55,7 @@ #include <config.h> #include <string.h> /* strcmp() */ #include <gdk/gdkkeysyms.h> +#include <gtk/gtk.h> #include "gal/util/e-util.h" #include "gal/widgets/e-unicode.h" #include "e-table-item.h" @@ -202,7 +203,8 @@ e_cell_combo_destroy (GtkObject *object) { ECellCombo *ecc = E_CELL_COMBO (object); - gtk_widget_destroy (ecc->popup_window); + if (ecc->popup_window) + gtk_widget_destroy (ecc->popup_window); ecc->popup_window = NULL; GTK_OBJECT_CLASS (parent_class)->destroy (object); @@ -405,7 +407,7 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc, *y += y1 + 1; scrollbar_width = popup->vscrollbar->requisition.width - + GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT (popup)->klass)->scrollbar_spacing; + + GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT_GET_CLASS (popup))->scrollbar_spacing; avail_height = gdk_screen_height () - *y; @@ -422,11 +424,11 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc, /* Calculate the desired width. */ *width = list_requisition.width - + 2 * popwin->child->style->klass->xthickness + + 2 * popwin->child->style->xthickness + 2 * GTK_CONTAINER (popwin->child)->border_width + 2 * GTK_CONTAINER (popup)->border_width + 2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width - + 2 * GTK_BIN (popup)->child->style->klass->xthickness; + + 2 * GTK_BIN (popup)->child->style->xthickness; /* Use at least the same width as the column. */ if (*width < column_width) @@ -440,16 +442,16 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc, } /* Calculate all the borders etc. that we need to add to the height. */ - work_height = (2 * popwin->child->style->klass->ythickness + work_height = (2 * popwin->child->style->ythickness + 2 * GTK_CONTAINER (popwin->child)->border_width + 2 * GTK_CONTAINER (popup)->border_width + 2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width - + 2 * GTK_BIN (popup)->child->style->klass->xthickness); + + 2 * GTK_BIN (popup)->child->style->xthickness); /* Add on the height of the horizontal scrollbar if we need it. */ if (show_hscroll) work_height += popup->hscrollbar->requisition.height + - GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT (popup)->klass)->scrollbar_spacing; + GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT_GET_CLASS (popup))->scrollbar_spacing; /* Check if it fits in the available height. */ if (work_height + list_requisition.height > avail_height) { diff --git a/widgets/table/e-cell-combo.h b/widgets/table/e-cell-combo.h index 6d1490c814..6e64deeb0c 100644 --- a/widgets/table/e-cell-combo.h +++ b/widgets/table/e-cell-combo.h @@ -3,8 +3,8 @@ * e-cell-combo.h: Combo cell renderer * Copyright 2001, Ximian, Inc. * - * Author: - * Damon Chaplin <damon@ximian.com> + * Author : + * Damon Chaplin <damon@ximian.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public diff --git a/widgets/table/e-cell-date.h b/widgets/table/e-cell-date.h index 2fff8ed1c6..f86eb5a1a5 100644 --- a/widgets/table/e-cell-date.h +++ b/widgets/table/e-cell-date.h @@ -24,9 +24,8 @@ #define _E_CELL_DATE_H_ #include <gal/e-table/e-cell-text.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_DATE_TYPE (e_cell_date_get_type ()) #define E_CELL_DATE(o) (GTK_CHECK_CAST ((o), E_CELL_DATE_TYPE, ECellDate)) @@ -45,6 +44,6 @@ typedef struct { GtkType e_cell_date_get_type (void); ECell *e_cell_date_new (const char *fontname, GtkJustification justify); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_DATE_H_ */ diff --git a/widgets/table/e-cell-float.c b/widgets/table/e-cell-float.c index 9b1880be71..aff6c88cc5 100644 --- a/widgets/table/e-cell-float.c +++ b/widgets/table/e-cell-float.c @@ -1,4 +1,4 @@ -/* +/* * e-cell-float.c - Float item for e-table. * Copyright 2001, CodeFactory AB * Copyright 2001, Mikael Hallendal <micke@codefactory.se> diff --git a/widgets/table/e-cell-float.h b/widgets/table/e-cell-float.h index 5ad547fc22..46223bc271 100644 --- a/widgets/table/e-cell-float.h +++ b/widgets/table/e-cell-float.h @@ -1,4 +1,4 @@ -/* +/* * e-cell-float.h - Float item for e-table. * Copyright 2001, CodeFactory AB * Copyright 2001, Mikael Hallendal <micke@codefactory.se> @@ -28,9 +28,8 @@ #define _E_CELL_FLOAT_H_ #include <gal/e-table/e-cell-text.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_FLOAT_TYPE (e_cell_float_get_type ()) #define E_CELL_FLOAT(o) (GTK_CHECK_CAST ((o), E_CELL_FLOAT_TYPE, ECellFloat)) @@ -49,6 +48,6 @@ typedef struct { GtkType e_cell_float_get_type (void); ECell *e_cell_float_new (const char *fontname, GtkJustification justify); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_FLOAT_H_ */ diff --git a/widgets/table/e-cell-number.h b/widgets/table/e-cell-number.h index 8ea312d4b2..026a1ba2e5 100644 --- a/widgets/table/e-cell-number.h +++ b/widgets/table/e-cell-number.h @@ -24,9 +24,8 @@ #define _E_CELL_NUMBER_H_ #include <gal/e-table/e-cell-text.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_NUMBER_TYPE (e_cell_number_get_type ()) #define E_CELL_NUMBER(o) (GTK_CHECK_CAST ((o), E_CELL_NUMBER_TYPE, ECellNumber)) @@ -45,6 +44,6 @@ typedef struct { GtkType e_cell_number_get_type (void); ECell *e_cell_number_new (const char *fontname, GtkJustification justify); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_NUMBER_H_ */ diff --git a/widgets/table/e-cell-pixbuf.c b/widgets/table/e-cell-pixbuf.c index 3fc8ead3f9..d58a75dd1c 100644 --- a/widgets/table/e-cell-pixbuf.c +++ b/widgets/table/e-cell-pixbuf.c @@ -22,7 +22,7 @@ */ #include <stdio.h> -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include "e-cell-pixbuf.h" static ECellClass *parent_class; @@ -43,6 +43,23 @@ enum { ARG_UNSELECTED_COLUMN }; +static int +gnome_print_pixbuf (GnomePrintContext *pc, GdkPixbuf *pixbuf) +{ + if (gdk_pixbuf_get_has_alpha (pixbuf)) + return gnome_print_rgbaimage (pc, + gdk_pixbuf_get_pixels (pixbuf), + gdk_pixbuf_get_width (pixbuf), + gdk_pixbuf_get_height (pixbuf), + gdk_pixbuf_get_rowstride (pixbuf)); + else + return gnome_print_rgbimage (pc, + gdk_pixbuf_get_pixels (pixbuf), + gdk_pixbuf_get_width (pixbuf), + gdk_pixbuf_get_height (pixbuf), + gdk_pixbuf_get_rowstride (pixbuf)); +} + /* * ECellPixbuf functions */ @@ -370,7 +387,7 @@ e_cell_pixbuf_class_init (GtkObjectClass *object_class) GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_UNSELECTED_COLUMN); } -guint +GtkType e_cell_pixbuf_get_type (void) { static guint type = 0; @@ -382,8 +399,7 @@ e_cell_pixbuf_get_type (void) sizeof (ECellPixbufClass), (GtkClassInitFunc) e_cell_pixbuf_class_init, (GtkObjectInitFunc) e_cell_pixbuf_init, - NULL, - NULL, + NULL, NULL, }; type = gtk_type_unique (e_cell_get_type (), &type_info); diff --git a/widgets/table/e-cell-pixbuf.h b/widgets/table/e-cell-pixbuf.h index 938cb84bb4..c405752723 100644 --- a/widgets/table/e-cell-pixbuf.h +++ b/widgets/table/e-cell-pixbuf.h @@ -1,4 +1,4 @@ -/* +/* * e-cell-pixbuf.h - An ECell that displays a GdkPixbuf * Copyright 2001, Ximian, Inc. * diff --git a/widgets/table/e-cell-popup.c b/widgets/table/e-cell-popup.c index 96eebfb6f0..8b7ed04679 100644 --- a/widgets/table/e-cell-popup.c +++ b/widgets/table/e-cell-popup.c @@ -42,7 +42,7 @@ static void e_cell_popup_class_init (GtkObjectClass *object_class); static void e_cell_popup_init (ECellPopup *ecp); -static void e_cell_popup_destroy (GtkObject *object); +static void e_cell_popup_dispose (GObject *object); static ECellView* ecp_new_view (ECell *ecell, @@ -122,7 +122,7 @@ e_cell_popup_class_init (GtkObjectClass *object_class) { ECellClass *ecc = (ECellClass *) object_class; - object_class->destroy = e_cell_popup_destroy; + G_OBJECT_CLASS (object_class)->dispose = e_cell_popup_dispose; ecc->new_view = ecp_new_view; ecc->kill_view = ecp_kill_view; @@ -171,13 +171,15 @@ e_cell_popup_new (void) * GtkObject::destroy method */ static void -e_cell_popup_destroy (GtkObject *object) +e_cell_popup_dispose (GObject *object) { ECellPopup *ecp = E_CELL_POPUP (object); - gtk_object_unref (GTK_OBJECT (ecp->child)); + if (ecp->child) + gtk_object_unref (GTK_OBJECT (ecp->child)); + ecp->child = NULL; - GTK_OBJECT_CLASS (parent_class)->destroy (object); + G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -277,11 +279,6 @@ ecp_draw (ECellView *ecv, GdkDrawable *drawable, if (flags & E_CELL_CURSOR) ecp->popup_arrow_shown = show_popup_arrow; -#if 0 - g_print ("In ecp_draw row:%i col: %i %i,%i %i,%i Show Arrow:%i\n", - row, view_col, x1, y1, x2, y2, show_popup_arrow); -#endif - if (show_popup_arrow) { e_cell_draw (ecp_view->child_view, drawable, model_col, view_col, row, flags, @@ -500,7 +497,7 @@ e_cell_popup_do_popup (ECellPopupView *ecp_view, ecp->popup_cell_view = ecp_view; - popup_func = E_CELL_POPUP_CLASS (GTK_OBJECT (ecp)->klass)->popup; + popup_func = E_CELL_POPUP_CLASS (GTK_OBJECT_GET_CLASS (ecp))->popup; ecp->popup_view_col = view_col; ecp->popup_row = row; diff --git a/widgets/table/e-cell-popup.h b/widgets/table/e-cell-popup.h index eba0d941df..a42a4d4f28 100644 --- a/widgets/table/e-cell-popup.h +++ b/widgets/table/e-cell-popup.h @@ -32,7 +32,7 @@ #ifndef _E_CELL_POPUP_H_ #define _E_CELL_POPUP_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/e-table/e-cell.h> #define E_CELL_POPUP_TYPE (e_cell_popup_get_type ()) @@ -94,4 +94,8 @@ void e_cell_popup_set_shown (ECellPopup *ecp, gboolean shown); void e_cell_popup_queue_cell_redraw (ECellPopup *ecp); +void e_cell_popup_set_shown (ECellPopup *ecp, + gboolean shown); +void e_cell_popup_queue_cell_redraw (ECellPopup *ecp); + #endif /* _E_CELL_POPUP_H_ */ diff --git a/widgets/table/e-cell-progress.c b/widgets/table/e-cell-progress.c index d38adb5082..6f90a0cb3b 100644 --- a/widgets/table/e-cell-progress.c +++ b/widgets/table/e-cell-progress.c @@ -38,7 +38,7 @@ #include <gtk/gtkwindow.h> #include <gtk/gtksignal.h> #include <gdk/gdkkeysyms.h> -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include "e-cell-progress.h" #include "gal/util/e-util.h" #include "e-table-item.h" diff --git a/widgets/table/e-cell-progress.h b/widgets/table/e-cell-progress.h index 4cd09ed0de..f71081016c 100644 --- a/widgets/table/e-cell-progress.h +++ b/widgets/table/e-cell-progress.h @@ -25,11 +25,11 @@ #ifndef _E_CELL_PROGRESS_H_ #define _E_CELL_PROGRESS_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include <gal/e-table/e-cell.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_PROGRESS_TYPE (e_cell_progress_get_type ()) #define E_CELL_PROGRESS(o) (GTK_CHECK_CAST ((o), E_CELL_PROGRESS_TYPE, ECellProgress)) @@ -67,7 +67,7 @@ void e_cell_progress_set_padding (ECellProgress *eprog, int padding); void e_cell_progress_set_border (ECellProgress *eprog, int border); void e_cell_progress_set_color (ECellProgress *eprog, guchar red, guchar green, guchar blue); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_PROGRESS_H_ */ diff --git a/widgets/table/e-cell-size.h b/widgets/table/e-cell-size.h index 3316b2a5ff..c8c4b40b75 100644 --- a/widgets/table/e-cell-size.h +++ b/widgets/table/e-cell-size.h @@ -24,9 +24,8 @@ #define _E_CELL_SIZE_H_ #include <gal/e-table/e-cell-text.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_SIZE_TYPE (e_cell_size_get_type ()) #define E_CELL_SIZE(o) (GTK_CHECK_CAST ((o), E_CELL_SIZE_TYPE, ECellSize)) @@ -45,6 +44,6 @@ typedef struct { GtkType e_cell_size_get_type (void); ECell *e_cell_size_new (const char *fontname, GtkJustification justify); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_SIZE_H_ */ diff --git a/widgets/table/e-cell-spin-button.c b/widgets/table/e-cell-spin-button.c index 917cb9e310..9c11e6c22f 100644 --- a/widgets/table/e-cell-spin-button.c +++ b/widgets/table/e-cell-spin-button.c @@ -348,7 +348,7 @@ ecsb_event (ECellView *ecv, ecsb_view = (ECellSpinButtonView *) ecv; ecsb = E_CELL_SPIN_BUTTON (ecsb_view->cell_view.ecell); - ecsb_class = E_CELL_SPIN_BUTTON_CLASS (GTK_OBJECT(ecsb)->klass); + ecsb_class = E_CELL_SPIN_BUTTON_CLASS (GTK_OBJECT_GET_CLASS (ecsb)); eti = E_TABLE_ITEM (ecsb_view->cell_view.e_table_item_view); switch (event->type) { @@ -474,12 +474,11 @@ ecsb_focus (ECellView *ecell_view, ecsb_view = (ECellSpinButtonView *) ecell_view; - klass = E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass); + klass = E_CELL_GET_CLASS (ecell_view->ecell); - if (klass->focus) { + if (klass->focus) klass->focus (ecell_view, model_col, view_col, row, x1, y1, x2, y2); - } } static void @@ -489,12 +488,10 @@ ecsb_unfocus (ECellView *ecell_view) ECellSpinButtonView *ecsb_view; ecsb_view = (ECellSpinButtonView *) ecell_view; - klass = E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass); + klass = E_CELL_GET_CLASS (ecell_view->ecell); - if (klass->unfocus) { + if (klass->unfocus) klass->unfocus (ecell_view); - } - } static void @@ -516,7 +513,7 @@ ecsb_show_tooltip (ECellView *ecv, } static void -ecsb_destroy (GtkObject *object) +ecsb_destroy (GtkObject *object) { ECellSpinButton *mcsp; @@ -543,7 +540,7 @@ e_cell_spin_button_new (gint min, GTK_JUSTIFY_LEFT); gtk_signal_connect (GTK_OBJECT (ecsb), "step", - e_cell_spin_button_step, + GTK_SIGNAL_FUNC (e_cell_spin_button_step), NULL); } @@ -568,7 +565,7 @@ e_cell_spin_button_new_float (gfloat min, if (!child_cell) { child_cell = e_cell_float_new (NULL, GTK_JUSTIFY_LEFT); gtk_signal_connect (GTK_OBJECT (ecsb), "step", - e_cell_spin_button_step_float, + GTK_SIGNAL_FUNC (e_cell_spin_button_step_float), NULL); } diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c index edbea905e7..c72e5248b4 100644 --- a/widgets/table/e-cell-text.c +++ b/widgets/table/e-cell-text.c @@ -5,7 +5,7 @@ * * Authors: * Miguel de Icaza <miguel@ximian.com> - * Chris Lahey <clahey@ximian.com> + * Chris Lahey <clahey@ximian.com> * * A lot of code taken from: * @@ -40,15 +40,10 @@ #include <math.h> #include <string.h> #include <gdk/gdkx.h> /* for BlackPixel */ -#include <gtk/gtkenums.h> -#include <gtk/gtkentry.h> -#include <gtk/gtkwindow.h> -#include <gtk/gtkinvisible.h> -#include <gtk/gtksignal.h> #include <gdk/gdkkeysyms.h> -#include <gtk/gtkwidget.h> -#include <libgnomeui/gnome-canvas.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <gtk/gtk.h> +#include <libgnomecanvas/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include "e-cell-text.h" #include "gal/util/e-util.h" #include "gal/widgets/e-canvas.h" @@ -58,9 +53,11 @@ #include "gal/util/e-text-event-processor.h" #include "gal/e-text/e-text.h" #include "gal/util/e-text-event-processor-emacs-like.h" +#include "gal/util/e-i18n.h" #include "e-table-tooltip.h" #define d(x) +#define DO_SELECTION 1 #if d(!)0 #define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x)), g_print ("%s: e_table_item_leave_edit\n", __FUNCTION__)) @@ -68,7 +65,7 @@ #define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x))) #endif -#define ECT_CLASS(c) (E_CELL_TEXT_CLASS(GTK_OBJECT((c))->klass)) +#define ECT_CLASS(c) (E_CELL_TEXT_CLASS(GTK_OBJECT_GET_CLASS ((c)))) /* This defines a line of text */ struct line { @@ -132,19 +129,16 @@ typedef struct { } ECellTextView; -typedef struct _CurrentCell{ +struct _CellEdit { + ECellTextView *text_view; - int width; - char *text; - int model_col, view_col, row; - ECellTextLineBreaks *breaks; - EFontStyle style; -} CurrentCell; -#define CURRENT_CELL(x) ((CurrentCell *)(x)) + int model_col, view_col, row; + int cell_width; -struct _CellEdit { - CurrentCell cell; + PangoLayout *layout; + + char *text; char *old_text; @@ -193,33 +187,11 @@ static void e_cell_text_view_command (ETextEventProcessor *tep, ETextEventProces static void e_cell_text_view_get_selection (CellEdit *edit, GdkAtom selection, guint32 time); static void e_cell_text_view_supply_selection (CellEdit *edit, guint time, GdkAtom selection, char *data, gint length); -static GtkWidget *e_cell_text_view_get_invisible (CellEdit *edit); -static void _selection_clear_event (GtkInvisible *invisible, - GdkEventSelection *event, - CellEdit *edit); -static void _selection_get (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint info, - guint time_stamp, - CellEdit *edit); -static void _selection_received (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint time, - CellEdit *edit); -static int number_of_lines (char *text); -static void split_into_lines (CurrentCell *cell); -static void unref_lines (CurrentCell *cell); -static void calc_line_widths (CurrentCell *cell); -static int get_line_ypos (CurrentCell *cell, struct line *line); -static int get_line_xpos (CurrentCell *cell, struct line *line); static void _get_tep (CellEdit *edit); -static gint _get_position_from_xy (CurrentCell *cell, gint x, gint y); -static void _get_xy_from_position (CurrentCell *cell, gint position, gint *xp, gint *yp); +static gint get_position_from_xy (CellEdit *edit, gint x, gint y); static gboolean _blink_scroll_timeout (gpointer data); -static void build_current_cell (CurrentCell *cell, ECellTextView *text_view, int model_col, int view_col, int row); -static void unbuild_current_cell (CurrentCell *cell); static void calc_ellipsis (ECellTextView *text_view); static void ect_free_color (gchar *color_spec, GdkColor *color, GdkColormap *colormap); static GdkColor* e_cell_text_get_color (ECellTextView *cell_view, gchar *color_spec); @@ -280,6 +252,14 @@ ect_queue_redraw (ECellTextView *text_view, int view_col, int view_row) view_col, view_row, view_col, view_row); } +static void +invisible_finalize (gpointer data, + GObject *invisible) +{ + CellEdit *edit = data; + edit->invisible = NULL; +} + /* * Shuts down the editing process */ @@ -289,19 +269,19 @@ ect_stop_editing (ECellTextView *text_view, gboolean commit) CellEdit *edit = text_view->edit; int row, view_col, model_col; char *old_text, *text; - CurrentCell *cell = (CurrentCell *) text_view->edit; if (!edit) return; - row = cell->row; - view_col = cell->view_col; - model_col = cell->model_col; + row = edit->row; + view_col = edit->view_col; + model_col = edit->model_col; old_text = edit->old_text; - text = cell->text; - if (edit->invisible) - gtk_widget_unref (edit->invisible); + text = edit->text; + if (edit->invisible) { + g_object_weak_unref (G_OBJECT (edit->invisible), invisible_finalize, edit); + } if (edit->tep) gtk_object_unref (GTK_OBJECT(edit->tep)); if (edit->primary_selection) @@ -322,6 +302,9 @@ ect_stop_editing (ECellTextView *text_view, gboolean commit) edit->timer = NULL; } + if (edit->layout) + g_object_unref (edit->layout); + g_free (edit); text_view->edit = NULL; @@ -402,7 +385,8 @@ ect_realize (ECellView *ecell_view) text_view->font = e_font_from_gdk_name (ect->font_name); } if (!text_view->font){ - text_view->font = e_font_from_gdk_font (GTK_WIDGET (text_view->canvas)->style->font); + gdk_font_ref (gtk_style_get_font (GTK_WIDGET (text_view->canvas)->style)); + text_view->font = e_font_from_gdk_font (gtk_style_get_font (GTK_WIDGET (text_view->canvas)->style)); } calc_ellipsis (text_view); @@ -452,29 +436,133 @@ ect_unrealize (ECellView *ecv) static void ect_free_color (gchar *color_spec, GdkColor *color, GdkColormap *colormap) { - g_free (color_spec); /* This frees the color. Note we don't free it if it is the special value. */ if (color != (GdkColor*) 1) { - gdk_colors_free (colormap, &color->pixel, 1, 0); + gulong pix = color->pixel; + + gdk_colors_free (colormap, &pix, 1, 0); /* This frees the memory for the GdkColor. */ gdk_color_free (color); } } -static void -set_style(ECellView *ecell_view, CurrentCell *cell, int row) +static PangoLayout * +build_layout (ECellTextView *text_view, int row, const char *text) { - EFontStyle style = E_FONT_PLAIN; + ECellView *ecell_view = (ECellView *) text_view; ECellText *ect = E_CELL_TEXT (ecell_view->ecell); + PangoLayout *layout; + gboolean bold, strikeout; + + layout = gtk_widget_create_pango_layout (GTK_WIDGET (((GnomeCanvasItem *)ecell_view->e_table_item_view)->canvas), text); + + bold = ect->bold_column >= 0 && + row >= 0 && + e_table_model_value_at(ecell_view->e_table_model, ect->bold_column, row); + strikeout = ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row); + + if (bold || strikeout) { + PangoAttrList *attrs; + int length = strlen (text); + attrs = pango_attr_list_new (); + if (bold) { + PangoAttribute *attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD); + attr->start_index = 0; + attr->end_index = length; + + pango_attr_list_insert_before (attrs, attr); + } + if (strikeout) { + PangoAttribute *attr = pango_attr_strikethrough_new (TRUE); + attr->start_index = 0; + attr->end_index = length; - if (ect->bold_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->bold_column, row)) - style = E_FONT_BOLD; + pango_attr_list_insert_before (attrs, attr); + } + pango_layout_set_attributes (layout, attrs); + pango_attr_list_unref (attrs); + } - cell->style = style; + return layout; +} + +static PangoLayout * +generate_layout (ECellTextView *text_view, int model_col, int view_col, int row) +{ + ECellView *ecell_view = (ECellView *) text_view; + ECellText *ect = E_CELL_TEXT (ecell_view->ecell); + PangoLayout *layout; + CellEdit *edit = text_view->edit; + + if (edit && edit->model_col == model_col && edit->row == row) { + g_object_ref (edit->layout); + return edit->layout; + } + + if (row >= 0) { + char *temp = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row); + layout = build_layout (text_view, row, temp); + e_cell_text_free_text(ect, temp); + } else + layout = build_layout (text_view, row, "Mumbo Jumbo"); + + return layout; +} + +static void +draw_pango_rectangle (GdkDrawable *drawable, GdkGC *gc, int x1, int y1, PangoRectangle rect) +{ + int width = rect.width / PANGO_SCALE; + int height = rect.height / PANGO_SCALE; + if (width <= 0) + width = 1; + if (height <= 0) + height = 1; + gdk_draw_rectangle (drawable, gc, TRUE, + x1 + rect.x / PANGO_SCALE, y1 + rect.y / PANGO_SCALE, width, height); +} + +static gboolean +show_pango_rectangle (CellEdit *edit, PangoRectangle rect) +{ + int x1 = rect.x / PANGO_SCALE; + int x2 = (rect.x + rect.width) / PANGO_SCALE; +#if 0 + int y1 = rect.y / PANGO_SCALE; + int y2 = (rect.y + rect.height) / PANGO_SCALE; +#endif + + int new_xofs_edit = edit->xofs_edit; + int new_yofs_edit = edit->yofs_edit; + + if (x1 < new_xofs_edit) + new_xofs_edit = x1; + if (2 + x2 - edit->cell_width > new_xofs_edit) + new_xofs_edit = 2 + x2 - edit->cell_width; + if (new_xofs_edit < 0) + new_xofs_edit = 0; + +#if 0 + if (y1 < new_yofs_edit) + new_yofs_edit = y1; + if (2 + y2 - edit->cell_height > new_yofs_edit) + new_yofs_edit = 2 + y2 - edit->cell_height; + if (new_yofs_edit < 0) + new_yofs_edit = 0; +#endif + + if (new_xofs_edit != edit->xofs_edit || + new_yofs_edit != edit->yofs_edit) { + edit->xofs_edit = new_xofs_edit; + edit->yofs_edit = new_yofs_edit; + return TRUE; + } + + return FALSE; } /* @@ -485,70 +573,39 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable, int model_col, int view_col, int row, ECellFlags flags, int x1, int y1, int x2, int y2) { - /* New ECellText */ - ECellText *ect = E_CELL_TEXT (ecell_view->ecell); + PangoLayout *layout; ECellTextView *text_view = (ECellTextView *) ecell_view; - GtkWidget *canvas = GTK_WIDGET (text_view->canvas); - GdkRectangle rect, *clip_rect; - struct line *lines; - int i; - int xpos, ypos; - int start_char, end_char; - int sel_start, sel_end; - GdkRectangle sel_rect; - GdkGC *fg_gc; - EFont *font = text_view->font; - const int height = e_font_height (text_view->font); + ECellText *ect = E_CELL_TEXT (ecell_view->ecell); CellEdit *edit = text_view->edit; - gboolean edit_display = FALSE; - ECellTextLineBreaks *linebreaks; - GdkColor *foreground, *cell_foreground, *cursor_color; - gchar *color_spec; gboolean selected; - EFontStyle style = E_FONT_PLAIN; + GdkColor *foreground, *cursor_color; + GtkWidget *canvas = GTK_WIDGET (text_view->canvas); + GdkRectangle clip_rect; + int x_origin, y_origin; selected = flags & E_CELL_SELECTED; - if (edit){ - if ((edit->cell.view_col == view_col) && (edit->cell.row == row)) { - edit_display = TRUE; - fg_gc = canvas->style->fg_gc[edit->has_selection ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE]; - } else - fg_gc = canvas->style->fg_gc[GTK_STATE_ACTIVE]; - } else { - fg_gc = canvas->style->fg_gc[GTK_STATE_ACTIVE]; - } - - /* - * Be a nice citizen: clip to the region we are supposed to draw on - */ - rect.x = x1; - rect.y = y1; - rect.width = x2 - x1; - rect.height = y2 - y1; - - gdk_gc_set_clip_rectangle (text_view->gc, &rect); - gdk_gc_set_clip_rectangle (fg_gc, &rect); - clip_rect = ▭ - - if (selected){ + if (selected) { if (flags & E_CELL_FOCUSED) - foreground = &canvas->style->text [GTK_STATE_SELECTED]; + foreground = &canvas->style->fg [GTK_STATE_SELECTED]; else - foreground = &canvas->style->text [GTK_STATE_ACTIVE]; + foreground = &canvas->style->fg [GTK_STATE_ACTIVE]; + cursor_color = foreground; } else { foreground = &canvas->style->text [GTK_STATE_NORMAL]; - } - - cursor_color = foreground; - - if (ect->color_column != -1 && ! selected) { - color_spec = e_table_model_value_at (ecell_view->e_table_model, - ect->color_column, row); - cell_foreground = e_cell_text_get_color (text_view, - color_spec); - if (cell_foreground) - foreground = cell_foreground; + cursor_color = foreground; + + if (ect->color_column != -1) { + char *color_spec; + GdkColor *cell_foreground; + + color_spec = e_table_model_value_at (ecell_view->e_table_model, + ect->color_column, row); + cell_foreground = e_cell_text_get_color (text_view, + color_spec); + if (cell_foreground) + foreground = cell_foreground; + } } gdk_gc_set_foreground (text_view->gc, foreground); @@ -558,179 +615,98 @@ ect_draw (ECellView *ecell_view, GdkDrawable *drawable, x2 -= 4; y2 -= 1; - rect.x = x1; - rect.y = y1; - rect.width = x2 - x1; - rect.height = y2 - y1; - - gdk_gc_set_clip_rectangle (text_view->gc, &rect); - gdk_gc_set_clip_rectangle (fg_gc, &rect); - clip_rect = ▭ + x_origin = x1 + ect->x + text_view->xofs - (edit ? edit->xofs_edit : 0); + y_origin = y1 + ect->y + text_view->yofs - (edit ? edit->yofs_edit : 0); + + clip_rect.x = x1; + clip_rect.y = y1; + clip_rect.width = x2 - x1; + clip_rect.height = y2 - y1; + + gdk_gc_set_clip_rectangle (text_view->gc, &clip_rect); + /* clip_rect = ▭*/ + + layout = generate_layout (text_view, model_col, view_col, row); + + gdk_draw_layout (drawable, text_view->gc, + x_origin, y_origin, + layout); + + if (edit && edit->view_col == view_col && edit->row == row) { + if (edit->selection_start != edit->selection_end) { + int start_index, end_index; + PangoLayoutLine *line; + gint *ranges; + gint n_ranges, i; + PangoRectangle logical_rect; + GdkRegion *clip_region = gdk_region_new (); + GdkRegion *rect_region; + GdkGC *selection_gc; + GdkGC *text_gc; + + start_index = MIN (edit->selection_start, edit->selection_end); + end_index = edit->selection_start ^ edit->selection_end ^ start_index; + + if (edit->has_selection) { + selection_gc = canvas->style->base_gc [GTK_STATE_SELECTED]; + text_gc = canvas->style->text_gc[GTK_STATE_SELECTED]; + } else { + selection_gc = canvas->style->base_gc [GTK_STATE_ACTIVE]; + text_gc = canvas->style->text_gc[GTK_STATE_ACTIVE]; + } - if (edit_display){ - CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); + gdk_gc_set_clip_rectangle (selection_gc, &clip_rect); - set_style(ecell_view, cell, row); + line = pango_layout_get_lines (layout)->data; - style = cell->style; + pango_layout_line_get_x_ranges (line, start_index, end_index, &ranges, &n_ranges); - cell->width = x2 - x1; - - split_into_lines (cell); + pango_layout_get_extents (layout, NULL, &logical_rect); - linebreaks = cell->breaks; - - lines = linebreaks->lines; - ypos = get_line_ypos (cell, lines); - ypos += e_font_ascent (text_view->font); - ypos -= edit->yofs_edit; + for (i=0; i < n_ranges; i++) { + GdkRectangle sel_rect; - for (i = 0; i < linebreaks->num_lines; i++) { - xpos = get_line_xpos (cell, lines); - xpos -= edit->xofs_edit; + sel_rect.x = x_origin + ranges[2*i] / PANGO_SCALE; + sel_rect.y = y_origin; + sel_rect.width = (ranges[2*i + 1] - ranges[2*i]) / PANGO_SCALE; + sel_rect.height = logical_rect.height / PANGO_SCALE; - /* start_char, end_char, sel_start and sel_end are IN BYTES */ + gdk_draw_rectangle (drawable, selection_gc, TRUE, + sel_rect.x, sel_rect.y, sel_rect.width, sel_rect.height); - start_char = lines->text - cell->text; - end_char = start_char + lines->length; - - sel_start = edit->selection_start; - sel_end = edit->selection_end; - - if (sel_start > sel_end){ - sel_start ^= sel_end; - sel_end ^= sel_start; - sel_start ^= sel_end; - } - if (sel_start < start_char) - sel_start = start_char; - if (sel_end > end_char) - sel_end = end_char; - - if (sel_start < sel_end){ - sel_rect.x = xpos + x1 + e_font_utf8_text_width (font, style, lines->text, sel_start - start_char); - sel_rect.y = ypos + y1 - e_font_ascent (font); - sel_rect.width = e_font_utf8_text_width (font, style, - lines->text + sel_start - start_char, - sel_end - sel_start); - sel_rect.height = height; - gtk_paint_flat_box (canvas->style, - drawable, - - edit->has_selection ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE, - GTK_SHADOW_NONE, - clip_rect, - canvas, - "text", - sel_rect.x, - sel_rect.y, - sel_rect.width, - sel_rect.height); - - e_font_draw_utf8_text (drawable, font, style, text_view->gc, xpos + x1, ypos + y1, - lines->text, - sel_start - start_char); - e_font_draw_utf8_text (drawable, font, style, fg_gc, - xpos + x1 + e_font_utf8_text_width (font, style, lines->text, sel_start - start_char), - ypos + y1, - lines->text + sel_start - start_char, - sel_end - sel_start); - e_font_draw_utf8_text (drawable, font, style, text_view->gc, - xpos + x1 + e_font_utf8_text_width (font, style, lines->text, sel_end - start_char), - ypos + y1, - lines->text + sel_end - start_char, - end_char - sel_end); - } else { - e_font_draw_utf8_text (drawable, font, style, text_view->gc, - xpos + x1, ypos + y1, - lines->text, - lines->length); - } - if (edit->selection_start == edit->selection_end && - edit->selection_start >= start_char && - edit->selection_start <= end_char && - edit->show_cursor) { - gdk_gc_set_foreground (text_view->gc, cursor_color); - gdk_draw_rectangle (drawable, - text_view->gc, - TRUE, - xpos + x1 + e_font_utf8_text_width (font, style, lines->text, sel_start - start_char), - ypos + y1 - e_font_ascent (font), - 1, - height); + gdk_region_union_with_rect (clip_region, &sel_rect); } - if (ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row)) { - gdk_draw_rectangle (drawable, - text_view->gc, - TRUE, - x1, ypos + y1 - (e_font_ascent (font) / 2), - x2 - x1, - 1); - } - ypos += height; - lines ++; - } - unref_lines (cell); - } else { - - ECellTextLineBreaks *linebreaks; - CurrentCell cell; - build_current_cell (&cell, text_view, model_col, view_col, row); - - set_style(ecell_view, &cell, row); - style = cell.style; + rect_region = gdk_region_rectangle (&clip_rect); + gdk_region_intersect (clip_region, rect_region); + gdk_region_destroy (rect_region); - cell.width = x2 - x1; - - split_into_lines (&cell); - - linebreaks = cell.breaks; - lines = linebreaks->lines; - ypos = get_line_ypos (&cell, lines); - ypos += e_font_ascent (text_view->font); - - - for (i = 0; i < linebreaks->num_lines; i++) { - xpos = get_line_xpos (&cell, lines); - if (ect->use_ellipsis && lines->ellipsis_length < lines->length) { - e_font_draw_utf8_text (drawable, font, style, text_view->gc, - xpos + x1, ypos + y1, - lines->text, - lines->ellipsis_length); - e_font_draw_utf8_text (drawable, font, style, text_view->gc, - xpos + x1 + lines->width - text_view->ellipsis_width[style], - ypos + y1, - ect->ellipsis ? ect->ellipsis : "...", - ect->ellipsis ? strlen (ect->ellipsis) : 3); - } else { - e_font_draw_utf8_text (drawable, font, style, text_view->gc, - xpos + x1, - ypos + y1, - lines->text, - lines->length); - } - if (ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row)) { - gdk_draw_rectangle (drawable, - text_view->gc, - TRUE, - x1, ypos + y1 - (e_font_ascent (font) / 2), - x2 - x1, - 1); + gdk_gc_set_clip_region (text_gc, clip_region); + gdk_draw_layout (drawable, text_gc, + x_origin, y_origin, + layout); + gdk_gc_set_clip_region (text_gc, NULL); + gdk_gc_set_clip_region (selection_gc, NULL); + + gdk_region_destroy (clip_region); + g_free (ranges); + } else { + if (edit->show_cursor) { + PangoRectangle strong_pos, weak_pos; + pango_layout_get_cursor_pos (layout, edit->selection_start, &strong_pos, &weak_pos); + draw_pango_rectangle (drawable, text_view->gc, x_origin, y_origin, strong_pos); + if (strong_pos.x != weak_pos.x || + strong_pos.y != weak_pos.y || + strong_pos.width != weak_pos.width || + strong_pos.height != weak_pos.height) + draw_pango_rectangle (drawable, text_view->gc, x_origin, y_origin, weak_pos); } - ypos += height; - lines++; } - unref_lines (&cell); - unbuild_current_cell (&cell); } - gdk_gc_set_clip_rectangle (text_view->gc, NULL); - gdk_gc_set_clip_rectangle (fg_gc, NULL); + g_object_unref (G_OBJECT (layout)); } - /* * Get the background color */ @@ -750,20 +726,6 @@ ect_get_bg_color(ECellView *ecell_view, int row) } -static void -ect_style_set(ECellView *ecell_view, GtkStyle *old_style) -{ - ECellTextView *text_view = (ECellTextView *) ecell_view; - ECellText *ect = (ECellText *) ecell_view->ecell; - - if (!ect->font_name) { - e_font_unref (text_view->font); - text_view->font = e_font_from_gdk_font (GTK_WIDGET (text_view->canvas)->style->font); - } -} - - - /* * Selects the entire string */ @@ -773,7 +735,7 @@ ect_edit_select_all (ECellTextView *text_view) g_assert (text_view->edit); text_view->edit->selection_start = 0; - text_view->edit->selection_end = strlen (text_view->edit->cell.text); + text_view->edit->selection_end = strlen (text_view->edit->text); } static gboolean @@ -797,28 +759,15 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, CellEdit *edit = text_view->edit; GtkWidget *canvas = GTK_WIDGET (text_view->canvas); gint return_val = 0; - CurrentCell cell, *cellptr; d(gboolean press = FALSE); if (!(flags & E_CELL_EDITING)) return 0; - build_current_cell (&cell, text_view, model_col, view_col, row); - - - if (edit){ - if ((edit->cell.view_col == view_col) && (edit->cell.row == row)) { - edit_display = TRUE; - cellptr = CURRENT_CELL(edit); - } else { - cellptr = &cell; - } - } else { - cellptr = &cell; + if (edit && edit->view_col == view_col && edit->row == row) { + edit_display = TRUE; } - set_style(ecell_view, cellptr, row); - e_tep_event.type = event->type; switch (event->type) { case GDK_FOCUS_CHANGE: @@ -837,7 +786,6 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row); ect_edit_select_all (text_view); edit = text_view->edit; - cellptr = CURRENT_CELL(edit); edit_display = TRUE; } if (edit_display) { @@ -886,14 +834,13 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row); edit = text_view->edit; - cellptr = CURRENT_CELL(edit); edit_display = TRUE; e_tep_event.button.type = GDK_BUTTON_PRESS; e_tep_event.button.time = button.time; e_tep_event.button.state = button.state; e_tep_event.button.button = button.button; - e_tep_event.button.position = _get_position_from_xy (cellptr, button.x, button.y); + e_tep_event.button.position = get_position_from_xy (edit, event->button.x, event->button.y); _get_tep (edit); edit->actions = 0; return_val = e_text_event_processor_handle_event (edit->tep, @@ -910,13 +857,13 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, edit->last_state = button.state; e_tep_event.button.type = GDK_BUTTON_RELEASE; - } + } if (edit_display) { GdkEventButton button = event->button; e_tep_event.button.time = button.time; e_tep_event.button.state = button.state; e_tep_event.button.button = button.button; - e_tep_event.button.position = _get_position_from_xy (cellptr, button.x, button.y); + e_tep_event.button.position = get_position_from_xy (edit, event->button.x, event->button.y); _get_tep (edit); edit->actions = 0; return_val = e_text_event_processor_handle_event (edit->tep, @@ -940,7 +887,7 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, GdkEventMotion motion = event->motion; e_tep_event.motion.time = motion.time; e_tep_event.motion.state = motion.state; - e_tep_event.motion.position = _get_position_from_xy (cellptr, motion.x, motion.y); + e_tep_event.motion.position = get_position_from_xy (edit, event->motion.x, event->motion.y); _get_tep (edit); edit->actions = 0; return_val = e_text_event_processor_handle_event (edit->tep, @@ -977,7 +924,6 @@ ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, break; } - unbuild_current_cell (&cell); if (return_val) return return_val; #if 0 @@ -996,22 +942,13 @@ static int ect_height (ECellView *ecell_view, int model_col, int view_col, int row) { ECellTextView *text_view = (ECellTextView *) ecell_view; - EFont *font; - ECellText *ect = E_CELL_TEXT(ecell_view->ecell); - gchar *string; - gint value; - - font = text_view->font; + gint height; + PangoLayout *layout; - if (row == -1) { - value = e_font_height (font) + TEXT_PAD; - } else { - string = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row); - value = e_font_height (font) * number_of_lines(string) + TEXT_PAD; - e_cell_text_free_text(ect, string); - } - - return value; + layout = generate_layout (text_view, model_col, view_col, row); + pango_layout_get_pixel_size (layout, NULL, &height); + g_object_unref (layout); + return height + 2; } /* @@ -1028,9 +965,19 @@ ect_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row) edit = g_new (CellEdit, 1); text_view->edit = edit; - build_current_cell (CURRENT_CELL(edit), text_view, model_col, view_col, row); + edit->view_col = -1; + edit->model_col = -1; + edit->row = -1; + + edit->layout = generate_layout (text_view, model_col, view_col, row); - set_style(ecell_view, CURRENT_CELL(edit), row); + edit->text_view = text_view; + edit->model_col = model_col; + edit->view_col = view_col; + edit->row = row; + edit->cell_width = e_table_header_get_column ( + ((ETableItem *)ecell_view->e_table_item_view)->header, + view_col)->width - 8; edit->xofs_edit = 0.0; edit->yofs_edit = 0.0; @@ -1068,7 +1015,7 @@ ect_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row) temp = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row); edit->old_text = g_strdup (temp); e_cell_text_free_text(ect, temp); - edit->cell.text = g_strdup (edit->old_text); + edit->text = g_strdup (edit->old_text); #if 0 if (edit->pointer_in){ @@ -1095,9 +1042,6 @@ ect_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, voi if (edit){ ect_stop_editing (text_view, TRUE); - /* FIXME: edit is freed in ect_stop_editing() so I've - commented this out - Damon. */ - /*unbuild_current_cell (CURRENT_CELL(edit));*/ } else { /* * We did invoke this leave edit internally @@ -1132,7 +1076,7 @@ ect_load_state (ECellView *ecell_view, int model_col, int view_col, int row, voi int length; int *selection = save_state; - length = strlen (edit->cell.text); + length = strlen (edit->text); edit->selection_start = MIN (selection[0], length); edit->selection_end = MIN (selection[1], length); @@ -1154,7 +1098,7 @@ ect_print (ECellView *ecell_view, GnomePrintContext *context, int model_col, int view_col, int row, double width, double height) { - GnomeFont *font = gnome_font_new ("Helvetica", 12); + GnomeFont *font = gnome_font_find ("Helvetica", 12); char *string; ECellText *ect = E_CELL_TEXT(ecell_view->ecell); string = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row); @@ -1193,32 +1137,23 @@ ect_max_width (ECellView *ecell_view, { /* New ECellText */ ECellTextView *text_view = (ECellTextView *) ecell_view; - EFont *font; int row; int number_of_rows; int max_width = 0; - font = text_view->font; number_of_rows = e_table_model_row_count (ecell_view->e_table_model); for (row = 0; row < number_of_rows; row++) { - CurrentCell cell; - struct line *line; + PangoLayout *layout = generate_layout (text_view, model_col, view_col, row); int width; - build_current_cell (&cell, text_view, model_col, view_col, row); - split_into_lines (&cell); - calc_line_widths (&cell); - - line = (struct line *)cell.breaks->lines; - width = e_font_utf8_text_width (font, cell.style, - line->text, line->length); + pango_layout_get_pixel_size (layout, &width, NULL); + max_width = MAX (max_width, width); - unref_lines (&cell); - unbuild_current_cell (&cell); + g_object_unref (layout); } - return max_width; + return max_width + 8; } static int @@ -1229,24 +1164,17 @@ ect_max_width_by_row (ECellView *ecell_view, { /* New ECellText */ ECellTextView *text_view = (ECellTextView *) ecell_view; - CurrentCell cell; - struct line *line; int width; + PangoLayout *layout; if (row >= e_table_model_row_count (ecell_view->e_table_model)) return 0; - build_current_cell (&cell, text_view, model_col, view_col, row); - split_into_lines (&cell); - calc_line_widths (&cell); - - line = (struct line *)cell.breaks->lines; - width = e_font_utf8_text_width (text_view->font, cell.style, - line->text, line->length); - unref_lines (&cell); - unbuild_current_cell (&cell); + layout = generate_layout (text_view, model_col, view_col, row); + pango_layout_get_pixel_size (layout, &width, NULL); + g_object_unref (layout); - return width; + return width + 8; } static gint @@ -1298,12 +1226,7 @@ ect_show_tooltip (ECellView *ecell_view, ETableTooltip *tooltip) { ECellTextView *text_view = (ECellTextView *) ecell_view; - CurrentCell cell; - struct line *lines; GtkWidget *canvas; - int i; - gdouble max_width; - gboolean cut_off; double i2c[6]; ArtPoint origin = {0, 0}; ArtPoint pixel_origin; @@ -1314,33 +1237,17 @@ ect_show_tooltip (ECellView *ecell_view, double tooltip_x; double tooltip_y; GnomeCanvasItem *rect; - double text_height; ECellText *ect = E_CELL_TEXT(ecell_view->ecell); GtkWidget *window; + PangoLayout *layout; + int width, height; tooltip->timer = 0; - build_current_cell (&cell, text_view, model_col, view_col, row); - - set_style(ecell_view, &cell, row); - - cell.width = col_width - 8; - split_into_lines (&cell); - calc_line_widths (&cell); - - cut_off = FALSE; - for (lines = cell.breaks->lines, i = 0; i < cell.breaks->num_lines; - lines++, i++) { - if (lines->length > lines->ellipsis_length) { - cut_off = TRUE; - break; - } - } + layout = generate_layout (text_view, model_col, view_col, row); - if (!cut_off) { - tooltip->timer = 0; - unref_lines (&cell); - unbuild_current_cell (&cell); + pango_layout_get_pixel_size (layout, &width, &height); + if (width < col_width - 8) { return; } @@ -1362,24 +1269,12 @@ ect_show_tooltip (ECellView *ecell_view, GTK_WIDGET_UNSET_FLAGS (canvas, GTK_CAN_FOCUS); GTK_WIDGET_UNSET_FLAGS (window, GTK_CAN_FOCUS); - max_width = 0.0; - for (lines = cell.breaks->lines, i = 0; i < cell.breaks->num_lines; - lines++, i++) { - gdouble line_width; - - line_width = e_font_utf8_text_width (text_view->font, - cell.style, lines->text, - lines->length); - max_width = MAX (max_width, line_width); - } - - text_height = e_font_height (text_view->font) * cell.breaks->num_lines + 4; rect = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)), gnome_canvas_rect_get_type (), "x1", (double) 0.0, "y1", (double) 0.0, - "x2", (double) max_width + 4, - "y2", (double) text_height, + "x2", (double) width + 4, + "y2", (double) height, "fill_color_gdk", tooltip->background, NULL); @@ -1390,18 +1285,18 @@ ect_show_tooltip (ECellView *ecell_view, "bold", (gboolean) ect->bold_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->bold_column, row), "strikeout", (gboolean) ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row), "fill_color_gdk", tooltip->foreground, - "text", cell.text, + "text", pango_layout_get_text (layout), "editable", FALSE, - "clip_width", max_width, - "clip_height", (double) text_height, + "clip_width", (double) width, + "clip_height", (double) height, "clip", TRUE, "line_wrap", FALSE, "justification", E_CELL_TEXT (text_view->cell_view.ecell)->justify, "draw_background", FALSE, NULL); - tooltip_width = max_width; - tooltip_height = text_height; + tooltip_width = width; + tooltip_height = height; tooltip_y = tooltip->y; switch (E_CELL_TEXT (text_view->cell_view.ecell)->justify) { @@ -1435,9 +1330,6 @@ ect_show_tooltip (ECellView *ecell_view, e_canvas_popup_tooltip (E_CANVAS(text_view->canvas), window, pixel_origin.x + tooltip->x, pixel_origin.y + tooltip->y - 1); - unref_lines (&cell); - unbuild_current_cell (&cell); - return; } @@ -1445,13 +1337,13 @@ ect_show_tooltip (ECellView *ecell_view, * GtkObject::destroy method */ static void -ect_destroy (GtkObject *object) +ect_finalize (GObject *object) { ECellText *ect = E_CELL_TEXT (object); g_free (ect->font_name); - GTK_OBJECT_CLASS (parent_class)->destroy (object); + G_OBJECT_CLASS (parent_class)->finalize (object); } /* Set_arg handler for the text item */ static void @@ -1532,7 +1424,7 @@ e_cell_text_class_init (GtkObjectClass *object_class) ECellTextClass *ectc = (ECellTextClass *) object_class; char *ellipsis_env; - object_class->destroy = ect_destroy; + G_OBJECT_CLASS (object_class)->finalize = ect_finalize; ecc->new_view = ect_new_view; ecc->kill_view = ect_kill_view; @@ -1552,7 +1444,6 @@ e_cell_text_class_init (GtkObjectClass *object_class) ecc->max_width_by_row = ect_max_width_by_row; ecc->show_tooltip = ect_show_tooltip; ecc->get_bg_color = ect_get_bg_color; - ecc->style_set = ect_style_set; ectc->get_text = ect_real_get_text; ectc->free_text = ect_real_free_text; @@ -1654,163 +1545,28 @@ e_cell_text_new (const char *fontname, GtkJustification justify) return (ECell *) ect; } -/* Calculates the x position of the specified line of text, based on the text's justification */ -static int -get_line_xpos (CurrentCell *cell, struct line *line) -{ - int x; - - ECellTextView *text_view = cell->text_view; - ECellText *ect = E_CELL_TEXT (((ECellView *)cell->text_view)->ecell); - - x = text_view->xofs + ect->x; - - switch (ect->justify) { - case GTK_JUSTIFY_RIGHT: - x += cell->width - line->width; - break; - - case GTK_JUSTIFY_CENTER: - x += (cell->width - line->width) / 2; - break; - - default: - /* For GTK_JUSTIFY_LEFT, we don't have to do anything. We do not support - * GTK_JUSTIFY_FILL, yet. - */ - break; - } - - return x; -} - -/* Calculates the x position of the specified line of text, based on the text's justification */ -static int -get_line_ypos (CurrentCell *cell, struct line *line) -{ - int y; - - ECellTextView *text_view = cell->text_view; - ECellText *ect = E_CELL_TEXT (((ECellView *)cell->text_view)->ecell); - ECellTextLineBreaks *linebreaks = cell->breaks; - - struct line *lines = linebreaks->lines; - - EFont *font; - - font = text_view->font; - - y = text_view->yofs + ect->y; - y += (line - lines) * e_font_height (font); - - return y; -} /* fixme: Handle Font attributes */ /* position is in BYTES */ -static void -_get_xy_from_position (CurrentCell *cell, gint position, gint *xp, gint *yp) -{ - if (xp || yp) { - struct line *lines; - int x, y; - int j; - ECellTextView *text_view = cell->text_view; - ECellTextLineBreaks *linebreaks; - EFont *font; - - font = text_view->font; - - split_into_lines (cell); - - linebreaks = cell->breaks; - lines = linebreaks->lines; - - x = get_line_xpos (cell, lines); - y = get_line_ypos (cell, lines); - for (j = 0, lines = linebreaks->lines; j < linebreaks->num_lines; lines++, j++) { - if (lines->text > cell->text + position) - break; - y += e_font_height (font); - } - lines --; - y -= e_font_descent (font); - - x += e_font_utf8_text_width (font, cell->style, - lines->text, - position - (lines->text - cell->text)); - if ((CellEdit *) cell == cell->text_view->edit){ - x -= ((CellEdit *)cell)->xofs_edit; - y -= ((CellEdit *)cell)->yofs_edit; - } - if (xp) - *xp = x; - if (yp) - *yp = y; - unref_lines (cell); - } -} - static gint -_get_position_from_xy (CurrentCell *cell, gint x, gint y) +get_position_from_xy (CellEdit *edit, gint x, gint y) { - int i, j; - int xpos, ypos; - struct line *lines; - int return_val; - gchar *p; - - ECellTextView *text_view = cell->text_view; - ECellTextLineBreaks *linebreaks; - EFont *font; - - font = text_view->font; - - split_into_lines (cell); - - linebreaks = cell->breaks; - - lines = linebreaks->lines; - - if ((CellEdit *) cell == cell->text_view->edit){ - x += ((CellEdit *)cell)->xofs_edit; - y += ((CellEdit *)cell)->yofs_edit; - } - - ypos = get_line_ypos (cell, linebreaks->lines); - j = 0; - while (y > ypos) { - ypos += e_font_height (font); - j ++; - } - j--; - if (j >= linebreaks->num_lines) - j = linebreaks->num_lines - 1; - if (j < 0) - j = 0; - i = 0; + int index; + int trailing; + const char *text; + PangoLayout *layout = edit->layout; + ECellTextView *text_view = edit->text_view; + ECellText *ect = (ECellText *) ((ECellView *)text_view)->ecell; - lines += j; - xpos = get_line_xpos (cell, lines); + x -= (ect->x + text_view->xofs - edit->xofs_edit); + y -= (ect->y + text_view->yofs - edit->yofs_edit); - for (p = lines->text; p < lines->text + lines->length && g_unichar_validate (g_utf8_get_char (p)); p = g_utf8_next_char (p)) { - gint charwidth; + pango_layout_xy_to_index (layout, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing); - charwidth = e_font_utf8_char_width (font, cell->style, p); + text = pango_layout_get_text (layout); - xpos += charwidth / 2; - if (xpos > x) { - break; - } - xpos += (charwidth + 1) / 2; - } - - return_val = p - cell->text; - - unref_lines (cell); - - return return_val; + return g_utf8_offset_to_pointer (text + index, trailing) - text; } #define SCROLL_WAIT_TIME 30000 @@ -1821,11 +1577,11 @@ _blink_scroll_timeout (gpointer data) ECellTextView *text_view = (ECellTextView *) data; ECellText *ect = E_CELL_TEXT (((ECellView *)text_view)->ecell); CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); gulong current_time; gboolean scroll = FALSE; gboolean redraw = FALSE; + int width, height; g_timer_elapsed (edit->timer, ¤t_time); @@ -1838,19 +1594,18 @@ _blink_scroll_timeout (gpointer data) current_time < edit->scroll_start) scroll = TRUE; } + + pango_layout_get_pixel_size (edit->layout, &width, &height); + if (scroll && edit->button_down) { /* FIXME: Copy this for y. */ - if (edit->lastx - ect->x > cell->width) { - ECellTextLineBreaks *linebreaks; - split_into_lines (cell); - linebreaks = cell->breaks; - if (edit->xofs_edit < linebreaks->max_width - cell->width) { + if (edit->lastx - ect->x > edit->cell_width) { + if (edit->xofs_edit < width - edit->cell_width) { edit->xofs_edit += 4; - if (edit->xofs_edit > linebreaks->max_width - cell->width + 1) - edit->xofs_edit = linebreaks->max_width - cell->width + 1; + if (edit->xofs_edit > width - edit->cell_width + 1) + edit->xofs_edit = width - edit->cell_width + 1; redraw = TRUE; } - unref_lines (cell); } if (edit->lastx - ect->x < 0 && edit->xofs_edit > 0) { @@ -1864,7 +1619,7 @@ _blink_scroll_timeout (gpointer data) e_tep_event.type = GDK_MOTION_NOTIFY; e_tep_event.motion.state = edit->last_state; e_tep_event.motion.time = 0; - e_tep_event.motion.position = _get_position_from_xy (cell, edit->lastx, edit->lasty); + e_tep_event.motion.position = get_position_from_xy (edit, edit->lastx, edit->lasty); _get_tep (edit); e_text_event_processor_handle_event (edit->tep, &e_tep_event); @@ -1882,7 +1637,7 @@ _blink_scroll_timeout (gpointer data) edit->show_cursor = FALSE; } if (redraw){ - ect_queue_redraw (text_view, edit->cell.view_col, edit->cell.row); + ect_queue_redraw (text_view, edit->view_col, edit->row); } return TRUE; } @@ -1890,36 +1645,35 @@ _blink_scroll_timeout (gpointer data) static int next_word (CellEdit *edit, int start) { - CurrentCell *cell = CURRENT_CELL(edit); char *p; int length; - length = strlen (cell->text); + length = strlen (edit->text); if (start >= length) return length; - p = g_utf8_next_char (cell->text + start); + p = g_utf8_next_char (edit->text + start); while (*p && g_unichar_validate (g_utf8_get_char (p))) { gunichar unival = g_utf8_get_char (p); if (g_unichar_isspace (unival)) - return p - cell->text; + return p - edit->text; p = g_utf8_next_char (p); } - return p - cell->text; + return p - edit->text; } static int _get_position (ECellTextView *text_view, ETextEventProcessorCommand *command) { int length; - int x, y; CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); EFont *font; gchar *p; int unival; + int index; + int trailing; font = text_view->font; @@ -1937,57 +1691,57 @@ _get_position (ECellTextView *text_view, ETextEventProcessorCommand *command) /* fixme: this probably confuses TEP */ case E_TEP_END_OF_BUFFER: - return strlen (cell->text); + return strlen (edit->text); case E_TEP_START_OF_LINE: if (edit->selection_end < 1) return 0; - p = g_utf8_find_prev_char (cell->text, cell->text + edit->selection_end); + p = g_utf8_find_prev_char (edit->text, edit->text + edit->selection_end); - if (p == cell->text) return 0; + if (p == edit->text) return 0; - p = g_utf8_find_prev_char (cell->text, p); + p = g_utf8_find_prev_char (edit->text, p); - while (p && p > cell->text) { - if (*p == '\n') return p - cell->text + 1; - p = g_utf8_find_prev_char (cell->text, p); + while (p && p > edit->text) { + if (*p == '\n') return p - edit->text + 1; + p = g_utf8_find_prev_char (edit->text, p); } return 0; case E_TEP_END_OF_LINE: - length = strlen (cell->text); + length = strlen (edit->text); if (edit->selection_end >= length) return length; - p = g_utf8_next_char (cell->text + edit->selection_end); + p = g_utf8_next_char (edit->text + edit->selection_end); while (*p && g_unichar_validate (g_utf8_get_char (p))) { - if (*p == '\n') return p - cell->text; + if (*p == '\n') return p - edit->text; p = g_utf8_next_char (p); } - return p - cell->text; + return p - edit->text; case E_TEP_FORWARD_CHARACTER: - length = strlen (cell->text); + length = strlen (edit->text); if (edit->selection_end >= length) return length; - p = g_utf8_next_char (cell->text + edit->selection_end); + p = g_utf8_next_char (edit->text + edit->selection_end); - return p - cell->text; + return p - edit->text; case E_TEP_BACKWARD_CHARACTER: if (edit->selection_end < 1) return 0; - p = g_utf8_find_prev_char (cell->text, cell->text + edit->selection_end); + p = g_utf8_find_prev_char (edit->text, edit->text + edit->selection_end); if (p == NULL) return 0; - return p - cell->text; + return p - edit->text; case E_TEP_FORWARD_WORD: return next_word (edit, edit->selection_end); @@ -1996,31 +1750,53 @@ _get_position (ECellTextView *text_view, ETextEventProcessorCommand *command) if (edit->selection_end < 1) return 0; - p = g_utf8_find_prev_char (cell->text, cell->text + edit->selection_end); + p = g_utf8_find_prev_char (edit->text, edit->text + edit->selection_end); - if (p == cell->text) return 0; + if (p == edit->text) return 0; - p = g_utf8_find_prev_char (cell->text, p); + p = g_utf8_find_prev_char (edit->text, p); - while (p && p > cell->text && g_unichar_validate (g_utf8_get_char (p))) { + while (p && p > edit->text && g_unichar_validate (g_utf8_get_char (p))) { unival = g_utf8_get_char (p); if (g_unichar_isspace (unival)) { - return (g_utf8_next_char (p) - cell->text); + return (g_utf8_next_char (p) - edit->text); } - p = g_utf8_find_prev_char (cell->text, p); + p = g_utf8_find_prev_char (edit->text, p); } return 0; case E_TEP_FORWARD_LINE: - _get_xy_from_position (cell, edit->selection_end, &x, &y); - y += e_font_height (font); - return _get_position_from_xy (cell, x, y); + pango_layout_move_cursor_visually (edit->layout, + TRUE, + edit->selection_end, + 0, + TRUE, + &index, + &trailing); + index = g_utf8_offset_to_pointer (edit->text + index, trailing) - edit->text; + if (index < 0) + return 0; + length = strlen (edit->text); + if (index >= length) + return length; + return index; case E_TEP_BACKWARD_LINE: - _get_xy_from_position (cell, edit->selection_end, &x, &y); - y -= e_font_height (font); - return _get_position_from_xy (cell, x, y); - + pango_layout_move_cursor_visually (edit->layout, + TRUE, + edit->selection_end, + 0, + TRUE, + &index, + &trailing); + + index = g_utf8_offset_to_pointer (edit->text + index, trailing) - edit->text; + if (index < 0) + return 0; + length = strlen (edit->text); + if (index >= length) + return length; + return index; case E_TEP_FORWARD_PARAGRAPH: case E_TEP_BACKWARD_PARAGRAPH: @@ -2038,7 +1814,6 @@ static void _delete_selection (ECellTextView *text_view) { CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); gint length; gchar *sp, *ep; @@ -2050,8 +1825,8 @@ _delete_selection (ECellTextView *text_view) edit->selection_end ^= edit->selection_start; } - sp = cell->text + edit->selection_start; - ep = cell->text + edit->selection_end; + sp = edit->text + edit->selection_start; + ep = edit->text + edit->selection_end; length = strlen (ep) + 1; memmove (sp, ep, length); @@ -2066,20 +1841,19 @@ static void _insert (ECellTextView *text_view, char *string, int value) { CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); char *temp; if (value <= 0) return; - temp = g_new (gchar, strlen (cell->text) + value + 1); + temp = g_new (gchar, strlen (edit->text) + value + 1); - strncpy (temp, cell->text, edit->selection_start); + strncpy (temp, edit->text, edit->selection_start); strncpy (temp + edit->selection_start, string, value); - strcpy (temp + edit->selection_start + value, cell->text + edit->selection_end); + strcpy (temp + edit->selection_start + value, edit->text + edit->selection_end); - g_free (cell->text); + g_free (edit->text); - cell->text = temp; + edit->text = temp; edit->selection_start += value; edit->selection_end = edit->selection_start; @@ -2088,13 +1862,12 @@ _insert (ECellTextView *text_view, char *string, int value) static void capitalize (CellEdit *edit, int start, int end, ETextEventProcessorCaps type) { - CurrentCell *cell = CURRENT_CELL(edit); - ECellTextView *text_view = cell->text_view; + ECellTextView *text_view = edit->text_view; gboolean first = TRUE; - int character_length = g_utf8_strlen (cell->text + start, start - end); - const char *p = cell->text + start; - const char *text_end = cell->text + end; + int character_length = g_utf8_strlen (edit->text + start, start - end); + const char *p = edit->text + start; + const char *text_end = edit->text + end; char *new_text = g_new0 (char, character_length * 6 + 1); char *output = new_text; @@ -2141,8 +1914,7 @@ static void e_cell_text_view_command (ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data) { CellEdit *edit = (CellEdit *) data; - CurrentCell *cell = CURRENT_CELL(edit); - ECellTextView *text_view = cell->text_view; + ECellTextView *text_view = edit->text_view; ECellText *ect = E_CELL_TEXT (text_view->cell_view.ecell); gboolean change = FALSE; @@ -2176,7 +1948,7 @@ e_cell_text_view_command (ETextEventProcessor *tep, ETextEventProcessorCommand * sel_end = MAX(edit->selection_start, edit->selection_end); if (sel_start != sel_end) { e_cell_text_view_supply_selection (edit, command->time, GDK_SELECTION_PRIMARY, - cell->text + sel_start, + edit->text + sel_start, sel_end - sel_start); } else if (edit->timer) { g_timer_reset (edit->timer); @@ -2211,7 +1983,7 @@ e_cell_text_view_command (ETextEventProcessor *tep, ETextEventProcessorCommand * sel_end = MAX(edit->selection_start, edit->selection_end); if (sel_start != sel_end) { e_cell_text_view_supply_selection (edit, command->time, clipboard_atom, - cell->text + sel_start, + edit->text + sel_start, sel_end - sel_start); } if (edit->timer) { @@ -2259,88 +2031,33 @@ e_cell_text_view_command (ETextEventProcessor *tep, ETextEventProcessorCommand * break; } - if (!edit->button_down) { - int x; - int i; - struct line *lines; - ECellTextLineBreaks *linebreaks; - - split_into_lines (cell); - - linebreaks = cell->breaks; - - for (lines = linebreaks->lines, i = 0; i < linebreaks->num_lines ; i++, lines ++) { - if ((lines->text - cell->text) > edit->selection_end) { - break; - } - } - lines --; - x = e_font_utf8_text_width (font, cell->style, - lines->text, - edit->selection_end - (lines->text - cell->text)); - + if (change) { + if (edit->layout) + g_object_unref (edit->layout); + edit->layout = build_layout (text_view, edit->row, edit->text); + } - if (x < edit->xofs_edit) { - edit->xofs_edit = x; - redraw = TRUE; + if (!edit->button_down) { + PangoRectangle strong_pos, weak_pos; + pango_layout_get_cursor_pos (edit->layout, edit->selection_end, &strong_pos, &weak_pos); + if (strong_pos.x != weak_pos.x || + strong_pos.y != weak_pos.y || + strong_pos.width != weak_pos.width || + strong_pos.height != weak_pos.height) { + if (show_pango_rectangle (edit, weak_pos)) + redraw = TRUE; } - - if (2 + x - cell->width > edit->xofs_edit) { - edit->xofs_edit = 2 + x - cell->width; + if (show_pango_rectangle (edit, strong_pos)) { redraw = TRUE; } - unref_lines (cell); } if (redraw){ - ect_queue_redraw (text_view, edit->cell.view_col, edit->cell.row); - } -#if 0 - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); -#endif -} - -static void _invisible_destroy (GtkInvisible *invisible, - CellEdit *edit) -{ - edit->invisible = NULL; -} - -static GtkWidget *e_cell_text_view_get_invisible (CellEdit *edit) -{ - GtkWidget *invisible; - if (edit->invisible) { - invisible = edit->invisible; - } else { - invisible = gtk_invisible_new (); - edit->invisible = invisible; - - gtk_selection_add_target (invisible, - GDK_SELECTION_PRIMARY, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_PRIMARY); - gtk_selection_add_target (invisible, - clipboard_atom, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_CLIPBOARD); - - gtk_signal_connect (GTK_OBJECT(invisible), "selection_get", - GTK_SIGNAL_FUNC (_selection_get), - edit); - gtk_signal_connect (GTK_OBJECT(invisible), "selection_clear_event", - GTK_SIGNAL_FUNC (_selection_clear_event), - edit); - gtk_signal_connect (GTK_OBJECT(invisible), "selection_received", - GTK_SIGNAL_FUNC (_selection_received), - edit); - - gtk_signal_connect (GTK_OBJECT(invisible), "destroy", - GTK_SIGNAL_FUNC (_invisible_destroy), - edit); + ect_queue_redraw (text_view, edit->view_col, edit->row); } - return invisible; } +#ifdef DO_SELECTION static void _selection_clear_event (GtkInvisible *invisible, GdkEventSelection *event, @@ -2403,9 +2120,41 @@ _selection_received (GtkInvisible *invisible, } } +static GtkWidget *e_cell_text_view_get_invisible (CellEdit *edit) +{ + if (edit->invisible == NULL) { + GtkWidget *invisible = gtk_invisible_new (); + edit->invisible = invisible; + + gtk_selection_add_target (invisible, + GDK_SELECTION_PRIMARY, + GDK_SELECTION_TYPE_STRING, + E_SELECTION_PRIMARY); + gtk_selection_add_target (invisible, + clipboard_atom, + GDK_SELECTION_TYPE_STRING, + E_SELECTION_CLIPBOARD); + + gtk_signal_connect (GTK_OBJECT(invisible), "selection_get", + GTK_SIGNAL_FUNC (_selection_get), + edit); + gtk_signal_connect (GTK_OBJECT(invisible), "selection_clear_event", + GTK_SIGNAL_FUNC (_selection_clear_event), + edit); + gtk_signal_connect (GTK_OBJECT(invisible), "selection_received", + GTK_SIGNAL_FUNC (_selection_received), + edit); + + g_object_weak_ref (G_OBJECT (invisible), invisible_finalize, edit); + } + return edit->invisible; +} +#endif + static void e_cell_text_view_supply_selection (CellEdit *edit, guint time, GdkAtom selection, char *data, gint length) { +#if DO_SELECTION gboolean successful; GtkWidget *invisible; @@ -2431,17 +2180,20 @@ e_cell_text_view_supply_selection (CellEdit *edit, guint time, GdkAtom selection if (selection == GDK_SELECTION_PRIMARY) edit->has_selection = successful; +#endif } static void e_cell_text_view_get_selection (CellEdit *edit, GdkAtom selection, guint32 time) { +#if DO_SELECTION GtkWidget *invisible; invisible = e_cell_text_view_get_invisible (edit); gtk_selection_convert (invisible, selection, GDK_SELECTION_TYPE_STRING, time); +#endif } static void @@ -2458,89 +2210,6 @@ _get_tep (CellEdit *edit) } } -static int -number_of_lines (char *text) -{ - int num_lines = 0; - gchar *p; - - if (!text) return 0; - - for (p = text; *p && g_unichar_validate (g_utf8_get_char (p)); p = g_utf8_next_char (p)) { - if (*p == '\n') num_lines++; - } - - num_lines++; - return num_lines; -} - -/* Splits the text of the text item into lines */ -static void -split_into_lines (CurrentCell *cell) -{ - char *p; - struct line *lines; - gint len; - - char *text = cell->text; - ECellTextLineBreaks *linebreaks; - - if (! cell->breaks) { - cell->breaks = g_new (ECellTextLineBreaks, 1); - cell->breaks->ref_count = 1; - } else { - cell->breaks->ref_count ++; - return; - } - linebreaks = cell->breaks; - - /* Check if already split. */ - linebreaks->lines = NULL; - linebreaks->num_lines = 0; - - if (!text) - return; - - /* First, count the number of lines */ - - linebreaks->num_lines = number_of_lines(cell->text); - - /* Allocate array of lines and calculate split positions */ - - linebreaks->lines = lines = g_new0 (struct line, linebreaks->num_lines); - - len = 0; - for (p = text; *p && g_unichar_validate (g_utf8_get_char (p)); p = g_utf8_next_char (p)) { - if (len == 0) lines->text = p; - if (*p == '\n') { - lines->length = p - lines->text; - lines++; - len = 0; - } else - len++; - } - - if (len == 0) - lines->text = p; - lines->length = p - lines->text; - - calc_line_widths (cell); -} - -/* Free lines structure. */ -static void -unref_lines (CurrentCell *cell) -{ - if (cell->breaks){ - cell->breaks->ref_count --; - if (cell->breaks->ref_count <= 0){ - g_free (cell->breaks->lines); - g_free (cell->breaks); - cell->breaks = NULL; - } - } -} - static void calc_ellipsis (ECellTextView *text_view) { @@ -2560,101 +2229,6 @@ calc_ellipsis (ECellTextView *text_view) } } -/* Calculates the line widths (in pixels) of the text's splitted lines */ -static void -calc_line_widths (CurrentCell *cell) -{ - ECellTextView *text_view = cell->text_view; - ECellText *ect = E_CELL_TEXT (((ECellView *)text_view)->ecell); - ECellTextLineBreaks *linebreaks = cell->breaks; - struct line *lines; - int i; - int j; - EFont *font; - - font = text_view->font; - - lines = linebreaks->lines; - linebreaks->max_width = 0; - - if (!lines) return; - - for (i = 0; i < linebreaks->num_lines; i++) { - if (lines->length != 0) { - if (font) { - lines->width = e_font_utf8_text_width (font, cell->style, - lines->text, lines->length); - lines->ellipsis_length = 0; - } else { - lines->width = 0; - } - - if (ect->use_ellipsis && - (!(text_view->edit && - cell->row == text_view->edit->cell.row && - cell->view_col == text_view->edit->cell.view_col)) && - lines->width > cell->width) { - if (font) { - lines->ellipsis_length = 0; - for (j = 0; j < lines->length; j++){ - if (e_font_utf8_text_width (font, cell->style, lines->text, j) + - text_view->ellipsis_width[cell->style] < cell->width) { - lines->ellipsis_length = j; - } - else - break; - } - } - else - lines->ellipsis_length = 0; - lines->width = e_font_utf8_text_width (font, cell->style, lines->text, lines->ellipsis_length) + - text_view->ellipsis_width[cell->style]; - } - else - lines->ellipsis_length = lines->length; - - if (lines->width > linebreaks->max_width) - linebreaks->max_width = lines->width; - } else { - lines->width = 0; - lines->ellipsis_length = 0; - } - - lines++; - } -} - -static void -build_current_cell (CurrentCell *cell, ECellTextView *text_view, int model_col, int view_col, int row) -{ - ECellView *ecell_view = (ECellView *) text_view; - ECellText *ect = E_CELL_TEXT (ecell_view->ecell); - char *temp; - - cell->text_view = text_view; - cell->model_col = model_col; - cell->view_col = view_col; - cell->row = row; - cell->breaks = NULL; - - temp = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row); - cell->text = g_strdup(temp); - e_cell_text_free_text(ect, temp); - - cell->width = e_table_header_get_column ( - ((ETableItem *)ecell_view->e_table_item_view)->header, - view_col)->width - 8; - cell->style = 0; -} - -static void -unbuild_current_cell (CurrentCell *cell) -{ - g_free(cell->text); - cell->text = NULL; -} - - static GdkColor* e_cell_text_get_color (ECellTextView *cell_view, gchar *color_spec) { diff --git a/widgets/table/e-cell-text.h b/widgets/table/e-cell-text.h index 476e40c51e..6612a0213b 100644 --- a/widgets/table/e-cell-text.h +++ b/widgets/table/e-cell-text.h @@ -8,7 +8,7 @@ * Chris Lahey <clahey@ximian.com> * * A lot of code taken from: - * + * * Text item type for GnomeCanvas widget * * GnomeCanvas is basically a port of the Tk toolkit's most excellent @@ -37,11 +37,10 @@ #ifndef _E_CELL_TEXT_H_ #define _E_CELL_TEXT_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/e-table/e-cell.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_TEXT_TYPE (e_cell_text_get_type ()) #define E_CELL_TEXT(o) (GTK_CHECK_CAST ((o), E_CELL_TEXT_TYPE, ECellText)) @@ -101,7 +100,7 @@ void e_cell_text_free_text (ECellText *cell, char *text); /* Sets the ETableModel value, based on the given string. */ void e_cell_text_set_value (ECellText *cell, ETableModel *model, int col, int row, const char *text); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_TEXT_H_ */ diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c index c787b8f07e..26904d284a 100644 --- a/widgets/table/e-cell-toggle.c +++ b/widgets/table/e-cell-toggle.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-cell-toggle.c - Multi-state image toggle cell object. * Copyright 1999, 2000, Ximian, Inc. * @@ -27,7 +27,7 @@ #include <gtk/gtkwindow.h> #include <gtk/gtksignal.h> #include <gdk/gdkkeysyms.h> -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include "e-cell-toggle.h" #include "gal/util/e-util.h" #include "gal/widgets/e-hsv-utils.h" @@ -46,6 +46,23 @@ static ECellClass *parent_class; #define CACHE_SEQ_COUNT 6 +static int +gnome_print_pixbuf (GnomePrintContext *pc, GdkPixbuf *pixbuf) +{ + if (gdk_pixbuf_get_has_alpha (pixbuf)) + return gnome_print_rgbaimage (pc, + gdk_pixbuf_get_pixels (pixbuf), + gdk_pixbuf_get_width (pixbuf), + gdk_pixbuf_get_height (pixbuf), + gdk_pixbuf_get_rowstride (pixbuf)); + else + return gnome_print_rgbimage (pc, + gdk_pixbuf_get_pixels (pixbuf), + gdk_pixbuf_get_width (pixbuf), + gdk_pixbuf_get_height (pixbuf), + gdk_pixbuf_get_rowstride (pixbuf)); +} + /* * ECell::realize method */ @@ -378,7 +395,7 @@ etog_style_set (ECellView *ecell_view, GtkStyle *previous_style) } static void -etog_destroy (GtkObject *object) +etog_finalize (GObject *object) { ECellToggle *etog = E_CELL_TOGGLE (object); int i; @@ -391,7 +408,7 @@ etog_destroy (GtkObject *object) etog->images = NULL; etog->n_states = 0; - GTK_OBJECT_CLASS (parent_class)->destroy (object); + G_OBJECT_CLASS (parent_class)->finalize (object); } static void @@ -399,7 +416,7 @@ e_cell_toggle_class_init (GtkObjectClass *object_class) { ECellClass *ecc = (ECellClass *) object_class; - object_class->destroy = etog_destroy; + G_OBJECT_CLASS (object_class)->finalize = etog_finalize; ecc->new_view = etog_new_view; ecc->kill_view = etog_kill_view; diff --git a/widgets/table/e-cell-toggle.h b/widgets/table/e-cell-toggle.h index da60321259..3e105773f6 100644 --- a/widgets/table/e-cell-toggle.h +++ b/widgets/table/e-cell-toggle.h @@ -24,12 +24,11 @@ #ifndef _E_CELL_TOGGLE_H_ #define _E_CELL_TOGGLE_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include <gal/e-table/e-cell.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_TOGGLE_TYPE (e_cell_toggle_get_type ()) #define E_CELL_TOGGLE(o) (GTK_CHECK_CAST ((o), E_CELL_TOGGLE_TYPE, ECellToggle)) @@ -56,7 +55,7 @@ ECell *e_cell_toggle_new (int border, int n_states, GdkPixbuf **images void e_cell_toggle_construct (ECellToggle *etog, int border, int n_states, GdkPixbuf **images); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_TOGGLE_H_ */ diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c index b6d51038cf..d5ccbd2e8c 100644 --- a/widgets/table/e-cell-tree.c +++ b/widgets/table/e-cell-tree.c @@ -40,7 +40,7 @@ #include <gtk/gtkinvisible.h> #include <gtk/gtksignal.h> #include <gdk/gdkkeysyms.h> -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include "e-tree-table-adapter.h" #include "e-tree-model.h" @@ -667,8 +667,13 @@ ect_destroy (GtkObject *object) gtk_object_unref (GTK_OBJECT (ect->subcell)); ect->subcell = NULL; - gdk_pixbuf_unref (ect->open_pixbuf); - gdk_pixbuf_unref (ect->closed_pixbuf); + if (ect->open_pixbuf) + gdk_pixbuf_unref (ect->open_pixbuf); + ect->open_pixbuf = NULL; + + if (ect->closed_pixbuf) + gdk_pixbuf_unref (ect->closed_pixbuf); + ect->closed_pixbuf = NULL; GTK_OBJECT_CLASS (parent_class)->destroy (object); } diff --git a/widgets/table/e-cell-tree.h b/widgets/table/e-cell-tree.h index c821a35fe7..daba990be6 100644 --- a/widgets/table/e-cell-tree.h +++ b/widgets/table/e-cell-tree.h @@ -30,11 +30,10 @@ #ifndef _E_CELL_TREE_H_ #define _E_CELL_TREE_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/e-table/e-cell.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_TREE_TYPE (e_cell_tree_get_type ()) #define E_CELL_TREE(o) (GTK_CHECK_CAST ((o), E_CELL_TREE_TYPE, ECellTree)) @@ -69,7 +68,7 @@ void e_cell_tree_construct (ECellTree *ect, ECell *subcell); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_TREE_H_ */ diff --git a/widgets/table/e-cell-vbox.h b/widgets/table/e-cell-vbox.h index c5207561f5..f815d40512 100644 --- a/widgets/table/e-cell-vbox.h +++ b/widgets/table/e-cell-vbox.h @@ -30,11 +30,10 @@ #ifndef _E_CELL_VBOX_H_ #define _E_CELL_VBOX_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/e-table/e-cell.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_CELL_VBOX_TYPE (e_cell_vbox_get_type ()) #define E_CELL_VBOX(o) (GTK_CHECK_CAST ((o), E_CELL_VBOX_TYPE, ECellVbox)) @@ -61,8 +60,6 @@ void e_cell_vbox_append (ECellVbox *vbox, int model_col); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_VBOX_H_ */ - - diff --git a/widgets/table/e-cell.c b/widgets/table/e-cell.c index 5d3e261cb0..a447bcffbf 100644 --- a/widgets/table/e-cell.c +++ b/widgets/table/e-cell.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-cell.c - base class for cell renderers in e-table * Copyright 1999, 2000, 2001, Ximian, Inc. * @@ -28,7 +28,7 @@ #define PARENT_TYPE gtk_object_get_type () -#define ECVIEW_EC_CLASS(v) (E_CELL_CLASS (GTK_OBJECT ((v)->ecell)->klass)) +#define ECVIEW_EC_CLASS(v) (E_CELL_GET_CLASS (v->ecell)) static ECellView * ec_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) @@ -200,7 +200,7 @@ e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_co ECellView * e_cell_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) { - return E_CELL_CLASS (GTK_OBJECT (ecell)->klass)->new_view ( + return E_CELL_GET_CLASS (ecell)->new_view ( ecell, table_model, e_table_item_view); } diff --git a/widgets/table/e-cell.h b/widgets/table/e-cell.h index e821ce60c3..d21aeaec60 100644 --- a/widgets/table/e-cell.h +++ b/widgets/table/e-cell.h @@ -27,17 +27,18 @@ #include <gdk/gdktypes.h> #include <libgnomeprint/gnome-print.h> +#include <libgnomeprint/gnome-font.h> #include <gal/e-table/e-table-model.h> #include <gal/e-table/e-table-tooltip.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS -#define E_CELL_TYPE (e_cell_get_type ()) -#define E_CELL(o) (GTK_CHECK_CAST ((o), E_CELL_TYPE, ECell)) -#define E_CELL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TYPE, ECellClass)) -#define E_IS_CELL(o) (GTK_CHECK_TYPE ((o), E_CELL_TYPE)) -#define E_IS_CELL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_TYPE)) +#define E_CELL_TYPE (e_cell_get_type ()) +#define E_CELL(o) (GTK_CHECK_CAST ((o), E_CELL_TYPE, ECell)) +#define E_CELL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TYPE, ECellClass)) +#define E_CELL_GET_CLASS(o) (GTK_CHECK_GET_CLASS((o), E_CELL_TYPE, ECellClass)) +#define E_IS_CELL(o) (GTK_CHECK_TYPE ((o), E_CELL_TYPE)) +#define E_IS_CELL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_TYPE)) typedef gboolean (*ETableSearchFunc) (gconstpointer haystack, const char *needle); @@ -216,7 +217,6 @@ void e_cell_free_state (ECellView *ecell_view, int row, void *state); - -END_GNOME_DECLS +G_END_DECLS #endif /* _E_CELL_H_ */ diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c index 12cc466d9e..4e1294c36f 100644 --- a/widgets/table/e-table-click-to-add.c +++ b/widgets/table/e-table-click-to-add.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-click-to-add.c * Copyright 2000, 2001, Ximian, Inc. * @@ -24,9 +24,9 @@ #include <config.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtksignal.h> -#include <libgnomeui/gnome-canvas.h> -#include <libgnomeui/gnome-canvas-util.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <libgnomecanvas/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas-util.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include "e-table-header.h" @@ -154,13 +154,16 @@ etcta_drop_message (ETableClickToAdd *etcta) static void -etcta_destroy (GtkObject *object){ +etcta_destroy (GtkObject *object) +{ ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (object); etcta_drop_table_header (etcta); etcta_drop_model (etcta); etcta_drop_message (etcta); - gtk_object_unref(GTK_OBJECT(etcta->selection)); + if (etcta->selection) + gtk_object_unref (GTK_OBJECT(etcta->selection)); + etcta->selection = NULL; if (GTK_OBJECT_CLASS (etcta_parent_class)->destroy) (*GTK_OBJECT_CLASS (etcta_parent_class)->destroy) (object); diff --git a/widgets/table/e-table-click-to-add.h b/widgets/table/e-table-click-to-add.h index 694b52a7aa..39371150e4 100644 --- a/widgets/table/e-table-click-to-add.h +++ b/widgets/table/e-table-click-to-add.h @@ -24,15 +24,14 @@ #ifndef _E_TABLE_CLICK_TO_ADD_H_ #define _E_TABLE_CLICK_TO_ADD_H_ -#include <gnome-xml/tree.h> -#include <libgnomeui/gnome-canvas.h> +#include <libxml/tree.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/e-table/e-table-header.h> #include <gal/e-table/e-table-sort-info.h> #include <gal/e-table/e-table-item.h> #include <gal/e-table/e-table-selection-model.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_CLICK_TO_ADD_TYPE (e_table_click_to_add_get_type ()) #define E_TABLE_CLICK_TO_ADD(o) (GTK_CHECK_CAST ((o), E_TABLE_CLICK_TO_ADD_TYPE, ETableClickToAdd)) @@ -73,6 +72,6 @@ GtkType e_table_click_to_add_get_type (void); void e_table_click_to_add_commit (ETableClickToAdd *etcta); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_CLICK_TO_ADD_H_ */ diff --git a/widgets/table/e-table-col-dnd.h b/widgets/table/e-table-col-dnd.h index ebc6f76431..d31c94ed26 100644 --- a/widgets/table/e-table-col-dnd.h +++ b/widgets/table/e-table-col-dnd.h @@ -24,9 +24,9 @@ #ifndef _E_TABLE_COL_DND_H_ #define _E_TABLE_COL_DND_H_ -#include <libgnome/gnome-defs.h> +#include <glib.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define TARGET_ETABLE_COL_TYPE "application/x-etable-column-header" @@ -34,6 +34,6 @@ enum { TARGET_ETABLE_COL_HEADER }; -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_COL_DND_H_ */ diff --git a/widgets/table/e-table-col.c b/widgets/table/e-table-col.c index fa53fb0d0c..bf538280c6 100644 --- a/widgets/table/e-table-col.c +++ b/widgets/table/e-table-col.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-col.c * Copyright 1999, 2000, 2001, Ximian, Inc. * @@ -29,7 +29,7 @@ #define PARENT_TYPE (gtk_object_get_type ()) -static GtkObjectClass *parent_class; +static GObjectClass *parent_class; enum { @@ -39,21 +39,25 @@ enum { }; static void -etc_destroy (GtkObject *object) +etc_finalize (GObject *object) { ETableCol *etc = E_TABLE_COL (object); - gtk_object_unref (GTK_OBJECT(etc->ecell)); + if (etc->ecell) + gtk_object_unref (GTK_OBJECT(etc->ecell)); + etc->ecell = NULL; if (etc->pixbuf) gdk_pixbuf_unref (etc->pixbuf); + etc->pixbuf = NULL; + if (etc->text) g_free (etc->text); + etc->text = NULL; - (*parent_class->destroy)(object); + parent_class->finalize (object); } - static void etc_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) { @@ -91,10 +95,11 @@ static void e_table_col_class_init (GtkObjectClass *object_class) { parent_class = gtk_type_class (PARENT_TYPE); - object_class->destroy = etc_destroy; object_class->get_arg = etc_get_arg; object_class->set_arg = etc_set_arg; + G_OBJECT_CLASS (object_class)->finalize = etc_finalize; + gtk_object_add_arg_type ("ETableCol::sortable", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_SORTABLE); gtk_object_add_arg_type ("ETableCol::compare_col", diff --git a/widgets/table/e-table-column-specification.c b/widgets/table/e-table-column-specification.c index bc296e0885..2ee2833e63 100644 --- a/widgets/table/e-table-column-specification.c +++ b/widgets/table/e-table-column-specification.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-column-specification.c - Savable specification of a column. * Copyright 2000, 2001, Ximian, Inc. * @@ -24,8 +24,8 @@ #include <config.h> #include <stdlib.h> #include <gtk/gtksignal.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include "gal/util/e-xml-utils.h" #include "gal/util/e-util.h" #include "e-table-column-specification.h" @@ -38,10 +38,15 @@ static void free_strings (ETableColumnSpecification *etcs) { g_free(etcs->title); + etcs->title = NULL; g_free(etcs->pixbuf); + etcs->pixbuf = NULL; g_free(etcs->cell); + etcs->cell = NULL; g_free(etcs->compare); + etcs->compare = NULL; g_free(etcs->search); + etcs->search = NULL; } static void diff --git a/widgets/table/e-table-column-specification.h b/widgets/table/e-table-column-specification.h index 67bf7afb48..2641eb82df 100644 --- a/widgets/table/e-table-column-specification.h +++ b/widgets/table/e-table-column-specification.h @@ -26,7 +26,7 @@ #include <glib.h> #include <gtk/gtkobject.h> -#include <gnome-xml/tree.h> +#include <libxml/tree.h> #ifdef __cplusplus extern "C" { diff --git a/widgets/table/e-table-column.c b/widgets/table/e-table-column.c index 2736a4381b..6d8f1c3aef 100644 --- a/widgets/table/e-table-column.c +++ b/widgets/table/e-table-column.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-column.c * Copyright 2000, 2001, Ximian, Inc. * @@ -35,7 +35,7 @@ static guint etc_signals [LAST_SIGNAL] = { 0, }; static GtkObjectClass *e_table_column_parent_class; static void -e_table_column_destroy (GtkObject *object) +e_table_column_finalize (GObject *object) { ETableColumn *etc = E_TABLE_COLUMN (object); const int cols = etc->col_count; @@ -54,14 +54,13 @@ e_table_column_destroy (GtkObject *object) for (i = 0; i < cols; i++) e_table_column_remove (etc, i); - if (e_table_column_parent_class->destroy) - e_table_column_parent_class->destroy (object); + G_OBJECT_CLASS (e_table_column_parent_class)->finalize (object); } static void e_table_column_class_init (GtkObjectClass *object_class) { - object_class->destroy = e_table_column_destroy; + G_OBJECT_CLASS (object_class)->finalize = e_table_column_finalize; e_table_column_parent_class = (gtk_type_class (gtk_object_get_type ())); diff --git a/widgets/table/e-table-config-field.c b/widgets/table/e-table-config-field.c index e0ae8f169c..5bcd5456a7 100644 --- a/widgets/table/e-table-config-field.c +++ b/widgets/table/e-table-config-field.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-config-field.c * Copyright 2000, 2001, Ximian, Inc. * @@ -23,7 +23,10 @@ #include <config.h> #include <stdlib.h> +#include <gtk/gtk.h> +#include <gtk/gtkbox.h> #include "gal/util/e-util.h" +#include "gal/util/e-i18n.h" #include "e-table-config-field.h" #define PARENT_TYPE (gtk_vbox_get_type()) @@ -35,8 +38,13 @@ etcf_destroy (GtkObject *object) { ETableConfigField *etcf = E_TABLE_CONFIG_FIELD (object); - gtk_object_unref(GTK_OBJECT(etcf->spec)); - gtk_object_unref(GTK_OBJECT(etcf->sort_info)); + if (etct->spec) + gtk_object_unref(GTK_OBJECT(etcf->spec)); + etct->spec = NULL; + + if (etct->sort_info) + gtk_object_unref(GTK_OBJECT(etcf->sort_info)); + etct->sort_info = NULL; GTK_OBJECT_CLASS (etcf_parent_class)->destroy (object); } diff --git a/widgets/table/e-table-config-field.h b/widgets/table/e-table-config-field.h index 495c29a76a..2a7a8b308b 100644 --- a/widgets/table/e-table-config-field.h +++ b/widgets/table/e-table-config-field.h @@ -27,9 +27,8 @@ #include <gtk/gtkvbox.h> #include <gal/e-table/e-table-sort-info.h> #include <gal/e-table/e-table-specification.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_CONFIG_FIELD_TYPE (e_table_config_field_get_type ()) #define E_TABLE_CONFIG_FIELD(o) (GTK_CHECK_CAST ((o), E_TABLE_CONFIG_FIELD_TYPE, ETableConfigField)) @@ -65,6 +64,6 @@ ETableConfigField *e_table_config_field_construct (ETableConfigField *field, ETableSortInfo *sort_info, gboolean grouping); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_CONFIG_FIELD_H_ */ diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c index a3e9554d3a..9d7354e38b 100644 --- a/widgets/table/e-table-config.c +++ b/widgets/table/e-table-config.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-config.c * Copyright 2000, 2001, Ximian, Inc. * @@ -67,13 +67,20 @@ enum { static guint e_table_config_signals [LAST_SIGNAL] = { 0, }; static void -config_destroy (GtkObject *object) +config_finalize (GObject *object) { ETableConfig *config = E_TABLE_CONFIG (object); gtk_object_destroy (GTK_OBJECT (config->state)); - gtk_object_unref (GTK_OBJECT (config->source_state)); - gtk_object_unref (GTK_OBJECT (config->source_spec)); + + if (config->source_state) + gtk_object_unref (GTK_OBJECT (config->source_state)); + config->source_state = NULL; + + if (config->source_spec) + gtk_object_unref (GTK_OBJECT (config->source_spec)); + config->source_spec = NULL; + g_free (config->header); config->header = NULL; @@ -82,8 +89,8 @@ config_destroy (GtkObject *object) g_free (config->domain); config->domain = NULL; - - GTK_OBJECT_CLASS (config_parent_class)->destroy (object); + + G_OBJECT_CLASS (config_parent_class)->finalize (object); } static void @@ -123,7 +130,7 @@ config_class_init (GtkObjectClass *object_class) klass->changed = NULL; object_class->get_arg = config_get_arg; - object_class->destroy = config_destroy; + G_OBJECT_CLASS (object_class)->finalize = config_finalize; e_table_config_signals [CHANGED] = gtk_signal_new ("changed", @@ -615,7 +622,7 @@ sort_entry_changed (GtkEntry *entry, ETableConfigSortWidgets *sort) ETableConfigSortWidgets *base = &config->sort[0]; int idx = sort - base; - char *s = gtk_entry_get_text (entry); + const char *s = gtk_entry_get_text (entry); if (s && s [0] && g_hash_table_lookup (sort->combo->elements, s)){ ETableSortColumn c; @@ -702,11 +709,13 @@ configure_sort_dialog (ETableConfig *config, GladeXML *gui) for (i = 0; i < 4; i++){ config->sort [i].changed_id = gtk_signal_connect ( GTK_OBJECT (config->sort [i].combo->entry), - "changed", sort_entry_changed, &config->sort [i]); + "changed", GTK_SIGNAL_FUNC (sort_entry_changed), + &config->sort [i]); config->sort [i].toggled_id = gtk_signal_connect ( GTK_OBJECT (config->sort [i].radio_ascending), - "toggled", sort_ascending_toggled, &config->sort [i]); + "toggled", GTK_SIGNAL_FUNC (sort_ascending_toggled), + &config->sort [i]); } } @@ -717,7 +726,7 @@ group_entry_changed (GtkEntry *entry, ETableConfigSortWidgets *group) ETableSortInfo *sort_info = config->temp_state->sort_info; ETableConfigSortWidgets *base = &config->group[0]; int idx = group - base; - char *s = gtk_entry_get_text (entry); + const char *s = gtk_entry_get_text (entry); if (s && s [0] && g_hash_table_lookup (group->combo->elements, s)){ ETableSortColumn c; @@ -812,11 +821,13 @@ configure_group_dialog (ETableConfig *config, GladeXML *gui) for (i = 0; i < 4; i++){ config->group [i].changed_id = gtk_signal_connect ( GTK_OBJECT (config->group [i].combo->entry), - "changed", group_entry_changed, &config->group [i]); + "changed", GTK_SIGNAL_FUNC (group_entry_changed), + &config->group [i]); config->group [i].toggled_id = gtk_signal_connect ( GTK_OBJECT (config->group [i].radio_ascending), - "toggled", group_ascending_toggled, &config->group [i]); + "toggled", GTK_SIGNAL_FUNC (group_ascending_toggled), + &config->group [i]); } } @@ -990,10 +1001,10 @@ configure_fields_dialog (ETableConfig *config, GladeXML *gui) "model", &config->shown_model, NULL); - connect_button (config, gui, "button-add", config_button_add); - connect_button (config, gui, "button-remove", config_button_remove); - connect_button (config, gui, "button-up", config_button_up); - connect_button (config, gui, "button-down", config_button_down); + connect_button (config, gui, "button-add", GTK_SIGNAL_FUNC (config_button_add)); + connect_button (config, gui, "button-remove", GTK_SIGNAL_FUNC (config_button_remove)); + connect_button (config, gui, "button-up", GTK_SIGNAL_FUNC (config_button_up)); + connect_button (config, gui, "button-down", GTK_SIGNAL_FUNC (config_button_down)); setup_fields (config); } @@ -1006,9 +1017,9 @@ setup_gui (ETableConfig *config) create_global_store (config); if (e_table_sort_info_get_can_group (config->state->sort_info)) { - gui = glade_xml_new_with_domain (ETABLE_GLADEDIR "/e-table-config.glade", NULL, E_I18N_DOMAIN); + gui = glade_xml_new (ETABLE_GLADEDIR "/e-table-config.glade", NULL, E_I18N_DOMAIN); } else { - gui = glade_xml_new_with_domain (ETABLE_GLADEDIR "/e-table-config-no-group.glade", NULL, E_I18N_DOMAIN); + gui = glade_xml_new (ETABLE_GLADEDIR "/e-table-config-no-group.glade", NULL, E_I18N_DOMAIN); } gtk_object_unref (GTK_OBJECT (global_store)); @@ -1040,9 +1051,9 @@ setup_gui (ETableConfig *config) config->fields_label = glade_xml_get_widget ( gui, "label-fields"); - connect_button (config, gui, "button-sort", config_button_sort); - connect_button (config, gui, "button-group", config_button_group); - connect_button (config, gui, "button-fields", config_button_fields); + connect_button (config, gui, "button-sort", GTK_SIGNAL_FUNC (config_button_sort)); + connect_button (config, gui, "button-group", GTK_SIGNAL_FUNC (config_button_group)); + connect_button (config, gui, "button-fields", GTK_SIGNAL_FUNC (config_button_fields)); configure_sort_dialog (config, gui); configure_group_dialog (config, gui); diff --git a/widgets/table/e-table-config.h b/widgets/table/e-table-config.h index d5640f73cd..9c52895d94 100644 --- a/widgets/table/e-table-config.h +++ b/widgets/table/e-table-config.h @@ -25,7 +25,6 @@ #ifndef _E_TABLE_CONFIG_H_ #define _E_TABLE_CONFIG_H_ -#include <libgnome/gnome-defs.h> #include <gal/e-table/e-table-sort-info.h> #include <gal/e-table/e-table-specification.h> #include <gal/widgets/gtk-combo-text.h> @@ -33,7 +32,7 @@ #include <gal/e-table/e-table-subset-variable.h> #include <gal/e-table/e-table.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_CONFIG_TYPE (e_table_config_get_type ()) #define E_TABLE_CONFIG(o) (GTK_CHECK_CAST ((o), E_TABLE_CONFIG_TYPE, ETableConfig)) @@ -107,6 +106,6 @@ ETableConfig *e_table_config_construct (ETableConfig *etco, ETableState *state); void e_table_config_raise (ETableConfig *config); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_CONFIG_H */ diff --git a/widgets/table/e-table-example-2.c b/widgets/table/e-table-example-2.c index 257867ebed..2321e4e7dd 100644 --- a/widgets/table/e-table-example-2.c +++ b/widgets/table/e-table-example-2.c @@ -338,7 +338,6 @@ main (int argc, char *argv []) gnome_init ("TableExample", "TableExample", argc, argv); e_cursors_init (); - gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); create_table (); diff --git a/widgets/table/e-table-extras.c b/widgets/table/e-table-extras.c index 9c5b5fb935..b3c0efa27c 100644 --- a/widgets/table/e-table-extras.c +++ b/widgets/table/e-table-extras.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-extras.c - Set of hash table sort of thingies. * Copyright 2000, 2001, Ximian, Inc. * @@ -64,15 +64,25 @@ ete_destroy (GtkObject *object) { ETableExtras *ete = E_TABLE_EXTRAS (object); - g_hash_table_foreach (ete->cells, (GHFunc) cell_hash_free, NULL); - g_hash_table_foreach (ete->compares, (GHFunc) g_free, NULL); - g_hash_table_foreach (ete->searches, (GHFunc) g_free, NULL); - g_hash_table_foreach (ete->pixbufs, (GHFunc) pixbuf_hash_free, NULL); + if (ete->cells) { + g_hash_table_foreach (ete->cells, (GHFunc) cell_hash_free, NULL); + g_hash_table_destroy (ete->cells); + } + + if (ete->compares) { + g_hash_table_foreach (ete->compares, (GHFunc) g_free, NULL); + g_hash_table_destroy (ete->compares); + } + + if (ete->searches) { + g_hash_table_foreach (ete->searches, (GHFunc) g_free, NULL); + g_hash_table_destroy (ete->searches); + } - g_hash_table_destroy (ete->cells); - g_hash_table_destroy (ete->compares); - g_hash_table_destroy (ete->searches); - g_hash_table_destroy (ete->pixbufs); + if (ete->pixbufs) { + g_hash_table_foreach (ete->pixbufs, (GHFunc) pixbuf_hash_free, NULL); + g_hash_table_destroy (ete->pixbufs); + } ete->cells = NULL; ete->compares = NULL; @@ -99,6 +109,40 @@ e_strint_compare(gconstpointer data1, gconstpointer data2) return g_int_compare(GINT_TO_POINTER(int1), GINT_TO_POINTER(int2)); } +/* UTF-8 strncasecmp - not optimized */ + +static gint +g_utf8_strncasecmp (const gchar *s1, + const gchar *s2, + guint n) +{ + gunichar c1, c2; + + g_return_val_if_fail (s1 != NULL && g_utf8_validate (s1, -1, NULL), 0); + g_return_val_if_fail (s2 != NULL && g_utf8_validate (s2, -1, NULL), 0); + + while (n && *s1 && *s2) + { + + n -= 1; + + c1 = g_unichar_tolower (g_utf8_get_char (s1)); + c2 = g_unichar_tolower (g_utf8_get_char (s2)); + + /* Collation is locale-dependent, so this totally fails to do the right thing. */ + if (c1 != c2) + return c1 < c2 ? -1 : 1; + + s1 = g_utf8_next_char (s1); + s2 = g_utf8_next_char (s2); + } + + if (n == 0 || (*s1 == '\0' && *s2 == '\0')) + return 0; + + return *s1 ? 1 : -1; +} + static gboolean e_string_search(gconstpointer haystack, const char *needle) { diff --git a/widgets/table/e-table-extras.h b/widgets/table/e-table-extras.h index a077319aec..01da79a53d 100644 --- a/widgets/table/e-table-extras.h +++ b/widgets/table/e-table-extras.h @@ -27,9 +27,8 @@ #include <gtk/gtkobject.h> #include <gal/e-table/e-cell.h> #include <gdk-pixbuf/gdk-pixbuf.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_EXTRAS_TYPE (e_table_extras_get_type ()) #define E_TABLE_EXTRAS(o) (GTK_CHECK_CAST ((o), E_TABLE_EXTRAS_TYPE, ETableExtras)) @@ -77,6 +76,6 @@ void e_table_extras_add_pixbuf (ETableExtras *extras, GdkPixbuf *e_table_extras_get_pixbuf (ETableExtras *extras, char *id); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_EXTRAS_H_ */ diff --git a/widgets/table/e-table-field-chooser-dialog.c b/widgets/table/e-table-field-chooser-dialog.c index fa9def8a6f..906dadc52a 100644 --- a/widgets/table/e-table-field-chooser-dialog.c +++ b/widgets/table/e-table-field-chooser-dialog.c @@ -23,7 +23,6 @@ #include <config.h> #include "e-table-field-chooser-dialog.h" -#include <libgnomeui/gnome-stock.h> #include "gal/util/e-i18n.h" static void e_table_field_chooser_dialog_init (ETableFieldChooserDialog *card); @@ -105,7 +104,7 @@ e_table_field_chooser_dialog_init (ETableFieldChooserDialog *e_table_field_choos e_table_field_chooser_dialog->header = NULL; gnome_dialog_append_buttons(GNOME_DIALOG(e_table_field_chooser_dialog), - GNOME_STOCK_BUTTON_CLOSE, + GTK_STOCK_CLOSE, NULL); gtk_window_set_policy(GTK_WINDOW(e_table_field_chooser_dialog), FALSE, TRUE, FALSE); @@ -138,11 +137,17 @@ static void e_table_field_chooser_dialog_destroy (GtkObject *object) { ETableFieldChooserDialog *etfcd = E_TABLE_FIELD_CHOOSER_DIALOG (object); - g_free(etfcd->dnd_code); + + g_free (etfcd->dnd_code); + etfcd->dnd_code = NULL; + if (etfcd->full_header) gtk_object_unref(GTK_OBJECT(etfcd->full_header)); + etfcd->full_header = NULL; + if (etfcd->header) gtk_object_unref(GTK_OBJECT(etfcd->header)); + etfcd->header = NULL; } static void diff --git a/widgets/table/e-table-field-chooser-item.c b/widgets/table/e-table-field-chooser-item.c index d09dfd6e11..b4555685cb 100644 --- a/widgets/table/e-table-field-chooser-item.c +++ b/widgets/table/e-table-field-chooser-item.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-field-chooser-item.c * Copyright 2000, 2001, Ximian, Inc. * @@ -25,10 +25,10 @@ #include <string.h> #include <gtk/gtksignal.h> #include <gtk/gtkdnd.h> -#include <libgnomeui/gnome-canvas.h> -#include <libgnomeui/gnome-canvas-util.h> -#include <libgnomeui/gnome-canvas-polygon.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <libgnomecanvas/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas-util.h> +#include <libgnomecanvas/gnome-canvas-polygon.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include "gal/util/e-util.h" @@ -72,15 +72,20 @@ enum { }; static void -etfci_destroy (GtkObject *object){ +etfci_destroy (GtkObject *object) +{ ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (object); etfci_drop_table_header (etfci); etfci_drop_full_header (etfci); - if (etfci->combined_header != NULL) + + if (etfci->combined_header) gtk_object_unref (GTK_OBJECT (etfci->combined_header)); - - gdk_font_unref(etfci->font); + etfci->combined_header = NULL; + + if (etfci->font) + gdk_font_unref(etfci->font); + etfci->font = NULL; if (GTK_OBJECT_CLASS (etfci_parent_class)->destroy) (*GTK_OBJECT_CLASS (etfci_parent_class)->destroy) (object); @@ -206,8 +211,12 @@ etfci_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flag item->y1 = c1.y; item->x2 = c2.x; item->y2 = c2.y; - +#ifndef NO_WARNINGS +#warning Group Child bounds !? +#endif +#if 0 gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item); +#endif } gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); } @@ -217,8 +226,8 @@ etfci_font_load (ETableFieldChooserItem *etfci) { if (etfci->font) gdk_font_unref (etfci->font); - - etfci->font = GTK_WIDGET(GNOME_CANVAS_ITEM(etfci)->canvas)->style->font; + + etfci->font = gtk_style_get_font (GTK_WIDGET(GNOME_CANVAS_ITEM(etfci)->canvas)->style); gdk_font_ref(etfci->font); } diff --git a/widgets/table/e-table-field-chooser-item.h b/widgets/table/e-table-field-chooser-item.h index 77a15b8811..8db4587955 100644 --- a/widgets/table/e-table-field-chooser-item.h +++ b/widgets/table/e-table-field-chooser-item.h @@ -24,12 +24,11 @@ #ifndef _E_TABLE_FIELD_CHOOSER_ITEM_H_ #define _E_TABLE_FIELD_CHOOSER_ITEM_H_ -#include <libgnomeui/gnome-canvas.h> -#include <gnome-xml/tree.h> +#include <libgnomecanvas/gnome-canvas.h> +#include <libxml/tree.h> #include <gal/e-table/e-table-header.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_FIELD_CHOOSER_ITEM_TYPE (e_table_field_chooser_item_get_type ()) #define E_TABLE_FIELD_CHOOSER_ITEM(o) (GTK_CHECK_CAST ((o), E_TABLE_FIELD_CHOOSER_ITEM_TYPE, ETableFieldChooserItem)) @@ -71,6 +70,6 @@ typedef struct { GtkType e_table_field_chooser_item_get_type (void); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_FIELD_CHOOSER_ITEM_H_ */ diff --git a/widgets/table/e-table-field-chooser.c b/widgets/table/e-table-field-chooser.c index 85d65817b0..5a74ae788c 100644 --- a/widgets/table/e-table-field-chooser.c +++ b/widgets/table/e-table-field-chooser.c @@ -22,7 +22,10 @@ */ #include <config.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <gtk/gtksignal.h> +#include <gtk/gtk.h> +#include <gtk/gtkbox.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include "e-table-field-chooser.h" #include "e-table-field-chooser-item.h" @@ -131,7 +134,7 @@ e_table_field_chooser_init (ETableFieldChooser *etfc) GladeXML *gui; GtkWidget *widget; - gui = glade_xml_new_with_domain (ETABLE_GLADEDIR "/e-table-field-chooser.glade", NULL, PACKAGE); + gui = glade_xml_new (ETABLE_GLADEDIR "/e-table-field-chooser.glade", NULL, PACKAGE); etfc->gui = gui; widget = glade_xml_get_widget(gui, "vbox-top"); @@ -141,7 +144,6 @@ e_table_field_chooser_init (ETableFieldChooser *etfc) gtk_widget_reparent(widget, GTK_WIDGET(etfc)); - gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); etfc->canvas = GNOME_CANVAS(glade_xml_get_widget(gui, "canvas-buttons")); @@ -176,7 +178,6 @@ e_table_field_chooser_init (ETableFieldChooser *etfc) GTK_SIGNAL_FUNC (allocate_callback), etfc); - gtk_widget_pop_visual (); gtk_widget_pop_colormap (); gtk_widget_show(widget); } @@ -186,14 +187,20 @@ e_table_field_chooser_destroy (GtkObject *object) { ETableFieldChooser *etfc = E_TABLE_FIELD_CHOOSER(object); - g_free(etfc->dnd_code); + g_free (etfc->dnd_code); + etfc->dnd_code = NULL; + if (etfc->full_header) gtk_object_unref(GTK_OBJECT(etfc->full_header)); + etfc->full_header = NULL; + if (etfc->header) gtk_object_unref(GTK_OBJECT(etfc->header)); + etfc->header = NULL; if (etfc->gui) gtk_object_unref(GTK_OBJECT(etfc->gui)); + etfc->gui = NULL; if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); diff --git a/widgets/table/e-table-field-chooser.h b/widgets/table/e-table-field-chooser.h index c5e5ae34e4..d422e74f9b 100644 --- a/widgets/table/e-table-field-chooser.h +++ b/widgets/table/e-table-field-chooser.h @@ -25,12 +25,10 @@ #define __E_TABLE_FIELD_CHOOSER_H__ #include <glade/glade.h> +#include <gtk/gtkvbox.h> #include <gal/e-table/e-table-header.h> -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ +G_BEGIN_DECLS /* ETableFieldChooser - A dialog displaying information about a contact. * @@ -76,9 +74,6 @@ struct _ETableFieldChooserClass GtkWidget *e_table_field_chooser_new(void); GtkType e_table_field_chooser_get_type (void); -#ifdef __cplusplus -} -#endif /* __cplusplus */ - +G_END_DECLS #endif /* __E_TABLE_FIELD_CHOOSER_H__ */ diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index c7185d9007..87e5e40a14 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-group-container.c * Copyright 2000, 2001, Ximian, Inc. * @@ -25,12 +25,11 @@ #include <gdk/gdkkeysyms.h> #include <gtk/gtksignal.h> #include <libgnome/libgnome.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include "e-table-group-container.h" #include "e-table-group-leaf.h" #include "e-table-item.h" #include "gal/util/e-util.h" -#include "gal/util/e-unicode-i18n.h" #include "gal/widgets/e-canvas.h" #include "gal/widgets/e-canvas-utils.h" #include "gal/widgets/e-unicode.h" @@ -100,6 +99,7 @@ e_table_group_container_list_free (ETableGroupContainer *etgc) } g_list_free (etgc->children); + etgc->children = NULL; } static void @@ -109,19 +109,23 @@ etgc_destroy (GtkObject *object) if (etgc->font) gdk_font_unref (etgc->font); - etgc->font = NULL; + etgc->font = NULL; if (etgc->ecol) gtk_object_unref (GTK_OBJECT(etgc->ecol)); + etgc->ecol = NULL; if (etgc->sort_info) gtk_object_unref (GTK_OBJECT(etgc->sort_info)); + etgc->sort_info = NULL; if (etgc->selection_model) gtk_object_unref (GTK_OBJECT(etgc->selection_model)); + etgc->selection_model = NULL; if (etgc->rect) gtk_object_destroy (GTK_OBJECT(etgc->rect)); + etgc->rect = NULL; e_table_group_container_list_free (etgc); @@ -161,8 +165,8 @@ e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContaine etgc->n = n; etgc->ascending = column.ascending; - etgc->font = GTK_WIDGET (GNOME_CANVAS_ITEM (etgc)->canvas)->style->font; - + etgc->font = gtk_style_get_font (GTK_WIDGET (GNOME_CANVAS_ITEM (etgc)->canvas)->style); + gdk_font_ref (etgc->font); etgc->open = TRUE; @@ -347,14 +351,14 @@ compute_text (ETableGroupContainer *etgc, ETableGroupContainerChildNode *child_n if (etgc->ecol->text) { text = g_strdup_printf ((child_node->count == 1) - ? U_("%s : %s (%d item)") - : U_("%s : %s (%d items)"), + ? _("%s : %s (%d item)") + : _("%s : %s (%d items)"), etgc->ecol->text, child_node->string, (gint) child_node->count); } else { text = g_strdup_printf ((child_node->count == 1) - ? U_("%s (%d item)") - : U_("%s (%d items)"), + ? _("%s (%d item)") + : _("%s (%d items)"), child_node->string, (gint) child_node->count); } @@ -1046,7 +1050,7 @@ e_table_group_apply_to_leafs (ETableGroup *etg, ETableGroupLeafFn fn, void *clos (*fn) (E_TABLE_GROUP_LEAF (etg)->item, closure); } else { g_error ("Unknown ETableGroup found: %s", - gtk_type_name (GTK_OBJECT (etg)->klass->type)); + g_type_name (G_TYPE_FROM_INSTANCE (etg))); } } @@ -1102,8 +1106,7 @@ e_table_group_container_print_page (EPrintable *ep, GList *child; EPrintable *child_printable; gchar *string; - - GnomeFont *font = gnome_font_new ("Helvetica", TEXT_HEIGHT); + GnomeFont *font = gnome_font_find ("Helvetica", TEXT_HEIGHT); child_printable = groupcontext->child_printable; child = groupcontext->child; @@ -1399,7 +1402,7 @@ e_table_group_container_will_fit (EPrintable *ep, static void e_table_group_container_printable_destroy (GtkObject *object, - ETGCPrintContext *groupcontext) + ETGCPrintContext *groupcontext) { gtk_object_unref(GTK_OBJECT(groupcontext->etgc)); if (groupcontext->child_printable) diff --git a/widgets/table/e-table-group-container.h b/widgets/table/e-table-group-container.h index 7bb9a706da..fd5c2c348d 100644 --- a/widgets/table/e-table-group-container.h +++ b/widgets/table/e-table-group-container.h @@ -24,14 +24,13 @@ #ifndef _E_TABLE_GROUP_CONTAINER_H_ #define _E_TABLE_GROUP_CONTAINER_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/e-table/e-table-model.h> #include <gal/e-table/e-table-header.h> #include <gal/e-table/e-table-group.h> #include <gal/e-table/e-table-item.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_GROUP_CONTAINER_TYPE (e_table_group_container_get_type ()) #define E_TABLE_GROUP_CONTAINER(o) (GTK_CHECK_CAST ((o), E_TABLE_GROUP_CONTAINER_TYPE, ETableGroupContainer)) @@ -94,6 +93,6 @@ void e_table_group_container_construct (GnomeCanvasGroup *parent, ETable GtkType e_table_group_container_get_type (void); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_GROUP_CONTAINER_H_ */ diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c index f9e34a8920..32f3a82913 100644 --- a/widgets/table/e-table-group-leaf.c +++ b/widgets/table/e-table-group-leaf.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-group-leaf.c * Copyright 2000, 2001, Ximian, Inc. * @@ -23,7 +23,7 @@ #include <config.h> #include <gtk/gtksignal.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include "e-table-group-leaf.h" #include "e-table-item.h" #include "e-table-sorted-variable.h" @@ -128,6 +128,8 @@ e_table_group_leaf_construct (GnomeCanvasGroup *parent, full_header, sort_info)); + gtk_object_ref (GTK_OBJECT (etgl->ets)); + gtk_object_sink (GTK_OBJECT (etgl->ets)); e_table_group_construct (parent, E_TABLE_GROUP (etgl), full_header, header, model); } @@ -449,8 +451,9 @@ etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) if (etgl->selection_model) gtk_object_unref(GTK_OBJECT(etgl->selection_model)); etgl->selection_model = E_SELECTION_MODEL(GTK_VALUE_OBJECT (*arg)); - if (etgl->selection_model) + if (etgl->selection_model) { gtk_object_ref(GTK_OBJECT(etgl->selection_model)); + } if (etgl->item) { gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item), "selection_model", etgl->selection_model, diff --git a/widgets/table/e-table-group-leaf.h b/widgets/table/e-table-group-leaf.h index afb0e51cf6..a6a5e54a53 100644 --- a/widgets/table/e-table-group-leaf.h +++ b/widgets/table/e-table-group-leaf.h @@ -24,13 +24,12 @@ #ifndef _E_TABLE_GROUP_LEAF_H_ #define _E_TABLE_GROUP_LEAF_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/e-table/e-table-group.h> #include <gal/e-table/e-table-subset.h> #include <gal/e-table/e-table-item.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_GROUP_LEAF_TYPE (e_table_group_leaf_get_type ()) #define E_TABLE_GROUP_LEAF(o) (GTK_CHECK_CAST ((o), E_TABLE_GROUP_LEAF_TYPE, ETableGroupLeaf)) @@ -85,7 +84,7 @@ ETableGroup *e_table_group_leaf_new (GnomeCanvasGroup *parent, GtkType e_table_group_leaf_get_type (void); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_GROUP_LEAF_H_ */ diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c index 6973d7c387..6123eb9862 100644 --- a/widgets/table/e-table-group.c +++ b/widgets/table/e-table-group.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-group.c * Copyright 2000, 2001, Ximian, Inc. * @@ -23,7 +23,7 @@ #include <config.h> #include <gtk/gtksignal.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include "e-table-group.h" #include "e-table-group-container.h" #include "e-table-group-leaf.h" @@ -32,7 +32,7 @@ #define PARENT_TYPE gnome_canvas_group_get_type () -#define ETG_CLASS(e) (E_TABLE_GROUP_CLASS(GTK_OBJECT(e)->klass)) +#define ETG_CLASS(e) (E_TABLE_GROUP_CLASS(GTK_OBJECT_GET_CLASS(e))) static GnomeCanvasGroupClass *etg_parent_class; @@ -135,7 +135,7 @@ e_table_group_construct (GnomeCanvasGroup *parent, gtk_object_ref (GTK_OBJECT(etg->header)); etg->model = model; gtk_object_ref (GTK_OBJECT(etg->model)); - gnome_canvas_item_constructv (GNOME_CANVAS_ITEM (etg), parent, 0, NULL); + gnome_canvas_item_construct (GNOME_CANVAS_ITEM (etg), parent, 0, NULL); } /** @@ -661,40 +661,44 @@ etg_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableGroupClass, double_click), - gtk_marshal_NONE__INT_INT_POINTER, - GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_NONE__INT_INT_BOXED, + GTK_TYPE_NONE, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); etg_signals [RIGHT_CLICK] = gtk_signal_new ("right_click", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableGroupClass, right_click), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GDK_TYPE_EVENT); etg_signals [CLICK] = gtk_signal_new ("click", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableGroupClass, click), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); etg_signals [KEY_PRESS] = gtk_signal_new ("key_press", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableGroupClass, key_press), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); etg_signals [START_DRAG] = gtk_signal_new ("start_drag", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableGroupClass, start_drag), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); E_OBJECT_CLASS_ADD_SIGNALS (object_class, etg_signals, LAST_SIGNAL); } diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h index 6cad768d57..8457e4e4f7 100644 --- a/widgets/table/e-table-group.h +++ b/widgets/table/e-table-group.h @@ -24,16 +24,15 @@ #ifndef _E_TABLE_GROUP_H_ #define _E_TABLE_GROUP_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/e-table/e-table-model.h> #include <gal/e-table/e-table-header.h> #include <gal/e-table/e-table-sort-info.h> #include <gal/e-table/e-table-defines.h> #include <gal/util/e-util.h> #include <gal/widgets/e-printable.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_GROUP_TYPE (e_table_group_get_type ()) #define E_TABLE_GROUP(o) (GTK_CHECK_CAST ((o), E_TABLE_GROUP_TYPE, ETableGroup)) @@ -174,6 +173,6 @@ void e_table_group_apply_to_leafs (ETableGroup *etg, ETableGroupLeafFn fn, void *closure); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_GROUP_H_ */ diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index 142e63b809..01718c2bf6 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-header-item.c * Copyright 1999, 2000, 2001, Ximian, Inc. * @@ -29,15 +29,17 @@ #include <string.h> #include <gtk/gtksignal.h> #include <gtk/gtkdnd.h> -#include <libgnomeui/gnome-canvas.h> -#include <libgnomeui/gnome-canvas-util.h> -#include <libgnomeui/gnome-canvas-polygon.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <gtk/gtkimage.h> +#include <libgnomecanvas/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas-util.h> +#include <libgnomecanvas/gnome-canvas-polygon.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include "gal/widgets/e-cursors.h" #include "gal/util/e-i18n.h" #include "gal/util/e-util.h" #include "gal/util/e-xml-utils.h" +#include "gal/util/e-marshal.h" #include "gal/widgets/e-canvas.h" #include "gal/widgets/e-popup-menu.h" #include "gal/widgets/e-gui-utils.h" @@ -136,9 +138,11 @@ ethi_destroy (GtkObject *object){ if (ethi->full_header) gtk_object_unref (GTK_OBJECT(ethi->full_header)); + ethi->full_header = NULL; if (ethi->config) gtk_object_destroy (GTK_OBJECT (ethi->config)); + ethi->config = NULL; if (GTK_OBJECT_CLASS (ethi_parent_class)->destroy) (*GTK_OBJECT_CLASS (ethi_parent_class)->destroy) (object); @@ -211,8 +215,12 @@ ethi_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags item->y1 = c1.y; item->x2 = c2.x; item->y2 = c2.y; - +#ifndef NO_WARNINGS +#warning FOO BAA +#endif +#if 0 gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item); +#endif } gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); } @@ -239,7 +247,7 @@ ethi_font_load (ETableHeaderItem *ethi, char *fontname) font = gdk_fontset_load (fontname); if (font == NULL) { - font = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas)->style->font; + font = gtk_style_get_font (GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas)->style); gdk_font_ref (font); } @@ -471,14 +479,13 @@ make_shaped_window_from_xpm (const char **xpm) gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap, &bitmap, 128); gdk_pixbuf_unref (pixbuf); - gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); win = gtk_window_new (GTK_WINDOW_POPUP); - pix = gtk_pixmap_new (pixmap, bitmap); + + pix = gtk_image_new_from_pixmap (pixmap, bitmap); gtk_widget_realize (win); gtk_container_add (GTK_CONTAINER (win), pix); gtk_widget_shape_combine_mask (win, bitmap, 0, 0); - gtk_widget_pop_visual (); gtk_widget_pop_colormap (); gdk_pixmap_unref (pixmap); @@ -594,6 +601,7 @@ do_drag_motion(ETableHeaderItem *ethi, { d(g_print("In do_drag_motion\n")); d(g_print("x = %d, y = %d, ethi->width = %d, ethi->height = %d\n", x, y, ethi->width, ethi->height)); + if ((x >= 0) && (x <= (ethi->width)) && (y >= 0) && (y <= (ethi->height))){ int col; @@ -681,13 +689,13 @@ static void context_destroyed (gpointer data) { ETableHeaderItem *ethi = data; - if (!GTK_OBJECT_DESTROYED (ethi)) { - ethi->last_drop_x = 0; - ethi->last_drop_y = 0; - ethi->last_drop_time = 0; - ethi->last_drop_context = NULL; - scroll_off (ethi); - } + + ethi->last_drop_x = 0; + ethi->last_drop_y = 0; + ethi->last_drop_time = 0; + ethi->last_drop_context = NULL; + scroll_off (ethi); + gtk_object_unref (GTK_OBJECT (ethi)); } @@ -723,10 +731,8 @@ ethi_drag_motion (GtkWidget *widget, GdkDragContext *context, d(g_print ("y = %d, widget->allocation.y = %d, GTK_LAYOUT (widget)->vadjustment->value = %f\n", y, widget->allocation.y, GTK_LAYOUT (widget)->vadjustment->value)); -#if 0 x -= widget->allocation.x; y -= widget->allocation.y; -#endif if (x < 20) direction |= ET_SCROLL_LEFT; @@ -891,7 +897,7 @@ ethi_realize (GnomeCanvasItem *item) window = GTK_WIDGET (item->canvas)->window; if (!ethi->font) - ethi_font_set (ethi, GTK_WIDGET (item->canvas)->style->font); + ethi_font_set (ethi, gtk_style_get_font (GTK_WIDGET (item->canvas)->style)); /* * Now, configure DnD @@ -1753,8 +1759,8 @@ ethi_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableHeaderItemClass, button_pressed), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, GTK_TYPE_GDK_EVENT); + e_marshal_NONE__BOXED, + GTK_TYPE_NONE, 1, GDK_TYPE_EVENT); E_OBJECT_CLASS_ADD_SIGNALS (object_class, ethi_signals, LAST_SIGNAL); } diff --git a/widgets/table/e-table-header-item.h b/widgets/table/e-table-header-item.h index 7371a20540..594ede0e7a 100644 --- a/widgets/table/e-table-header-item.h +++ b/widgets/table/e-table-header-item.h @@ -27,13 +27,12 @@ #include <gal/e-table/e-table.h> #include <gal/e-table/e-tree.h> -#include <libgnomeui/gnome-canvas.h> -#include <gnome-xml/tree.h> +#include <libgnomecanvas/gnome-canvas.h> +#include <libxml/tree.h> #include <gal/e-table/e-table-header.h> #include <gal/e-table/e-table-sort-info.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_HEADER_ITEM_TYPE (e_table_header_item_get_type ()) #define E_TABLE_HEADER_ITEM(o) (GTK_CHECK_CAST ((o), E_TABLE_HEADER_ITEM_TYPE, ETableHeaderItem)) @@ -110,6 +109,6 @@ typedef struct { GtkType e_table_header_item_get_type (void); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_HEADER_ITEM_H_ */ diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c index 9668250961..60cc9f9e32 100644 --- a/widgets/table/e-table-header-utils.c +++ b/widgets/table/e-table-header-utils.c @@ -5,8 +5,8 @@ * * Authors: * Chris Lahey <clahey@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Federico Mena-Quintero <federico@ximian.com> + * Miguel de Icaza <miguel@ximian.com> + * Federico Mena-Quintero <federico@ximian.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -31,6 +31,8 @@ #include <string.h> /* strlen() */ #include <glib.h> +#include <gtk/gtkbutton.h> +#include <gtk/gtkwindow.h> #include "e-table-defines.h" #include <gal/widgets/e-unicode.h> @@ -56,7 +58,7 @@ e_table_header_compute_height (ETableCol *ecol, GtkStyle *style, GdkFont *font) g_return_val_if_fail (E_IS_TABLE_COL (ecol), -1); g_return_val_if_fail (style != NULL, -1); - ythick = style->klass->ythickness; + ythick = style->ythickness; if (font) height = font->ascent + font->descent; @@ -80,7 +82,7 @@ e_table_header_width_extras (GtkStyle *style) { g_return_val_if_fail (style != NULL, -1); - return 2 * (style->klass->xthickness + HEADER_PADDING); + return 2 * (style->xthickness + HEADER_PADDING); } /* Creates a pixmap that is a composite of a background color and the upper-left @@ -250,8 +252,8 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol, gc = g_label->style->fg_gc[GTK_STATE_NORMAL]; - xthick = style->klass->xthickness; - ythick = style->klass->ythickness; + xthick = style->xthickness; + ythick = style->ythickness; /* Button bevel */ diff --git a/widgets/table/e-table-header-utils.h b/widgets/table/e-table-header-utils.h index 4d14652f48..50166010e5 100644 --- a/widgets/table/e-table-header-utils.h +++ b/widgets/table/e-table-header-utils.h @@ -5,8 +5,8 @@ * * Authors: * Chris Lahey <clahey@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Federico Mena-Quintero <federico@ximian.com> + * Miguel de Icaza <miguel@ximian.com> + * Federico Mena-Quintero <federico@ximian.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c index 70d9b5583e..e57a8f38a0 100644 --- a/widgets/table/e-table-header.c +++ b/widgets/table/e-table-header.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-header.c * Copyright 1999, 2000, 2001, Ximian, Inc. * @@ -26,6 +26,8 @@ #include <string.h> #include <gtk/gtkobject.h> #include <gtk/gtksignal.h> +#include <gtk/gtkimage.h> +#include <gal/util/e-util.h> #include "e-table-header.h" #include "e-table-defines.h" #include "gal/util/e-util.h" @@ -153,12 +155,18 @@ eth_destroy (GtkObject *object) gtk_signal_disconnect(GTK_OBJECT(eth->sort_info), eth->sort_info_group_change_id); gtk_object_unref(GTK_OBJECT(eth->sort_info)); + eth->sort_info = NULL; } if (eth->idle) g_source_remove(eth->idle); - g_slist_foreach(eth->change_queue, (GFunc) g_free, NULL); - g_slist_free(eth->change_queue); + eth->idle = 0; + + if (eth->change_queue) { + g_slist_foreach(eth->change_queue, (GFunc) g_free, NULL); + g_slist_free(eth->change_queue); + eth->change_queue = NULL; + } /* * Destroy columns @@ -168,6 +176,9 @@ eth_destroy (GtkObject *object) } g_free (eth->columns); + eth->col_count = 0; + eth->columns = NULL; + if (e_table_header_parent_class->destroy) e_table_header_parent_class->destroy (object); } @@ -277,7 +288,7 @@ e_table_header_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableHeaderClass, request_width), - gtk_marshal_INT__INT, + e_marshal_INT__INT, GTK_TYPE_INT, 1, GTK_TYPE_INT); E_OBJECT_CLASS_ADD_SIGNALS (object_class, eth_signals, LAST_SIGNAL); diff --git a/widgets/table/e-table-header.h b/widgets/table/e-table-header.h index c20fd0be6e..c2ce0b2d71 100644 --- a/widgets/table/e-table-header.h +++ b/widgets/table/e-table-header.h @@ -29,9 +29,8 @@ #include <gdk/gdk.h> #include <gal/e-table/e-table-sort-info.h> #include <gal/e-table/e-table-col.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS typedef struct _ETableHeader ETableHeader; @@ -115,7 +114,7 @@ ETableCol *e_table_header_prioritized_column_selected (ETableHeader *e gpointer user_data); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_HEADER_H_ */ diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index cc4c52ad4b..e85eeb7106 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-item.c * Copyright 1999, 2000, 2001, Ximian, Inc. * @@ -35,6 +35,7 @@ #include <math.h> #include <stdio.h> #include <gtk/gtksignal.h> +#include <gtk/gtkmain.h> #include <gdk/gdkkeysyms.h> #include "e-table-subset.h" #include "e-cell.h" @@ -42,6 +43,7 @@ #include "gal/widgets/e-canvas.h" #include "gal/widgets/e-canvas-utils.h" #include "gal/util/e-util.h" +#include "gal/util/e-i18n.h" #include <string.h> #include <stdlib.h> @@ -50,7 +52,6 @@ #define FOCUSED_BORDER 2 #define d(x) -#define DO_TOOLTIPS #if d(!)0 #define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x)), g_print ("%s: e_table_item_leave_edit\n", __FUNCTION__)) @@ -941,6 +942,13 @@ eti_check_cursor_bounds (ETableItem *eti) return; } + if (!((GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED) && eti->cell_views_realized)) + return; + + if (eti->frozen_count > 0) { + return; + } + gtk_object_get(GTK_OBJECT(eti->selection), "cursor_row", &cursor_row, NULL); @@ -985,10 +993,12 @@ static gboolean eti_idle_show_cursor_cb (gpointer data) { ETableItem *eti = data; - if (!GTK_OBJECT_DESTROYED (eti)) { + + if (eti->selection) { eti_show_cursor (eti, 0); eti_check_cursor_bounds (eti); } + gtk_object_unref (GTK_OBJECT (eti)); return FALSE; } @@ -1270,6 +1280,7 @@ eti_add_table_model (ETableItem *eti, ETableModel *table_model) } eti_freeze (eti); + eti_table_model_changed (table_model, eti); } @@ -1388,25 +1399,29 @@ eti_destroy (GtkObject *object) g_source_remove(eti->height_cache_idle_id); eti->height_cache_idle_id = 0; } + eti->height_cache_idle_count = 0; if (eti->height_cache) g_free (eti->height_cache); eti->height_cache = NULL; - eti->height_cache_idle_count = 0; e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(eti)->canvas)); if (eti->tooltip) { if (eti->tooltip->background) gdk_color_free (eti->tooltip->background); + eti->tooltip->background = NULL; + if (eti->tooltip->foreground) gdk_color_free (eti->tooltip->foreground); + eti->tooltip->foreground = NULL; + if (eti->tooltip->timer) { gtk_timeout_remove (eti->tooltip->timer); eti->tooltip->timer = 0; } g_free (eti->tooltip); + eti->tooltip = NULL; } - eti->tooltip = NULL; if (GTK_OBJECT_CLASS (eti_parent_class)->destroy) (*GTK_OBJECT_CLASS (eti_parent_class)->destroy) (object); @@ -1849,6 +1864,11 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, return; } + last_row = row; + + if (first_row == -1) + return; + /* * Draw cells */ @@ -2309,6 +2329,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) eti->drag_x = realx; eti->drag_y = realy; eti->drag_state = e->button.state; + eti->grabbed = TRUE; d(g_print ("%s: eti_grab\n", __FUNCTION__)); eti_grab (eti, e->button.time); } @@ -2454,11 +2475,6 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) e->button.x -= e_table_header_col_diff (eti->header, 0, model_to_view_col (eti, model_col)); e->button.y -= e_table_item_row_diff (eti, 0, model_to_view_row (eti, model_row)); -#if 0 - button.x = x1; - button.y = y1; -#endif - if (e->button.button == 1) { if (eti->maybe_in_drag) { eti->maybe_in_drag = FALSE; @@ -2518,7 +2534,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e) e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(eti)->canvas)); #ifdef DO_TOOLTIPS - if (g_getenv ("GAL_DO_TOOLTIPS")) { + if (!g_getenv ("GAL_DONT_DO_TOOLTIPS")) { if (eti->tooltip->timer > 0) gtk_timeout_remove (eti->tooltip->timer); eti->tooltip->col = col; @@ -2886,7 +2902,7 @@ eti_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableItemClass, cursor_activated), - gtk_marshal_NONE__INT, + e_marshal_NONE__INT, GTK_TYPE_NONE, 1, GTK_TYPE_INT); eti_signals [DOUBLE_CLICK] = @@ -2894,40 +2910,45 @@ eti_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableItemClass, double_click), - gtk_marshal_NONE__INT_INT_POINTER, - GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_NONE__INT_INT_BOXED, + GTK_TYPE_NONE, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); eti_signals [START_DRAG] = gtk_signal_new ("start_drag", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableItemClass, start_drag), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); eti_signals [RIGHT_CLICK] = gtk_signal_new ("right_click", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableItemClass, right_click), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); eti_signals [CLICK] = gtk_signal_new ("click", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableItemClass, click), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); eti_signals [KEY_PRESS] = gtk_signal_new ("key_press", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableItemClass, key_press), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); eti_signals [STYLE_SET] = gtk_signal_new ("style_set", @@ -2938,7 +2959,6 @@ eti_class_init (GtkObjectClass *object_class) GTK_TYPE_NONE, 1, GTK_TYPE_STYLE); E_OBJECT_CLASS_ADD_SIGNALS (object_class, eti_signals, LAST_SIGNAL); - } GtkType diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h index f1f055f1a1..e9044590d5 100644 --- a/widgets/table/e-table-item.h +++ b/widgets/table/e-table-item.h @@ -25,16 +25,15 @@ #ifndef _E_TABLE_ITEM_H_ #define _E_TABLE_ITEM_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/e-table/e-table-model.h> #include <gal/e-table/e-table-header.h> #include <gal/e-table/e-table-defines.h> #include <gal/e-table/e-table-tooltip.h> #include <gal/widgets/e-selection-model.h> #include <gal/widgets/e-printable.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_ITEM_TYPE (e_table_item_get_type ()) #define E_TABLE_ITEM(o) (GTK_CHECK_CAST ((o), E_TABLE_ITEM_TYPE, ETableItem)) @@ -221,6 +220,6 @@ int e_table_item_row_diff (ETableItem *eti, int start_row, int end_row); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_ITEM_H_ */ diff --git a/widgets/table/e-table-memory-callbacks.c b/widgets/table/e-table-memory-callbacks.c index 7a2771843d..3b804ab9cc 100644 --- a/widgets/table/e-table-memory-callbacks.c +++ b/widgets/table/e-table-memory-callbacks.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-memory-callbacks.c * Copyright 2000, 2001, Ximian, Inc. * diff --git a/widgets/table/e-table-memory-store.h b/widgets/table/e-table-memory-store.h index 979359bdb6..5368b39417 100644 --- a/widgets/table/e-table-memory-store.h +++ b/widgets/table/e-table-memory-store.h @@ -26,9 +26,8 @@ #include <gal/e-table/e-table-memory.h> #include <gal/e-table/e-table-memory-callbacks.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_MEMORY_STORE_TYPE (e_table_memory_store_get_type ()) #define E_TABLE_MEMORY_STORE(o) (GTK_CHECK_CAST ((o), E_TABLE_MEMORY_STORE_TYPE, ETableMemoryStore)) @@ -133,6 +132,6 @@ void e_table_memory_store_remove (ETableMemoryStore int row); void e_table_memory_store_clear (ETableMemoryStore *etms); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_MEMORY_STORE_H_ */ diff --git a/widgets/table/e-table-memory.c b/widgets/table/e-table-memory.c index 84e9fe3378..0e53c80b09 100644 --- a/widgets/table/e-table-memory.c +++ b/widgets/table/e-table-memory.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-memory.c * Copyright 2000, 2001, Ximian, Inc. * @@ -32,8 +32,8 @@ #include <fcntl.h> #include <gtk/gtksignal.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include "gal/util/e-util.h" #include "gal/util/e-xml-utils.h" @@ -59,9 +59,11 @@ etmm_destroy (GtkObject *object) ETableMemoryPriv *priv = etmm->priv; /* XXX lots of stuff to free here */ - - g_free (priv->data); - g_free (priv); + if (priv) { + g_free (priv->data); + g_free (priv); + } + etmm->priv = NULL; GTK_OBJECT_CLASS (parent_class)->destroy (object); } diff --git a/widgets/table/e-table-model.c b/widgets/table/e-table-model.c index f731dc396a..93d8cfece8 100644 --- a/widgets/table/e-table-model.c +++ b/widgets/table/e-table-model.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-model.c * Copyright 2000, 2001, Ximian, Inc. * @@ -26,7 +26,7 @@ #include "e-table-model.h" #include "gal/util/e-util.h" -#define ETM_CLASS(e) ((ETableModelClass *)((GtkObject *)e)->klass) +#define ETM_CLASS(e) ((ETableModelClass *)(GTK_OBJECT_GET_CLASS (e))) #define PARENT_TYPE gtk_object_get_type () @@ -366,7 +366,7 @@ e_table_model_class_init (GtkObjectClass *object_class) } -guint +GtkType e_table_model_get_type (void) { static guint type = 0; diff --git a/widgets/table/e-table-one.c b/widgets/table/e-table-one.c index cd6be49753..15193c46d3 100644 --- a/widgets/table/e-table-one.c +++ b/widgets/table/e-table-one.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-one.c * Copyright 2000, 2001, Ximian, Inc. * @@ -133,35 +133,42 @@ one_value_to_string (ETableModel *etm, int col, const void *value) } static void -one_destroy (GtkObject *object) +one_finalize (GObject *object) { - ETableOne *one = E_TABLE_ONE(object); - - if (one->source) { + ETableOne *one = E_TABLE_ONE (object); + + if (one->data) { int i; int col_count; col_count = e_table_model_column_count(one->source); - - if (one->data) { - for (i = 0; i < col_count; i++) { - e_table_model_free_value(one->source, i, one->data[i]); - } - } - gtk_object_unref(GTK_OBJECT(one->source)); + for (i = 0; i < col_count; i++) + e_table_model_free_value(one->source, i, one->data[i]); + g_free (one->data); } + one->data = NULL; - g_free(one->data); + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void +one_dispose (GObject *object) +{ + ETableOne *one = E_TABLE_ONE (object); + + if (one->source) + gtk_object_unref(GTK_OBJECT(one->source)); + one->source = NULL; - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); + G_OBJECT_CLASS (parent_class)->dispose (object); } static void e_table_one_class_init (GtkObjectClass *object_class) { ETableModelClass *model_class = (ETableModelClass *) object_class; + GObjectClass *gobject_class = (GObjectClass *) object_class; parent_class = gtk_type_class (E_TABLE_MODEL_TYPE); @@ -176,7 +183,8 @@ e_table_one_class_init (GtkObjectClass *object_class) model_class->value_is_empty = one_value_is_empty; model_class->value_to_string = one_value_to_string; - object_class->destroy = one_destroy; + gobject_class->dispose = one_dispose; + gobject_class->finalize = one_finalize; } static void diff --git a/widgets/table/e-table-scrolled.c b/widgets/table/e-table-scrolled.c index 6bcc2cb008..080c685d6e 100644 --- a/widgets/table/e-table-scrolled.c +++ b/widgets/table/e-table-scrolled.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-scrolled.c * Copyright 2000, 2001, Ximian, Inc. * @@ -26,10 +26,10 @@ #include <stdio.h> #include <string.h> #include <stdio.h> -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gtk/gtksignal.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include "e-table.h" #include "e-table-scrolled.h" @@ -188,13 +188,13 @@ ets_grab_focus (GtkWidget *widget) /* Focus handler for the scrolled ETable */ static gint -ets_focus (GtkContainer *container, GtkDirectionType direction) +ets_focus (GtkWidget *container, GtkDirectionType direction) { ETableScrolled *ets; ets = E_TABLE_SCROLLED (container); - return gtk_container_focus (GTK_CONTAINER (ets->table), direction); + return gtk_widget_child_focus (GTK_WIDGET (ets->table), direction); } static void @@ -214,7 +214,7 @@ e_table_scrolled_class_init (ETableScrolledClass *class) widget_class->grab_focus = ets_grab_focus; - container_class->focus = ets_focus; + widget_class->focus = ets_focus; gtk_object_add_arg_type ("ETableScrolled::table", GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_TABLE); diff --git a/widgets/table/e-table-scrolled.h b/widgets/table/e-table-scrolled.h index ce12a8cefd..58241f25b6 100644 --- a/widgets/table/e-table-scrolled.h +++ b/widgets/table/e-table-scrolled.h @@ -27,9 +27,8 @@ #include <gal/widgets/e-scroll-frame.h> #include <gal/e-table/e-table-model.h> #include <gal/e-table/e-table.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_SCROLLED_TYPE (e_table_scrolled_get_type ()) #define E_TABLE_SCROLLED(o) (GTK_CHECK_CAST ((o), E_TABLE_SCROLLED_TYPE, ETableScrolled)) @@ -71,7 +70,7 @@ GtkWidget *e_table_scrolled_new_from_spec_file (ETableModel *etm, ETable *e_table_scrolled_get_table (ETableScrolled *ets); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_SCROLLED_H_ */ diff --git a/widgets/table/e-table-search.c b/widgets/table/e-table-search.c index 1ec3583076..0348189446 100644 --- a/widgets/table/e-table-search.c +++ b/widgets/table/e-table-search.c @@ -132,8 +132,8 @@ e_table_search_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableSearchClass, search), - e_marshal_BOOL__STRING_ENUM, - GTK_TYPE_BOOL, 2, GTK_TYPE_STRING, GTK_TYPE_ENUM); + e_marshal_BOOLEAN__STRING_INT, + GTK_TYPE_BOOL, 2, GTK_TYPE_STRING, GTK_TYPE_INT); e_table_search_signals [SEARCH_ACCEPT] = gtk_signal_new ("accept", @@ -160,7 +160,7 @@ e_table_search_init (ETableSearch *ets) } -guint +GtkType e_table_search_get_type (void) { static guint type = 0; diff --git a/widgets/table/e-table-search.h b/widgets/table/e-table-search.h index bd614206a0..0c3e8b9bd9 100644 --- a/widgets/table/e-table-search.h +++ b/widgets/table/e-table-search.h @@ -25,10 +25,8 @@ #define _E_TABLE_SEARCH_H_ #include <gtk/gtkobject.h> -#include <libgnome/gnome-defs.h> -#include <gal/unicode/gunicode.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_SEARCH_TYPE (e_table_search_get_type ()) #define E_TABLE_SEARCH(o) (GTK_CHECK_CAST ((o), E_TABLE_SEARCH_TYPE, ETableSearch)) @@ -67,6 +65,6 @@ void e_table_search_input_character (ETableSearch *e_table_search, gboolean e_table_search_backspace (ETableSearch *e_table_search); void e_table_search_cancel (ETableSearch *e_table_search); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_SEARCH_H_ */ diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c index 5de3ced003..e4d2767ea5 100644 --- a/widgets/table/e-table-selection-model.c +++ b/widgets/table/e-table-selection-model.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-selection-model.c * Copyright 2000, 2001, Ximian, Inc. * @@ -236,9 +236,10 @@ etsm_destroy (GtkObject *object) etsm = E_TABLE_SELECTION_MODEL (object); - if (etsm->model_changed_idle_id) { - g_source_remove(etsm->model_changed_idle_id); - } + if (etsm->model_changed_idle_id) + g_source_remove (etsm->model_changed_idle_id); + etsm->model_changed_idle_id = 0; + drop_model(etsm); free_hash(etsm); diff --git a/widgets/table/e-table-simple.c b/widgets/table/e-table-simple.c index 11cfafd01f..c8a7d4fe16 100644 --- a/widgets/table/e-table-simple.c +++ b/widgets/table/e-table-simple.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-simple.c * Copyright 2000, 2001, Ximian, Inc. * diff --git a/widgets/table/e-table-simple.h b/widgets/table/e-table-simple.h index 6dfe28f573..36ffa02de9 100644 --- a/widgets/table/e-table-simple.h +++ b/widgets/table/e-table-simple.h @@ -26,9 +26,8 @@ #define _E_TABLE_SIMPLE_H_ #include <gal/e-table/e-table-model.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_SIMPLE_TYPE (e_table_simple_get_type ()) #define E_TABLE_SIMPLE(o) (GTK_CHECK_CAST ((o), E_TABLE_SIMPLE_TYPE, ETableSimple)) @@ -117,7 +116,6 @@ char *e_table_simple_string_value_to_string (ETableModel const void *val, void *data); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_SIMPLE_H_ */ - diff --git a/widgets/table/e-table-size-test.c b/widgets/table/e-table-size-test.c index a523bcf6d9..05a4245899 100644 --- a/widgets/table/e-table-size-test.c +++ b/widgets/table/e-table-size-test.c @@ -295,7 +295,6 @@ main (int argc, char *argv []) gnome_init ("TableExample", "TableExample", argc, argv); e_cursors_init (); - gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); create_table (); diff --git a/widgets/table/e-table-sort-info.c b/widgets/table/e-table-sort-info.c index 3d49e4ba88..de9e7be4ea 100644 --- a/widgets/table/e-table-sort-info.c +++ b/widgets/table/e-table-sort-info.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-sort-info.c * Copyright 2000, 2001, Ximian, Inc. * @@ -54,8 +54,11 @@ etsi_destroy (GtkObject *object) if (etsi->groupings) g_free(etsi->groupings); + etsi->groupings = NULL; + if (etsi->sortings) g_free(etsi->sortings); + etsi->sortings = NULL; GTK_OBJECT_CLASS (e_table_sort_info_parent_class)->destroy (object); } diff --git a/widgets/table/e-table-sort-info.h b/widgets/table/e-table-sort-info.h index e7f7bea5cb..7a398fbb85 100644 --- a/widgets/table/e-table-sort-info.h +++ b/widgets/table/e-table-sort-info.h @@ -25,7 +25,7 @@ #define _E_TABLE_SORT_INFO_H_ #include <gtk/gtkobject.h> -#include <gnome-xml/tree.h> +#include <libxml/tree.h> #ifdef __cplusplus extern "C" { diff --git a/widgets/table/e-table-sorted-variable.c b/widgets/table/e-table-sorted-variable.c index 7689d1f33f..93e103e1cc 100644 --- a/widgets/table/e-table-sorted-variable.c +++ b/widgets/table/e-table-sorted-variable.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-sorted-variable.c * Copyright 2000, 2001, Ximian, Inc. * @@ -50,20 +50,27 @@ etsv_destroy (GtkObject *object) { ETableSortedVariable *etsv = E_TABLE_SORTED_VARIABLE (object); - gtk_signal_disconnect (GTK_OBJECT (etsv->sort_info), - etsv->sort_info_changed_id); + if (etsv->sort_info_changed_id) + gtk_signal_disconnect (GTK_OBJECT (etsv->sort_info), + etsv->sort_info_changed_id); + etsv->sort_info_changed_id = 0; if (etsv->sort_idle_id) { g_source_remove(etsv->sort_idle_id); + etsv->sort_idle_id = 0; } if (etsv->insert_idle_id) { g_source_remove(etsv->insert_idle_id); + etsv->insert_idle_id = 0; } if (etsv->sort_info) gtk_object_unref(GTK_OBJECT(etsv->sort_info)); + etsv->sort_info = NULL; + if (etsv->full_header) gtk_object_unref(GTK_OBJECT(etsv->full_header)); + etsv->full_header = NULL; GTK_OBJECT_CLASS (etsv_parent_class)->destroy (object); } diff --git a/widgets/table/e-table-sorted.c b/widgets/table/e-table-sorted.c index 5cc9c5bfd7..c84d6c15c0 100644 --- a/widgets/table/e-table-sorted.c +++ b/widgets/table/e-table-sorted.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-sorted.c * Copyright 2000, 2001, Ximian, Inc. * @@ -53,21 +53,24 @@ ets_destroy (GtkObject *object) { ETableSorted *ets = E_TABLE_SORTED (object); - if (ets->sort_idle_id) { + if (ets->sort_idle_id) g_source_remove(ets->sort_idle_id); - } - if (ets->insert_idle_id) { + ets->sort_idle_id = 0; + + if (ets->insert_idle_id) g_source_remove(ets->insert_idle_id); - } + ets->insert_idle_id = 0; if (ets->sort_info) { gtk_signal_disconnect (GTK_OBJECT (ets->sort_info), ets->sort_info_changed_id); gtk_object_unref(GTK_OBJECT(ets->sort_info)); + ets->sort_info = NULL; } if (ets->full_header) gtk_object_unref(GTK_OBJECT(ets->full_header)); + ets->full_header = NULL; GTK_OBJECT_CLASS (ets_parent_class)->destroy (object); } diff --git a/widgets/table/e-table-sorter.c b/widgets/table/e-table-sorter.c index 7a0c9d9126..8c530dca90 100644 --- a/widgets/table/e-table-sorter.c +++ b/widgets/table/e-table-sorter.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-sorter.c * Copyright 2000, 2001, Ximian, Inc. * @@ -88,10 +88,15 @@ ets_destroy (GtkObject *object) if (ets->sort_info) gtk_object_unref(GTK_OBJECT(ets->sort_info)); + ets->sort_info = NULL; + if (ets->full_header) gtk_object_unref(GTK_OBJECT(ets->full_header)); + ets->full_header = NULL; + if (ets->source) gtk_object_unref(GTK_OBJECT(ets->source)); + ets->source = NULL; GTK_OBJECT_CLASS (parent_class)->destroy (object); } diff --git a/widgets/table/e-table-sorter.h b/widgets/table/e-table-sorter.h index b0097b9155..4bee51fbbd 100644 --- a/widgets/table/e-table-sorter.h +++ b/widgets/table/e-table-sorter.h @@ -30,9 +30,8 @@ #include <gal/e-table/e-table-subset-variable.h> #include <gal/e-table/e-table-sort-info.h> #include <gal/e-table/e-table-header.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_SORTER_TYPE (e_table_sorter_get_type ()) #define E_TABLE_SORTER(o) (GTK_CHECK_CAST ((o), E_TABLE_SORTER_TYPE, ETableSorter)) @@ -70,6 +69,6 @@ GtkType e_table_sorter_get_type (void); ETableSorter *e_table_sorter_new (ETableModel *etm, ETableHeader *full_header, ETableSortInfo *sort_info); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_SORTER_H_ */ diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c index 7395ce60aa..6d8653b6d6 100644 --- a/widgets/table/e-table-specification.c +++ b/widgets/table/e-table-specification.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-specification.c * Copyright 2000, 2001, Ximian, Inc. * @@ -31,8 +31,8 @@ #include <string.h> #include <gtk/gtksignal.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include "gal/util/e-util.h" #include "gal/util/e-xml-utils.h" @@ -51,17 +51,17 @@ etsp_destroy (GtkObject *object) gtk_object_unref (GTK_OBJECT (etsp->columns[i])); } g_free (etsp->columns); + etsp->columns = NULL; } if (etsp->state) gtk_object_unref (GTK_OBJECT (etsp->state)); + etsp->state = NULL; + g_free (etsp->click_to_add_message); + etsp->click_to_add_message = NULL; g_free (etsp->domain); - - etsp->columns = NULL; - etsp->state = NULL; - etsp->click_to_add_message = NULL; etsp->domain = NULL; GTK_OBJECT_CLASS (etsp_parent_class)->destroy (object); @@ -251,6 +251,8 @@ e_table_specification_load_from_node (ETableSpecification *specification, if (!strcmp (children->name, "ETableColumn")) { ETableColumnSpecification *col_spec = e_table_column_specification_new (); + gtk_object_ref (GTK_OBJECT (col_spec)); + gtk_object_sink (GTK_OBJECT (col_spec)); e_table_column_specification_load_from_node (col_spec, children); list = g_list_append (list, col_spec); } else if (specification->state == NULL && !strcmp (children->name, "ETableState")) { @@ -260,6 +262,11 @@ e_table_specification_load_from_node (ETableSpecification *specification, } } + if (specification->state == NULL) { + /* Make the default state. */ + specification->state = e_table_state_vanilla (g_list_length (list)); + } + specification->columns = g_new (ETableColumnSpecification *, g_list_length (list) + 1); for (list2 = list, i = 0; list2; list2 = g_list_next (list2), i++) { specification->columns[i] = list2->data; @@ -293,7 +300,7 @@ e_table_specification_save_to_file (ETableSpecification *specification, xmlDocSetRootElement (doc, e_table_specification_save_to_node (specification, doc)); - ret = e_xml_save_file (filename, doc); + ret = xmlSaveFile (filename, doc); xmlFreeDoc (doc); diff --git a/widgets/table/e-table-specification.h b/widgets/table/e-table-specification.h index 3f21426390..92f52a4f42 100644 --- a/widgets/table/e-table-specification.h +++ b/widgets/table/e-table-specification.h @@ -25,7 +25,7 @@ #define _E_TABLE_SPECIFICATION_H_ #include <gtk/gtkobject.h> -#include <gnome-xml/tree.h> +#include <libxml/tree.h> #include <gal/widgets/e-selection-model.h> #include <gal/e-table/e-table-state.h> #include <gal/e-table/e-table-column-specification.h> diff --git a/widgets/table/e-table-state.c b/widgets/table/e-table-state.c index c9117add68..64b911f38f 100644 --- a/widgets/table/e-table-state.c +++ b/widgets/table/e-table-state.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-state.c * Copyright 2000, 2001, Ximian, Inc. * @@ -21,7 +21,6 @@ * 02111-1307, USA. */ - #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -31,8 +30,8 @@ #include <gtk/gtksignal.h> #include <gtk/gtkobject.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include "gal/util/e-util.h" #include "gal/util/e-xml-utils.h" #include "e-table-state.h" @@ -95,6 +94,26 @@ e_table_state_new (void) return (ETableState *) etst; } +ETableState * +e_table_state_vanilla (int col_count) +{ + GString *str; + int i; + ETableState *res; + + str = g_string_new ("<ETableState>\n"); + for (i = 0; i < col_count; i++) + g_string_append_printf (str, " <column source=\"%d\"/>\n", i); + g_string_append (str, " <grouping></grouping>\n"); + g_string_append (str, "</ETableState>\n"); + + res = e_table_state_new (); + e_table_state_load_from_string (res, str->str); + + g_string_free (str, TRUE); + return res; +} + gboolean e_table_state_load_from_file (ETableState *state, const char *filename) @@ -191,7 +210,7 @@ e_table_state_save_to_file (ETableState *state, xmlDocSetRootElement (doc, e_table_state_save_to_node (state, NULL)); - e_xml_save_file (filename, doc); + xmlSaveFile (filename, doc); xmlFreeDoc (doc); } diff --git a/widgets/table/e-table-state.h b/widgets/table/e-table-state.h index b4d64ad453..0532ba3771 100644 --- a/widgets/table/e-table-state.h +++ b/widgets/table/e-table-state.h @@ -25,7 +25,7 @@ #define _E_TABLE_STATE_H_ #include <gtk/gtkobject.h> -#include <gnome-xml/tree.h> +#include <libxml/tree.h> #include <gal/e-table/e-table-sort-info.h> #ifdef __cplusplus @@ -55,6 +55,8 @@ typedef struct { GtkType e_table_state_get_type (void); ETableState *e_table_state_new (void); +ETableState *e_table_state_vanilla (int col_count); + gboolean e_table_state_load_from_file (ETableState *state, const char *filename); void e_table_state_load_from_string (ETableState *state, diff --git a/widgets/table/e-table-subset-variable.c b/widgets/table/e-table-subset-variable.c index 474fb5586d..16ff83d3f3 100644 --- a/widgets/table/e-table-subset-variable.c +++ b/widgets/table/e-table-subset-variable.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-subset-variable.c * Copyright 2000, 2001, Ximian, Inc. * @@ -28,7 +28,7 @@ #include "gal/util/e-util.h" #include "e-table-subset-variable.h" -#define ETSSV_CLASS(e) ((ETableSubsetVariableClass *)((GtkObject *)e)->klass) +#define ETSSV_CLASS(e) ((ETableSubsetVariableClass *)(GTK_OBJECT_GET_CLASS (e))) #define PARENT_TYPE E_TABLE_SUBSET_TYPE diff --git a/widgets/table/e-table-subset.c b/widgets/table/e-table-subset.c index 9518d4a2db..fe1c0c3962 100644 --- a/widgets/table/e-table-subset.c +++ b/widgets/table/e-table-subset.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-subset.c - Implements a table that contains a subset of another table. * Copyright 1999, 2000, 2001, Ximian, Inc. * @@ -41,7 +41,7 @@ static void etss_proxy_model_rows_deleted_real (ETableSubset *etss, ETableModel static ETableModelClass *etss_parent_class; -#define ETSS_CLASS(object) (E_TABLE_SUBSET_CLASS(GTK_OBJECT(object)->klass)) +#define ETSS_CLASS(object) (E_TABLE_SUBSET_CLASS(GTK_OBJECT_GET_CLASS(object))) static gint etss_get_view_row (ETableSubset *etss, int row) @@ -112,6 +112,7 @@ etss_destroy (GtkObject *object) } g_free (etss->map_table); + etss->map_table = NULL; GTK_OBJECT_CLASS (etss_parent_class)->destroy (object); } diff --git a/widgets/table/e-table-tooltip.h b/widgets/table/e-table-tooltip.h index 0438b52f40..81c00f9e34 100644 --- a/widgets/table/e-table-tooltip.h +++ b/widgets/table/e-table-tooltip.h @@ -24,10 +24,9 @@ #ifndef _E_TABLE_TOOLTIP_H_ #define _E_TABLE_TOOLTIP_H_ -#include <libgnomeui/gnome-canvas.h> -#include <libgnome/gnome-defs.h> +#include <libgnomecanvas/gnome-canvas.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS typedef struct { gint timer; @@ -40,6 +39,6 @@ typedef struct { GnomeCanvasItem *eti; } ETableTooltip; -END_GNOME_DECLS +G_END_DECLS #endif diff --git a/widgets/table/e-table-tree.h b/widgets/table/e-table-tree.h index b99372a474..5648fc2f06 100644 --- a/widgets/table/e-table-tree.h +++ b/widgets/table/e-table-tree.h @@ -25,9 +25,8 @@ #define _E_TABLE_TREE_H_ #include <gal/e-table/e-table-model.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS typedef struct { char *title; @@ -44,6 +43,6 @@ typedef struct { ETableGroup *e_table_group_new (const char *title, ETableModel *table); ETableGroup *e_table_group_new_leaf (const char *title); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_TREE_H_ */ diff --git a/widgets/table/e-table-utils.c b/widgets/table/e-table-utils.c index c0e51e5bec..3af68ea2a3 100644 --- a/widgets/table/e-table-utils.c +++ b/widgets/table/e-table-utils.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-utils.c * Copyright 2000, 2001, Ximian, Inc. * diff --git a/widgets/table/e-table-utils.h b/widgets/table/e-table-utils.h index 35277583c0..3c7fd937b6 100644 --- a/widgets/table/e-table-utils.h +++ b/widgets/table/e-table-utils.h @@ -28,9 +28,8 @@ #include <gal/e-table/e-table-state.h> #include <gal/e-table/e-table-specification.h> #include <gal/e-table/e-table-extras.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS ETableHeader *e_table_state_to_header (GtkWidget *widget, ETableHeader *full_header, @@ -44,7 +43,7 @@ ETableCol *e_table_util_calculate_current_search_col (ETableHeader *h ETableSortInfo *sort_info, gboolean always_search); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TABLE_UTILS_H_ */ diff --git a/widgets/table/e-table-without.c b/widgets/table/e-table-without.c index 7aa4a2fc1d..8691796062 100644 --- a/widgets/table/e-table-without.c +++ b/widgets/table/e-table-without.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table-without.c * Copyright 2000, 2001, Ximian, Inc. * diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index bf9e850322..5772c26fc7 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-table.c - A graphical view of a Table. * Copyright 1999, 2000, 2001, Ximian, Inc. * @@ -22,18 +22,18 @@ * 02111-1307, USA. */ - #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <stdlib.h> #include <string.h> - +#include <stdio.h> +#include <gdk/gdk.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtksignal.h> -#include <libgnomeui/gnome-canvas.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <libgnomecanvas/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> #include "gal/util/e-i18n.h" #include "gal/util/e-util.h" @@ -158,7 +158,7 @@ static void et_drag_data_received(GtkWidget *widget, guint time, ETable *et); -static gint et_focus (GtkContainer *container, GtkDirectionType direction); +static gint et_focus (GtkWidget *container, GtkDirectionType direction); static void scroll_off (ETable *et); static void scroll_on (ETable *et, guint scroll_direction); @@ -292,13 +292,13 @@ connect_header (ETable *e_table, ETableState *state) e_table->structure_change_id = gtk_signal_connect (GTK_OBJECT (e_table->header), "structure_change", - structure_changed, e_table); + GTK_SIGNAL_FUNC (structure_changed), e_table); e_table->expansion_change_id = gtk_signal_connect (GTK_OBJECT (e_table->header), "expansion_change", - expansion_changed, e_table); + GTK_SIGNAL_FUNC (expansion_changed), e_table); e_table->dimension_change_id = gtk_signal_connect (GTK_OBJECT (e_table->header), "dimension_change", - dimension_changed, e_table); + GTK_SIGNAL_FUNC (dimension_changed), e_table); } static void @@ -316,40 +316,76 @@ et_destroy (GtkObject *object) gtk_signal_disconnect (GTK_OBJECT (et->search), et->search_accept_id); gtk_object_unref (GTK_OBJECT (et->search)); + et->search = NULL; } - if (et->group_info_change_id) + if (et->group_info_change_id) { gtk_signal_disconnect (GTK_OBJECT (et->sort_info), et->group_info_change_id); - if (et->sort_info_change_id) + et->group_info_change_id = 0; + } + + if (et->sort_info_change_id) { gtk_signal_disconnect (GTK_OBJECT (et->sort_info), et->sort_info_change_id); + et->sort_info_change_id = 0; + } - if (et->reflow_idle_id) + if (et->reflow_idle_id) { g_source_remove(et->reflow_idle_id); - et->reflow_idle_id = 0; + et->reflow_idle_id = 0; + } scroll_off (et); disconnect_header (et); - - gtk_object_unref (GTK_OBJECT (et->model)); - gtk_object_unref (GTK_OBJECT (et->full_header)); - gtk_object_unref (GTK_OBJECT (et->sort_info)); - gtk_object_unref (GTK_OBJECT (et->sorter)); - gtk_object_unref (GTK_OBJECT (et->selection)); - if (et->spec) + + if (et->model) { + gtk_object_unref (GTK_OBJECT (et->model)); + et->model = NULL; + } + + if (et->full_header) { + gtk_object_unref (GTK_OBJECT (et->full_header)); + et->full_header = NULL; + } + + if (et->sort_info) { + gtk_object_unref (GTK_OBJECT (et->sort_info)); + et->sort_info = NULL; + } + + if (et->sorter) { + gtk_object_unref (GTK_OBJECT (et->sorter)); + et->sorter = NULL; + } + + if (et->selection) { + gtk_object_unref (GTK_OBJECT (et->selection)); + et->selection = NULL; + } + + if (et->spec) { gtk_object_unref (GTK_OBJECT (et->spec)); + et->spec = NULL; + } - if (et->header_canvas != NULL) + if (et->header_canvas != NULL) { gtk_widget_destroy (GTK_WIDGET (et->header_canvas)); + et->header_canvas = NULL; + } - if (et->site != NULL) + if (et->site != NULL) { e_table_drag_source_unset (et); + et->site = NULL; + } - gtk_widget_destroy (GTK_WIDGET (et->table_canvas)); + if (et->table_canvas != NULL) { + gtk_widget_destroy (GTK_WIDGET (et->table_canvas)); + et->table_canvas = NULL; + } - if (et->rebuild_idle_id) { + if (et->rebuild_idle_id != 0) { g_source_remove (et->rebuild_idle_id); et->rebuild_idle_id = 0; } @@ -458,6 +494,19 @@ init_search (ETable *e_table) } static void +et_finalize (GObject *object) +{ + ETable *et = E_TABLE (object); + + g_free (et->click_to_add_message); + et->click_to_add_message = NULL; + + g_free(et->domain); + et->domain = NULL; + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void e_table_init (GtkObject *object) { ETable *e_table = E_TABLE (object); @@ -528,18 +577,18 @@ et_grab_focus (GtkWidget *widget) /* Focus handler for the ETable */ static gint -et_focus (GtkContainer *container, GtkDirectionType direction) +et_focus (GtkWidget *container, GtkDirectionType direction) { ETable *e_table; e_table = E_TABLE (container); - if (container->focus_child) { - gtk_container_set_focus_child (container, NULL); + if (GTK_CONTAINER (container)->focus_child) { + gtk_container_set_focus_child (GTK_CONTAINER (container), NULL); return FALSE; } - return gtk_container_focus (GTK_CONTAINER (e_table->table_canvas), direction); + return gtk_widget_child_focus (GTK_WIDGET (e_table->table_canvas), direction); } static void @@ -1003,6 +1052,7 @@ static void et_eti_leave_edit (ETable *et) { GnomeCanvas *canvas = et->table_canvas; + if (GTK_WIDGET_HAS_FOCUS(canvas)) { GnomeCanvasItem *item = GNOME_CANVAS(canvas)->focused_item; @@ -1393,11 +1443,17 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, ETableSpecification *specification, ETableState *state) { int row = 0; + int col_count, i; if (ete) gtk_object_ref(GTK_OBJECT(ete)); - else + else { ete = e_table_extras_new(); + gtk_object_ref(GTK_OBJECT(ete)); + gtk_object_sink(GTK_OBJECT(ete)); + } + + e_table->domain = g_strdup (specification->domain); e_table->domain = g_strdup (specification->domain); @@ -1410,11 +1466,22 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, e_table->draw_focus = specification->draw_focus; e_table->cursor_mode = specification->cursor_mode; e_table->full_header = e_table_spec_to_full_header(specification, ete); + gtk_object_ref (GTK_OBJECT (e_table->full_header)); + gtk_object_sink (GTK_OBJECT (e_table->full_header)); + + col_count = e_table_header_count (e_table->full_header); + for (i = 0; i < col_count; i++) { + ETableCol *col = e_table_header_get_column(e_table->full_header, i); + if (col && col->search) { + e_table->current_search_col = col; + e_table->search_col_set = TRUE; + break; + } + } e_table->model = etm; gtk_object_ref (GTK_OBJECT (etm)); - gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); connect_header (e_table, state); @@ -1440,6 +1507,8 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, NULL); e_table->sorter = e_table_sorter_new(etm, e_table->full_header, e_table->sort_info); + gtk_object_ref (GTK_OBJECT (e_table->sorter)); + gtk_object_sink (GTK_OBJECT (e_table->sorter)); gtk_object_set (GTK_OBJECT (e_table->selection), "model", etm, @@ -1482,7 +1551,6 @@ et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, 0, 0); gtk_widget_pop_colormap (); - gtk_widget_pop_visual (); gtk_object_unref(GTK_OBJECT(ete)); @@ -1517,13 +1585,21 @@ e_table_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL); g_return_val_if_fail(spec_str != NULL, NULL); + gtk_object_ref (GTK_OBJECT (etm)); + gtk_object_sink (GTK_OBJECT (etm)); + specification = e_table_specification_new(); + gtk_object_ref (GTK_OBJECT (specification)); + gtk_object_sink (GTK_OBJECT (specification)); if (!e_table_specification_load_from_string(specification, spec_str)) { gtk_object_unref(GTK_OBJECT(specification)); return NULL; } + if (state_str) { state = e_table_state_new(); + gtk_object_ref (GTK_OBJECT (state)); + gtk_object_sink (GTK_OBJECT (state)); e_table_state_load_from_string(state, state_str); if (state->col_count <= 0) { gtk_object_unref(GTK_OBJECT(state)); @@ -2804,7 +2880,11 @@ static void context_destroyed (gpointer data) { ETable *et = data; - if (!GTK_OBJECT_DESTROYED (et)) { + /* if (!GTK_OBJECT_DESTROYED (et)) */ +#ifndef NO_WARNINGS +#warning FIXME +#endif + { et->last_drop_x = 0; et->last_drop_y = 0; et->last_drop_time = 0; @@ -2980,6 +3060,7 @@ e_table_class_init (ETableClass *class) parent_class = gtk_type_class (PARENT_TYPE); object_class->destroy = et_destroy; + G_OBJECT_CLASS (object_class)->finalize = et_finalize; object_class->set_arg = et_set_arg; object_class->get_arg = et_get_arg; @@ -2987,7 +3068,7 @@ e_table_class_init (ETableClass *class) widget_class->unrealize = et_unrealize; widget_class->size_request = et_size_request; - container_class->focus = et_focus; + widget_class->focus = et_focus; class->cursor_change = NULL; class->cursor_activated = NULL; @@ -3039,40 +3120,45 @@ e_table_class_init (ETableClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, double_click), - gtk_marshal_NONE__INT_INT_POINTER, - GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_NONE__INT_INT_BOXED, + GTK_TYPE_NONE, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); et_signals [RIGHT_CLICK] = gtk_signal_new ("right_click", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, right_click), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); et_signals [CLICK] = gtk_signal_new ("click", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, click), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); et_signals [KEY_PRESS] = gtk_signal_new ("key_press", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, key_press), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); et_signals [START_DRAG] = gtk_signal_new ("start_drag", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, start_drag), - e_marshal_INT__INT_INT_POINTER, - GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_INT_BOXED, + GTK_TYPE_INT, 3, GTK_TYPE_INT, + GTK_TYPE_INT, GDK_TYPE_EVENT); et_signals [STATE_CHANGE] = gtk_signal_new ("state_change", @@ -3088,38 +3174,38 @@ e_table_class_init (ETableClass *class) E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, white_space_event), gtk_marshal_INT__POINTER, - GTK_TYPE_INT, 1, GTK_TYPE_GDK_EVENT); + GTK_TYPE_INT, 1, GDK_TYPE_EVENT); et_signals[TABLE_DRAG_BEGIN] = gtk_signal_new ("table_drag_begin", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, table_drag_begin), - gtk_marshal_NONE__INT_INT_POINTER, + e_marshal_NONE__INT_INT_OBJECT, GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT); + GDK_TYPE_DRAG_CONTEXT); et_signals[TABLE_DRAG_END] = gtk_signal_new ("table_drag_end", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, table_drag_end), - gtk_marshal_NONE__INT_INT_POINTER, + e_marshal_NONE__INT_INT_OBJECT, GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT); + GDK_TYPE_DRAG_CONTEXT); et_signals[TABLE_DRAG_DATA_GET] = gtk_signal_new ("table_drag_data_get", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, table_drag_data_get), - e_marshal_NONE__INT_INT_POINTER_POINTER_UINT_UINT, + e_marshal_NONE__INT_INT_OBJECT_POINTER_UINT_UINT, GTK_TYPE_NONE, 6, GTK_TYPE_INT, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_SELECTION_DATA, GTK_TYPE_UINT, GTK_TYPE_UINT); @@ -3128,33 +3214,33 @@ e_table_class_init (ETableClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, table_drag_data_delete), - gtk_marshal_NONE__INT_INT_POINTER, + e_marshal_NONE__INT_INT_OBJECT, GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT); + GDK_TYPE_DRAG_CONTEXT); et_signals[TABLE_DRAG_LEAVE] = gtk_signal_new ("table_drag_leave", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, table_drag_leave), - e_marshal_NONE__INT_INT_POINTER_UINT, + e_marshal_NONE__INT_INT_OBJECT_UINT, GTK_TYPE_NONE, 4, GTK_TYPE_INT, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_UINT); et_signals[TABLE_DRAG_MOTION] = gtk_signal_new ("table_drag_motion", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, table_drag_motion), - e_marshal_BOOL__INT_INT_POINTER_INT_INT_UINT, + e_marshal_BOOLEAN__INT_INT_OBJECT_INT_INT_UINT, GTK_TYPE_BOOL, 6, GTK_TYPE_INT, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_UINT); @@ -3163,11 +3249,11 @@ e_table_class_init (ETableClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, table_drag_drop), - e_marshal_BOOL__INT_INT_POINTER_INT_INT_UINT, + e_marshal_BOOLEAN__INT_INT_OBJECT_INT_INT_UINT, GTK_TYPE_BOOL, 6, GTK_TYPE_INT, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_UINT); @@ -3176,11 +3262,11 @@ e_table_class_init (ETableClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, table_drag_data_received), - e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_UINT_UINT, + e_marshal_NONE__INT_INT_OBJECT_INT_INT_BOXED_UINT_UINT, GTK_TYPE_NONE, 8, GTK_TYPE_INT, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_SELECTION_DATA, @@ -3196,7 +3282,7 @@ e_table_class_init (ETableClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETableClass, set_scroll_adjustments), - gtk_marshal_NONE__POINTER_POINTER, + e_marshal_NONE__POINTER_POINTER, GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); gtk_object_add_arg_type ("ETable::length_threshold", GTK_TYPE_INT, diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h index f67e0078b1..175c8d58db 100644 --- a/widgets/table/e-table.h +++ b/widgets/table/e-table.h @@ -25,9 +25,10 @@ #ifndef _E_TABLE_H_ #define _E_TABLE_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> +#include <gtk/gtkdnd.h> #include <gtk/gtktable.h> -#include <gnome-xml/tree.h> +#include <libxml/tree.h> #include <gal/e-table/e-table-model.h> #include <gal/e-table/e-table-header.h> #include <gal/e-table/e-table-group.h> @@ -40,9 +41,8 @@ #include <gal/e-table/e-table-state.h> #include <gal/e-table/e-table-sorter.h> #include <gal/e-table/e-table-search.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TABLE_TYPE (e_table_get_type ()) #define E_TABLE(o) (GTK_CHECK_CAST ((o), E_TABLE_TYPE, ETable)) @@ -350,7 +350,9 @@ void e_table_right_click_up (ETable *table) void e_table_commit_click_to_add (ETable *table); -END_GNOME_DECLS +void e_table_commit_click_to_add (ETable *table); + +G_END_DECLS #endif /* _E_TABLE_H_ */ diff --git a/widgets/table/e-tree-memory-callbacks.c b/widgets/table/e-tree-memory-callbacks.c index e129891656..bce925b335 100644 --- a/widgets/table/e-tree-memory-callbacks.c +++ b/widgets/table/e-tree-memory-callbacks.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree-memory-callbacks.c * Copyright 2000, 2001, Ximian, Inc. * diff --git a/widgets/table/e-tree-memory.c b/widgets/table/e-tree-memory.c index 27948727f7..f8898903d6 100644 --- a/widgets/table/e-tree-memory.c +++ b/widgets/table/e-tree-memory.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree-memory.c * Copyright 2000, 2001, Ximian, Inc. * @@ -30,8 +30,8 @@ #include <fcntl.h> #include <stdlib.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include <gtk/gtksignal.h> #include "gal/util/e-util.h" @@ -219,12 +219,15 @@ etmm_destroy (GtkObject *object) ETreeMemory *etmm = E_TREE_MEMORY (object); ETreeMemoryPriv *priv = etmm->priv; + if (priv) { /* XXX lots of stuff to free here */ - if (priv->root) - e_tree_memory_node_remove (etmm, priv->root); + if (priv->root) + e_tree_memory_node_remove (etmm, priv->root); - g_free (priv); + g_free (priv); + } + etmm->priv = NULL; GTK_OBJECT_CLASS (parent_class)->destroy (object); } diff --git a/widgets/table/e-tree-model.c b/widgets/table/e-tree-model.c index 193a79914d..89de484496 100644 --- a/widgets/table/e-tree-model.c +++ b/widgets/table/e-tree-model.c @@ -1,10 +1,10 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree-model.c * Copyright 2000, 2001, Ximian, Inc. * * Authors: - * Chris Lahey <clahey@ximian.com> + * Chris Lahey <clahey@ximian.com> * Chris Toshok <toshok@ximian.com> * * This library is free software; you can redistribute it and/or @@ -30,15 +30,15 @@ #include <unistd.h> #include <fcntl.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include <gtk/gtksignal.h> #include "gal/util/e-util.h" #include "gal/util/e-xml-utils.h" #include "e-tree-model.h" -#define ETM_CLASS(e) ((ETreeModelClass *)((GtkObject *)e)->klass) +#define ETM_CLASS(e) ((ETreeModelClass *)(GTK_OBJECT_GET_CLASS(e))) #define PARENT_TYPE (gtk_object_get_type()) @@ -106,7 +106,7 @@ e_tree_model_class_init (GtkObjectClass *klass) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (klass), GTK_SIGNAL_OFFSET (ETreeModelClass, node_col_changed), - gtk_marshal_NONE__POINTER_INT, + e_marshal_NONE__POINTER_INT, GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_INT); e_tree_model_signals [NODE_INSERTED] = @@ -114,7 +114,7 @@ e_tree_model_class_init (GtkObjectClass *klass) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (klass), GTK_SIGNAL_OFFSET (ETreeModelClass, node_inserted), - gtk_marshal_NONE__POINTER_POINTER, + e_marshal_NONE__POINTER_POINTER, GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_POINTER); e_tree_model_signals [NODE_REMOVED] = diff --git a/widgets/table/e-tree-model.h b/widgets/table/e-tree-model.h index cf4a7ac68c..dac0f85505 100644 --- a/widgets/table/e-tree-model.h +++ b/widgets/table/e-tree-model.h @@ -27,9 +27,9 @@ #include <gdk-pixbuf/gdk-pixbuf.h> #include <gtk/gtkobject.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS + +G_BEGIN_DECLS #define E_TREE_MODEL_TYPE (e_tree_model_get_type ()) @@ -220,6 +220,7 @@ void e_tree_model_node_deleted (ETreeModel *tree_model, void e_tree_model_node_request_collapse (ETreeModel *tree_model, ETreePath deleted_node); -END_GNOME_DECLS + +G_END_DECLS #endif /* _E_TREE_MODEL_H */ diff --git a/widgets/table/e-tree-scrolled.c b/widgets/table/e-tree-scrolled.c index 93a5e6c702..f788a909f8 100644 --- a/widgets/table/e-tree-scrolled.c +++ b/widgets/table/e-tree-scrolled.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree-scrolled.c * Copyright 2000, 2001, Ximian, Inc. * @@ -26,10 +26,10 @@ #include <stdio.h> #include <string.h> #include <stdio.h> -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gtk/gtksignal.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include <gal/util/e-util.h> #include "e-tree-scrolled.h" @@ -187,13 +187,13 @@ ets_grab_focus (GtkWidget *widget) /* Focus handler for the scrolled ETree */ static gint -ets_focus (GtkContainer *container, GtkDirectionType direction) +ets_focus (GtkWidget *container, GtkDirectionType direction) { ETreeScrolled *ets; ets = E_TREE_SCROLLED (container); - return gtk_container_focus (GTK_CONTAINER (ets->tree), direction); + return gtk_widget_child_focus (GTK_WIDGET (ets->tree), direction); } static void @@ -213,7 +213,7 @@ e_tree_scrolled_class_init (ETreeScrolledClass *class) widget_class->grab_focus = ets_grab_focus; - container_class->focus = ets_focus; + widget_class->focus = ets_focus; gtk_object_add_arg_type ("ETreeScrolled::tree", GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_TREE); diff --git a/widgets/table/e-tree-scrolled.h b/widgets/table/e-tree-scrolled.h index c1debd0afb..b528042eed 100644 --- a/widgets/table/e-tree-scrolled.h +++ b/widgets/table/e-tree-scrolled.h @@ -27,9 +27,8 @@ #include <gal/widgets/e-scroll-frame.h> #include <gal/e-table/e-tree-model.h> #include <gal/e-table/e-tree.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TREE_SCROLLED_TYPE (e_tree_scrolled_get_type ()) #define E_TREE_SCROLLED(o) (GTK_CHECK_CAST ((o), E_TREE_SCROLLED_TYPE, ETreeScrolled)) @@ -71,7 +70,7 @@ GtkWidget *e_tree_scrolled_new_from_spec_file (ETreeModel *etm, ETree *e_tree_scrolled_get_tree (ETreeScrolled *ets); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TREE_SCROLLED_H_ */ diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c index 4e1b626259..dc1a4610d1 100644 --- a/widgets/table/e-tree-selection-model.c +++ b/widgets/table/e-tree-selection-model.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree-selection-model.c * Copyright 2000, 2001, Ximian, Inc. * @@ -635,15 +635,19 @@ etsm_destroy (GtkObject *object) etsm = E_TREE_SELECTION_MODEL (object); - etsm_real_clear (etsm); - etsm->priv->cursor_path = NULL; - drop_model(etsm); - drop_ets(etsm); + if (etsm->priv) { + etsm_real_clear (etsm); + etsm->priv->cursor_path = NULL; - g_free (etsm->priv->cursor_save_id); + drop_model(etsm); + drop_ets(etsm); + + g_free (etsm->priv->cursor_save_id); + etsm->priv->cursor_save_id = NULL; - g_free(etsm->priv); - etsm->priv = NULL; + g_free (etsm->priv); + etsm->priv = NULL; + } if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -1326,6 +1330,8 @@ e_tree_selection_model_init (ETreeSelectionModel *etsm) priv->frozen_count = 0; + priv->frozen_count = 0; + priv->tree_model_pre_change_id = 0; priv->tree_model_no_change_id = 0; @@ -1337,7 +1343,6 @@ e_tree_selection_model_init (ETreeSelectionModel *etsm) priv->tree_model_node_deleted_id = 0; priv->sorted_model_node_resorted_id = 0; - priv->selected_row = -1; priv->selected_range_end = -1; } diff --git a/widgets/table/e-tree-simple.c b/widgets/table/e-tree-simple.c index 3abea69acf..c2c8c4314f 100644 --- a/widgets/table/e-tree-simple.c +++ b/widgets/table/e-tree-simple.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree-simple.c * Copyright 2000, 2001, Ximian, Inc. * diff --git a/widgets/table/e-tree-sorted-variable.c b/widgets/table/e-tree-sorted-variable.c index f2a753222a..9fa587022f 100644 --- a/widgets/table/e-tree-sorted-variable.c +++ b/widgets/table/e-tree-sorted-variable.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree-sorted-variable.c * Copyright 2000, 2001, Ximian, Inc. * @@ -62,32 +62,40 @@ etsv_destroy (GtkObject *object) { ETreeSortedVariable *etsv = E_TREE_SORTED_VARIABLE (object); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etsv->table_model_changed_id); + if (etsv->table_model_changed_id) + gtk_signal_disconnect (GTK_OBJECT (etss->source), + etsv->table_model_changed_id); + etsv->table_model_changed_id = 0; + #if 0 gtk_signal_disconnect (GTK_OBJECT (etss->source), etsv->table_model_row_changed_id); gtk_signal_disconnect (GTK_OBJECT (etss->source), etsv->table_model_cell_changed_id); + + etsv->table_model_row_changed_id = 0; + etsv->table_model_cell_changed_id = 0; #endif - gtk_signal_disconnect (GTK_OBJECT (etsv->sort_info), - etsv->sort_info_changed_id); + if (etsv->sort_info_changed_id) + gtk_signal_disconnect (GTK_OBJECT (etsv->sort_info), + etsv->sort_info_changed_id); + etsv->sort_info_changed_id = 0; - if (etsv->sort_idle_id) { + if (etsv->sort_idle_id) g_source_remove(etsv->sort_idle_id); - } - if (etsv->insert_idle_id) { + etsv->sort_idle_id = 0; + + if (etsv->insert_idle_id) g_source_remove(etsv->insert_idle_id); - } - - etsv->table_model_changed_id = 0; - etsv->table_model_row_changed_id = 0; - etsv->table_model_cell_changed_id = 0; + etsv->insert_idle_id = 0; if (etsv->sort_info) gtk_object_unref(GTK_OBJECT(etsv->sort_info)); + etsv->sort_info = NULL; + if (etsv->full_header) gtk_object_unref(GTK_OBJECT(etsv->full_header)); + etsv->full_header = NULL; GTK_OBJECT_CLASS (etsv_parent_class)->destroy (object); } diff --git a/widgets/table/e-tree-sorted-variable.h b/widgets/table/e-tree-sorted-variable.h index 23d80eed10..7818ee8182 100644 --- a/widgets/table/e-tree-sorted-variable.h +++ b/widgets/table/e-tree-sorted-variable.h @@ -29,9 +29,8 @@ #include <gal/e-table/e-table-subset-variable.h> #include <gal/e-table/e-table-sort-info.h> #include <gal/e-table/e-table-header.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TREE_SORTED_VARIABLE_TYPE (e_tree_sorted_variable_get_type ()) #define E_TREE_SORTED_VARIABLE(o) (GTK_CHECK_CAST ((o), E_TREE_SORTED_VARIABLE_TYPE, ETreeSortedVariable)) @@ -80,6 +79,6 @@ void e_tree_sorted_variable_decrement (ETreeSortedVariable *ets, gint amount); void e_tree_sorted_variable_set_allocation (ETreeSortedVariable *ets, gint total); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TREE_SORTED_VARIABLE_H_ */ diff --git a/widgets/table/e-tree-sorted.c b/widgets/table/e-tree-sorted.c index 7069369a38..0e6cf3ebf9 100644 --- a/widgets/table/e-tree-sorted.c +++ b/widgets/table/e-tree-sorted.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree-sorted.c * Copyright 2000, 2001, Ximian, Inc. * @@ -38,8 +38,8 @@ #include <fcntl.h> #include <string.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> +#include <libxml/parser.h> +#include <libxml/xmlmemory.h> #include <gtk/gtksignal.h> #include "gal/util/e-util.h" @@ -594,6 +594,10 @@ ets_destroy (GtkObject *object) ETreeSortedPriv *priv = ets->priv; /* FIXME lots of stuff to free here */ + if (!priv) { + GTK_OBJECT_CLASS (parent_class)->destroy (object); + return; + } if (priv->root) free_path(priv->root); @@ -653,6 +657,8 @@ ets_destroy (GtkObject *object) g_free (priv); + ets->priv = NULL; + GTK_OBJECT_CLASS (parent_class)->destroy (object); } diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c index 92c33668de..201e121369 100644 --- a/widgets/table/e-tree-table-adapter.c +++ b/widgets/table/e-tree-table-adapter.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree-table-adapter.c * Copyright 2000, 2001, Ximian, Inc. * @@ -31,8 +31,8 @@ #include <string.h> #include <gtk/gtksignal.h> -#include <gnome-xml/tree.h> -#include <gnome-xml/parser.h> +#include <libxml/tree.h> +#include <libxml/parser.h> #include "gal/util/e-util.h" #include "gal/util/e-xml-utils.h" #include "e-tree-table-adapter.h" @@ -405,6 +405,11 @@ etta_destroy (GtkObject *object) { ETreeTableAdapter *etta = E_TREE_TABLE_ADAPTER (object); + if (!etta->priv) { + GTK_OBJECT_CLASS (parent_class)->destroy (object); + return; + } + if (etta->priv->source && e_tree_model_has_save_id(etta->priv->source)) { g_hash_table_foreach(etta->priv->attributes, free_string, NULL); } @@ -444,6 +449,7 @@ etta_destroy (GtkObject *object) g_free (etta->priv->map_table); g_free (etta->priv); + etta->priv = NULL; GTK_OBJECT_CLASS (parent_class)->destroy (object); } @@ -961,7 +967,7 @@ e_tree_table_adapter_save_expanded_state (ETreeTableAdapter *etta, const char *f save_expanded_state_func, &tar); - e_xml_save_file (filename, doc); + xmlSaveFile (filename, doc); xmlFreeDoc (doc); } @@ -1006,6 +1012,8 @@ e_tree_table_adapter_load_expanded_state (ETreeTableAdapter *etta, const char *f e_table_model_pre_change(E_TABLE_MODEL(etta)); + e_table_model_pre_change(E_TABLE_MODEL(etta)); + for (child = root->xmlChildrenNode; child; child = child->next) { char *id; diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index 46ff8a9f27..1dd7b8a4ad 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * e-tree.c * Copyright 2000, 2001, Ximian, Inc. * @@ -28,9 +28,9 @@ #include <stdio.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtksignal.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> -#include "gal/util/e-i18n.h" +#include <gal/util/e-i18n.h> #include <gal/util/e-util.h> #include <gal/widgets/e-canvas.h> #include <gal/widgets/e-canvas-background.h> @@ -241,7 +241,6 @@ static void et_drag_data_received(GtkWidget *widget, guint time, ETree *et); -static gint et_focus (GtkContainer *container, GtkDirectionType direction); static void scroll_off (ETree *et); static void scroll_on (ETree *et, guint scroll_direction); @@ -352,20 +351,20 @@ connect_header (ETree *e_tree, ETableState *state) e_tree->priv->structure_change_id = gtk_signal_connect (GTK_OBJECT (e_tree->priv->header), "structure_change", - search_col_change_trigger, e_tree); + GTK_SIGNAL_FUNC (search_col_change_trigger), e_tree); e_tree->priv->expansion_change_id = gtk_signal_connect (GTK_OBJECT (e_tree->priv->header), "expansion_change", - change_trigger, e_tree); + GTK_SIGNAL_FUNC (change_trigger), e_tree); if (state->sort_info) { e_tree->priv->sort_info = e_table_sort_info_duplicate(state->sort_info); e_table_sort_info_set_can_group (e_tree->priv->sort_info, FALSE); e_tree->priv->sort_info_change_id = gtk_signal_connect (GTK_OBJECT (e_tree->priv->sort_info), "sort_info_changed", - search_col_change_trigger, e_tree); + GTK_SIGNAL_FUNC (search_col_change_trigger), e_tree); e_tree->priv->group_info_change_id = gtk_signal_connect (GTK_OBJECT (e_tree->priv->sort_info), "group_info_changed", - search_col_change_trigger, e_tree); + GTK_SIGNAL_FUNC (search_col_change_trigger), e_tree); } else e_tree->priv->sort_info = NULL; @@ -379,50 +378,54 @@ et_destroy (GtkObject *object) { ETree *et = E_TREE (object); - if (et->priv->search) { - if (et->priv->search_search_id) - gtk_signal_disconnect (GTK_OBJECT (et->priv->search), - et->priv->search_search_id); - if (et->priv->search_accept_id) - gtk_signal_disconnect (GTK_OBJECT (et->priv->search), - et->priv->search_accept_id); - gtk_object_unref (GTK_OBJECT (et->priv->search)); - } + if (et->priv) { - if (et->priv->reflow_idle_id) - g_source_remove(et->priv->reflow_idle_id); - et->priv->reflow_idle_id = 0; + if (et->priv->search) { + if (et->priv->search_search_id) + gtk_signal_disconnect (GTK_OBJECT (et->priv->search), + et->priv->search_search_id); + if (et->priv->search_accept_id) + gtk_signal_disconnect (GTK_OBJECT (et->priv->search), + et->priv->search_accept_id); + gtk_object_unref (GTK_OBJECT (et->priv->search)); + } - scroll_off (et); - hover_off (et); - e_free_string_list (et->priv->expanded_list); + if (et->priv->reflow_idle_id) + g_source_remove(et->priv->reflow_idle_id); + et->priv->reflow_idle_id = 0; + + scroll_off (et); + hover_off (et); + e_free_string_list (et->priv->expanded_list); - et_disconnect_from_etta (et); + et_disconnect_from_etta (et); - gtk_object_unref (GTK_OBJECT (et->priv->etta)); - gtk_object_unref (GTK_OBJECT (et->priv->model)); - gtk_object_unref (GTK_OBJECT (et->priv->sorted)); - gtk_object_unref (GTK_OBJECT (et->priv->full_header)); - disconnect_header (et); - gtk_object_unref (GTK_OBJECT (et->priv->selection)); - if (et->priv->spec) - gtk_object_unref (GTK_OBJECT (et->priv->spec)); + gtk_object_unref (GTK_OBJECT (et->priv->etta)); + gtk_object_unref (GTK_OBJECT (et->priv->model)); + gtk_object_unref (GTK_OBJECT (et->priv->sorted)); + gtk_object_unref (GTK_OBJECT (et->priv->full_header)); + disconnect_header (et); + gtk_object_unref (GTK_OBJECT (et->priv->selection)); + if (et->priv->spec) + gtk_object_unref (GTK_OBJECT (et->priv->spec)); - if (et->priv->sorter) - gtk_object_unref (GTK_OBJECT (et->priv->sorter)); + if (et->priv->sorter) + gtk_object_unref (GTK_OBJECT (et->priv->sorter)); - if (et->priv->header_canvas) - gtk_widget_destroy (GTK_WIDGET (et->priv->header_canvas)); + if (et->priv->header_canvas) + gtk_widget_destroy (GTK_WIDGET (et->priv->header_canvas)); - if (et->priv->site) - e_tree_drag_source_unset (et); + if (et->priv->site) + e_tree_drag_source_unset (et); - gtk_widget_destroy (GTK_WIDGET (et->priv->table_canvas)); + gtk_widget_destroy (GTK_WIDGET (et->priv->table_canvas)); - g_free(et->priv); - et->priv = NULL; + g_free(et->priv); + et->priv = NULL; + } - (*parent_class->destroy)(object); + if (parent_class->destroy) + parent_class->destroy (object); } static void @@ -447,7 +450,7 @@ search_search_callback (ETreeModel *model, ETreePath path, gpointer data) const void *value; ETableCol *col = current_search_col (cb_data->et); - value = e_tree_model_value_at (model, path, col->col_idx); + value = e_tree_model_value_at (model, path, cb_data->et->priv->current_search_col->col_idx); return col->search (value, cb_data->string); } @@ -624,18 +627,18 @@ et_grab_focus (GtkWidget *widget) /* Focus handler for the ETree */ static gint -et_focus (GtkContainer *container, GtkDirectionType direction) +et_focus (GtkWidget *container, GtkDirectionType direction) { ETree *e_tree; e_tree = E_TREE (container); - if (container->focus_child) { - gtk_container_set_focus_child (container, NULL); + if (GTK_CONTAINER (container)->focus_child) { + gtk_container_set_focus_child (GTK_CONTAINER (container), NULL); return FALSE; } - return gtk_container_focus (GTK_CONTAINER (e_tree->priv->table_canvas), direction); + return gtk_widget_child_focus (GTK_WIDGET (e_tree->priv->table_canvas), direction); } static void @@ -1362,6 +1365,7 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, ETableSpecification *specification, ETableState *state) { int row = 0; + int i, col_count; if (ete) gtk_object_ref(GTK_OBJECT(ete)); @@ -1376,6 +1380,7 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, e_tree->priv->full_header = e_table_spec_to_full_header(specification, ete); connect_header (e_tree, state); + e_tree->priv->horizontal_scrolling = specification->horizontal_scrolling; e_tree->priv->model = etm; @@ -1387,7 +1392,6 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, et_connect_to_etta (e_tree); - gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); e_tree->priv->sorter = e_sorter_new(); @@ -1437,7 +1441,6 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, 0, 0); gtk_widget_pop_colormap (); - gtk_widget_pop_visual (); gtk_object_unref(GTK_OBJECT(ete)); @@ -1777,7 +1780,6 @@ et_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) case ARG_ALWAYS_SEARCH: GTK_VALUE_BOOL (*arg) = etree->priv->always_search; break; - default: break; } @@ -3040,7 +3042,7 @@ e_tree_class_init (ETreeClass *class) widget_class->grab_focus = et_grab_focus; widget_class->unrealize = et_unrealize; - container_class->focus = et_focus; + widget_class->focus = et_focus; class->cursor_change = NULL; class->cursor_activated = NULL; @@ -3068,7 +3070,7 @@ e_tree_class_init (ETreeClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, cursor_change), - gtk_marshal_NONE__INT_POINTER, + e_marshal_NONE__INT_POINTER, GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_POINTER); et_signals [CURSOR_ACTIVATED] = @@ -3076,7 +3078,7 @@ e_tree_class_init (ETreeClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, cursor_activated), - gtk_marshal_NONE__INT_POINTER, + e_marshal_NONE__INT_POINTER, GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_POINTER); et_signals [SELECTION_CHANGE] = @@ -3092,40 +3094,61 @@ e_tree_class_init (ETreeClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, double_click), - e_marshal_NONE__INT_POINTER_INT_POINTER, - GTK_TYPE_NONE, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_NONE__INT_POINTER_INT_BOXED, + GTK_TYPE_NONE, 4, GTK_TYPE_INT, + GTK_TYPE_POINTER, GTK_TYPE_INT, GDK_TYPE_EVENT); et_signals [RIGHT_CLICK] = gtk_signal_new ("right_click", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, right_click), - e_marshal_INT__INT_POINTER_INT_POINTER, - GTK_TYPE_INT, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_POINTER_INT_BOXED, + GTK_TYPE_INT, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, + GTK_TYPE_INT, GDK_TYPE_EVENT); et_signals [CLICK] = gtk_signal_new ("click", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, click), - e_marshal_INT__INT_POINTER_INT_POINTER, - GTK_TYPE_INT, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_POINTER_INT_BOXED, + GTK_TYPE_INT, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, + GTK_TYPE_INT, GDK_TYPE_EVENT); et_signals [KEY_PRESS] = gtk_signal_new ("key_press", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, key_press), - e_marshal_INT__INT_POINTER_INT_POINTER, - GTK_TYPE_INT, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_INT__INT_POINTER_INT_BOXED, + GTK_TYPE_INT, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, + GTK_TYPE_INT, GDK_TYPE_EVENT); et_signals [START_DRAG] = gtk_signal_new ("start_drag", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, start_drag), - e_marshal_NONE__INT_POINTER_INT_POINTER, - GTK_TYPE_NONE, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT); + e_marshal_NONE__INT_POINTER_INT_BOXED, + GTK_TYPE_NONE, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, + GTK_TYPE_INT, GDK_TYPE_EVENT); + + et_signals [STATE_CHANGE] = + gtk_signal_new ("state_change", + GTK_RUN_LAST, + E_OBJECT_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (ETreeClass, state_change), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + + et_signals [WHITE_SPACE_EVENT] = + gtk_signal_new ("white_space_event", + GTK_RUN_LAST, + E_OBJECT_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (ETreeClass, white_space_event), + gtk_marshal_INT__POINTER, + GTK_TYPE_INT, 1, GDK_TYPE_EVENT); et_signals [STATE_CHANGE] = gtk_signal_new ("state_change", @@ -3141,41 +3164,41 @@ e_tree_class_init (ETreeClass *class) E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, white_space_event), gtk_marshal_INT__POINTER, - GTK_TYPE_INT, 1, GTK_TYPE_GDK_EVENT); + GTK_TYPE_INT, 1, GDK_TYPE_EVENT); et_signals[TREE_DRAG_BEGIN] = gtk_signal_new ("tree_drag_begin", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_begin), - e_marshal_NONE__INT_POINTER_INT_POINTER, + e_marshal_NONE__INT_POINTER_INT_BOXED, GTK_TYPE_NONE, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT); + GDK_TYPE_DRAG_CONTEXT); et_signals[TREE_DRAG_END] = gtk_signal_new ("tree_drag_end", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_end), - e_marshal_NONE__INT_POINTER_INT_POINTER, + e_marshal_NONE__INT_POINTER_INT_BOXED, GTK_TYPE_NONE, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT); + GDK_TYPE_DRAG_CONTEXT); et_signals[TREE_DRAG_DATA_GET] = gtk_signal_new ("tree_drag_data_get", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_data_get), - e_marshal_NONE__INT_POINTER_INT_POINTER_POINTER_UINT_UINT, + e_marshal_NONE__INT_POINTER_INT_OBJECT_BOXED_UINT_UINT, GTK_TYPE_NONE, 7, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_SELECTION_DATA, GTK_TYPE_UINT, GTK_TYPE_UINT); @@ -3184,36 +3207,36 @@ e_tree_class_init (ETreeClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_data_delete), - e_marshal_NONE__INT_POINTER_INT_POINTER, + e_marshal_NONE__INT_POINTER_INT_OBJECT, GTK_TYPE_NONE, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT); + GDK_TYPE_DRAG_CONTEXT); et_signals[TREE_DRAG_LEAVE] = gtk_signal_new ("tree_drag_leave", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_leave), - e_marshal_NONE__INT_POINTER_INT_POINTER_UINT, + e_marshal_NONE__INT_POINTER_INT_OBJECT_UINT, GTK_TYPE_NONE, 5, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_UINT); et_signals[TREE_DRAG_MOTION] = gtk_signal_new ("tree_drag_motion", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_motion), - e_marshal_BOOL__INT_POINTER_INT_POINTER_INT_INT_UINT, + e_marshal_BOOLEAN__INT_POINTER_INT_OBJECT_INT_INT_UINT, GTK_TYPE_BOOL, 7, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_UINT); @@ -3222,12 +3245,12 @@ e_tree_class_init (ETreeClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_drop), - e_marshal_BOOL__INT_POINTER_INT_POINTER_INT_INT_UINT, + e_marshal_BOOLEAN__INT_POINTER_INT_OBJECT_INT_INT_UINT, GTK_TYPE_BOOL, 7, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_UINT); @@ -3236,12 +3259,12 @@ e_tree_class_init (ETreeClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_data_received), - e_marshal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_UINT_UINT, + e_marshal_NONE__INT_POINTER_INT_OBJECT_INT_INT_BOXED_UINT_UINT, GTK_TYPE_NONE, 9, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, - GTK_TYPE_GDK_DRAG_CONTEXT, + GDK_TYPE_DRAG_CONTEXT, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_SELECTION_DATA, @@ -3257,8 +3280,9 @@ e_tree_class_init (ETreeClass *class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETreeClass, set_scroll_adjustments), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT); + e_marshal_NONE__POINTER_POINTER, + GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, + GTK_TYPE_ADJUSTMENT); gtk_object_add_arg_type ("ETree::length_threshold", GTK_TYPE_INT, GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD); diff --git a/widgets/table/e-tree.h b/widgets/table/e-tree.h index b877b00d1f..c66311b1c3 100644 --- a/widgets/table/e-tree.h +++ b/widgets/table/e-tree.h @@ -24,10 +24,10 @@ #ifndef _E_TREE_H_ #define _E_TREE_H_ +#include <gtk/gtkdnd.h> #include <gtk/gtktable.h> -#include <gnome-xml/tree.h> -#include <libgnomeui/gnome-canvas.h> - +#include <libxml/tree.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gal/widgets/e-printable.h> #include <gal/e-table/e-table-extras.h> @@ -35,7 +35,6 @@ #include <gal/e-table/e-table-state.h> #include <gal/e-table/e-tree-model.h> #include <gal/e-table/e-tree-table-adapter.h> -#include <libgnome/gnome-defs.h> #define E_TREE_USE_TREE_SELECTION @@ -43,7 +42,7 @@ #include <gal/e-table/e-tree-selection-model.h> #endif -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TREE_TYPE (e_tree_get_type ()) #define E_TREE(o) (GTK_CHECK_CAST ((o), E_TREE_TYPE, ETree)) @@ -305,7 +304,7 @@ gboolean e_tree_find_next (ETree *et, void e_tree_right_click_up (ETree *et); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_TREE_H_ */ diff --git a/widgets/table/table-test.c b/widgets/table/table-test.c index 20faa35e57..fe211e9d21 100644 --- a/widgets/table/table-test.c +++ b/widgets/table/table-test.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * table-test.c * Copyright 1999, 2000, 2001, Ximian, Inc. * diff --git a/widgets/table/test-check.c b/widgets/table/test-check.c index 1b717009ef..2c0c4f72e9 100644 --- a/widgets/table/test-check.c +++ b/widgets/table/test-check.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * test-check.c * Copyright 2000, 2001, Ximian, Inc. * @@ -160,7 +160,6 @@ check_test (void) GdkPixbuf *pixbuf; GnomeCanvasItem *item; - gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); e_table_model = e_table_simple_new ( diff --git a/widgets/table/test-cols.c b/widgets/table/test-cols.c index d6bbe4d2be..6fd0059f4b 100644 --- a/widgets/table/test-cols.c +++ b/widgets/table/test-cols.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * test-cols.c * Copyright 2000, 2001, Ximian, Inc. * @@ -159,7 +159,6 @@ multi_cols_test (void) ECell *cell_left_just, *cell_image_toggle; GnomeCanvasItem *item; - gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); e_table_model = e_table_simple_new ( diff --git a/widgets/table/test-table.c b/widgets/table/test-table.c index 55a432e995..9ef77c6c2d 100644 --- a/widgets/table/test-table.c +++ b/widgets/table/test-table.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * test-table.c * Copyright 2000, 2001, Ximian, Inc. * diff --git a/widgets/text/e-completion-match.c b/widgets/text/e-completion-match.c index e61362a561..0da197d1fe 100644 --- a/widgets/text/e-completion-match.c +++ b/widgets/text/e-completion-match.c @@ -23,7 +23,6 @@ #include <config.h> #include <string.h> -#include <gal/unicode/gunicode.h> #include <gal/widgets/e-unicode.h> #include "e-completion-match.h" diff --git a/widgets/text/e-completion-match.h b/widgets/text/e-completion-match.h index ba93e53172..f2773ee094 100644 --- a/widgets/text/e-completion-match.h +++ b/widgets/text/e-completion-match.h @@ -25,10 +25,9 @@ #define __E_COMPLETION_MATCH_H__ #include <glib.h> -#include <libgnome/gnome-defs.h> #include <gtk/gtkwidget.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS typedef struct _ECompletionMatch ECompletionMatch; @@ -63,7 +62,7 @@ ECompletionMatch *e_completion_match_new (const gchar *match_text, co -END_GNOME_DECLS +G_END_DECLS #endif /* __E_COMPLETION_MATCH_H__ */ diff --git a/widgets/text/e-completion-view.c b/widgets/text/e-completion-view.c index 067f89aec8..42b2a53876 100644 --- a/widgets/text/e-completion-view.c +++ b/widgets/text/e-completion-view.c @@ -90,6 +90,7 @@ e_completion_view_paint (GtkWidget *widget, GdkRectangle *area) } +#if 0 static void e_completion_view_draw (GtkWidget *widget, GdkRectangle *area) { @@ -109,6 +110,7 @@ e_completion_view_draw (GtkWidget *widget, GdkRectangle *area) gtk_widget_draw (bin->child, &child_area); } } +#endif static gint e_completion_view_expose_event (GtkWidget *widget, GdkEventExpose *event) @@ -276,7 +278,6 @@ e_completion_view_class_init (ECompletionViewClass *klass) object_class->destroy = e_completion_view_destroy; widget_class->key_press_event = e_completion_view_local_key_press_handler; - widget_class->draw = e_completion_view_draw; widget_class->expose_event = e_completion_view_expose_event; widget_class->size_request = e_completion_view_size_request; widget_class->size_allocate = e_completion_view_size_allocate; @@ -297,16 +298,19 @@ e_completion_view_destroy (GtkObject *object) e_completion_view_disconnect (cv); e_completion_view_clear_choices (cv); - g_ptr_array_free (cv->choices, TRUE); + if (cv->choices) + g_ptr_array_free (cv->choices, TRUE); + cv->choices = NULL; if (cv->key_widget) { gtk_signal_disconnect (GTK_OBJECT (cv->key_widget), cv->key_signal_id); gtk_object_unref (GTK_OBJECT (cv->key_widget)); + cv->key_widget = NULL; } if (cv->completion) gtk_object_unref (GTK_OBJECT (cv->completion)); - + cv->completion = NULL; if (parent_class->destroy) (parent_class->destroy) (object); diff --git a/widgets/text/e-completion-view.h b/widgets/text/e-completion-view.h index f58050a564..f869b92725 100644 --- a/widgets/text/e-completion-view.h +++ b/widgets/text/e-completion-view.h @@ -25,12 +25,11 @@ #ifndef E_COMPLETION_VIEW_H #define E_COMPLETION_VIEW_H -#include <libgnome/gnome-defs.h> #include <gtk/gtk.h> #include <gal/e-table/e-table.h> #include "e-completion.h" -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_COMPLETION_VIEW_TYPE (e_completion_view_get_type ()) #define E_COMPLETION_VIEW(o) (GTK_CHECK_CAST ((o), E_COMPLETION_VIEW_TYPE, ECompletionView)) @@ -97,7 +96,7 @@ void e_completion_view_set_uncomplete_key (ECompletionView *cv, gint keyva void e_completion_view_set_width (ECompletionView *cv, gint width); void e_completion_view_set_editable (ECompletionView *cv, gboolean); -END_GNOME_DECLS +G_END_DECLS #endif /* E_COMPLETION_H */ diff --git a/widgets/text/e-completion.c b/widgets/text/e-completion.c index 975bc9e112..f96e4cb258 100644 --- a/widgets/text/e-completion.c +++ b/widgets/text/e-completion.c @@ -26,6 +26,7 @@ #include <string.h> #include <stdio.h> #include <gtk/gtk.h> +#include <gal/util/e-util.h> #include "e-completion.h" #include "gal/util/e-util.h" @@ -110,7 +111,7 @@ e_completion_class_init (ECompletionClass *klass) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ECompletionClass, request_completion), - gtk_marshal_NONE__POINTER_INT_INT, + e_marshal_NONE__POINTER_INT_INT, GTK_TYPE_NONE, 3, GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_INT); @@ -119,7 +120,7 @@ e_completion_class_init (ECompletionClass *klass) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ECompletionClass, begin_completion), - gtk_marshal_NONE__POINTER_INT_INT, + e_marshal_NONE__POINTER_INT_INT, GTK_TYPE_NONE, 3, GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_INT); @@ -189,17 +190,19 @@ e_completion_destroy (GtkObject *object) { ECompletion *complete = E_COMPLETION (object); - g_free (complete->priv->search_text); - complete->priv->search_text = NULL; + if (complete->priv) { + g_free (complete->priv->search_text); + complete->priv->search_text = NULL; - e_completion_clear_matches (complete); - e_completion_clear_search_stack (complete); + e_completion_clear_matches (complete); + e_completion_clear_search_stack (complete); - g_ptr_array_free (complete->priv->matches, TRUE); - complete->priv->matches = NULL; + g_ptr_array_free (complete->priv->matches, TRUE); + complete->priv->matches = NULL; - g_free (complete->priv); - complete->priv = NULL; + g_free (complete->priv); + complete->priv = NULL; + } if (parent_class->destroy) (parent_class->destroy) (object); @@ -393,7 +396,7 @@ e_completion_begin_search (ECompletion *complete, const gchar *text, gint pos, g g_return_if_fail (E_IS_COMPLETION (complete)); g_return_if_fail (text != NULL); - klass = E_COMPLETION_CLASS (GTK_OBJECT (complete)->klass); + klass = E_COMPLETION_CLASS (GTK_OBJECT_GET_CLASS (complete)); if (!complete->priv->searching && complete->priv->done_search) { diff --git a/widgets/text/e-completion.h b/widgets/text/e-completion.h index 9e7b5ab4b3..2f228ac130 100644 --- a/widgets/text/e-completion.h +++ b/widgets/text/e-completion.h @@ -25,11 +25,10 @@ #ifndef E_COMPLETION_H #define E_COMPLETION_H -#include <libgnome/gnome-defs.h> #include <gtk/gtkobject.h> #include "e-completion-match.h" -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_COMPLETION_TYPE (e_completion_get_type ()) #define E_COMPLETION(o) (GTK_CHECK_CAST ((o), E_COMPLETION_TYPE, ECompletion)) @@ -96,7 +95,7 @@ void e_completion_lost_match (ECompletion *comp, ECompletionMatch *); void e_completion_clear (ECompletion *comp); void e_completion_end_search (ECompletion *comp); -END_GNOME_DECLS +G_END_DECLS #endif /* E_COMPLETION_H */ diff --git a/widgets/text/e-entry-test.c b/widgets/text/e-entry-test.c index 94f490113b..5dc78364d4 100644 --- a/widgets/text/e-entry-test.c +++ b/widgets/text/e-entry-test.c @@ -21,10 +21,11 @@ * 02111-1307, USA. */ -#include "config.h" +#include <config.h> #include <gnome.h> #include "e-entry.h" +#include <gal/util/e-i18n.h> static void destroy_callback(GtkWidget *app, gpointer data) { diff --git a/widgets/text/e-entry.c b/widgets/text/e-entry.c index 6e4b6a1949..bb1c8266f6 100644 --- a/widgets/text/e-entry.c +++ b/widgets/text/e-entry.c @@ -28,14 +28,12 @@ #include <stdio.h> #include <string.h> #include <ctype.h> -#ifdef HAVE_ALLOCA_H -#include <alloca.h> -#endif #include <stdio.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtksignal.h> -#include <gnome-xml/parser.h> -#include <libgnomeui/gnome-canvas.h> +#include <gtk/gtktypebuiltins.h> +#include <libxml/parser.h> +#include <libgnomecanvas/gnome-canvas.h> #include "gal/util/e-util.h" #include "gal/widgets/e-canvas.h" #include "gal/widgets/e-canvas-utils.h" @@ -177,12 +175,12 @@ canvas_size_request (GtkWidget *widget, GtkRequisition *requisition, g_return_if_fail (requisition != NULL); if (entry->priv->draw_borders) { - xthick = 2 * widget->style->klass->xthickness; - ythick = 2 * widget->style->klass->ythickness; + xthick = 2 * widget->style->xthickness; + ythick = 2 * widget->style->ythickness; } else { xthick = ythick = 0; } - + if (entry->priv->emulate_label_resize) { gdouble width; gtk_object_get (GTK_OBJECT (entry->item), @@ -198,8 +196,8 @@ canvas_size_request (GtkWidget *widget, GtkRequisition *requisition, d(g_print("%s: width = %d\n", __FUNCTION__, requisition->width)); - requisition->height = (2 + widget->style->font->ascent + - widget->style->font->descent + + requisition->height = (2 + gtk_style_get_font (widget->style)->ascent + + gtk_style_get_font (widget->style)->descent + ythick); } @@ -278,6 +276,8 @@ e_entry_init (GtkObject *object) entry->priv->emulate_label_resize = FALSE; + entry->priv->emulate_label_resize = FALSE; + entry->canvas = GNOME_CANVAS (e_canvas_new ()); gtk_signal_connect (GTK_OBJECT (entry->canvas), @@ -904,7 +904,7 @@ et_get_arg (GtkObject *o, GtkArg *arg, guint arg_id) case ARG_JUSTIFICATION: gtk_object_get(item, - "justification", >K_VALUE_ENUM (*arg), + "justification", >K_VALUE_INT (*arg), NULL); break; @@ -1061,7 +1061,7 @@ et_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) break; case ARG_JUSTIFICATION: - entry->priv->justification = GTK_VALUE_ENUM (*arg); + entry->priv->justification = GTK_VALUE_INT (*arg); gtk_object_get(item, "clip_width", &width, "clip_height", &height, @@ -1071,8 +1071,8 @@ et_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) xthick = 0; ythick = 0; } else { - xthick = widget->style->klass->xthickness; - ythick = widget->style->klass->ythickness; + xthick = widget->style->xthickness; + ythick = widget->style->ythickness; } switch (entry->priv->justification) { @@ -1210,25 +1210,27 @@ e_entry_destroy (GtkObject *object) { EEntry *entry = E_ENTRY (object); - if (entry->priv->completion_delay_tag) - gtk_timeout_remove (entry->priv->completion_delay_tag); + if (entry->priv) { + if (entry->priv->completion_delay_tag) + gtk_timeout_remove (entry->priv->completion_delay_tag); - if (entry->priv->completion) - gtk_object_unref (GTK_OBJECT (entry->priv->completion)); - if (entry->priv->completion_view_popup) { - gtk_widget_destroy (GTK_WIDGET (entry->priv->completion_view_popup)); - gtk_object_unref (GTK_OBJECT (entry->priv->completion_view_popup)); - } - g_free (entry->priv->pre_browse_text); + if (entry->priv->completion) + gtk_object_unref (GTK_OBJECT (entry->priv->completion)); + if (entry->priv->completion_view_popup) { + gtk_widget_destroy (GTK_WIDGET (entry->priv->completion_view_popup)); + gtk_object_unref (GTK_OBJECT (entry->priv->completion_view_popup)); + } + g_free (entry->priv->pre_browse_text); - if (entry->priv->changed_since_keypress_tag) - gtk_timeout_remove (entry->priv->changed_since_keypress_tag); + if (entry->priv->changed_since_keypress_tag) + gtk_timeout_remove (entry->priv->changed_since_keypress_tag); - if (entry->priv->ptr_grab) - gdk_pointer_ungrab (GDK_CURRENT_TIME); + if (entry->priv->ptr_grab) + gdk_pointer_ungrab (GDK_CURRENT_TIME); - g_free (entry->priv); - entry->priv = NULL; + g_free (entry->priv); + entry->priv = NULL; + } if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -1290,7 +1292,7 @@ e_entry_class_init (GtkObjectClass *object_class) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (EEntryClass, popup), - gtk_marshal_NONE__POINTER_INT, + e_marshal_NONE__POINTER_INT, GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_INT); e_entry_signals[E_ENTRY_COMPLETION_POPUP] = @@ -1315,17 +1317,17 @@ e_entry_class_init (GtkObjectClass *object_class) gtk_object_add_arg_type ("EEntry::fontset", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONTSET); gtk_object_add_arg_type ("EEntry::font_gdk", - GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE, ARG_FONT_GDK); + GDK_TYPE_FONT, GTK_ARG_READWRITE, ARG_FONT_GDK); gtk_object_add_arg_type ("EEntry::justification", GTK_TYPE_JUSTIFICATION, GTK_ARG_READWRITE, ARG_JUSTIFICATION); gtk_object_add_arg_type ("EEntry::fill_color", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FILL_COLOR); gtk_object_add_arg_type ("EEntry::fill_color_gdk", - GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_FILL_COLOR_GDK); + GDK_TYPE_COLOR, GTK_ARG_READWRITE, ARG_FILL_COLOR_GDK); gtk_object_add_arg_type ("EEntry::fill_color_rgba", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_FILL_COLOR_RGBA); gtk_object_add_arg_type ("EEntry::fill_stipple", - GTK_TYPE_GDK_WINDOW, GTK_ARG_READWRITE, ARG_FILL_STIPPLE); + GDK_TYPE_WINDOW, GTK_ARG_READWRITE, ARG_FILL_STIPPLE); gtk_object_add_arg_type ("EEntry::editable", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE); gtk_object_add_arg_type ("EEntry::use_ellipsis", diff --git a/widgets/text/e-entry.h b/widgets/text/e-entry.h index bd57e862a8..1e073a87e8 100644 --- a/widgets/text/e-entry.h +++ b/widgets/text/e-entry.h @@ -25,15 +25,13 @@ #ifndef _E_ENTRY_H_ #define _E_ENTRY_H_ -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gtk/gtktable.h> -#include <gnome-xml/tree.h> +#include <libxml/tree.h> #include <gal/e-text/e-text.h> #include "e-completion.h" -#include <libgnome/gnome-defs.h> - -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_ENTRY_TYPE (e_entry_get_type ()) #define E_ENTRY(o) (GTK_CHECK_CAST ((o), E_ENTRY_TYPE, EEntry)) @@ -84,6 +82,6 @@ void e_entry_enable_completion_full (EEntry *entry, ECompletion *complet EEntryCompletionHandler handler); gboolean e_entry_completion_popup_is_visible (EEntry *entry); -END_GNOME_DECLS +G_END_DECLS #endif /* _E_ENTRY_H_ */ diff --git a/widgets/text/e-table-text-model.c b/widgets/text/e-table-text-model.c index 6b195136f2..cd47f0ff43 100644 --- a/widgets/text/e-table-text-model.c +++ b/widgets/text/e-table-text-model.c @@ -122,13 +122,16 @@ e_table_text_model_destroy (GtkObject *object) if (model->cell_changed_signal_id) gtk_signal_disconnect (GTK_OBJECT(model->model), model->cell_changed_signal_id); + model->cell_changed_signal_id = 0; if (model->row_changed_signal_id) gtk_signal_disconnect (GTK_OBJECT(model->model), model->row_changed_signal_id); + model->row_changed_signal_id = 0; if (model->model) gtk_object_unref (GTK_OBJECT(model->model)); + model->model = NULL; if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); diff --git a/widgets/text/e-table-text-model.h b/widgets/text/e-table-text-model.h index 4f55b45ccf..1c1a88dd47 100644 --- a/widgets/text/e-table-text-model.h +++ b/widgets/text/e-table-text-model.h @@ -26,10 +26,8 @@ #include <gal/e-text/e-text-model.h> #include <gal/e-table/e-table-model.h> -#include <libgnome/gnome-defs.h> - -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TYPE_TABLE_TEXT_MODEL (e_table_text_model_get_type ()) #define E_TABLE_TEXT_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TABLE_TEXT_MODEL, ETableTextModel)) @@ -61,6 +59,6 @@ struct _ETableTextModelClass { GtkType e_table_text_model_get_type (void); ETableTextModel *e_table_text_model_new (ETableModel *table_model, int row, int model_col); -END_GNOME_DECLS +G_END_DECLS #endif diff --git a/widgets/text/e-text-model-test.c b/widgets/text/e-text-model-test.c index c364b852c6..4913b7774e 100644 --- a/widgets/text/e-text-model-test.c +++ b/widgets/text/e-text-model-test.c @@ -67,10 +67,8 @@ main (int argc, gchar **argv) for (i=0; i<2; ++i) { win[i] = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); canvas[i] = e_canvas_new (); - gtk_widget_pop_visual (); gtk_widget_pop_colormap (); item[i] = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas[i])), diff --git a/widgets/text/e-text-model-uri.c b/widgets/text/e-text-model-uri.c index 765faa05ca..7292d2954e 100644 --- a/widgets/text/e-text-model-uri.c +++ b/widgets/text/e-text-model-uri.c @@ -116,7 +116,6 @@ e_text_model_uri_destroy (GtkObject *object) g_free (iter->data); g_list_free (model_uri->uris); model_uri->uris = NULL; - if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -345,7 +344,7 @@ e_text_model_uri_activate_nth_object (ETextModel *model, gint i) objectify_idle_flush (E_TEXT_MODEL_URI (model)); obj_str = e_text_model_strdup_nth_object (model, i); - gnome_url_show (obj_str); + gnome_url_show (obj_str, NULL); g_free (obj_str); } diff --git a/widgets/text/e-text-model-uri.h b/widgets/text/e-text-model-uri.h index a4b2f9f80f..9293a8f63f 100644 --- a/widgets/text/e-text-model-uri.h +++ b/widgets/text/e-text-model-uri.h @@ -25,9 +25,8 @@ #define E_TEXT_MODEL_URI_H #include <gal/e-text/e-text-model.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TYPE_TEXT_MODEL_URI (e_text_model_get_type ()) #define E_TEXT_MODEL_URI(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TEXT_MODEL_URI, ETextModelURI)) @@ -52,6 +51,6 @@ struct _ETextModelURIClass { GtkType e_text_model_uri_get_type (void); ETextModel *e_text_model_uri_new (void); -END_GNOME_DECLS +G_END_DECLS #endif diff --git a/widgets/text/e-text-model.c b/widgets/text/e-text-model.c index da8644570b..d761f8e193 100644 --- a/widgets/text/e-text-model.c +++ b/widgets/text/e-text-model.c @@ -27,11 +27,12 @@ #include <ctype.h> #include <string.h> #include <gtk/gtksignal.h> +#include <gal/util/e-util.h> #include "e-text-model-repos.h" #include "e-text-model.h" #include "gal/util/e-util.h" -#define CLASS(obj) (E_TEXT_MODEL_CLASS (GTK_OBJECT (obj)->klass)) +#define CLASS(obj) (E_TEXT_MODEL_CLASS (GTK_OBJECT_GET_CLASS (obj))) #define MAX_LENGTH (2047) @@ -121,7 +122,7 @@ e_text_model_class_init (ETextModelClass *klass) GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETextModelClass, reposition), - gtk_marshal_NONE__POINTER_POINTER, + e_marshal_NONE__POINTER_POINTER, GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_POINTER); @@ -186,10 +187,12 @@ e_text_model_destroy (GtkObject *object) model = E_TEXT_MODEL (object); - g_free (model->priv->text); + if (model->priv) { + g_free (model->priv->text); - g_free (model->priv); - model->priv = NULL; + g_free (model->priv); + model->priv = NULL; + } if (GTK_OBJECT_CLASS (parent_class)->destroy) GTK_OBJECT_CLASS (parent_class)->destroy (object); diff --git a/widgets/text/e-text-model.h b/widgets/text/e-text-model.h index a3b1caa415..8b5c7aab23 100644 --- a/widgets/text/e-text-model.h +++ b/widgets/text/e-text-model.h @@ -26,9 +26,8 @@ #include <glib.h> #include <gtk/gtkobject.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS #define E_TYPE_TEXT_MODEL (e_text_model_get_type ()) #define E_TEXT_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TEXT_MODEL, ETextModel)) @@ -114,6 +113,6 @@ void e_text_model_activate_nth_object (ETextModel *model, gint n); -END_GNOME_DECLS +G_END_DECLS #endif diff --git a/widgets/text/e-text-test.c b/widgets/text/e-text-test.c index 39572905c8..45b39d3352 100644 --- a/widgets/text/e-text-test.c +++ b/widgets/text/e-text-test.c @@ -105,10 +105,8 @@ main (int argc, gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (quit_cb), NULL); - gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); canvas = e_canvas_new (); - gtk_widget_pop_visual (); gtk_widget_pop_colormap (); scroller = gtk_scrolled_window_new (NULL, NULL); vbox = gtk_vbox_new (FALSE, 2); diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index 6275235c11..abaa788a98 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -46,8 +46,10 @@ #include <gtk/gtkmain.h> #include <gtk/gtkselection.h> #include <gtk/gtkwindow.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <gtk/gtktypebuiltins.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> +#include "gal/util/e-util.h" #include "gal/widgets/e-canvas.h" #include "gal/widgets/e-canvas-utils.h" #include "gal/widgets/e-unicode.h" @@ -69,7 +71,7 @@ enum { E_TEXT_LAST_SIGNAL }; -static guint signals[E_TEXT_LAST_SIGNAL] = { 0 }; +static GQuark e_text_signals[E_TEXT_LAST_SIGNAL] = { 0 }; @@ -205,35 +207,48 @@ e_text_destroy (GtkObject *object) text = E_TEXT (object); - if (text->tooltip_owner) { + if (text->tooltip_owner) e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas)); - } + text->tooltip_owner = 0; if (text->model_changed_signal_id) gtk_signal_disconnect (GTK_OBJECT (text->model), text->model_changed_signal_id); + text->model_changed_signal_id = 0; if (text->model_repos_signal_id) gtk_signal_disconnect (GTK_OBJECT (text->model), text->model_repos_signal_id); + text->model_repos_signal_id = 0; if (text->model) gtk_object_unref(GTK_OBJECT(text->model)); + text->model = NULL; if (text->tep_command_id) gtk_signal_disconnect(GTK_OBJECT(text->tep), text->tep_command_id); + text->tep_command_id = 0; if (text->tep) gtk_object_unref (GTK_OBJECT(text->tep)); + text->tep = NULL; if (text->invisible) gtk_object_unref (GTK_OBJECT(text->invisible)); + text->invisible = NULL; g_free (text->lines); + text->lines = NULL; + g_free (text->primary_selection); + text->primary_selection = NULL; + g_free (text->clipboard_selection); + text->clipboard_selection = NULL; + g_free (text->revert); + text->revert = NULL; if (text->font) e_font_unref (text->font); @@ -246,6 +261,7 @@ e_text_destroy (GtkObject *object) if (text->stipple) gdk_bitmap_unref (text->stipple); + text->stipple = NULL; if (text->timeout_id) { g_source_remove(text->timeout_id); @@ -293,7 +309,7 @@ e_text_text_model_changed (ETextModel *model, EText *text) e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(text)); gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (text)); - gtk_signal_emit (GTK_OBJECT (text), signals[E_TEXT_CHANGED]); + gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_CHANGED]); } static void @@ -643,6 +659,9 @@ text_draw_with_objects (ETextModel *model, if (text == NULL) return; + if (text == NULL) + return; + while (*text && numbytes > 0) { gint obj_num = -1; @@ -682,7 +701,7 @@ text_draw_with_objects (ETextModel *model, typedef void (*LineSplitterFn) (int line_num, const char *start, int length, gpointer user_data); -#define IS_BREAK_CHAR(break_chars, c) (g_unichar_isspace (c) || ((break_chars) && g_utf8_strchr ((break_chars), (c)))) +#define IS_BREAK_CHAR(break_chars, c) (g_unichar_isspace (c) || ((break_chars) && g_utf8_strchr ((break_chars), -1, (c)))) static gint line_splitter (ETextModel *model, EFont *font, EFontStyle style, @@ -773,21 +792,9 @@ line_split_cb (int line_num, const char *start, int length, gpointer user_data) static void split_into_lines (EText *text) { - double clip_width; - - if (text->text == NULL) - return; - /* Free old array of lines */ e_text_free_lines (text); - clip_width = text->clip_width; - if (clip_width >= 0 && text->draw_borders) { - clip_width -= 6; - if (clip_width < 0) - clip_width = 0; - } - /* First, count the number of lines */ text->num_lines = line_splitter (text->model, text->font, text->style, text->break_characters, @@ -883,7 +890,7 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) e_text_free_lines(text); text->text = e_text_model_get_text(text->model); - gtk_signal_emit (GTK_OBJECT (text), signals[E_TEXT_CHANGED]); + gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_CHANGED]); text->needs_split_into_lines = 1; needs_reflow = 1; @@ -1004,13 +1011,13 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) break; case ARG_ANCHOR: - text->anchor = GTK_VALUE_ENUM (*arg); + text->anchor = GTK_VALUE_INT (*arg); text->needs_recalc_bounds = 1; needs_update = 1; break; case ARG_JUSTIFICATION: - text->justification = GTK_VALUE_ENUM (*arg); + text->justification = GTK_VALUE_INT (*arg); text->needs_redraw = 1; needs_update = 1; break; @@ -1205,8 +1212,13 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) } if (color_changed) { +#ifndef NO_WARNINGS +#warning Color stuff ... +#endif +#if 0 if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(item)) gdk_color_context_query_color (item->canvas->cc, &color); +#endif text->color = color; @@ -1228,7 +1240,6 @@ static void e_text_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) { EText *text; - GdkColor *color; text = E_TEXT (object); @@ -1259,11 +1270,11 @@ e_text_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) break; case ARG_ANCHOR: - GTK_VALUE_ENUM (*arg) = text->anchor; + GTK_VALUE_INT (*arg) = text->anchor; break; case ARG_JUSTIFICATION: - GTK_VALUE_ENUM (*arg) = text->justification; + GTK_VALUE_INT (*arg) = text->justification; break; case ARG_CLIP_WIDTH: @@ -1291,9 +1302,7 @@ e_text_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) break; case ARG_FILL_COLOR_GDK: - color = g_new (GdkColor, 1); - *color = text->color; - GTK_VALUE_BOXED (*arg) = color; + GTK_VALUE_BOXED (*arg) = gdk_color_copy (&text->color); break; case ARG_FILL_COLOR_RGBA: @@ -1510,14 +1519,19 @@ e_text_realize (GnomeCanvasItem *item) (* parent_class->realize) (item); text->gc = gdk_gc_new (item->canvas->layout.bin_window); +#ifndef NO_WARNINGS +#warning Color brokenness ... +#endif +#if 0 gdk_color_context_query_color (item->canvas->cc, &text->color); gdk_gc_set_foreground (text->gc, &text->color); +#endif text->i_cursor = gdk_cursor_new (GDK_XTERM); text->default_cursor = gdk_cursor_new (GDK_LEFT_PTR); if (text->font == NULL) { - gdk_font_ref (GTK_WIDGET (item->canvas)->style->font); - text->font = e_font_from_gdk_font (GTK_WIDGET (item->canvas)->style->font); + gdk_font_ref (gtk_style_get_font (GTK_WIDGET (item->canvas)->style)); + text->font = e_font_from_gdk_font (gtk_style_get_font (GTK_WIDGET (item->canvas)->style)); } } @@ -1732,7 +1746,7 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, * me as to whether it should be: * thiswidth + 2 or thiswidth + 1. */ - gtk_paint_focus (widget->style, drawable, + gtk_paint_focus (widget->style, drawable, GTK_STATE_NORMAL, NULL, widget, "entry", thisx, thisy, thiswidth - 1, thisheight - 1); } @@ -1742,10 +1756,10 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gtk_paint_flat_box (widget->style, drawable, GTK_WIDGET_STATE(widget), GTK_SHADOW_NONE, NULL, widget, "entry_bg", - thisx + widget->style->klass->xthickness, - thisy + widget->style->klass->ythickness, - thiswidth - widget->style->klass->xthickness * 2, - thisheight - widget->style->klass->ythickness * 2); + thisx + widget->style->xthickness, + thisy + widget->style->ythickness, + thiswidth - widget->style->xthickness * 2, + thisheight - widget->style->ythickness * 2); } } if (text->draw_button) { @@ -1801,8 +1815,8 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, } if (GTK_WIDGET_CAN_DEFAULT (widget)) { - thisx += widget->style->klass->xthickness; - thisy += widget->style->klass->ythickness; + thisx += widget->style->xthickness; + thisy += widget->style->ythickness; thiswidth -= 2 * thisx + default_spacing; thisheight -= 2 * thisy + default_spacing; thisx += (1 + default_spacing) / 2; @@ -1835,14 +1849,13 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, thiswidth += 2; thisheight += 2; - gtk_paint_focus (widget->style, widget->window, + gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget), &area, widget, "button", thisx + xoff, thisy + yoff, thiswidth - 1, thisheight - 1); } } } - if (!text->text || !text->font) return; @@ -2503,9 +2516,10 @@ static gboolean tooltip_event(GtkWidget *tooltip, GdkEvent *event, EText *text) { gint ret_val = FALSE; - if (GTK_OBJECT_DESTROYED (text)) { + + if (!text->model) return FALSE; - } + switch (event->type) { case GDK_LEAVE_NOTIFY: e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas)); @@ -2751,6 +2765,35 @@ start_editing (EText *text) g_timer_start(text->timer); } +void +e_text_stop_editing (EText *text) +{ + if (!text->editing) + return; + + g_free (text->revert); + text->revert = NULL; + + text->editing = FALSE; + if ( (!text->default_cursor_shown) && (!text->draw_borders) ) { + gdk_window_set_cursor (GTK_WIDGET (GNOME_CANVAS_ITEM (text)->canvas)->window, text->default_cursor); + text->default_cursor_shown = TRUE; + } + if (text->timer) { + g_timer_stop(text->timer); + g_timer_destroy(text->timer); + text->timer = NULL; + } +} + +void +e_text_cancel_editing (EText *text) +{ + if (text->revert) + e_text_model_set_text(text->model, text->revert); + e_text_stop_editing (text); +} + static gboolean _click (gpointer data) { @@ -2766,7 +2809,7 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) gint return_val = 0; - if (GTK_OBJECT_DESTROYED (item)) + if (!text->model) return FALSE; e_tep_event.type = event->type; @@ -2818,7 +2861,7 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) ret = e_text_event_processor_handle_event (text->tep, &e_tep_event); if (event->type == GDK_KEY_PRESS) - gtk_signal_emit (GTK_OBJECT (text), signals[E_TEXT_KEYPRESS], + gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_KEYPRESS], e_tep_event.key.keyval, e_tep_event.key.state); @@ -2870,7 +2913,7 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) /* We follow convention and emit popup events on right-clicks. */ if (event->type == GDK_BUTTON_PRESS && event->button.button == 3) { gtk_signal_emit (GTK_OBJECT (text), - signals[E_TEXT_POPUP], + e_text_signals[E_TEXT_POPUP], &(event->button), _get_position_from_xy (text, event->button.x, event->button.y)); @@ -3401,7 +3444,7 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp e_text_get_selection (text, GDK_SELECTION_PRIMARY, command->time); break; case E_TEP_ACTIVATE: - gtk_signal_emit (GTK_OBJECT (text), signals[E_TEXT_ACTIVATE]); + gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_ACTIVATE]); if (text->timer) { g_timer_reset(text->timer); } @@ -3721,6 +3764,7 @@ _selection_received (GtkInvisible *invisible, command.time = time; e_text_command(text->tep, &command, text); } + text->last_type_request = -1; d(g_print ("Setting last_type_request to %d at line %d\n", text->last_type_request, __LINE__)); if (text->queued_requests) { @@ -3734,8 +3778,6 @@ _selection_received (GtkInvisible *invisible, } } - - static void e_text_get_selection(EText *text, GdkAtom selection, guint32 time) { @@ -3934,7 +3976,7 @@ e_text_class_init (ETextClass *klass) parent_class = gtk_type_class (gnome_canvas_item_get_type ()); - signals[E_TEXT_CHANGED] = + e_text_signals[E_TEXT_CHANGED] = gtk_signal_new ("changed", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), @@ -3942,7 +3984,7 @@ e_text_class_init (ETextClass *klass) gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0); - signals[E_TEXT_ACTIVATE] = + e_text_signals[E_TEXT_ACTIVATE] = gtk_signal_new ("activate", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), @@ -3950,7 +3992,7 @@ e_text_class_init (ETextClass *klass) gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0); - signals[E_TEXT_KEYPRESS] = + e_text_signals[E_TEXT_KEYPRESS] = gtk_signal_new ("keypress", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), @@ -3958,23 +4000,15 @@ e_text_class_init (ETextClass *klass) gtk_marshal_NONE__INT_INT, GTK_TYPE_NONE, 2, GTK_TYPE_UINT, GTK_TYPE_UINT); - signals[E_TEXT_POPUP] = + e_text_signals[E_TEXT_POPUP] = gtk_signal_new ("popup", GTK_RUN_LAST, E_OBJECT_CLASS_TYPE (object_class), GTK_SIGNAL_OFFSET (ETextClass, popup), - gtk_marshal_NONE__POINTER_INT, + e_marshal_NONE__POINTER_INT, GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_INT); - signals[E_TEXT_STYLE_SET] = - gtk_signal_new ("style_set", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (ETextClass, style_set), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, GTK_TYPE_STYLE); - - E_OBJECT_CLASS_ADD_SIGNALS (object_class, signals, E_TEXT_LAST_SIGNAL); + E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_text_signals, E_TEXT_LAST_SIGNAL); gtk_object_add_arg_type ("EText::model", @@ -3988,7 +4022,7 @@ e_text_class_init (ETextClass *klass) gtk_object_add_arg_type ("EText::fontset", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONTSET); gtk_object_add_arg_type ("EText::font_gdk", - GTK_TYPE_GDK_FONT, GTK_ARG_WRITABLE, ARG_FONT_GDK); + GDK_TYPE_FONT, GTK_ARG_WRITABLE, ARG_FONT_GDK); gtk_object_add_arg_type ("EText::font_e", GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_FONT_E); gtk_object_add_arg_type ("EText::bold", @@ -4014,11 +4048,11 @@ e_text_class_init (ETextClass *klass) gtk_object_add_arg_type ("EText::fill_color", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FILL_COLOR); gtk_object_add_arg_type ("EText::fill_color_gdk", - GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_FILL_COLOR_GDK); + GDK_TYPE_COLOR, GTK_ARG_READWRITE, ARG_FILL_COLOR_GDK); gtk_object_add_arg_type ("EText::fill_color_rgba", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_FILL_COLOR_RGBA); gtk_object_add_arg_type ("EText::fill_stipple", - GTK_TYPE_GDK_WINDOW, GTK_ARG_READWRITE, ARG_FILL_STIPPLE); + GDK_TYPE_WINDOW, GTK_ARG_READWRITE, ARG_FILL_STIPPLE); gtk_object_add_arg_type ("EText::text_width", GTK_TYPE_DOUBLE, GTK_ARG_READABLE, ARG_TEXT_WIDTH); gtk_object_add_arg_type ("EText::text_height", @@ -4055,24 +4089,21 @@ e_text_class_init (ETextClass *klass) - klass->changed = NULL; - klass->activate = NULL; - klass->keypress = NULL; - klass->popup = NULL; - klass->style_set = e_text_style_set; + klass->changed = NULL; + klass->activate = NULL; object_class->destroy = e_text_destroy; object_class->set_arg = e_text_set_arg; object_class->get_arg = e_text_get_arg; - item_class->update = e_text_update; - item_class->realize = e_text_realize; + item_class->update = e_text_update; + item_class->realize = e_text_realize; item_class->unrealize = e_text_unrealize; - item_class->draw = e_text_draw; - item_class->point = e_text_point; - item_class->bounds = e_text_bounds; - item_class->render = e_text_render; - item_class->event = e_text_event; + item_class->draw = e_text_draw; + item_class->point = e_text_point; + item_class->bounds = e_text_bounds; + item_class->render = e_text_render; + item_class->event = e_text_event; } /* Object initialization function for the text item */ @@ -4142,15 +4173,12 @@ e_text_init (EText *text) text->pointer_in = FALSE; text->default_cursor_shown = TRUE; - text->line_wrap = FALSE; text->break_characters = NULL; text->max_lines = -1; - text->tooltip_timeout = 0; text->tooltip_count = 0; text->tooltip_owner = FALSE; - text->dbl_timeout = 0; text->tpl_timeout = 0; @@ -4203,31 +4231,3 @@ e_text_get_type (void) return text_type; } -void -e_text_cancel_editing (EText *text) -{ - if (text->revert) - e_text_model_set_text(text->model, text->revert); - e_text_stop_editing (text); -} - -void -e_text_stop_editing (EText *text) -{ - if (!text->editing) - return; - - g_free (text->revert); - text->revert = NULL; - - text->editing = FALSE; - if ( (!text->default_cursor_shown) && (!text->draw_borders) ) { - gdk_window_set_cursor (GTK_WIDGET (GNOME_CANVAS_ITEM (text)->canvas)->window, text->default_cursor); - text->default_cursor_shown = TRUE; - } - if (text->timer) { - g_timer_stop(text->timer); - g_timer_destroy(text->timer); - text->timer = NULL; - } -} diff --git a/widgets/text/e-text.h b/widgets/text/e-text.h index 49cc4b9e57..911edcd046 100644 --- a/widgets/text/e-text.h +++ b/widgets/text/e-text.h @@ -38,15 +38,13 @@ #define E_TEXT_H #include <gtk/gtkobject.h> -#include <gtk/gtkpacker.h> #include <gal/widgets/e-font.h> #include <gal/util/e-text-event-processor.h> #include <gal/e-text/e-text-model.h> #include <gal/widgets/e-canvas.h> -#include <libgnome/gnome-defs.h> -BEGIN_GNOME_DECLS +G_BEGIN_DECLS /* Text item for the canvas. Text items are positioned by an anchor point and an anchor direction. @@ -249,7 +247,7 @@ struct _EText { gint last_type_request; /* Last selection type requested. */ guint32 last_time_request; /* The time of the last selection request. */ - guint32 last_selection_request; /* The time of the last selection request. */ + GdkAtom last_selection_request; /* The time of the last selection request. */ GList *queued_requests; /* Queued selection requests. */ }; @@ -269,6 +267,6 @@ GtkType e_text_get_type (void); void e_text_cancel_editing (EText *text); void e_text_stop_editing (EText *text); -END_GNOME_DECLS +G_END_DECLS #endif |