aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
Diffstat (limited to 'e-util')
-rw-r--r--e-util/.cvsignore6
-rw-r--r--e-util/ChangeLog495
-rw-r--r--e-util/Makefile.am48
-rw-r--r--e-util/e-canvas-utils.c67
-rw-r--r--e-util/e-canvas-utils.h30
-rw-r--r--e-util/e-canvas-vbox.c321
-rw-r--r--e-util/e-canvas-vbox.h86
-rw-r--r--e-util/e-canvas.c696
-rw-r--r--e-util/e-canvas.h121
-rw-r--r--e-util/e-cursors.c134
-rw-r--r--e-util/e-cursors.h33
-rw-r--r--e-util/e-dialog-widgets.c824
-rw-r--r--e-util/e-dialog-widgets.h60
-rw-r--r--e-util/e-font.c128
-rw-r--r--e-util/e-font.h64
-rw-r--r--e-util/e-gui-utils.c219
-rw-r--r--e-util/e-gui-utils.h19
-rw-r--r--e-util/e-html-utils.c274
-rw-r--r--e-util/e-html-utils.h33
-rw-r--r--e-util/e-iterator.c186
-rw-r--r--e-util/e-iterator.h69
-rw-r--r--e-util/e-list-iterator.c247
-rw-r--r--e-util/e-list-iterator.h44
-rw-r--r--e-util/e-list.c158
-rw-r--r--e-util/e-list.h61
-rw-r--r--e-util/e-popup-menu.c114
-rw-r--r--e-util/e-popup-menu.h25
-rw-r--r--e-util/e-printable.c207
-rw-r--r--e-util/e-printable.h72
-rw-r--r--e-util/e-sexp.c1163
-rw-r--r--e-util/e-sexp.h119
-rw-r--r--e-util/e-text-event-processor-emacs-like.c372
-rw-r--r--e-util/e-text-event-processor-emacs-like.h68
-rw-r--r--e-util/e-text-event-processor-types.h140
-rw-r--r--e-util/e-text-event-processor.c103
-rw-r--r--e-util/e-text-event-processor.h74
-rw-r--r--e-util/e-util.c475
-rw-r--r--e-util/e-util.c-8611475
-rw-r--r--e-util/e-util.h94
-rw-r--r--e-util/e-util.h-2900294
-rw-r--r--e-util/e-xml-utils.c104
-rw-r--r--e-util/e-xml-utils.c-56826104
-rw-r--r--e-util/e-xml-utils.h35
-rw-r--r--e-util/e-xml-utils.h-8254835
-rw-r--r--e-util/ename/.cvsignore8
-rw-r--r--e-util/ename/Makefile.am50
-rw-r--r--e-util/ename/TODO2
-rw-r--r--e-util/ename/e-name-western-tables.h54
-rw-r--r--e-util/ename/e-name-western.c868
-rw-r--r--e-util/ename/e-name-western.h21
-rw-r--r--e-util/ename/test-ename-western-gtk.c148
-rw-r--r--e-util/ename/test-ename-western.c70
52 files changed, 0 insertions, 9517 deletions
diff --git a/e-util/.cvsignore b/e-util/.cvsignore
deleted file mode 100644
index cb49036068..0000000000
--- a/e-util/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-*.lo
-*.la
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
deleted file mode 100644
index 9958171157..0000000000
--- a/e-util/ChangeLog
+++ /dev/null
@@ -1,495 +0,0 @@
-2000-08-21 Lauris Kaplinski <lauris@helixcode.com>
-
- * e-font.h:
- * e-font.c: Changed UTF-8 syntax from char-based to byte-based
-
-2000-08-21 Peter Williams <peterw@helixcode.com>
-
- * e-html-utils.c (e_text_to_html): Fix a booboo in the tab
- expansion code (didn't use the new value of 'out').
-
-2000-08-19 Lauris Kaplinski lauris@helixcode.com
-
- * e-font.h: #define e_font_height(f) to save some space
-
-2000-08-19 Lauris Kaplinski lauris@helixcode.com
-
- * e-font.h:
- * e-font.c: Thin wrapper around GdkFont to deal with UTF-8 directly
- Also handles bold/italic styling
-
-2000-08-14 Peter Williams <peterw@helixcode.com>
-
- * e-sexp.c (scanner_config): Add "-" to be an acceptable
- first character for an operation -- yaaay subtraction!
-
-2000-08-11 Peter Williams <peterw@helixcode.com>
-
- * e-html-utils.c (e_text_to_html): Fix the tab expansion
- for when the length would exceed the ten characters that
- we allocated.
-
-2000-08-10 Dan Winship <danw@helixcode.com>
-
- * e-setup.[ch]: Remove. The shell tells the components where
- the evolution homedir is now.
-
- * Makefile.am (libeutil_la_SOURCES): Remove e-setup.c
-
- * e-html-utils.c (e_text_to_html): If converting both spaces and
- newlines, then convert tabs too. The joys of pseudo-<PRE>.
-
-2000-08-09 Christopher James Lahey <clahey@helixcode.com>
-
- * e-popup-menu.c: Fix the bug where it truncates the last item
-
-2000-08-09 Christopher James Lahey <clahey@helixcode.com>
-
- * e-popup-menu.c: Ooops.
-
-2000-08-09 Christopher James Lahey <clahey@helixcode.com>
-
- * e-util.c, e-util.h: Added uncompiled e_read_uri function.
-
-2000-08-09 Christopher James Lahey <clahey@helixcode.com>
-
- * e-popup-menu.c, e-popup-menu.h: Added a hide_mask argument to
- the two popup menu functions.
-
-2000-08-07 Christopher James Lahey <clahey@helixcode.com>
-
- * e-gui-utils.c, e-gui-utils.c: Added
- e_container_change_tab_order.
-
-2000-07-27 Peter Williams <peterw@helixcode.com>
-
- * e-canvas.c (e_canvas_destroy): Chain the
- destroy handler.
-
-2000-07-25 Peter Williams <peterw@helixcode.com>
-
- * e-canvas.c (emit_event): Don't bother with
- dereferencing the event pointer.
- (e_canvas_item_set_cursor): Reference our selection
- item; print a debug message. Deref when destroying
- (e_canvas_item_add_selection): Same.
- (e_canvas_item_remove_selection): Same.
-
-2000-07-25 Peter Williams <peterw@helixcode.com>
-
- * Makefile.am (libeutil_static_la_LDFLAGS): Build both libraries
- (a typo didn't build libeutil.la, only -static.)
-
-2000-07-25 Seth Alves <alves@hungry.com>
-
- * Makefile.am (libeutil_static_la_LDFLAGS): build static version
- of library for conduit to use
-
-2000-07-25 Christopher James Lahey <clahey@helixcode.com>
-
- * e-util.c, e-util.h: Added a bunch of e_marshal functions.
-
-2000-07-12 Christopher James Lahey <clahey@helixcode.com>
-
- * e-util.c, e-util.h: Added e_strstrcase function.
-
-2000-07-11 Christopher James Lahey <clahey@helixcode.com>
-
- * e-canvas-vbox.c: Removed some debugging printfs.
-
- * e-canvas.c (e_canvas_unrealize): Call parent unrealize method.
-
-2000-07-10 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-sexp.c (eval_dump_result): `#if 0'ed out.
-
- * e-popup-menu.h (e_popup_menu_create): New prototype.
-
-2000-07-10 Dan Winship <danw@helixcode.com>
-
- * e-html-utils.c: Fix warnings.
-
-2000-07-08 Christopher James Lahey <clahey@helixcode.com>
-
- * e-list.c, e-list.h: Added e_list_duplicate.
-
-2000-07-07 Christopher James Lahey <clahey@helixcode.com>
-
- * e-util.c, e-util.h: Added e_strsplit to work around a bug in
- g_strsplit.
-
-2000-07-07 Christopher James Lahey <clahey@helixcode.com>
-
- * e-iterator.c, e-iterator.h, e-list-iterator.c,
- e-list-iterator.h: Added last and insert functions.
-
-2000-07-06 Federico Mena Quintero <federico@helixcode.com>
-
- * e-dialog-widgets.c: Added docstrings. This file did not have
- them at all. EEEEEEK!
-
-2000-07-05 Dan Winship <danw@helixcode.com>
-
- * e-sexp.c (e_sexp_parse): Kill debugging message
-
-2000-07-03 Christopher James Lahey <clahey@helixcode.com>
-
- * e-iterator.c, e-iterator.h, e-list-iterator.c,
- e-list-iterator.h, e-list.c, e-list.h: New list class with
- iterators.
-
- * e-canvas.c: Made it so that you don't get the same selection in
- the selection list more than once.
-
-2000-07-01 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-gui-utils.h: #include <libgnomeui/gnome-messagebox.h>. It's
- needed to be able to pass an appropriate @type arg to
- `e_notice()'.
-
-2000-06-29 Jody Goldberg <jgoldberg@home.com>
-
- * e-canvas.c (e_canvas_init) : Init the InputContext members
- (e_canvas_class_init) : Add a handler for unrealize.
- (e_canvas_focus_in) : enable the input context.
- (e_canvas_focus_out) : enable the input context.
- (e_canvas_realize) : Create an input context.
- (e_canvas_unrealize) : New function to release the input context.
-
-2000-06-28 Dan Winship <danw@helixcode.com>
-
- * e-html-utils.c (url_extract): add ")" to the set of characters
- to back up over at the end of a potential URL.
-
-2000-06-27 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-dialog-widgets.c (get_toggle_value): Use `value_var', not
- `value'.
-
-2000-06-27 Ettore Perazzoli <ettore@helixcode.com>
-
- * Makefile.am (INCLUDES): `-I$(top_srcdir)' to fix compilation
- with builddir != srcdir.
-
-2000-06-26 Christopher James Lahey <clahey@helixcode.com>
-
- * Makefile.am: Added e-canvas-vbox.c and e-canvas-vbox.h.
-
- * e-canvas-vbox.c, e-canvas-vbox.h: New canvas object to act like
- a vbox using the reflow system.
-
-2000-06-20 Christopher James Lahey <clahey@helixcode.com>
-
- * e-canvas.c, e-canvas.h: Added a variable to keep track of the
- cursor. Set the cursor when selection_add is called. Properly
- unset the cursor at the right times.
-
-2000-06-20 Christopher James Lahey <clahey@helixcode.com>
-
- * e-canvas.c: Grab the focus when setting the cursor.
-
-2000-06-20 Christopher James Lahey <clahey@helixcode.com>
-
- * e-canvas.c, e-canvas.h: Built a system for doing selections
- and/or a cursor in canvas.
-
-2000-06-13 Christopher James Lahey <clahey@helixcode.com>
-
- * e-util.c, e-util.h: Changed the needed e_marshal functions.
-
- * e-printable.c, e-printable.h: Added a quantize parameter to
- e_printable_height. Also, added a e_printable_will_fit function.
-
-2000-06-10 Christopher James Lahey <clahey@helixcode.com>
-
- * Makefile.am: Added e-printable.c and e-printable.h.
-
- * e-printable.c, e-printable.h: This new class is a printing
- context. Other classes return an EPrintable which represents a
- context for printing that object.
-
- * e-util.c, e-util.h: Added
- e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL and
- e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE.
-
-2000-06-01 Christopher James Lahey <clahey@helixcode.com>
-
- * e-util.c: Fixed e_marshal_INT__INT_INT_POINTER.
-
-2000-06-01 Christopher James Lahey <clahey@helixcode.com>
-
- * e-util.c, e-util.h: Added e_marshal_INT__INT_INT_POINTER.
-
-2000-06-01 Dan Winship <danw@helixcode.com>
-
- * e-util.c (g_int_compare): Duh! -1 != 1. :)
-
-2000-06-01 Christopher James Lahey <clahey@helixcode.com>
-
- * e-sexp.c (e_sexp_term_eval): g_return_val_if_fail to prevent a crash.
-
-2000-05-30 Not Zed <NotZed@HelixCode.com>
-
- * e-sexp.c (e_sexp_encode_bool): Utility function to build a bool
- as part of an expression string.
- (e_sexp_encode_string): Likewise for strings.
-
-2000-05-30 Christopher James Lahey <clahey@helixcode.com>
-
- * e-canvas-utils.c, e-canvas-utils.h: Added
- e_canvas_item_show_area which makes sure that a particular area of
- a given item is in the scroll area.
-
-2000-05-30 Federico Mena Quintero <federico@helixcode.com>
-
- * e-dialog-widgets.c (hook_radio): Use the exported function to
- set the value.
- (get_radio_value): Likewise.
- (hook_option_menu): Likewise.
- (get_option_menu_value): Likewise.
- (hook_toggle): Likewise.
- (get_toggle_value): Likewise.
- (hook_spin_button): Likewise.
- (get_spin_button_value): Likewise.
- (hook_editable): Likewise.
- (get_editable_value): Likewise.
- (e_dialog_radio_set): Radio buttons are prepended to their parent
- group's list, so we need to flip the index around when
- getting/setting the value.
- (e_dialog_radio_get): Likewise.
-
-2000-05-27 Federico Mena Quintero <federico@helixcode.com>
-
- * e-dialog-widgets.c (e_dialog_editable_set): Moved over from
- event-editor-utils.c.
- (e_dialog_editable_get): Likewise.
- (e_dialog_toggle_set): Likewise.
- (e_dialog_toggle_get): Likewise.
- (e_dialog_spin_set): Likewise.
- (e_dialog_spin_get_double): Likewise.
- (e_dialog_spin_get_int): Likewise.
- (e_dialog_option_menu_set): Likewise, and added a value map.
- (e_dialog_option_menu_get): Likewise.
- (e_dialog_dateedit_set): Likewise.
- (e_dialog_dateedit_get): Likewise.
- (e_dialog_radio_set): New function.
- (e_dialog_radio_get): New function.
-
-2000-05-24 Christopher James Lahey <clahey@helixcode.com>
-
- * e-paned.c, e-paned.h: Removed.
-
-2000-05-23 Federico Mena Quintero <federico@helixcode.com>
-
- * e-dialog-widgets.c (get_radio_value): Implemented. Amazing that
- one has to go through so much pain to get a stupid value from
- GTK+.
- (hook_option_menu): Implemented. Same complaint.
- (get_toggle_value): Implemented.
- (get_spin_button_value): Implemented.
- (get_entry_value): Implemented.
- (e_dialog_widget_hook_value): Function to hook a widget to the
- variable it will modify.
- (e_dialog_get_values): Function to feed the variables from a
- dialog's widgets.
- (e_dialog_xml_widget_hook_value): Function to hook a widget from
- a Glade file.
-
-2000-05-23 Christopher James Lahey <clahey@helixcode.com>
-
- * e-util.c, e-util.h: Added e_write_file.
-
-2000-05-19 Federico Mena Quintero <federico@helixcode.com>
-
- * e-dialog-widgets.[ch]: New files with utilities for hooking up
- widgets in Glade-generated dialogs.
-
- * Makefile.am (libeutil_la_SOURCES): Added e-dialog-widgets.[ch].
-
-2000-05-19 Christopher James Lahey <clahey@helixcode.com>
-
- * e-gui-utils.c, e-gui-utils.h: Added e_container_foreach_leaf.
-
-2000-05-18 Christopher James Lahey <clahey@helixcode.com>
-
- * Makefile.am: Add imagesdir support.
-
- * e-gui-utils.c, e-gui-utils.h: Added e_create_image_widget for
- glade use.
-
-2000-05-16 Christopher James Lahey <clahey@helixcode.com>
-
- * e-xml-utils.c: xmlGetProp appears to return malloced memory.
- Thus we must free it.
-
-2000-05-15 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-util.c (e_free_string_list): New function.
-
-2000-05-14 Christopher James Lahey <clahey@helixcode.com>
-
- * e-util.c, e-util.h: Added e_strdup_strip which returns a copy of
- the string with the leading and trailing spaces removed.
-
-2000-05-11 NotZed <NotZed@HelixCode.com>
-
- * e-sexp.c (e_sexp_finalise): Destroy the g_scanner when cleaning up.
- (e_sexp_finalise): Free symbol table on finalise.
-
-2000-05-09 Christopher James Lahey <clahey@helixcode.com>
-
- * e-canvas.c: Remove reflow idle when being destroyed.
-
-2000-05-06 Christopher James Lahey <clahey@helixcode.com>
-
- * e-html-utils.c: Got rid of some warnings.
-
- * e-util.c, e-util.h: Added e_read_file which takes a filename and
- returns a newly allocated string containing the contents of that
- file.
-
-2000-05-03 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-util.h: #include <glib.h> and <gtk/gtktypeutils.h>.
-
- * e-util.c (e_free_object_list): New utility function.
-
-2000-05-02 Damon Chaplin <damon@helixcode.com>
-
- * e-canvas.c (e_canvas_focus_in):
- (e_canvas_focus_out): set and reset the GTK_HAS_FOCUS flag. We now get
- focus_out events correctly.
-
-2000-05-02 NotZed <NotZed@HelixCode.com>
-
- * e-sexp.c (e_sexp_finalise): Free the parse tree if we have one.
- (e_sexp_parse): If we already have a parse tree, free it.
-
-2000-05-02 Matt Loper <matt@helixcode.com>
-
- * Makefile.am: set G_LOG_DOMAIN.
-
-2000-05-01 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-xml-utils.c, e-xml-utils.h: Constified all the functions.
-
-2000-04-27 Dan Winship <danw@helixcode.com>
-
- * e-html-utils.c (e_text_to_html): Moved here from the mailer,
- since it's of general use, and the composer needs it too.
-
-2000-04-24 Miguel de Icaza <miguel@helixcode.com>
-
- * e-popup-menu.c: New file. Implements easy to use popup menus.
-
-2000-04-24 Matt Loper <matt@helixcode.com>
-
- * e-paned.c: New file. Makes a GtkPaned with more than two
- children.
- * e-paned.h: same.
-
- * Makefile.am: added e-paned.[ch].
-
-2000-04-19 Christopher James Lahey <clahey@helixcode.com>
-
- * e-xml-utils.c, e-xml-utils.h: Added
- e_xml_get_child_by_name_by_lang.
-
-2000-04-16 Anders Carlsson <andersca@gnu.org>
-
- * e-canvas.c (e_canvas_class_init): Add realize.
- (e_canvas_realize): Set the back pixmap to NULL to reduce flicker.
-
-2000-04-14 Christopher James Lahey <clahey@helixcode.com>
-
- * e-xml-utils.c: Fixing a warning.
-
-2000-04-14 Christopher James Lahey <clahey@helixcode.com>
-
- * e-xml-utils.c: Add g_return_if_fails.
-
-2000-04-12 Miguel de Icaza <miguel@gnu.org>
-
- * e-cursors.c (e_cursor_get): Prevent next hacker to get bitten by this.
-
-2000-04-10 Christopher James Lahey <clahey@helixcode.com>
-
- * e-canvas.c: Added proper keyboard focus handling.
-
-2000-04-06 Matt Loper <matt@helixcode.com>
-
- * e-setup.c (e_setup_base_dir): Get/set Evolution's base directory
- via gnome-config.
- (mkdir_if_necessary): New function.
- (e_setup_base_dir): Use mkdir_if_necessary().
-
-2000-03-22 NotZed <NotZed@HelixCode.com>
-
- * e-util/e-sexp.h: Formatting cleanup.
-
-2000-03-07 NotZed <NotZed@HelixCode.com>
-
- * e-util/Makefile.am (libeutil_la_SOURCES): s-sexp.h -> e-sexp.h.
-
-2000-03-12 Christopher James Lahey <clahey@helixcode.com>
-
- * e-util/e-canvas.c, e-util/e-canvas.h: Fixed some bugs here to
- speed up reflow and to make it fail less often.
-
-2000-03-10 Christopher James Lahey <clahey@helixcode.com>
-
- * e-util/e-canvas.c, e-util/e-canvas.h: Designed a new system for
- doing hierarchical displays in the canvas. Adds an extra idle
- loop to the canvas system.
-
-2000-03-05 Christopher James Lahey <clahey@helixcode.com>
-
- * e-util/e-xml-utils.c: Fixed e_xml_set_integer_prop_by_name.
-
-2000-03-04 Christopher James Lahey <clahey@helixcode.com>
-
- * e-util/e-xml-utils.c, e-util/e-xml-utils.h: Added
- e_xml_set_integer_prop_by_name.
-
-2000-02-28 NotZed <NotZed@HelixCode.com>
-
- * e-util/e-sexp.[ch]: Added. moved from filter-sexp.[ch]
-
- * e-util/Makefile.am (libeutil_a_SOURCES): Add e-sexp.
- (noinst_LTLIBRARIES): Changed to a libtool library.
-
-2000-02-24 Christopher James Lahey <clahey@helixcode.com>
-
- * e-util/e-xml-utils.c, e-util/e-xml-utils.h: Added
- e_xml_get_integer_prop_by_name.
-
- * e-util/Makefile.am: Added e-util.c.
-
- * e-util/e-util.h: Added e-util.c functions.
-
- * e-util/e-util.c: New file for compare functions
-
-2000-02-24 Christopher James Lahey <clahey@helixcode.com>
-
- * e-util/e-canvas-utils.h: Fixed the comment at the top and added
- #ifndef __E_CANVAS_UTILS__.
-
- * e-util/Makefile.am: Added e-xml-utils.c and
- e-xml-utils.h.
-
- * e-util/e-xml-utils.h, e-util/e-xml-utils.c: Added files for some
- xml utilities.
-
- * e-util/e-util.h: Added type EFocus which describes which
- direction the focus will be coming from.
-
-2000-02-23 Dan Winship <danw@helixcode.com>
-
- * e-util/e-setup.c (e_setup_base_dir): Make ~/evolution mode 700
- rather than mode 600 (and use the symbolic name rather than the
- number).
-
-2000-02-09 Christopher James Lahey <clahey@helixcode.com>
-
- * e-util/Makefile.am: Add canvas utilities to libeutil.
-
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
deleted file mode 100644
index 6a1dd2cb02..0000000000
--- a/e-util/Makefile.am
+++ /dev/null
@@ -1,48 +0,0 @@
-imagesdir = $(datadir)/images/evolution
-
-INCLUDES = \
- -I$(top_srcdir) \
- $(GNOME_INCLUDEDIR) \
- $(UNICODE_CFLAGS) \
- -DEVOLUTION_IMAGES=\""$(imagesdir)"\" \
- -DG_LOG_DOMAIN=\"e-utils\" \
- $(UNICODE_CFLAGS)
-
-noinst_LTLIBRARIES = libeutil.la libeutil-static.la
-
-libeutil_la_SOURCES = \
- e-canvas.c \
- e-canvas.h \
- e-canvas-utils.c \
- e-canvas-utils.h \
- e-canvas-vbox.c \
- e-canvas-vbox.h \
- e-cursors.c \
- e-cursors.h \
- e-dialog-widgets.c \
- e-dialog-widgets.h \
- e-gui-utils.c \
- e-gui-utils.h \
- e-html-utils.c \
- e-html-utils.h \
- e-iterator.c \
- e-iterator.h \
- e-list.c \
- e-list.h \
- e-list-iterator.c \
- e-list-iterator.h \
- e-popup-menu.c \
- e-popup-menu.h \
- e-printable.c \
- e-printable.h \
- e-sexp.c \
- e-sexp.h \
- e-util.c \
- e-util.h \
- e-xml-utils.c \
- e-xml-utils.h \
- e-font.c \
- e-font.h
-
-libeutil_static_la_SOURCES = $(libeutil_la_SOURCES)
-libeutil_static_la_LDFLAGS = --all-static \ No newline at end of file
diff --git a/e-util/e-canvas-utils.c b/e-util/e-canvas-utils.c
deleted file mode 100644
index ac61545b5f..0000000000
--- a/e-util/e-canvas-utils.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas-utils.c
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "e-canvas-utils.h"
-
-void
-e_canvas_item_move_absolute (GnomeCanvasItem *item, double dx, double dy)
-{
- double translate[6];
-
- g_return_if_fail (item != NULL);
- g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
-
- art_affine_translate (translate, dx, dy);
-
- gnome_canvas_item_affine_absolute (item, translate);
-}
-
-void
-e_canvas_item_show_area (GnomeCanvasItem *item, double x1, double y1, double x2, double y2)
-{
- GtkAdjustment *h, *v;
- double dx = 0, dy = 0;
-
- g_return_if_fail (item != NULL);
- g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
-
- gnome_canvas_item_i2w(item, &x1, &y1);
- gnome_canvas_item_i2w(item, &x2, &y2);
-
- h = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- v = gtk_layout_get_vadjustment(GTK_LAYOUT(item->canvas));
-
- if (x2 > h->value + h->page_size)
- dx = (x2 - (h->value + h->page_size));
- if (y2 > v->value + v->page_size)
- dy = (y2 - (v->value + v->page_size));
-
- if (x1 < h->value + dx)
- dx = (x1 - h->value);
- if (y1 < v->value + dy)
- dy = (y1 - v->value);
-
- if (dx)
- gtk_adjustment_set_value(h, h->value + dx);
- if (dy)
- gtk_adjustment_set_value(v, v->value + dy);
-}
diff --git a/e-util/e-canvas-utils.h b/e-util/e-canvas-utils.h
deleted file mode 100644
index a940ea393c..0000000000
--- a/e-util/e-canvas-utils.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas-utils.h
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __E_CANVAS_UTILS__
-#define __E_CANVAS_UTILS__
-
-#include <gnome.h>
-void e_canvas_item_move_absolute (GnomeCanvasItem *item, double dx, double dy);
-void e_canvas_item_show_area (GnomeCanvasItem *item, double x1, double y1, double x2, double y2);
-
-#endif /* __E_CANVAS_UTILS__ */
diff --git a/e-util/e-canvas-vbox.c b/e-util/e-canvas-vbox.c
deleted file mode 100644
index 2d389a83e6..0000000000
--- a/e-util/e-canvas-vbox.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas-vbox.c
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gnome.h>
-#include <math.h>
-#include "e-canvas-vbox.h"
-#include <e-util/e-canvas-utils.h>
-#include <e-util/e-canvas.h>
-#include <e-util/e-util.h>
-
-static void e_canvas_vbox_init (ECanvasVbox *CanvasVbox);
-static void e_canvas_vbox_class_init (ECanvasVboxClass *klass);
-static void e_canvas_vbox_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_canvas_vbox_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_canvas_vbox_destroy (GtkObject *object);
-
-static gint e_canvas_vbox_event (GnomeCanvasItem *item, GdkEvent *event);
-static void e_canvas_vbox_realize (GnomeCanvasItem *item);
-
-static void e_canvas_vbox_reflow (GnomeCanvasItem *item, int flags);
-
-static void e_canvas_vbox_real_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item);
-static void e_canvas_vbox_resize_children (GnomeCanvasItem *item);
-
-static GnomeCanvasGroupClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_WIDTH,
- ARG_HEIGHT,
- ARG_SPACING,
-};
-
-GtkType
-e_canvas_vbox_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type)
- {
- static const GtkTypeInfo info =
- {
- "ECanvasVbox",
- sizeof (ECanvasVbox),
- sizeof (ECanvasVboxClass),
- (GtkClassInitFunc) e_canvas_vbox_class_init,
- (GtkObjectInitFunc) e_canvas_vbox_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (gnome_canvas_group_get_type (), &info);
- }
-
- return type;
-}
-
-static void
-e_canvas_vbox_class_init (ECanvasVboxClass *klass)
-{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- object_class = (GtkObjectClass*) klass;
- item_class = (GnomeCanvasItemClass *) klass;
-
- parent_class = gtk_type_class (gnome_canvas_group_get_type ());
-
- gtk_object_add_arg_type ("ECanvasVbox::width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_WIDTH);
- gtk_object_add_arg_type ("ECanvasVbox::height", GTK_TYPE_DOUBLE,
- GTK_ARG_READABLE, ARG_HEIGHT);
- gtk_object_add_arg_type ("ECanvasVbox::spacing", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_SPACING);
-
- klass->add_item = e_canvas_vbox_real_add_item;
-
- object_class->set_arg = e_canvas_vbox_set_arg;
- object_class->get_arg = e_canvas_vbox_get_arg;
- object_class->destroy = e_canvas_vbox_destroy;
-
- /* GnomeCanvasItem method overrides */
- item_class->event = e_canvas_vbox_event;
- item_class->realize = e_canvas_vbox_realize;
-}
-
-static void
-e_canvas_vbox_init (ECanvasVbox *vbox)
-{
- vbox->items = NULL;
-
- vbox->width = 10;
- vbox->height = 10;
- vbox->spacing = 0;
-
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(vbox), e_canvas_vbox_reflow);
-}
-
-static void
-e_canvas_vbox_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- ECanvasVbox *e_canvas_vbox;
-
- item = GNOME_CANVAS_ITEM (o);
- e_canvas_vbox = E_CANVAS_VBOX (o);
-
- switch (arg_id){
- case ARG_WIDTH:
- e_canvas_vbox->width = GTK_VALUE_DOUBLE (*arg);
- e_canvas_vbox_resize_children(item);
- e_canvas_item_request_reflow(item);
- break;
- case ARG_SPACING:
- e_canvas_vbox->spacing = GTK_VALUE_DOUBLE (*arg);
- e_canvas_item_request_reflow(item);
- break;
- }
-}
-
-static void
-e_canvas_vbox_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ECanvasVbox *e_canvas_vbox;
-
- e_canvas_vbox = E_CANVAS_VBOX (object);
-
- switch (arg_id) {
- case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_canvas_vbox->width;
- break;
- case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = e_canvas_vbox->height;
- break;
- case ARG_SPACING:
- GTK_VALUE_DOUBLE (*arg) = e_canvas_vbox->spacing;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-e_canvas_vbox_destroy (GtkObject *object)
-{
- ECanvasVbox *vbox = E_CANVAS_VBOX(object);
-
- g_list_foreach(vbox->items, (GFunc) gtk_object_unref, NULL);
- g_list_free(vbox->items);
- vbox->items = NULL;
-
- GTK_OBJECT_CLASS(parent_class)->destroy (object);
-}
-
-static gint
-e_canvas_vbox_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- gint return_val = TRUE;
-
- switch (event->type) {
- case GDK_KEY_PRESS:
- switch (event->key.keyval) {
- case GDK_Tab:
- case GDK_KP_Tab:
- case GDK_ISO_Left_Tab:
- case GDK_Left:
- case GDK_KP_Left:
- case GDK_Right:
- case GDK_KP_Right:
- case GDK_Down:
- case GDK_KP_Down:
- case GDK_Up:
- case GDK_KP_Up:
- case GDK_Return:
- case GDK_KP_Enter:
- return_val = TRUE;
- break;
- default:
- return_val = FALSE;
- break;
- }
- break;
- default:
- return_val = FALSE;
- break;
- }
- if (!return_val) {
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event)
- return GNOME_CANVAS_ITEM_CLASS (parent_class)->event (item, event);
- }
- return return_val;
-
-}
-
-static void
-e_canvas_vbox_realize (GnomeCanvasItem *item)
-{
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize)
- (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item);
-
- e_canvas_vbox_resize_children(item);
- e_canvas_item_request_reflow(item);
-}
-
-static void
-e_canvas_vbox_remove_item (GnomeCanvasItem *item, ECanvasVbox *vbox)
-{
- vbox->items = g_list_remove(vbox->items, item);
- gtk_object_unref(GTK_OBJECT(vbox));
-}
-
-static void
-e_canvas_vbox_real_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item)
-{
- e_canvas_vbox->items = g_list_append(e_canvas_vbox->items, item);
- gtk_object_ref(GTK_OBJECT(item));
- gtk_object_ref(GTK_OBJECT(e_canvas_vbox));
- gtk_signal_connect(GTK_OBJECT(item), "destroy",
- GTK_SIGNAL_FUNC(e_canvas_vbox_remove_item), e_canvas_vbox);
- if ( GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED ) {
- gnome_canvas_item_set(item,
- "width", (double) e_canvas_vbox->width,
- NULL);
- e_canvas_item_request_reflow(item);
- }
-
-}
-
-static void
-e_canvas_vbox_resize_children (GnomeCanvasItem *item)
-{
- GList *list;
- ECanvasVbox *e_canvas_vbox;
-
- e_canvas_vbox = E_CANVAS_VBOX (item);
- for ( list = e_canvas_vbox->items; list; list = list->next ) {
- GnomeCanvasItem *child = GNOME_CANVAS_ITEM(list->data);
- gnome_canvas_item_set(child,
- "width", (double) e_canvas_vbox->width,
- NULL);
- }
-}
-
-static void
-e_canvas_vbox_reflow( GnomeCanvasItem *item, int flags )
-{
- ECanvasVbox *e_canvas_vbox = E_CANVAS_VBOX(item);
- if ( GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED ) {
-
- gdouble old_height;
- gdouble running_height;
-
- old_height = e_canvas_vbox->height;
-
- running_height = 0;
-
- if (e_canvas_vbox->items == NULL) {
- } else {
- GList *list;
- gdouble item_height;
-
- list = e_canvas_vbox->items;
- gtk_object_get (GTK_OBJECT(list->data),
- "height", &item_height,
- NULL);
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
- (double) 0,
- (double) running_height);
- running_height += item_height;
- list = g_list_next(list);
-
- for( ; list; list = g_list_next(list)) {
- running_height += e_canvas_vbox->spacing;
-
- gtk_object_get (GTK_OBJECT(list->data),
- "height", &item_height,
- NULL);
-
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
- (double) 0,
- (double) running_height);
-
- running_height += item_height;
- }
-
- }
- e_canvas_vbox->height = running_height;
- if (old_height != e_canvas_vbox->height)
- e_canvas_item_request_parent_reflow(item);
- }
-}
-
-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);
-}
diff --git a/e-util/e-canvas-vbox.h b/e-util/e-canvas-vbox.h
deleted file mode 100644
index c45baa0b0a..0000000000
--- a/e-util/e-canvas-vbox.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-canvas-vbox.h
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifndef __E_CANVAS_VBOX_H__
-#define __E_CANVAS_VBOX_H__
-
-#include <gnome.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* ECanvasVbox - A canvas item container.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- * width double RW width of the CanvasVbox
- * height double R height of the CanvasVbox
- * spacing double RW Spacing between items.
- */
-
-#define E_CANVAS_VBOX_TYPE (e_canvas_vbox_get_type ())
-#define E_CANVAS_VBOX(obj) (GTK_CHECK_CAST ((obj), E_CANVAS_VBOX_TYPE, ECanvasVbox))
-#define E_CANVAS_VBOX_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CANVAS_VBOX_TYPE, ECanvasVboxClass))
-#define E_IS_CANVAS_VBOX(obj) (GTK_CHECK_TYPE ((obj), E_CANVAS_VBOX_TYPE))
-#define E_IS_CANVAS_VBOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CANVAS_VBOX_TYPE))
-
-
-typedef struct _ECanvasVbox ECanvasVbox;
-typedef struct _ECanvasVboxClass ECanvasVboxClass;
-
-struct _ECanvasVbox
-{
- GnomeCanvasGroup parent;
-
- /* item specific fields */
- GList *items; /* Of type GnomeCanvasItem */
-
- double width;
- double height;
- double spacing;
-};
-
-struct _ECanvasVboxClass
-{
- GnomeCanvasGroupClass parent_class;
-
- /* Virtual methods. */
- void (* add_item) (ECanvasVbox *CanvasVbox, GnomeCanvasItem *item);
-};
-
-/*
- * To be added to a CanvasVbox, an item must have the argument "width" as
- * a Read/Write argument and "height" as a Read Only argument. It
- * should also do an ECanvas parent CanvasVbox request if its size
- * changes.
- */
-void e_canvas_vbox_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item);
-GtkType e_canvas_vbox_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_CANVAS_VBOX_H__ */
diff --git a/e-util/e-canvas.c b/e-util/e-canvas.c
deleted file mode 100644
index fb67bf0379..0000000000
--- a/e-util/e-canvas.c
+++ /dev/null
@@ -1,696 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas.c
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <gnome.h>
-#include "e-canvas.h"
-static void e_canvas_init (ECanvas *card);
-static void e_canvas_destroy (GtkObject *object);
-static void e_canvas_class_init (ECanvasClass *klass);
-static void e_canvas_realize (GtkWidget *widget);
-static void e_canvas_unrealize (GtkWidget *widget);
-static gint e_canvas_key (GtkWidget *widget,
- GdkEventKey *event);
-
-static gint e_canvas_focus_in (GtkWidget *widget,
- GdkEventFocus *event);
-static gint e_canvas_focus_out (GtkWidget *widget,
- GdkEventFocus *event);
-
-static int emit_event (GnomeCanvas *canvas, GdkEvent *event);
-
-static GnomeCanvasClass *parent_class = NULL;
-
-enum {
- REFLOW,
- LAST_SIGNAL
-};
-
-static guint e_canvas_signals [LAST_SIGNAL] = { 0, };
-
-GtkType
-e_canvas_get_type (void)
-{
- static GtkType canvas_type = 0;
-
- if (!canvas_type)
- {
- static const GtkTypeInfo canvas_info =
- {
- "ECanvas",
- sizeof (ECanvas),
- sizeof (ECanvasClass),
- (GtkClassInitFunc) e_canvas_class_init,
- (GtkObjectInitFunc) e_canvas_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- canvas_type = gtk_type_unique (gnome_canvas_get_type (), &canvas_info);
- }
-
- return canvas_type;
-}
-
-static void
-e_canvas_class_init (ECanvasClass *klass)
-{
- GtkObjectClass *object_class;
- GnomeCanvasClass *canvas_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass*) klass;
- canvas_class = (GnomeCanvasClass *) klass;
- widget_class = (GtkWidgetClass *) klass;
-
- parent_class = gtk_type_class (gnome_canvas_get_type ());
-
- object_class->destroy = e_canvas_destroy;
-
- widget_class->key_press_event = e_canvas_key;
- widget_class->key_release_event = e_canvas_key;
- widget_class->focus_in_event = e_canvas_focus_in;
- widget_class->focus_out_event = e_canvas_focus_out;
- widget_class->realize = e_canvas_realize;
- widget_class->unrealize = e_canvas_unrealize;
-
- klass->reflow = NULL;
-
- e_canvas_signals [REFLOW] =
- gtk_signal_new ("reflow",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ECanvasClass, reflow),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, e_canvas_signals, LAST_SIGNAL);
-}
-
-static void
-e_canvas_init (ECanvas *canvas)
-{
- canvas->selection = NULL;
- canvas->cursor = NULL;
- canvas->ic = NULL;
- canvas->ic_attr = NULL;
-}
-
-static void
-e_canvas_destroy (GtkObject *object)
-{
- ECanvas *canvas = E_CANVAS(object);
- if (canvas->idle_id)
- g_source_remove(canvas->idle_id);
- if ((GTK_OBJECT_CLASS (parent_class))->destroy)
- (*(GTK_OBJECT_CLASS (parent_class))->destroy) (object);
-}
-
-GtkWidget *
-e_canvas_new ()
-{
- return GTK_WIDGET (gtk_type_new (e_canvas_get_type ()));
-}
-
-
-/* Returns whether the item is an inferior of or is equal to the parent. */
-static int
-is_descendant (GnomeCanvasItem *item, GnomeCanvasItem *parent)
-{
- for (; item; item = item->parent)
- if (item == parent)
- return TRUE;
-
- return FALSE;
-}
-
-/* Emits an event for an item in the canvas, be it the current item, grabbed
- * item, or focused item, as appropriate.
- */
-static int
-emit_event (GnomeCanvas *canvas, GdkEvent *event)
-{
- /*GdkEvent ev;*/
- gint finished;
- GnomeCanvasItem *item;
- GnomeCanvasItem *parent;
- guint mask;
-
- /* Perform checks for grabbed items */
-
- if (canvas->grabbed_item && !is_descendant (canvas->current_item, canvas->grabbed_item))
- return FALSE;
-
- if (canvas->grabbed_item) {
- switch (event->type) {
- case GDK_ENTER_NOTIFY:
- mask = GDK_ENTER_NOTIFY_MASK;
- break;
-
- case GDK_LEAVE_NOTIFY:
- mask = GDK_LEAVE_NOTIFY_MASK;
- break;
-
- case GDK_MOTION_NOTIFY:
- mask = GDK_POINTER_MOTION_MASK;
- break;
-
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- mask = GDK_BUTTON_PRESS_MASK;
- break;
-
- case GDK_BUTTON_RELEASE:
- mask = GDK_BUTTON_RELEASE_MASK;
- break;
-
- case GDK_KEY_PRESS:
- mask = GDK_KEY_PRESS_MASK;
- break;
-
- case GDK_KEY_RELEASE:
- mask = GDK_KEY_RELEASE_MASK;
- break;
-
- default:
- mask = 0;
- break;
- }
-
- if (!(mask & canvas->grabbed_event_mask))
- return FALSE;
- }
-
- /* Convert to world coordinates -- we have two cases because of diferent
- * offsets of the fields in the event structures.
- */
-
- /*ev = *event;*/
-
- switch (event->type) {
- case GDK_ENTER_NOTIFY:
- case GDK_LEAVE_NOTIFY:
- gnome_canvas_window_to_world (canvas,
- event->crossing.x,
- event->crossing.y,
- &(event->crossing.x),
- &(event->crossing.y));
- break;
-
- case GDK_MOTION_NOTIFY:
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- gnome_canvas_window_to_world (canvas,
- event->motion.x,
- event->motion.y,
- &(event->motion.x),
- &(event->motion.y));
- break;
-
- default:
- break;
- }
-
- /* Choose where we send the event */
-
- item = canvas->current_item;
-
- if (canvas->focused_item
- && ((event->type == GDK_KEY_PRESS) || (event->type == GDK_KEY_RELEASE) || (event->type == GDK_FOCUS_CHANGE)))
- item = canvas->focused_item;
-
- /* The event is propagated up the hierarchy (for if someone connected to
- * a group instead of a leaf event), and emission is stopped if a
- * handler returns TRUE, just like for GtkWidget events.
- */
-
- finished = FALSE;
-
- while (item && !finished) {
- gtk_object_ref (GTK_OBJECT (item));
-
- gtk_signal_emit_by_name (GTK_OBJECT (item), "event",
- event,
- &finished);
-
- if (GTK_OBJECT_DESTROYED (item))
- finished = TRUE;
-
- parent = item->parent;
- gtk_object_unref (GTK_OBJECT (item));
-
- item = parent;
- }
-
- return finished;
-}
-
-/* Key event handler for the canvas */
-static gint
-e_canvas_key (GtkWidget *widget, GdkEventKey *event)
-{
- GnomeCanvas *canvas;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- canvas = GNOME_CANVAS (widget);
-
- return emit_event (canvas, (GdkEvent *) event);
-}
-
-
-/**
- * e_canvas_item_grab_focus:
- * @item: A canvas item.
- *
- * Makes the specified item take the keyboard focus, so all keyboard events will
- * be sent to it. If the canvas widget itself did not have the focus, it grabs
- * it as well.
- **/
-void
-e_canvas_item_grab_focus (GnomeCanvasItem *item)
-{
- GnomeCanvasItem *focused_item;
- GdkEvent ev;
-
- g_return_if_fail (item != NULL);
- g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
- g_return_if_fail (GTK_WIDGET_CAN_FOCUS (GTK_WIDGET (item->canvas)));
-
- focused_item = item->canvas->focused_item;
-
- if (focused_item) {
- ev.focus_change.type = GDK_FOCUS_CHANGE;
- ev.focus_change.window = GTK_LAYOUT (item->canvas)->bin_window;
- ev.focus_change.send_event = FALSE;
- ev.focus_change.in = FALSE;
-
- emit_event (item->canvas, &ev);
- }
-
- item->canvas->focused_item = item;
-
- if (!GTK_WIDGET_HAS_FOCUS (GTK_WIDGET(item->canvas))) {
- gtk_widget_grab_focus (GTK_WIDGET (item->canvas));
- }
-
- if (focused_item) {
- ev.focus_change.type = GDK_FOCUS_CHANGE;
- ev.focus_change.window = GTK_LAYOUT (item->canvas)->bin_window;
- ev.focus_change.send_event = FALSE;
- ev.focus_change.in = TRUE;
-
- emit_event (item->canvas, &ev);
- }
-}
-
-/* Focus in handler for the canvas */
-static gint
-e_canvas_focus_in (GtkWidget *widget, GdkEventFocus *event)
-{
- GnomeCanvas *canvas;
- ECanvas *ecanvas;
-
- canvas = GNOME_CANVAS (widget);
- ecanvas = E_CANVAS (widget);
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
-
- if (ecanvas->ic)
- gdk_im_begin (ecanvas->ic, canvas->layout.bin_window);
-
- if (canvas->focused_item)
- return emit_event (canvas, (GdkEvent *) event);
- else
- return FALSE;
-}
-
-/* Focus out handler for the canvas */
-static gint
-e_canvas_focus_out (GtkWidget *widget, GdkEventFocus *event)
-{
- GnomeCanvas *canvas;
- ECanvas *ecanvas;
-
- canvas = GNOME_CANVAS (widget);
- ecanvas = E_CANVAS (widget);
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
-
- if (ecanvas->ic)
- gdk_im_end ();
-
- if (canvas->focused_item)
- return emit_event (canvas, (GdkEvent *) event);
- else
- return FALSE;
-}
-
-static void
-e_canvas_realize (GtkWidget *widget)
-{
- ECanvas *ecanvas = E_CANVAS (widget);
-
- 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);
-
- if (gdk_im_ready () && (ecanvas->ic_attr = gdk_ic_attr_new ()) != NULL) {
- GdkEventMask mask;
- GdkICAttr *attr = ecanvas->ic_attr;
- GdkICAttributesType attrmask = GDK_IC_ALL_REQ;
- GdkIMStyle style;
- GdkIMStyle supported_style = GDK_IM_PREEDIT_NONE |
- GDK_IM_PREEDIT_NOTHING |
- GDK_IM_STATUS_NONE |
- GDK_IM_STATUS_NOTHING;
-
- attr->style = style = gdk_im_decide_style (supported_style);
- attr->client_window = ecanvas->parent.layout.bin_window;
-
- ecanvas->ic = gdk_ic_new (attr, attrmask);
- if (ecanvas->ic != NULL) {
- mask = gdk_window_get_events (attr->client_window);
- mask |= gdk_ic_get_events (ecanvas->ic);
- gdk_window_set_events (attr->client_window, mask);
-
- if (GTK_WIDGET_HAS_FOCUS (widget))
- gdk_im_begin (ecanvas->ic, attr->client_window);
- } else
- g_warning ("Can't create input context.");
- }
-
-}
-
-static void
-e_canvas_unrealize (GtkWidget *widget)
-{
- ECanvas * ecanvas = E_CANVAS (widget);
- if (ecanvas->ic) {
- gdk_ic_destroy (ecanvas->ic);
- ecanvas->ic = NULL;
- }
- if (ecanvas->ic_attr) {
- gdk_ic_attr_destroy (ecanvas->ic_attr);
- ecanvas->ic_attr = NULL;
- }
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-}
-
-static void
-e_canvas_item_invoke_reflow (GnomeCanvasItem *item, int flags)
-{
- GnomeCanvasGroup *group;
- GList *list;
- GnomeCanvasItem *child;
-
- if (GNOME_IS_CANVAS_GROUP (item)) {
- group = GNOME_CANVAS_GROUP (item);
- for (list = group->item_list; list; list = list->next) {
- child = GNOME_CANVAS_ITEM (list->data);
- if (child->object.flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW)
- e_canvas_item_invoke_reflow (child, flags);
- }
- }
-
- if (item->object.flags & E_CANVAS_ITEM_NEEDS_REFLOW) {
- ECanvasItemReflowFunc func;
- func = gtk_object_get_data (GTK_OBJECT (item),
- "ECanvasItem::reflow_callback");
- if (func)
- func (item, flags);
- }
-
- item->object.flags &= ~E_CANVAS_ITEM_NEEDS_REFLOW;
- item->object.flags &= ~E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW;
-}
-
-static void
-do_reflow (ECanvas *canvas)
-{
- if (GNOME_CANVAS(canvas)->root->object.flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW)
- e_canvas_item_invoke_reflow (GNOME_CANVAS(canvas)->root, 0);
-}
-
-/* Idle handler for the e-canvas. It deals with pending reflows. */
-static gint
-idle_handler (gpointer data)
-{
- ECanvas *canvas;
-
- GDK_THREADS_ENTER();
-
- canvas = E_CANVAS (data);
- do_reflow (canvas);
-
- /* Reset idle id */
- canvas->idle_id = 0;
-
- gtk_signal_emit (GTK_OBJECT (canvas),
- e_canvas_signals [REFLOW]);
-
- GDK_THREADS_LEAVE();
-
- return FALSE;
-}
-
-/* Convenience function to add an idle handler to a canvas */
-static void
-add_idle (ECanvas *canvas)
-{
- if (canvas->idle_id != 0)
- return;
-
- canvas->idle_id = g_idle_add_full (G_PRIORITY_HIGH_IDLE, idle_handler, (gpointer) canvas, NULL);
-}
-
-static void
-e_canvas_item_descendent_needs_reflow (GnomeCanvasItem *item)
-{
- if (item->object.flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW)
- return;
-
- item->object.flags |= E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW;
- if (item->parent)
- e_canvas_item_descendent_needs_reflow(item->parent);
-}
-
-void
-e_canvas_item_request_reflow (GnomeCanvasItem *item)
-{
- if (item->object.flags & GNOME_CANVAS_ITEM_REALIZED) {
- item->object.flags |= E_CANVAS_ITEM_NEEDS_REFLOW;
- e_canvas_item_descendent_needs_reflow(item);
- add_idle(E_CANVAS(item->canvas));
- }
-}
-
-void
-e_canvas_item_request_parent_reflow (GnomeCanvasItem *item)
-{
- g_return_if_fail(item != NULL);
- g_return_if_fail(GNOME_IS_CANVAS_ITEM(item));
- e_canvas_item_request_reflow(item->parent);
-}
-
-void
-e_canvas_item_set_reflow_callback (GnomeCanvasItem *item, ECanvasItemReflowFunc func)
-{
- gtk_object_set_data(GTK_OBJECT(item), "ECanvasItem::reflow_callback", (gpointer) func);
-}
-
-
-void
-e_canvas_item_set_selection_callback (GnomeCanvasItem *item, ECanvasItemSelectionFunc func)
-{
- gtk_object_set_data(GTK_OBJECT(item), "ECanvasItem::selection_callback", (gpointer) func);
-}
-
-void
-e_canvas_item_set_selection_compare_callback (GnomeCanvasItem *item, ECanvasItemSelectionCompareFunc func)
-{
- gtk_object_set_data(GTK_OBJECT(item), "ECanvasItem::selection_compare_callback", (gpointer) func);
-}
-
-void
-e_canvas_item_set_cursor (GnomeCanvasItem *item, gpointer id)
-{
- GList *list;
- int flags;
- ECanvas *canvas;
- ECanvasSelectionInfo *info;
- ECanvasItemSelectionFunc func;
-
- g_return_if_fail(item != NULL);
- g_return_if_fail(GNOME_IS_CANVAS_ITEM(item));
- g_return_if_fail(item->canvas != NULL);
- g_return_if_fail(E_IS_CANVAS(item->canvas));
-
- canvas = E_CANVAS(item->canvas);
- flags = E_CANVAS_ITEM_SELECTION_DELETE_DATA;
-
- for (list = canvas->selection; list; list = g_list_next(list)) {
- info = list->data;
-
- func = gtk_object_get_data(GTK_OBJECT(info->item), "ECanvasItem::selection_callback");
- if (func)
- func(info->item, flags, info->id);
- g_message ("ECANVAS: free info (2): item %p, id %p",
- info->item, info->id);
- gtk_object_unref (GTK_OBJECT (info->item));
- g_free(info);
- }
- g_list_free(canvas->selection);
-
- canvas->selection = NULL;
-
- gnome_canvas_item_grab_focus(item);
-
- info = g_new(ECanvasSelectionInfo, 1);
- info->item = item;
- gtk_object_ref (GTK_OBJECT (info->item));
- info->id = id;
- g_message ("ECANVAS: new info item %p, id %p", item, id);
-
- flags = E_CANVAS_ITEM_SELECTION_SELECT | E_CANVAS_ITEM_SELECTION_CURSOR;
- func = gtk_object_get_data(GTK_OBJECT(item), "ECanvasItem::selection_callback");
- if (func)
- func(item, flags, id);
-
- canvas->selection = g_list_prepend(canvas->selection, info);
- canvas->cursor = info;
-}
-
-void
-e_canvas_item_set_cursor_end (GnomeCanvasItem *item, gpointer id)
-{
-}
-
-void
-e_canvas_item_add_selection (GnomeCanvasItem *item, gpointer id)
-{
- int flags;
- ECanvas *canvas;
- ECanvasSelectionInfo *info;
- ECanvasItemSelectionFunc func;
- GList *list;
-
- g_return_if_fail(item != NULL);
- g_return_if_fail(GNOME_IS_CANVAS_ITEM(item));
- g_return_if_fail(item->canvas != NULL);
- g_return_if_fail(E_IS_CANVAS(item->canvas));
-
- flags = E_CANVAS_ITEM_SELECTION_SELECT;
- canvas = E_CANVAS(item->canvas);
-
- if (canvas->cursor) {
- func = gtk_object_get_data(GTK_OBJECT(canvas->cursor->item), "ECanvasItem::selection_callback");
- if (func)
- func(canvas->cursor->item, flags, canvas->cursor->id);
- }
-
- gnome_canvas_item_grab_focus(item);
-
- flags = E_CANVAS_ITEM_SELECTION_SELECT | E_CANVAS_ITEM_SELECTION_CURSOR;
-
- for (list = canvas->selection; list; list = g_list_next(list)) {
- ECanvasSelectionInfo *search;
- search = list->data;
-
- if (search->item == item) {
- ECanvasItemSelectionCompareFunc compare_func;
- compare_func = gtk_object_get_data(GTK_OBJECT(search->item), "ECanvasItem::selection_compare_callback");
-
- if (compare_func(search->item, search->id, id, 0) == 0) {
- canvas->cursor = search;
- func = gtk_object_get_data(GTK_OBJECT(item), "ECanvasItem::selection_callback");
- if (func)
- func(item, flags, search->id);
- return;
- }
- }
- }
-
- info = g_new(ECanvasSelectionInfo, 1);
- info->item = item;
- gtk_object_ref (GTK_OBJECT (info->item));
- info->id = id;
- g_message ("ECANVAS: new info (2): item %p, id %p", item, id);
-
- func = gtk_object_get_data(GTK_OBJECT(item), "ECanvasItem::selection_callback");
- if (func)
- func(item, flags, id);
-
- canvas->selection = g_list_prepend(canvas->selection, info);
- canvas->cursor = info;
-}
-
-void
-e_canvas_item_remove_selection (GnomeCanvasItem *item, gpointer id)
-{
- int flags;
- ECanvas *canvas;
- ECanvasSelectionInfo *info;
- GList *list;
-
- g_return_if_fail(item != NULL);
- g_return_if_fail(GNOME_IS_CANVAS_ITEM(item));
- g_return_if_fail(item->canvas != NULL);
- g_return_if_fail(E_IS_CANVAS(item->canvas));
-
- flags = E_CANVAS_ITEM_SELECTION_DELETE_DATA;
- canvas = E_CANVAS(item->canvas);
-
- for (list = canvas->selection; list; list = g_list_next(list)) {
- info = list->data;
-
- if (info->item == item) {
- ECanvasItemSelectionCompareFunc compare_func;
- compare_func = gtk_object_get_data(GTK_OBJECT(info->item), "ECanvasItem::selection_compare_callback");
-
- if (compare_func(info->item, info->id, id, 0) == 0) {
- ECanvasItemSelectionFunc func;
- func = gtk_object_get_data(GTK_OBJECT(info->item), "ECanvasItem::selection_callback");
- if (func)
- func(info->item, flags, info->id);
- canvas->selection = g_list_remove_link(canvas->selection, list);
-
- if (canvas->cursor == info)
- canvas->cursor = NULL;
-
- g_message ("ECANVAS: removing info: item %p, info %p",
- info->item, info->id);
- gtk_object_unref (GTK_OBJECT (info->item));
- g_free(info);
- g_list_free_1(list);
- break;
- }
- }
- }
-}
diff --git a/e-util/e-canvas.h b/e-util/e-canvas.h
deleted file mode 100644
index b13a9dd2ab..0000000000
--- a/e-util/e-canvas.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-canvas.h
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifndef __E_CANVAS_H__
-#define __E_CANVAS_H__
-
-#include <gnome.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* ECanvas - A class derived from canvas for the purpose of adding
- * evolution specific canvas hacks.
- */
-
-#define E_CANVAS_TYPE (e_canvas_get_type ())
-#define E_CANVAS(obj) (GTK_CHECK_CAST ((obj), E_CANVAS_TYPE, ECanvas))
-#define E_CANVAS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CANVAS_TYPE, ECanvasClass))
-#define E_IS_CANVAS(obj) (GTK_CHECK_TYPE ((obj), E_CANVAS_TYPE))
-#define E_IS_CANVAS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CANVAS_TYPE))
-
-typedef void (*ECanvasItemReflowFunc) (GnomeCanvasItem *item,
- gint flags);
-
-typedef void (*ECanvasItemSelectionFunc) (GnomeCanvasItem *item,
- gint flags,
- gpointer user_data);
-/* Returns the same as strcmp does. */
-typedef gint (*ECanvasItemSelectionCompareFunc) (GnomeCanvasItem *item,
- gpointer data1,
- gpointer data2,
- gint flags);
-
-
-typedef struct _ECanvas ECanvas;
-typedef struct _ECanvasClass ECanvasClass;
-
-/* Object flags for items */
-enum {
- E_CANVAS_ITEM_NEEDS_REFLOW = 1 << 13,
- E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW = 1 << 14
-};
-
-enum {
- E_CANVAS_ITEM_SELECTION_SELECT = 1 << 0, /* TRUE = select. FALSE = unselect. */
- E_CANVAS_ITEM_SELECTION_CURSOR = 1 << 1, /* TRUE = has become cursor. FALSE = not cursor. */
- E_CANVAS_ITEM_SELECTION_DELETE_DATA = 1 << 2,
-};
-
-typedef struct {
- GnomeCanvasItem *item;
- gpointer id;
-} ECanvasSelectionInfo;
-
-struct _ECanvas
-{
- GnomeCanvas parent;
-
- int idle_id;
- GList *selection;
- ECanvasSelectionInfo *cursor;
-
- /* Input context for dead key support */
- GdkIC *ic;
- GdkICAttr *ic_attr;
-};
-
-struct _ECanvasClass
-{
- GnomeCanvasClass parent_class;
- void (* reflow) (ECanvas *canvas);
-};
-
-
-GtkType e_canvas_get_type (void);
-GtkWidget *e_canvas_new (void);
-
-/* Used to send all of the keystroke events to a specific item as well as
- * GDK_FOCUS_CHANGE events.
- */
-void e_canvas_item_grab_focus (GnomeCanvasItem *item);
-
-void e_canvas_item_request_reflow (GnomeCanvasItem *item);
-void e_canvas_item_request_parent_reflow (GnomeCanvasItem *item);
-void e_canvas_item_set_reflow_callback (GnomeCanvasItem *item, ECanvasItemReflowFunc func);
-
-void e_canvas_item_set_selection_callback (GnomeCanvasItem *item, ECanvasItemSelectionFunc func);
-void e_canvas_item_set_selection_compare_callback (GnomeCanvasItem *item, ECanvasItemSelectionCompareFunc func);
-
-void e_canvas_item_set_cursor (GnomeCanvasItem *item, gpointer id);
-void e_canvas_item_add_selection (GnomeCanvasItem *item, gpointer id);
-void e_canvas_item_remove_selection (GnomeCanvasItem *item, gpointer id);
-
-/* Not implemented yet. */
-void e_canvas_item_set_cursor_end (GnomeCanvasItem *item, gpointer id);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_CANVAS_H__ */
diff --git a/e-util/e-cursors.c b/e-util/e-cursors.c
deleted file mode 100644
index 56a5015cbd..0000000000
--- a/e-util/e-cursors.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * cursors.c: cursor handling for Evolution.
- * copied from Gnumeric.
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- */
-#include <config.h>
-#include <gnome.h>
-#include "e-cursors.h"
-
-static GdkColor black, white;
-
-#define GDK_INTERNAL_CURSOR -1
-
-typedef struct {
- GdkCursor *cursor;
- int hot_x, hot_y;
- char **xpm;
-} CursorDef;
-
-static CursorDef cursors [] = {
- { NULL, GDK_INTERNAL_CURSOR, GDK_CROSSHAIR, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_LEFT_PTR, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_FLEUR, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_SB_H_DOUBLE_ARROW, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_SB_V_DOUBLE_ARROW, NULL },
- { NULL, 0, 0, NULL }
-};
-
-static int inited = FALSE;
-
-static void
-create_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, gchar **xpm)
-{
- int height, width, colors;
- char pixmap_buffer [(32 * 32)/8];
- char mask_buffer [(32 * 32)/8];
- int x, y, pix, yofs;
- int transparent_color, black_color;
-
- sscanf (xpm [0], "%d %d %d %d", &height, &width, &colors, &pix);
-
- g_assert (height == 32);
- g_assert (width == 32);
- g_assert (colors <= 3);
-
- transparent_color = ' ';
- black_color = '.';
-
- yofs = colors + 1;
- for (y = 0; y < 32; y++){
- for (x = 0; x < 32;){
- char value = 0, maskv = 0;
-
- for (pix = 0; pix < 8; pix++, x++){
- if (xpm [y + yofs][x] != transparent_color){
- maskv |= 1 << pix;
-
- /*
- * Invert the colours here because it seems
- * to workaround a bug the Matrox G100 Xserver?
- * We reverse the foreground & background in the next
- * routine to compensate.
- */
- if (xpm [y + yofs][x] == black_color){
- value |= 1 << pix;
- }
- }
- }
- pixmap_buffer [(y * 4 + x/8)-1] = value;
- mask_buffer [(y * 4 + x/8)-1] = maskv;
- }
- }
- *bitmap = gdk_bitmap_create_from_data (NULL, pixmap_buffer, 32, 32);
- *mask = gdk_bitmap_create_from_data (NULL, mask_buffer, 32, 32);
-}
-
-void
-e_cursors_init (void)
-{
- GdkColormap *colormap;
- int i;
-
- colormap = gtk_widget_get_default_colormap ();
- gdk_color_white (colormap, &white);
- gdk_color_black (colormap, &black);
-
- for (i = 0; cursors [i].hot_x; i++){
- GdkBitmap *bitmap, *mask;
-
- if (cursors [i].hot_x < 0)
- cursors [i].cursor = gdk_cursor_new (cursors [i].hot_y);
- else {
- create_bitmap_and_mask_from_xpm (&bitmap, &mask, cursors [i].xpm);
-
- /* The foreground and background colours are reversed.
- * See comment above for explanation.
- */
- cursors [i].cursor =
- gdk_cursor_new_from_pixmap (
- bitmap, mask,
- &black, &white,
- cursors [i].hot_x,
- cursors [i].hot_y);
- }
- }
-
- inited = TRUE;
-
- g_assert (i == E_NUM_CURSORS);
-}
-
-void
-e_cursors_shutdown (void)
-{
- int i;
-
- for (i = 0; cursors [i].hot_x; i++)
- gdk_cursor_destroy (cursors [i].cursor);
-}
-
-
-/* Returns a cursor given its type */
-GdkCursor *
-e_cursor_get (ECursorType type)
-{
- g_return_val_if_fail (type >= 0 && type < E_NUM_CURSORS, NULL);
-
- if (!inited)
- g_warning ("e_cursors_init not called");
-
- return cursors [type].cursor;
-}
diff --git a/e-util/e-cursors.h b/e-util/e-cursors.h
deleted file mode 100644
index 771e5f6d4d..0000000000
--- a/e-util/e-cursors.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef E_CURSORS_H
-#define E_CURSORS_H
-
-/* Copied from Gnumeric */
-
-typedef enum {
- E_CURSOR_THIN_CROSS,
- E_CURSOR_ARROW,
- E_CURSOR_MOVE,
- E_CURSOR_SIZE_X,
- E_CURSOR_SIZE_Y,
- E_NUM_CURSORS
-} ECursorType;
-
-void e_cursors_init (void);
-void e_cursors_shutdown (void);
-
-#define e_cursor_set(win, c) \
-G_STMT_START { \
- if (win) \
- gdk_window_set_cursor (win, e_cursor_get (c)); \
-} G_STMT_END
-
-#define e_cursor_set_widget(w, c) \
-G_STMT_START { \
- if (GTK_WIDGET (w)->window) \
- gdk_window_set_cursor (GTK_WIDGET (w)->window, e_cursor_get (c)); \
-} G_STMT_END
-
-GdkCursor *e_cursor_get (ECursorType type);
-
-#endif /* E_CURSORS_H */
-
diff --git a/e-util/e-dialog-widgets.c b/e-util/e-dialog-widgets.c
deleted file mode 100644
index 19c698af02..0000000000
--- a/e-util/e-dialog-widgets.c
+++ /dev/null
@@ -1,824 +0,0 @@
-/* Evolution internal utilities - Glade dialog widget utilities
- *
- * Copyright (C) 2000 Helix Code, Inc.
- *
- * Author: Federico Mena-Quintero <federico@gimp.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <math.h>
-#include <time.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkoptionmenu.h>
-#include <gtk/gtkradiobutton.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkspinbutton.h>
-#include <libgnomeui/gnome-dateedit.h>
-#include "e-dialog-widgets.h"
-
-
-
-/* A widget, a pointer to the variable it will modify, and extra information */
-typedef struct {
- GtkWidget *widget;
- gpointer value_var;
- gpointer info;
-} WidgetHook;
-
-/* Hook information for a complete dialog */
-typedef struct {
- GSList *whooks;
-} DialogHooks;
-
-
-
-/* Destroy handler for the dialog; frees the dialog hooks */
-static void
-dialog_destroy_cb (GtkObject *dialog, gpointer data)
-{
- DialogHooks *hooks;
-
- hooks = data;
-
- g_slist_free (hooks->whooks);
- hooks->whooks = NULL;
-
- g_free (hooks);
- gtk_object_set_data (dialog, "dialog-hooks", NULL);
-}
-
-/* Ensures that the dialog has the necessary attached data to store the widget
- * hook information.
- */
-static DialogHooks *
-get_dialog_hooks (GtkWidget *dialog)
-{
- DialogHooks *hooks;
-
- hooks = gtk_object_get_data (GTK_OBJECT (dialog), "dialog-hooks");
- if (!hooks) {
- hooks = g_new0 (DialogHooks, 1);
- gtk_object_set_data (GTK_OBJECT (dialog), "dialog-hooks", hooks);
- gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
- GTK_SIGNAL_FUNC (dialog_destroy_cb), hooks);
- }
-
- return hooks;
-}
-
-/* Converts an mapped value to the appropriate index in an item group. The
- * values for the items are provided as a -1-terminated array.
- */
-static int
-value_to_index (const int *value_map, int value)
-{
- int i;
-
- for (i = 0; value_map[i] != -1; i++)
- if (value_map[i] == value)
- return i;
-
- return -1;
-}
-
-/* Converts an index in an item group to the appropriate mapped value. See the
- * function above.
- */
-static int
-index_to_value (const int *value_map, int index)
-{
- int i;
-
- /* We do this the hard way, i.e. not as a simple array reference, to
- * check for correctness.
- */
-
- for (i = 0; value_map[i] != -1; i++)
- if (i == index)
- return value_map[i];
-
- return -1;
-}
-
-/* Callback for the "toggled" signal of toggle buttons */
-static void
-toggled_cb (GtkToggleButton *toggle, gpointer data)
-{
- GnomePropertyBox *pbox;
-
- pbox = GNOME_PROPERTY_BOX (data);
-
- /* For radio buttons, we only notify the property box if the button is
- * active, because we'll get one call for each of the changed buttons in
- * the radio group.
- */
- if (!GTK_IS_RADIO_BUTTON (toggle) || toggle->active)
- gnome_property_box_changed (pbox);
-}
-
-/* Hooks a radio button group */
-static void
-hook_radio (GtkWidget *dialog, GtkRadioButton *radio, gpointer value_var, gpointer info)
-{
- GSList *group;
- GSList *l;
- int *value;
- const int *value_map;
-
- group = gtk_radio_button_group (radio);
-
- /* Set the value */
-
- value = (int *) value_var;
- value_map = (const int *) info;
-
- e_dialog_radio_set (GTK_WIDGET (radio), *value, value_map);
-
- /* Hook to changed */
-
- if (GNOME_IS_PROPERTY_BOX (dialog))
- for (l = group; l; l = l->next)
- gtk_signal_connect (GTK_OBJECT (l->data), "toggled",
- GTK_SIGNAL_FUNC (toggled_cb), dialog);
-}
-
-/* Gets the value of a radio button group */
-static void
-get_radio_value (GtkRadioButton *radio, gpointer value_var, gpointer info)
-{
- int *value;
- const int *value_map;
-
- value = (int *) value_var;
- value_map = (const int *) info;
-
- *value = e_dialog_radio_get (GTK_WIDGET (radio), value_map);
-}
-
-/* Callback for the "activate" signal of menu items */
-static void
-activate_cb (GtkMenuItem *item, gpointer data)
-{
- GnomePropertyBox *pbox;
-
- pbox = GNOME_PROPERTY_BOX (data);
- gnome_property_box_changed (pbox);
-}
-
-/* Hooks an option menu */
-static void
-hook_option_menu (GtkWidget *dialog, GtkOptionMenu *omenu, gpointer value_var, gpointer info)
-{
- int *value;
- const int *value_map;
-
- /* Set the value */
-
- value = (int *) value_var;
- value_map = (const int *) info;
-
- e_dialog_option_menu_set (GTK_WIDGET (omenu), *value, value_map);
-
- /* Hook to changed */
-
- if (GNOME_IS_PROPERTY_BOX (dialog)) {
- GtkMenu *menu;
- GList *l;
-
- menu = GTK_MENU (gtk_option_menu_get_menu (omenu));
-
- for (l = GTK_MENU_SHELL (menu)->children; l; l = l->next)
- gtk_signal_connect (GTK_OBJECT (l->data), "activate",
- GTK_SIGNAL_FUNC (activate_cb), dialog);
- }
-}
-
-/* Gets the value of an option menu */
-static void
-get_option_menu_value (GtkOptionMenu *omenu, gpointer value_var, gpointer info)
-{
- int *value;
- const int *value_map;
-
- value = (int *) value_var;
- value_map = (const int *) info;
-
- *value = e_dialog_option_menu_get (GTK_WIDGET (omenu), value_map);
-}
-
-/* Hooks a toggle button */
-static void
-hook_toggle (GtkWidget *dialog, GtkToggleButton *toggle, gpointer value_var, gpointer info)
-{
- gboolean *value;
-
- /* Set the value */
-
- value = (gboolean *) value_var;
- e_dialog_toggle_set (GTK_WIDGET (toggle), *value);
-
- /* Hook to changed */
-
- if (GNOME_IS_PROPERTY_BOX (dialog))
- gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
- GTK_SIGNAL_FUNC (toggled_cb), dialog);
-}
-
-/* Gets the value of a toggle button */
-static void
-get_toggle_value (GtkToggleButton *toggle, gpointer value_var, gpointer info)
-{
- gboolean *value;
-
- value = (gboolean *) value_var;
- *value = e_dialog_toggle_get (GTK_WIDGET (toggle));
-}
-
-/* Callback for the "value_changed" signal of the adjustment of a spin button */
-static void
-value_changed_cb (GtkAdjustment *adj, gpointer data)
-{
- GnomePropertyBox *pbox;
-
- pbox = GNOME_PROPERTY_BOX (data);
- gnome_property_box_changed (pbox);
-}
-
-/* Hooks a spin button */
-static void
-hook_spin_button (GtkWidget *dialog, GtkSpinButton *spin, gpointer value_var, gpointer info)
-{
- double *value;
- GtkAdjustment *adj;
-
- /* Set the value */
-
- value = (double *) value_var;
- e_dialog_spin_set (GTK_WIDGET (spin), *value);
-
- /* Hook to changed */
-
- adj = gtk_spin_button_get_adjustment (spin);
-
- if (GNOME_IS_PROPERTY_BOX (dialog))
- gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
- GTK_SIGNAL_FUNC (value_changed_cb), dialog);
-}
-
-/* Gets the value of a spin button */
-static void
-get_spin_button_value (GtkSpinButton *spin, gpointer value_var, gpointer info)
-{
- double *value;
-
- value = (double *) value_var;
- *value = e_dialog_spin_get_double (GTK_WIDGET (spin));
-}
-
-/* Callback for the "changed" signal of a GtkEditable widget */
-static void
-changed_cb (GtkEditable *editable, gpointer data)
-{
- GnomePropertyBox *pbox;
-
- pbox = GNOME_PROPERTY_BOX (data);
- gnome_property_box_changed (pbox);
-}
-
-/* Hooks a GtkEditable widget */
-static void
-hook_editable (GtkWidget *dialog, GtkEditable *editable, gpointer value_var, gpointer info)
-{
- char **value;
-
- /* Set the value */
-
- value = (char **) value_var;
-
- e_dialog_editable_set (GTK_WIDGET (editable), *value);
-
- /* Hook to changed */
-
- if (GNOME_IS_PROPERTY_BOX (dialog))
- gtk_signal_connect (GTK_OBJECT (editable), "changed",
- GTK_SIGNAL_FUNC (changed_cb), dialog);
-}
-
-/* Gets the value of a GtkEditable widget */
-static void
-get_editable_value (GtkEditable *editable, gpointer value_var, gpointer data)
-{
- char **value;
-
- value = (char **) value_var;
- if (*value)
- g_free (*value);
-
- *value = e_dialog_editable_get (GTK_WIDGET (editable));
-}
-
-/**
- * e_dialog_editable_set:
- * @widget: A #GtkEditable widget.
- * @value: String value.
- *
- * Sets the string value inside a #GtkEditable-derived widget.
- **/
-void
-e_dialog_editable_set (GtkWidget *widget, char *value)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_EDITABLE (widget));
-
- gtk_editable_delete_text (GTK_EDITABLE (widget), 0, -1);
-
- if (value) {
- gint pos;
-
- pos = 0;
- gtk_editable_insert_text (GTK_EDITABLE (widget), value, strlen (value), &pos);
- }
-}
-
-/**
- * e_dialog_editable_get:
- * @widget: A #GtkEditable widget.
- *
- * Queries the string value inside a #GtkEditable-derived widget.
- *
- * Return value: String value.
- **/
-char *
-e_dialog_editable_get (GtkWidget *widget)
-{
- g_return_val_if_fail (widget != NULL, NULL);
- g_return_val_if_fail (GTK_IS_EDITABLE (widget), NULL);
-
- return gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1);
-}
-
-/**
- * e_dialog_radio_set:
- * @widget: A #GtkRadioButton in a radio button group.
- * @value: Enumerated value.
- * @value_map: Map from enumeration values to array indices.
- *
- * Sets the selected item in a radio group. The specified @widget can be any of
- * the #GtkRadioButtons in the group. Each radio button should correspond to an
- * enumeration value; the specified @value will be mapped to an integer from
- * zero to the number of items in the group minus 1 by using a mapping table
- * specified in @value_map. The last element in this table should be -1. Thus
- * a table to map three possible interpolation values to integers could be
- * specified as { NEAREST_NEIGHBOR, BILINEAR, HYPERBOLIC, -1 }.
- **/
-void
-e_dialog_radio_set (GtkWidget *widget, int value, const int *value_map)
-{
- GSList *group;
- int i;
- GSList *l;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_RADIO_BUTTON (widget));
- g_return_if_fail (value_map != NULL);
-
- group = gtk_radio_button_group (GTK_RADIO_BUTTON (widget));
-
- i = value_to_index (value_map, value);
- if (i != -1) {
- /* Groups are built by prepending items, so the list ends up in reverse
- * order; we need to flip the index around.
- */
- i = g_slist_length (group) - i - 1;
-
- l = g_slist_nth (group, i);
- if (!l)
- g_message ("e_dialog_radio_set(): could not find index %d in radio group!",
- i);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (l->data), TRUE);
- } else
- g_message ("e_dialog_radio_set(): could not find value %d in value map!",
- value);
-}
-
-/**
- * e_dialog_radio_get:
- * @widget: A #GtkRadioButton in a radio button group.
- * @value_map: Map from enumeration values to array indices.
- *
- * Queries the selected item in a #GtkRadioButton group. Please read the
- * description of e_dialog_radio_set() to see how @value_map maps enumeration
- * values to button indices.
- *
- * Return value: Enumeration value which corresponds to the selected item in the
- * radio group.
- **/
-int
-e_dialog_radio_get (GtkWidget *widget, const int *value_map)
-{
- GSList *group;
- GSList *l;
- int i;
- int v;
-
- g_return_val_if_fail (widget != NULL, -1);
- g_return_val_if_fail (GTK_IS_RADIO_BUTTON (widget), -1);
- g_return_val_if_fail (value_map != NULL, -1);
-
- group = gtk_radio_button_group (GTK_RADIO_BUTTON (widget));
-
- for (i = 0, l = group; l; l = l->next, i++) {
- widget = GTK_WIDGET (l->data);
-
- if (GTK_TOGGLE_BUTTON (widget)->active)
- break;
- }
-
- if (!l)
- g_assert_not_reached ();
-
- /* Groups are built by prepending items, so the list ends up in reverse
- * order; we need to flip the index around.
- */
- i = g_slist_length (group) - i - 1;
-
- v = index_to_value (value_map, i);
- if (v == -1) {
- g_message ("e_dialog_radio_get(): could not find index %d in value map!", i);
- return -1;
- }
-
- return v;
-}
-
-/**
- * e_dialog_toggle_set:
- * @widget: A #GtkToggleButton.
- * @value: Toggle value.
- *
- * Sets the value of a #GtkToggleButton-derived widget. This should not be used
- * for radio buttons; it is more convenient to use use e_dialog_radio_set()
- * instead.
- **/
-void
-e_dialog_toggle_set (GtkWidget *widget, gboolean value)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), value);
-}
-
-/**
- * e_dialog_toggle_get:
- * @widget: A #GtkToggleButton.
- *
- * Queries the value of a #GtkToggleButton-derived widget. This should not be
- * used for radio buttons; it is more convenient to use e_dialog_radio_get()
- * instead.
- *
- * Return value: Toggle value.
- **/
-gboolean
-e_dialog_toggle_get (GtkWidget *widget)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_TOGGLE_BUTTON (widget), FALSE);
-
- return GTK_TOGGLE_BUTTON (widget)->active;
-}
-
-/**
- * e_dialog_spin_set:
- * @widget: A #GtkSpinButton.
- * @value: Numeric value.
- *
- * Sets the value of a #GtkSpinButton widget.
- **/
-void
-e_dialog_spin_set (GtkWidget *widget, double value)
-{
- GtkAdjustment *adj;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (widget));
-
- adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget));
-
- adj->value = value;
- gtk_signal_emit_by_name (GTK_OBJECT (adj), "value_changed");
-}
-
-/**
- * e_dialog_spin_get_double:
- * @widget: A #GtkSpinButton.
- *
- * Queries the floating-point value of a #GtkSpinButton widget.
- *
- * Return value: Numeric value.
- **/
-double
-e_dialog_spin_get_double (GtkWidget *widget)
-{
- GtkAdjustment *adj;
-
- g_return_val_if_fail (widget != NULL, 0.0);
- g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), 0.0);
-
- adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget));
- return adj->value;
-}
-
-/**
- * e_dialog_spin_get_int:
- * @widget: A #GtkSpinButton.
- *
- * Queries the integer value of a #GtkSpinButton widget.
- *
- * Return value: Numeric value.
- **/
-int
-e_dialog_spin_get_int (GtkWidget *widget)
-{
- double value;
-
- g_return_val_if_fail (widget != NULL, -1);
- g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), -1);
-
- value = e_dialog_spin_get_double (widget);
- return (int) floor (value);
-}
-
-/**
- * e_dialog_option_menu_set:
- * @widget: A #GtkOptionMenu.
- * @value: Enumerated value.
- * @value_map: Map from enumeration values to array indices.
- *
- * Sets the selected item in a #GtkOptionMenu. Please read the description of
- * e_dialog_radio_set() to see how @value_map maps enumeration values to item
- * indices.
- **/
-void
-e_dialog_option_menu_set (GtkWidget *widget, int value, const int *value_map)
-{
- int i;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_OPTION_MENU (widget));
- g_return_if_fail (value_map != NULL);
-
- i = value_to_index (value_map, value);
-
- if (i != -1)
- gtk_option_menu_set_history (GTK_OPTION_MENU (widget), i);
- else
- g_message ("e_dialog_option_menu_set(): could not find value %d in value map!",
- value);
-}
-
-/**
- * e_dialog_option_menu_get:
- * @widget: A #GtkOptionMenu.
- * @value_map: Map from enumeration values to array indices.
- *
- * Queries the selected item in a #GtkOptionMenu. Please read the description
- * of e_dialog_radio_set() to see how @value_map maps enumeration values to item
- * indices.
- *
- * Return value: Enumeration value which corresponds to the selected item in the
- * option menu.
- **/
-int
-e_dialog_option_menu_get (GtkWidget *widget, const int *value_map)
-{
- GtkMenu *menu;
- GtkWidget *active;
- GList *children;
- GList *l;
- int i;
- int v;
-
- g_return_val_if_fail (widget != NULL, -1);
- g_return_val_if_fail (GTK_IS_OPTION_MENU (widget), -1);
- g_return_val_if_fail (value_map != NULL, -1);
-
- menu = GTK_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (widget)));
-
- active = gtk_menu_get_active (menu);
- g_assert (active != NULL);
-
- children = GTK_MENU_SHELL (menu)->children;
-
- for (i = 0, l = children; l; l = l->next, i++) {
- if (GTK_WIDGET (l->data) == active)
- break;
- }
-
- if (!l)
- g_assert_not_reached ();
-
- v = index_to_value (value_map, i);
- if (v == -1) {
- g_message ("e_dialog_option_menu_get(): could not find index %d in value map!", i);
- return -1;
- }
-
- return v;
-}
-
-/**
- * e_dialog_dateedit_set:
- * @widget: A #GnomeDateEdit widget.
- * @t: Date/time value.
- *
- * Sets the value of a #GnomeDateEdit widget.
- **/
-void
-e_dialog_dateedit_set (GtkWidget *widget, time_t t)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNOME_IS_DATE_EDIT (widget));
-
- gnome_date_edit_set_time (GNOME_DATE_EDIT (widget), t);
-}
-
-/**
- * e_dialog_dateedit_get:
- * @widget: A #GnomeDateEdit widget.
- *
- * Queries the value of a #GnomeDateEdit widget.
- *
- * Return value: Date/time value.
- **/
-time_t
-e_dialog_dateedit_get (GtkWidget *widget)
-{
- g_return_val_if_fail (widget != NULL, -1);
- g_return_val_if_fail (GNOME_IS_DATE_EDIT (widget), -1);
-
- return gnome_date_edit_get_date (GNOME_DATE_EDIT (widget));
-}
-
-/**
- * e_dialog_widget_hook_value:
- * @dialog: Dialog box in which the @widget lives in.
- * @widget: A widget that will control a variable.
- * @value_var: Pointer to the variable that the @widget will control.
- * @info: NULL for most widgets, or an integer value map array (see
- * e_dialog_radio_set() for details).
- *
- * Hooks a widget from a dialog box to the variable it will modify. Supported
- * widgets are: #GtkEditable (char *), #GtkRadioButton (int/value_map pair; see
- * e_dialog_radio_set() for more information), #GtkTogglebutton (gboolean),
- * #GtkSpinButton (double), #GtkOptionMenu (int/value_map pair), and
- * #GnomeDateEdit (time_t).
- *
- * A pointer to the appropriate variable to modify should be passed in @value_var.
- * For values that take a value_map array as well, it should be passed in @info.
- *
- * The widgets within a dialog that are hooked with this function will set their
- * respective variables only when e_dialog_get_values() is called. The typical
- * use is to call that function in the handler for the "OK" button of a dialog
- * box.
- *
- * In addition, if the specified @dialog is a #GnomePropertyBox, the widgets wil
- * automatically turn on the "Apply" button of the property box when they are
- * modified by the user.
- *
- * Return value: TRUE if the type of the specified @widget is supported, FALSE
- * otherwise.
- **/
-gboolean
-e_dialog_widget_hook_value (GtkWidget *dialog, GtkWidget *widget,
- gpointer value_var, gpointer info)
-{
- DialogHooks *hooks;
- WidgetHook *wh;
-
- g_return_val_if_fail (dialog != NULL, FALSE);
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
- g_return_val_if_fail (value_var != NULL, FALSE);
-
- hooks = get_dialog_hooks (dialog);
-
- /* First check if it is a "group" widget, like a radio button or an
- * option menu. Then we check for normal ungrouped widgets.
- */
-
- if (GTK_IS_RADIO_BUTTON (widget))
- hook_radio (dialog, GTK_RADIO_BUTTON (widget), value_var, info);
- else if (GTK_IS_OPTION_MENU (widget))
- hook_option_menu (dialog, GTK_OPTION_MENU (widget), value_var, info);
- else if (GTK_IS_TOGGLE_BUTTON (widget))
- hook_toggle (dialog, GTK_TOGGLE_BUTTON (widget), value_var, info);
- else if (GTK_IS_SPIN_BUTTON (widget))
- hook_spin_button (dialog, GTK_SPIN_BUTTON (widget), value_var, info);
- else if (GTK_IS_EDITABLE (widget))
- hook_editable (dialog, GTK_EDITABLE (widget), value_var, info);
- else
- return FALSE;
-
- wh = g_new (WidgetHook, 1);
- wh->widget = widget;
- wh->value_var = value_var;
- wh->info = info;
-
- hooks->whooks = g_slist_prepend (hooks->whooks, wh);
-
- return TRUE;
-}
-
-/**
- * e_dialog_get_values:
- * @dialog: A dialog box whose widgets have been hooked to the appropriate
- * variables with e_dialog_widget_hook_value().
- *
- * Makes every widget in a @dialog that was hooked with
- * e_dialog_widget_hook_value() apply its value to its corresponding variable.
- * The typical usage is to call this function in the handler for the "OK" button
- * of a dialog box.
- **/
-void
-e_dialog_get_values (GtkWidget *dialog)
-{
- DialogHooks *hooks;
- GSList *l;
-
- g_return_if_fail (dialog != NULL);
-
- hooks = get_dialog_hooks (dialog);
-
- for (l = hooks->whooks; l; l = l->next) {
- WidgetHook *wh;
-
- wh = l->data;
-
- if (GTK_IS_RADIO_BUTTON (wh->widget))
- get_radio_value (GTK_RADIO_BUTTON (wh->widget), wh->value_var, wh->info);
- else if (GTK_IS_OPTION_MENU (wh->widget))
- get_option_menu_value (GTK_OPTION_MENU (wh->widget), wh->value_var, wh->info);
- else if (GTK_IS_TOGGLE_BUTTON (wh->widget))
- get_toggle_value (GTK_TOGGLE_BUTTON (wh->widget), wh->value_var, wh->info);
- else if (GTK_IS_SPIN_BUTTON (wh->widget))
- get_spin_button_value (GTK_SPIN_BUTTON (wh->widget), wh->value_var, wh->info);
- else if (GTK_IS_EDITABLE (wh->widget))
- get_editable_value (GTK_EDITABLE (wh->widget), wh->value_var, wh->info);
- else
- g_assert_not_reached ();
- }
-}
-
-/**
- * e_dialog_xml_widget_hook_value:
- * @xml: Glade XML description of a dialog box.
- * @dialog: Dialog box in which the widget lives in.
- * @widget_name: Name of the widget in the Glade XML data.
- * @value_var: Pointer to the variable that the widget will control.
- * @info: NULL for most widgets, or an integer value map array (see
- * e_dialog_radio_set() for details).
- *
- * Similar to e_dialog_widget_hook_value(), but uses the widget from a #GladeXML
- * data structure.
- *
- * Return value: TRUE if the type of the specified widget is supported, FALSE
- * otherwise.
- **/
-gboolean
-e_dialog_xml_widget_hook_value (GladeXML *xml, GtkWidget *dialog, const char *widget_name,
- gpointer value_var, gpointer info)
-{
- GtkWidget *widget;
-
- g_return_val_if_fail (xml != NULL, FALSE);
- g_return_val_if_fail (GLADE_IS_XML (xml), FALSE);
- g_return_val_if_fail (dialog != NULL, FALSE);
- g_return_val_if_fail (widget_name != NULL, FALSE);
- g_return_val_if_fail (value_var != NULL, FALSE);
-
- widget = glade_xml_get_widget (xml, widget_name);
- if (!widget) {
- g_message ("e_dialog_xml_widget_hook_value(): could not find widget `%s' in "
- "Glade data!", widget_name);
- return FALSE;
- }
-
- return e_dialog_widget_hook_value (dialog, widget, value_var, info);
-}
diff --git a/e-util/e-dialog-widgets.h b/e-util/e-dialog-widgets.h
deleted file mode 100644
index cbcdd1c8f1..0000000000
--- a/e-util/e-dialog-widgets.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Evolution internal utilities - Glade dialog widget utilities
- *
- * Copyright (C) 2000 Helix Code, Inc.
- *
- * Author: Federico Mena-Quintero <federico@gimp.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef E_DIALOG_WIDGETS_H
-#define E_DIALOG_WIDGETS_H
-
-#include <time.h>
-#include <glade/glade.h>
-#include <libgnomeui/gnome-propertybox.h>
-
-
-
-void e_dialog_editable_set (GtkWidget *widget, char *value);
-char *e_dialog_editable_get (GtkWidget *widget);
-
-void e_dialog_radio_set (GtkWidget *widget, int value, const int *value_map);
-int e_dialog_radio_get (GtkWidget *widget, const int *value_map);
-
-void e_dialog_toggle_set (GtkWidget *widget, gboolean value);
-gboolean e_dialog_toggle_get (GtkWidget *widget);
-
-void e_dialog_spin_set (GtkWidget *widget, double value);
-double e_dialog_spin_get_double (GtkWidget *widget);
-int e_dialog_spin_get_int (GtkWidget *widget);
-
-void e_dialog_option_menu_set (GtkWidget *widget, int value, const int *value_map);
-int e_dialog_option_menu_get (GtkWidget *widget, const int *value_map);
-
-void e_dialog_dateedit_set (GtkWidget *widget, time_t t);
-time_t e_dialog_dateedit_get (GtkWidget *widget);
-
-gboolean e_dialog_widget_hook_value (GtkWidget *dialog, GtkWidget *widget,
- gpointer value_var, gpointer info);
-
-void e_dialog_get_values (GtkWidget *dialog);
-
-gboolean e_dialog_xml_widget_hook_value (GladeXML *xml, GtkWidget *dialog, const char *widget_name,
- gpointer value_var, gpointer info);
-
-
-
-#endif
diff --git a/e-util/e-font.c b/e-util/e-font.c
deleted file mode 100644
index a13f0b962c..0000000000
--- a/e-util/e-font.c
+++ /dev/null
@@ -1,128 +0,0 @@
-#define _E_FONT_C_
-
-/*
- * e-font
- *
- * Temporary wrappers around GdkFonts to get unicode displaying
- *
- * Author: Lauris Kaplinski <lauris@helixcode.com>
- *
- * Copyright (C) 2000 Helix Code, Inc.
- *
- */
-
-#include <unicode.h>
-#include "e-font.h"
-
-struct _EFont {
- GdkFont font;
-};
-
-EFont *
-e_font_from_gdk_name (const gchar *name)
-{
- GdkFont *font;
-
- font = gdk_fontset_load (name);
-
- return (EFont *) font;
-}
-
-EFont *
-e_font_from_gdk_font (GdkFont *font)
-{
- gdk_font_ref (font);
-
- return (EFont *) font;
-}
-
-void
-e_font_ref (EFont *font)
-{
- gdk_font_ref (&font->font);
-}
-
-void
-e_font_unref (EFont *font)
-{
- gdk_font_unref (&font->font);
-}
-
-gint
-e_font_ascent (EFont * font)
-{
- return font->font.ascent;
-}
-
-gint
-e_font_descent (EFont * font)
-{
- return font->font.descent;
-}
-
-void
-e_font_draw_utf8_text (GdkDrawable *drawable, EFont *font, EFontStyle style, GdkGC *gc, gint x, gint y, gchar *text, gint numbytes)
-{
- guchar *iso;
- gchar *p;
- gint uni, len;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (font != NULL);
- g_return_if_fail (gc != NULL);
- g_return_if_fail (text != NULL);
-
- if (numbytes < 1) return;
-
- iso = alloca (numbytes);
-
- for (len = 0, p = text; p != NULL && p < (text + numbytes); len++, p = unicode_next_utf8 (p)) {
- unicode_get_utf8 (p, &uni);
- if ((uni < ' ') || (uni > 255)) uni = ' ';
- iso[len] = uni;
- }
-
- gdk_draw_text (drawable, &font->font, gc, x, y, iso, len);
-
- if (style & E_FONT_BOLD)
- gdk_draw_text (drawable, &font->font, gc, x + 1, y, iso, len);
-}
-
-gint
-e_font_utf8_text_width (EFont *font, EFontStyle style, char *text, int numbytes)
-{
- guchar *iso;
- gchar *p;
- gint uni, len;
-
- iso = alloca (numbytes);
-
- for (len = 0, p = text; p != NULL && p < (text + numbytes); len++, p = unicode_next_utf8 (p)) {
- unicode_get_utf8 (p, &uni);
- if ((uni < ' ') || (uni > 255)) uni = ' ';
- iso[len] = uni;
- }
-
- return gdk_text_width (&font->font, iso, len);
-}
-
-gint
-e_font_utf8_char_width (EFont *font, EFontStyle style, char *text)
-{
- unicode_char_t uni;
- guchar iso;
-
- if (!unicode_get_utf8 (text, &uni)) return 0;
-
- if ((uni < ' ') || (uni > 255)) uni = ' ';
-
- iso = uni;
-
- return gdk_text_width (&font->font, &iso, 1);
-}
-
-
-
-
-
-
diff --git a/e-util/e-font.h b/e-util/e-font.h
deleted file mode 100644
index 9616e9ef4b..0000000000
--- a/e-util/e-font.h
+++ /dev/null
@@ -1,64 +0,0 @@
-#ifndef _E_FONT_H_
-#define _E_FONT_H_
-
-/*
- * e-font
- *
- * Temporary wrappers around GdkFonts to get unicode displaying
- *
- * Author: Lauris Kaplinski <lauris@helixcode.com>
- *
- * Copyright (C) 2000 Helix Code, Inc.
- *
- */
-
-#include <glib.h>
-#include <gdk/gdk.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-typedef struct _EFont EFont;
-
-/*
- * We use very primitive styling here, enough for marking read/unread lines
- */
-
-typedef enum {
- E_FONT_PLAIN = 0,
- E_FONT_BOLD = (1 << 0),
- E_FONT_ITALIC = (1 << 4)
-} EFontStyle;
-
-EFont * e_font_from_gdk_name (const gchar *name);
-EFont * e_font_from_gdk_font (GdkFont *font);
-
-void e_font_ref (EFont *font);
-void e_font_unref (EFont *font);
-
-gint e_font_ascent (EFont * font);
-gint e_font_descent (EFont * font);
-
-#define e_font_height(f) (e_font_ascent (f) + e_font_descent (f))
-
-/*
- * NB! UTF-8 text widths are given in chars, not bytes
- */
-
-void e_font_draw_utf8_text (GdkDrawable *drawable,
- EFont *font, EFontStyle style,
- GdkGC *gc,
- gint x, gint y,
- gchar *text,
- gint numbytes);
-
-int e_font_utf8_text_width (EFont *font, EFontStyle style,
- char *text,
- int numbytes);
-
-int e_font_utf8_char_width (EFont *font, EFontStyle style,
- char *text);
-
-END_GNOME_DECLS
-
-#endif
diff --git a/e-util/e-gui-utils.c b/e-util/e-gui-utils.c
deleted file mode 100644
index 2e31eb101b..0000000000
--- a/e-util/e-gui-utils.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * GUI utility functions
- *
- * Author:
- * Miguel de Icaza (miguel@helixcode.com)
- *
- * (C) 1999 Miguel de Icaza
- * (C) 2000 Helix Code, Inc.
- */
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include <libgnomeui/gnome-messagebox.h>
-#include <libgnomeui/gnome-stock.h>
-#include <gnome.h>
-#include "e-gui-utils.h"
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gdk-pixbuf/gnome-canvas-pixbuf.h>
-
-void
-e_notice (GtkWindow *window, const char *type, const char *format, ...)
-{
- GtkWidget *dialog;
- va_list args;
- char *str;
-
- va_start (args, format);
- str = g_strdup_vprintf (format, args);
- dialog = gnome_message_box_new (str, type, GNOME_STOCK_BUTTON_OK, NULL);
- va_end (args);
- g_free (str);
-
- if (window)
- gnome_dialog_set_parent (GNOME_DIALOG (dialog), window);
-
- gnome_dialog_run (GNOME_DIALOG (dialog));
-}
-
-static void
-kill_popup_menu (GtkWidget *widget, GtkMenu *menu)
-{
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- gtk_object_unref (GTK_OBJECT (menu));
-}
-
-void
-e_auto_kill_popup_menu_on_hide (GtkMenu *menu)
-{
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- gtk_signal_connect (GTK_OBJECT (menu), "hide",
- GTK_SIGNAL_FUNC (kill_popup_menu), menu);
-}
-
-void
-e_popup_menu (GtkMenu *menu, GdkEventButton *event)
-{
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- e_auto_kill_popup_menu_on_hide (menu);
- gtk_menu_popup (menu, NULL, NULL, 0, NULL, event->button, event->time);
-}
-
-GtkWidget *e_create_image_widget(gchar *name,
- gchar *string1, gchar *string2,
- gint int1, gint int2)
-{
- char *filename;
- GdkPixbuf *pixbuf;
- double width, height;
- GtkWidget *canvas, *alignment;
- if (string1) {
- if (*string1 == '/')
- filename = g_strdup(string1);
- else
- filename = g_concat_dir_and_file(EVOLUTION_IMAGES, string1);
- pixbuf = gdk_pixbuf_new_from_file(filename);
- width = gdk_pixbuf_get_width(pixbuf);
- height = gdk_pixbuf_get_height(pixbuf);
-
- canvas = gnome_canvas_new_aa();
- GTK_OBJECT_UNSET_FLAGS(GTK_WIDGET(canvas), GTK_CAN_FOCUS);
- gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(canvas)),
- gnome_canvas_pixbuf_get_type(),
-
- "pixbuf", pixbuf,
- NULL);
-
- alignment = gtk_widget_new(gtk_alignment_get_type(),
- "child", canvas,
- "xalign", (double) 0,
- "yalign", (double) 0,
- "xscale", (double) 0,
- "yscale", (double) 0,
- NULL);
-
- gtk_widget_set_usize(canvas, width, height);
-
- gdk_pixbuf_unref(pixbuf);
-
- gtk_widget_show(canvas);
- gtk_widget_show(alignment);
- g_free(filename);
-
- return alignment;
- } else
- return NULL;
-}
-
-typedef struct {
- GtkCallback callback;
- gpointer closure;
-} CallbackClosure;
-
-static void
-e_container_foreach_leaf_callback(GtkWidget *widget, CallbackClosure *callback_closure)
-{
- if (GTK_IS_CONTAINER(widget)) {
- e_container_foreach_leaf(GTK_CONTAINER(widget), callback_closure->callback, callback_closure->closure);
- } else {
- (*callback_closure->callback) (widget, callback_closure->closure);
- }
-}
-
-void
-e_container_foreach_leaf(GtkContainer *container,
- GtkCallback callback,
- gpointer closure)
-{
- CallbackClosure callback_closure;
- callback_closure.callback = callback;
- callback_closure.closure = closure;
- gtk_container_foreach(container, (GtkCallback) e_container_foreach_leaf_callback, &callback_closure);
-}
-
-static void
-e_container_change_tab_order_destroy_notify(gpointer data)
-{
- GList *list = data;
- g_list_foreach(list, (GFunc) gtk_object_unref, NULL);
- g_list_free(list);
-}
-
-
-static gint
-e_container_change_tab_order_callback(GtkContainer *container,
- GtkDirectionType direction,
- GList *children)
-{
- GtkWidget *focus_child;
- GtkWidget *child;
-
- if (direction != GTK_DIR_TAB_FORWARD &&
- direction != GTK_DIR_TAB_BACKWARD)
- return FALSE;
-
- focus_child = container->focus_child;
-
- if (direction == GTK_DIR_TAB_BACKWARD) {
- children = g_list_last(children);
- }
-
- while (children) {
- child = children->data;
- if (direction == GTK_DIR_TAB_FORWARD)
- children = children->next;
- else
- children = children->prev;
-
- if (!child)
- continue;
-
- if (focus_child) {
- if (focus_child == child) {
- focus_child = NULL;
-
- 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");
- 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");
- return TRUE;
- }
- }
- else if (GTK_WIDGET_CAN_FOCUS (child)) {
- gtk_widget_grab_focus (child);
- gtk_signal_emit_stop_by_name(GTK_OBJECT(container), "focus");
- return TRUE;
- }
- }
- }
-
- return FALSE;
-}
-
-gint
-e_container_change_tab_order(GtkContainer *container, GList *widgets)
-{
- GList *list;
- list = g_list_copy(widgets);
- g_list_foreach(list, (GFunc) gtk_object_ref, NULL);
- return gtk_signal_connect_full(GTK_OBJECT(container), "focus",
- GTK_SIGNAL_FUNC(e_container_change_tab_order_callback),
- NULL, list,
- e_container_change_tab_order_destroy_notify,
- FALSE, FALSE);
-}
diff --git a/e-util/e-gui-utils.h b/e-util/e-gui-utils.h
deleted file mode 100644
index 1d47a7b514..0000000000
--- a/e-util/e-gui-utils.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef E_GUI_UTILS_H
-#define E_GUI_UTILS_H
-
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkwindow.h>
-
-#include <libgnomeui/gnome-messagebox.h>
-
-void e_popup_menu (GtkMenu *menu, GdkEventButton *event);
-void e_auto_kill_popup_menu_on_hide (GtkMenu *menu);
-void e_notice (GtkWindow *window, const char *type, const char *format, ...);
-GtkWidget *e_create_image_widget (gchar *name, gchar *string1, gchar *string2, gint int1, gint int2);
-void e_container_foreach_leaf (GtkContainer *container,
- GtkCallback callback,
- gpointer closure);
-gint e_container_change_tab_order (GtkContainer *container,
- GList *widgets);
-
-#endif /* E_GUI_UTILS_H */
diff --git a/e-util/e-html-utils.c b/e-util/e-html-utils.c
deleted file mode 100644
index 91cb00aa4b..0000000000
--- a/e-util/e-html-utils.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-html-utils.c
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Dan Winship <danw@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "e-html-utils.h"
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-
-static int etth_interesting[] = {
- 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x00 - 0x0f */
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x10 - 0x1f */
- 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* sp - / */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 1, 2, 1, 2, /* 0 - ? */
- 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ - O */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, /* P - _ */
- 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ` - o */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, /* p - del */
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x80 - 0x8f */
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x90 - 0x9f */
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xa0 - 0xaf */
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xb0 - 0xbf */
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xc0 - 0xcf */
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xd0 - 0xdf */
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xe0 - 0xef */
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 /* 0xf0 - 0xff */
-};
-#define ETTH_SPECIAL 1
-#define ETTH_PUNCTUATION 2
-#define ETTH_ESCAPED 3
-#define ETTH_EOF 4
-
-static char *
-check_size (char **buffer, int *buffer_size, char *out, int len)
-{
- if (out + len > *buffer + *buffer_size) {
- int index = out - *buffer;
-
- *buffer_size *= 2;
- *buffer = g_realloc (*buffer, *buffer_size);
- out = *buffer + index;
- }
- return out;
-}
-
-static char *
-url_extract (const unsigned char **text, gboolean check)
-{
- const unsigned char *end = *text, *p;
- char *out;
-
- while (*end && !isspace (*end) && *end != '"')
- end++;
-
- /* Back up if we probably went too far. */
- while (end > *text && strchr (",.!?;:>)", *(end - 1)))
- end--;
-
- if (check) {
- /* Make sure we weren't fooled. */
- p = memchr (*text, ':', end - *text);
- if (!p || end - p < 3)
- return NULL;
- }
-
- out = g_strndup (*text, end - *text);
- *text = end;
- return out;
-}
-
-/**
- * e_text_to_html:
- * @input: a NUL-terminated input buffer
- * @flags: some combination of the E_TEXT_TO_HTML_* flags defined
- * in e-html-utils.h
- *
- * This takes a buffer of text as input and produces a buffer of
- * "equivalent" HTML, subject to certain transformation rules.
- *
- * The set of possible flags is:
- *
- * - E_TEXT_TO_HTML_PRE: wrap the output HTML in <PRE> and </PRE>.
- * Should only be used if @input is the entire buffer to be
- * converted. If e_text_to_html is being called with small pieces
- * of data, you should wrap the entire result in <PRE> yourself.
- *
- * - E_TEXT_TO_HTML_CONVERT_NL: convert "\n" to "<BR>\n" on output.
- * (should not be used with E_TEXT_TO_HTML_PRE, since that would
- * result in double-newlines).
- *
- * - E_TEXT_TO_HTML_CONVERT_SPACES: convert a block of N spaces
- * into N-1 non-breaking spaces and one normal space. A space
- * at the start of the buffer is always converted to a
- * non-breaking space, regardless of the following character,
- * which probably means you don't want to use this flag on
- * pieces of data that aren't delimited by at least line breaks.
- *
- * If E_TEXT_TO_HTML_CONVERT_NL and E_TEXT_TO_HTML_CONVERT_SPACES
- * are both defined, then TABs will also be converted to spaces.
- *
- * - E_TEXT_TO_HTML_CONVERT_URLS: wrap <a href="..."> </a> around
- * strings that look like URLs.
- **/
-char *
-e_text_to_html (const char *input, unsigned int flags)
-{
- const unsigned char *cur = input, *end;
- char *buffer = NULL;
- char *out = NULL;
- int buffer_size = 0, col;
-
- /* Allocate a translation buffer. */
- buffer_size = strlen (input) * 2 + 5;
- buffer = g_malloc (buffer_size);
-
- out = buffer;
- if (flags & E_TEXT_TO_HTML_PRE)
- out += sprintf (out, "<PRE>\n");
-
- col = 0;
- while (*cur) {
- if (isalpha (*cur) && (flags & E_TEXT_TO_HTML_CONVERT_URLS)) {
- char *tmpurl = NULL, *refurl = NULL, *dispurl = NULL;
-
- if (!strncasecmp (cur, "http://", 7) ||
- !strncasecmp (cur, "https://", 8) ||
- !strncasecmp (cur, "ftp://", 6) ||
- !strncasecmp (cur, "nntp://", 7) ||
- !strncasecmp (cur, "mailto:", 7) ||
- !strncasecmp (cur, "news:", 5)) {
- tmpurl = url_extract (&cur, TRUE);
- if (tmpurl) {
- refurl = e_text_to_html (tmpurl, 0);
- dispurl = g_strdup (refurl);
- }
- } else if (!strncasecmp (cur, "www.", 4) &&
- isalnum (*(cur + 4))) {
- tmpurl = url_extract (&cur, FALSE);
- dispurl = e_text_to_html (tmpurl, 0);
- refurl = g_strdup_printf ("http://%s",
- dispurl);
- }
-
- if (tmpurl) {
- out = check_size (&buffer, &buffer_size, out,
- strlen (refurl) +
- strlen (dispurl) + 15);
- out += sprintf (out,
- "<a href=\"%s\">%s</a>",
- refurl, dispurl);
- col += strlen (tmpurl);
- g_free (tmpurl);
- g_free (refurl);
- g_free (dispurl);
- }
- }
-
- /* Skip until we need to care. */
- end = cur;
- while (!etth_interesting[*end] ||
- (etth_interesting[*end] == ETTH_PUNCTUATION &&
- !(flags & E_TEXT_TO_HTML_CONVERT_URLS)))
- end++;
-
- out = check_size (&buffer, &buffer_size, out,
- end - cur + 10);
- memcpy (out, cur, end - cur);
- out += end - cur;
- col += end - cur;
-
- if (!*end)
- break;
- cur = end;
-
- switch (*cur) {
- case '<':
- strcpy (out, "&lt;");
- out += 4;
- col++;
- break;
-
- case '>':
- strcpy (out, "&gt;");
- out += 4;
- col++;
- break;
-
- case '&':
- strcpy (out, "&amp;");
- out += 5;
- col++;
- break;
-
- case '"':
- strcpy (out, "&quot;");
- out += 6;
- col++;
- break;
-
- case '\n':
- if (flags & E_TEXT_TO_HTML_CONVERT_NL) {
- strcpy (out, "<br>");
- out += 4;
- }
- *out++ = *cur;
- col = 0;
- break;
-
- case '\t':
- if (flags & (E_TEXT_TO_HTML_CONVERT_SPACES |
- E_TEXT_TO_HTML_CONVERT_NL)) {
- do {
- out = check_size (&buffer, &buffer_size,
- out, 6);
- strcpy (out, "&nbsp;");
- out += 6;
- col++;
- } while (col % 8);
- break;
- }
- /* otherwise, FALL THROUGH */
-
- case ' ':
- if (flags & E_TEXT_TO_HTML_CONVERT_SPACES) {
- if (cur == (const unsigned char *)input ||
- *(cur + 1) == ' ' || *(cur + 1) == '\t') {
- strcpy (out, "&nbsp;");
- out += 6;
- col++;
- break;
- }
- }
- /* otherwise, FALL THROUGH */
-
- default:
- if ((*cur >= 0x20 && *cur < 0x80) ||
- (*cur == '\r' || *cur == '\t')) {
- /* Default case, just copy. */
- *out++ = *cur;
- } else
- out += g_snprintf(out, 9, "&#%d;", *cur);
- col++;
- break;
- }
-
- cur++;
- }
-
- out = check_size (&buffer, &buffer_size, out, 7);
- if (flags & E_TEXT_TO_HTML_PRE)
- strcpy (out, "</PRE>");
- else
- *out = '\0';
-
- return buffer;
-}
diff --git a/e-util/e-html-utils.h b/e-util/e-html-utils.h
deleted file mode 100644
index a56889f4d9..0000000000
--- a/e-util/e-html-utils.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-html-utils.c */
-/*
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Dan Winship <danw@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __E_HTML_UTILS__
-#define __E_HTML_UTILS__
-
-#define E_TEXT_TO_HTML_PRE (1 << 0)
-#define E_TEXT_TO_HTML_CONVERT_NL (1 << 1)
-#define E_TEXT_TO_HTML_CONVERT_SPACES (1 << 2)
-#define E_TEXT_TO_HTML_CONVERT_URLS (1 << 3)
-
-char *e_text_to_html (const char *input, unsigned int flags);
-
-#endif /* __E_HTML_UTILS__ */
diff --git a/e-util/e-iterator.c b/e-util/e-iterator.c
deleted file mode 100644
index 874d05ccea..0000000000
--- a/e-util/e-iterator.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@umich.edu>
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#include <config.h>
-#include <gtk/gtk.h>
-
-#include "e-iterator.h"
-
-#define ECI_CLASS(object) (E_ITERATOR_CLASS(GTK_OBJECT((object))->klass))
-
-static void e_iterator_init (EIterator *card);
-static void e_iterator_class_init (EIteratorClass *klass);
-
-#define PARENT_TYPE (gtk_object_get_type ())
-
-static GtkObjectClass *parent_class;
-
-enum {
- INVALIDATE,
- LAST_SIGNAL
-};
-
-static guint e_iterator_signals [LAST_SIGNAL] = { 0, };
-
-/**
- * e_iterator_get_type:
- * @void:
- *
- * Registers the &EIterator class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &EIterator class.
- **/
-GtkType
-e_iterator_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type) {
- GtkTypeInfo info = {
- "EIterator",
- sizeof (EIterator),
- sizeof (EIteratorClass),
- (GtkClassInitFunc) e_iterator_class_init,
- (GtkObjectInitFunc) e_iterator_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-static void
-e_iterator_class_init (EIteratorClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS(klass);
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- e_iterator_signals [INVALIDATE] =
- gtk_signal_new ("invalidate",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EIteratorClass, invalidate),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, e_iterator_signals, LAST_SIGNAL);
-
- klass->invalidate = NULL;
- klass->get = NULL;
- klass->reset = NULL;
- klass->last = NULL;
- klass->next = NULL;
- klass->prev = NULL;
- klass->delete = NULL;
- klass->insert = NULL;
- klass->set = NULL;
- klass->is_valid = NULL;
-}
-
-/**
- * e_iterator_init:
- */
-static void
-e_iterator_init (EIterator *card)
-{
-}
-
-/*
- * Virtual functions:
- */
-const void *
-e_iterator_get (EIterator *iterator)
-{
- if (ECI_CLASS(iterator)->get)
- return ECI_CLASS(iterator)->get(iterator);
- else
- return NULL;
-}
-
-void
-e_iterator_reset (EIterator *iterator)
-{
- if (ECI_CLASS(iterator)->reset)
- ECI_CLASS(iterator)->reset(iterator);
-}
-
-void
-e_iterator_last (EIterator *iterator)
-{
- if (ECI_CLASS(iterator)->last)
- ECI_CLASS(iterator)->last(iterator);
-}
-
-gboolean
-e_iterator_next (EIterator *iterator)
-{
- if (ECI_CLASS(iterator)->next)
- return ECI_CLASS(iterator)->next(iterator);
- else
- return FALSE;
-}
-
-gboolean
-e_iterator_prev (EIterator *iterator)
-{
- if (ECI_CLASS(iterator)->prev)
- return ECI_CLASS(iterator)->prev(iterator);
- else
- return FALSE;
-}
-
-void
-e_iterator_delete (EIterator *iterator)
-{
- if (ECI_CLASS(iterator)->delete)
- ECI_CLASS(iterator)->delete(iterator);
-}
-
-void e_iterator_insert (EIterator *iterator,
- const void *object,
- gboolean before)
-{
- if (ECI_CLASS(iterator)->insert)
- ECI_CLASS(iterator)->insert(iterator, object, before);
-}
-
-void
-e_iterator_set (EIterator *iterator,
- const void *object)
-{
- if (ECI_CLASS(iterator)->set)
- ECI_CLASS(iterator)->set(iterator, object);
-}
-
-gboolean
-e_iterator_is_valid (EIterator *iterator)
-{
- if (ECI_CLASS(iterator)->is_valid)
- return ECI_CLASS(iterator)->is_valid(iterator);
- else
- return FALSE;
-}
-
-void
-e_iterator_invalidate (EIterator *iterator)
-{
- g_return_if_fail (iterator != NULL);
- g_return_if_fail (E_IS_ITERATOR (iterator));
-
- gtk_signal_emit (GTK_OBJECT (iterator),
- e_iterator_signals [INVALIDATE]);
-}
diff --git a/e-util/e-iterator.h b/e-util/e-iterator.h
deleted file mode 100644
index 84a2db142b..0000000000
--- a/e-util/e-iterator.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@helixcode.com>
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#ifndef __E_ITERATOR_H__
-#define __E_ITERATOR_H__
-
-#include <time.h>
-#include <gtk/gtk.h>
-#include <stdio.h>
-
-#define E_TYPE_ITERATOR (e_iterator_get_type ())
-#define E_ITERATOR(obj) (GTK_CHECK_CAST ((obj), E_TYPE_ITERATOR, EIterator))
-#define E_ITERATOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_ITERATOR, EIteratorClass))
-#define E_IS_ITERATOR(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_ITERATOR))
-#define E_IS_ITERATOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_ITERATOR))
-
-typedef struct _EIterator EIterator;
-typedef struct _EIteratorClass EIteratorClass;
-
-struct _EIterator {
- GtkObject object;
-};
-
-struct _EIteratorClass {
- GtkObjectClass parent_class;
-
- /* Signals */
- void (*invalidate) (EIterator *iterator);
-
- /* Virtual functions */
- const void * (*get) (EIterator *iterator);
- void (*reset) (EIterator *iterator);
- void (*last) (EIterator *iterator);
- gboolean (*next) (EIterator *iterator);
- gboolean (*prev) (EIterator *iterator);
- void (*delete) (EIterator *iterator);
- void (*insert) (EIterator *iterator,
- const void *object,
- gboolean before);
- void (*set) (EIterator *iterator,
- const void *object);
- gboolean (*is_valid) (EIterator *iterator);
-};
-
-const void *e_iterator_get (EIterator *iterator);
-void e_iterator_reset (EIterator *iterator);
-void e_iterator_last (EIterator *iterator);
-gboolean e_iterator_next (EIterator *iterator);
-gboolean e_iterator_prev (EIterator *iterator);
-void e_iterator_delete (EIterator *iterator);
-void e_iterator_insert (EIterator *iterator,
- const void *object,
- gboolean before);
-void e_iterator_set (EIterator *iterator,
- const void *object);
-gboolean e_iterator_is_valid (EIterator *iterator);
-
-void e_iterator_invalidate (EIterator *iterator);
-
-/* Standard Gtk function */
-GtkType e_iterator_get_type (void);
-
-#endif /* ! __E_ITERATOR_H__ */
diff --git a/e-util/e-list-iterator.c b/e-util/e-list-iterator.c
deleted file mode 100644
index 51480447b4..0000000000
--- a/e-util/e-list-iterator.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@umich.edu>
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#include <config.h>
-#include <gtk/gtk.h>
-
-#include "e-list-iterator.h"
-#include "e-list.h"
-
-static void e_list_iterator_init (EListIterator *list);
-static void e_list_iterator_class_init (EListIteratorClass *klass);
-
-static void e_list_iterator_invalidate (EIterator *iterator);
-static gboolean e_list_iterator_is_valid (EIterator *iterator);
-static void e_list_iterator_set (EIterator *iterator,
- const void *object);
-static void e_list_iterator_delete (EIterator *iterator);
-static void e_list_iterator_insert (EIterator *iterator,
- const void *object,
- gboolean before);
-static gboolean e_list_iterator_prev (EIterator *iterator);
-static gboolean e_list_iterator_next (EIterator *iterator);
-static void e_list_iterator_reset (EIterator *iterator);
-static void e_list_iterator_last (EIterator *iterator);
-static const void *e_list_iterator_get (EIterator *iterator);
-static void e_list_iterator_destroy (GtkObject *object);
-
-#define PARENT_TYPE (e_iterator_get_type ())
-
-static GtkObjectClass *parent_class;
-#define PARENT_CLASS (E_LIST_ITERATOR_CLASS(parent_class))
-
-/**
- * e_list_iterator_get_type:
- * @void:
- *
- * Registers the &EListIterator class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &EListIterator class.
- **/
-GtkType
-e_list_iterator_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type) {
- GtkTypeInfo info = {
- "EListIterator",
- sizeof (EListIterator),
- sizeof (EListIteratorClass),
- (GtkClassInitFunc) e_list_iterator_class_init,
- (GtkObjectInitFunc) e_list_iterator_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-static void
-e_list_iterator_class_init (EListIteratorClass *klass)
-{
- GtkObjectClass *object_class;
- EIteratorClass *iterator_class;
-
- object_class = GTK_OBJECT_CLASS(klass);
- iterator_class = E_ITERATOR_CLASS(klass);
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = e_list_iterator_destroy;
-
- iterator_class->invalidate = e_list_iterator_invalidate;
- iterator_class->get = e_list_iterator_get;
- iterator_class->reset = e_list_iterator_reset;
- iterator_class->last = e_list_iterator_last;
- iterator_class->next = e_list_iterator_next;
- iterator_class->prev = e_list_iterator_prev;
- iterator_class->delete = e_list_iterator_delete;
- iterator_class->insert = e_list_iterator_insert;
- iterator_class->set = e_list_iterator_set;
- iterator_class->is_valid = e_list_iterator_is_valid;
-}
-
-
-
-/**
- * e_list_iterator_init:
- */
-static void
-e_list_iterator_init (EListIterator *list)
-{
-}
-
-EIterator *
-e_list_iterator_new (EList *list)
-{
- EListIterator *iterator = gtk_type_new(e_list_iterator_get_type());
-
- iterator->list = list;
- gtk_object_ref(GTK_OBJECT(list));
- iterator->iterator = list->list;
-
- return E_ITERATOR(iterator);
-}
-
-/*
- * Virtual functions:
- */
-static void
-e_list_iterator_destroy (GtkObject *object)
-{
- EListIterator *iterator = E_LIST_ITERATOR(object);
- e_list_remove_iterator(iterator->list, E_ITERATOR(iterator));
- gtk_object_unref(GTK_OBJECT(iterator->list));
-}
-
-static const void *
-e_list_iterator_get (EIterator *_iterator)
-{
- EListIterator *iterator = E_LIST_ITERATOR(_iterator);
- if (iterator->iterator)
- return iterator->iterator->data;
- else
- return NULL;
-}
-
-static void
-e_list_iterator_reset (EIterator *_iterator)
-{
- EListIterator *iterator = E_LIST_ITERATOR(_iterator);
- iterator->iterator = iterator->list->list;
-}
-
-static void
-e_list_iterator_last (EIterator *_iterator)
-{
- EListIterator *iterator = E_LIST_ITERATOR(_iterator);
- iterator->iterator = g_list_last(iterator->list->list);
-}
-
-static gboolean
-e_list_iterator_next (EIterator *_iterator)
-{
- EListIterator *iterator = E_LIST_ITERATOR(_iterator);
- if (iterator->iterator)
- iterator->iterator = g_list_next(iterator->iterator);
- return (iterator->iterator != NULL);
-}
-
-static gboolean
-e_list_iterator_prev (EIterator *_iterator)
-{
- EListIterator *iterator = E_LIST_ITERATOR(_iterator);
- if (iterator->iterator)
- iterator->iterator = g_list_previous(iterator->iterator);
- return (iterator->iterator != NULL);
-}
-
-static void
-e_list_iterator_insert (EIterator *_iterator,
- const void *object,
- gboolean before)
-{
- EListIterator *iterator = E_LIST_ITERATOR(_iterator);
- void *data;
- if (iterator->list->copy)
- data = iterator->list->copy(object, iterator->list->closure);
- else
- data = (void *) object;
- if (iterator->iterator) {
- if (before) {
- iterator->list->list = g_list_first(g_list_prepend(iterator->iterator, data));
- iterator->iterator = iterator->iterator->prev;
- } else {
- if (iterator->iterator->next)
- g_list_prepend(iterator->iterator->next, data);
- else
- g_list_append(iterator->iterator, data);
- iterator->iterator = iterator->iterator->next;
- }
- e_list_invalidate_iterators(iterator->list, E_ITERATOR(iterator));
- } else {
- if (before) {
- iterator->list->list = g_list_append(iterator->list->list, data);
- iterator->iterator = g_list_last(iterator->list->list);
- } else {
- iterator->list->list = g_list_prepend(iterator->list->list, data);
- iterator->iterator = iterator->list->list;
- }
- e_list_invalidate_iterators(iterator->list, E_ITERATOR(iterator));
- }
-}
-
-static void
-e_list_iterator_delete (EIterator *_iterator)
-{
- EListIterator *iterator = E_LIST_ITERATOR(_iterator);
- if (iterator->iterator) {
- GList *temp = iterator->iterator->next;
- if (iterator->list->free)
- iterator->list->free(iterator->iterator->data, iterator->list->closure);
- iterator->list->list = g_list_remove_link(iterator->list->list, iterator->iterator);
- iterator->iterator = temp;
- e_list_invalidate_iterators(iterator->list, E_ITERATOR(iterator));
- }
-}
-
-static void
-e_list_iterator_set (EIterator *_iterator,
- const void *object)
-{
- EListIterator *iterator = E_LIST_ITERATOR(_iterator);
- if (iterator->iterator) {
- if (iterator->list->free)
- iterator->list->free(iterator->iterator->data, iterator->list->closure);
- if (iterator->list->copy)
- iterator->iterator->data = iterator->list->copy(object, iterator->list->closure);
- else
- iterator->iterator->data = (void *) object;
- }
-}
-
-static gboolean
-e_list_iterator_is_valid (EIterator *_iterator)
-{
- EListIterator *iterator = E_LIST_ITERATOR(_iterator);
- return iterator->iterator != NULL;
-}
-
-static void
-e_list_iterator_invalidate (EIterator *_iterator)
-{
- EListIterator *iterator = E_LIST_ITERATOR(_iterator);
- iterator->iterator = NULL;
-}
diff --git a/e-util/e-list-iterator.h b/e-util/e-list-iterator.h
deleted file mode 100644
index a2b7d82988..0000000000
--- a/e-util/e-list-iterator.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@helixcode.com>
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#ifndef __E_LIST_ITERATOR_H__
-#define __E_LIST_ITERATOR_H__
-
-typedef struct _EListIterator EListIterator;
-typedef struct _EListIteratorClass EListIteratorClass;
-
-#include <time.h>
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include <e-util/e-iterator.h>
-#include <e-util/e-list.h>
-
-#define E_TYPE_LIST_ITERATOR (e_list_iterator_get_type ())
-#define E_LIST_ITERATOR(obj) (GTK_CHECK_CAST ((obj), E_TYPE_LIST_ITERATOR, EListIterator))
-#define E_LIST_ITERATOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_LIST_ITERATOR, EListIteratorClass))
-#define E_IS_LIST_ITERATOR(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_LIST_ITERATOR))
-#define E_IS_LIST_ITERATOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_LIST_ITERATOR))
-
-struct _EListIterator {
- EIterator parent;
-
- EList *list;
- GList *iterator;
-};
-
-struct _EListIteratorClass {
- EIteratorClass parent_class;
-};
-
-EIterator *e_list_iterator_new (EList *list);
-
-/* Standard Gtk function */
-GtkType e_list_iterator_get_type (void);
-
-#endif /* ! __E_LIST_ITERATOR_H__ */
diff --git a/e-util/e-list.c b/e-util/e-list.c
deleted file mode 100644
index 2a6f842888..0000000000
--- a/e-util/e-list.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@umich.edu>
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#include <config.h>
-#include <gtk/gtk.h>
-
-#include "e-list.h"
-#include "e-list-iterator.h"
-
-#define ECL_CLASS(object) (E_LIST_CLASS(GTK_OBJECT((object))->klass))
-
-static void e_list_init (EList *list);
-static void e_list_class_init (EListClass *klass);
-static void e_list_destroy (GtkObject *object);
-
-#define PARENT_TYPE (gtk_object_get_type ())
-
-static GtkObjectClass *parent_class;
-
-/**
- * e_list_get_type:
- * @void:
- *
- * Registers the &EList class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &EList class.
- **/
-GtkType
-e_list_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type) {
- GtkTypeInfo info = {
- "EList",
- sizeof (EList),
- sizeof (EListClass),
- (GtkClassInitFunc) e_list_class_init,
- (GtkObjectInitFunc) e_list_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-static void
-e_list_class_init (EListClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS(klass);
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = e_list_destroy;
-}
-
-/**
- * e_list_init:
- */
-static void
-e_list_init (EList *list)
-{
- list->list = NULL;
- list->iterators = NULL;
-}
-
-EList *
-e_list_new (EListCopyFunc copy, EListFreeFunc free, void *closure)
-{
- EList *list = gtk_type_new(e_list_get_type());
- list->copy = copy;
- list->free = free;
- list->closure = closure;
- return list;
-}
-
-EList *
-e_list_duplicate (EList *old)
-{
- EList *list = gtk_type_new(e_list_get_type());
-
- list->copy = old->copy;
- list->free = old->free;
- list->closure = old->closure;
- list->list = g_list_copy(old->list);
- if (list->copy) {
- GList *listlist;
- for (listlist = list->list; listlist; listlist = listlist->next) {
- listlist->data = list->copy (listlist->data, list->closure);
- }
- }
- return list;
-}
-
-EIterator *
-e_list_get_iterator (EList *list)
-{
- EIterator *iterator = e_list_iterator_new(list);
- list->iterators = g_list_append(list->iterators, iterator);
- return iterator;
-}
-
-int
-e_list_length (EList *list)
-{
- return g_list_length(list->list);
-}
-
-void
-e_list_append (EList *list, const void *data)
-{
- e_list_invalidate_iterators(list, NULL);
- if (list->copy)
- list->list = g_list_append(list->list, list->copy(data, list->closure));
- else
- list->list = g_list_append(list->list, (void *) data);
-}
-
-void
-e_list_invalidate_iterators (EList *list, EIterator *skip)
-{
- GList *iterators = list->iterators;
- for (; iterators; iterators = iterators->next) {
- if (iterators->data != skip) {
- e_iterator_invalidate(E_ITERATOR(iterators->data));
- }
- }
-}
-
-void
-e_list_remove_iterator (EList *list, EIterator *iterator)
-{
- list->iterators = g_list_remove(list->iterators, iterator);
-}
-
-/*
- * Virtual functions
- */
-static void
-e_list_destroy (GtkObject *object)
-{
- EList *list = E_LIST(object);
- g_list_foreach(list->list, (GFunc) list->free, list->closure);
- g_list_free(list->list);
-}
diff --git a/e-util/e-list.h b/e-util/e-list.h
deleted file mode 100644
index 7a0170970f..0000000000
--- a/e-util/e-list.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@helixcode.com>
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#ifndef __E_LIST_H__
-#define __E_LIST_H__
-
-typedef struct _EList EList;
-typedef struct _EListClass EListClass;
-
-#include <time.h>
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include <e-util/e-list-iterator.h>
-
-#define E_TYPE_LIST (e_list_get_type ())
-#define E_LIST(obj) (GTK_CHECK_CAST ((obj), E_TYPE_LIST, EList))
-#define E_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_LIST, EListClass))
-#define E_IS_LIST(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_LIST))
-#define E_IS_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_LIST))
-
-typedef void *(*EListCopyFunc) (const void *data, void *closure);
-typedef void (*EListFreeFunc) (void *data, void *closure);
-
-struct _EList {
- GtkObject object;
- GList *list;
- GList *iterators;
- EListCopyFunc copy;
- EListFreeFunc free;
- void *closure;
-};
-
-struct _EListClass {
- GtkObjectClass parent_class;
-};
-
-EList *e_list_new (EListCopyFunc copy,
- EListFreeFunc free,
- void *closure);
-EList *e_list_duplicate (EList *list);
-EIterator *e_list_get_iterator (EList *list);
-void e_list_append (EList *list,
- const void *data);
-int e_list_length (EList *list);
-
-/* For iterators to call. */
-void e_list_invalidate_iterators (EList *list,
- EIterator *skip);
-void e_list_remove_iterator (EList *list,
- EIterator *iterator);
-
-/* Standard Gtk function */
-GtkType e_list_get_type (void);
-
-#endif /* ! __E_LIST_H__ */
diff --git a/e-util/e-popup-menu.c b/e-util/e-popup-menu.c
deleted file mode 100644
index 3fb382ae20..0000000000
--- a/e-util/e-popup-menu.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-popup-menu.c: popup menu display
-nnn *
- * Author:
- * Miguel de Icaza (miguel@kernel.org)
- * Jody Goldberg (jgoldberg@home.com)
- *
- * (C) 2000 Helix Code, Inc.
- */
-#include <config.h>
-#include <gnome.h>
-#include "e-popup-menu.h"
-#include "e-gui-utils.h"
-
-/*
- * Creates an item with an optional icon
- */
-static GtkWidget *
-make_item (GtkMenu *menu, const char *name, const char *pixname)
-{
- GtkWidget *label, *item;
- guint label_accel;
-
- if (*name == '\0')
- return gtk_menu_item_new ();
-
- /*
- * Ugh. This needs to go into Gtk+
- */
- label = gtk_accel_label_new ("");
- label_accel = gtk_label_parse_uline (GTK_LABEL (label), name);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_widget_show (label);
-
- item = gtk_pixmap_menu_item_new ();
- gtk_container_add (GTK_CONTAINER (item), label);
-
- if (label_accel != GDK_VoidSymbol){
- gtk_widget_add_accelerator (
- item,
- "activate_item",
- gtk_menu_ensure_uline_accel_group (GTK_MENU (menu)),
- label_accel, 0,
- GTK_ACCEL_LOCKED);
- }
-
- if (pixname){
- GtkWidget *pixmap = gnome_stock_pixmap_widget (item, pixname);
-
- gtk_widget_show (pixmap);
- gtk_pixmap_menu_item_set_pixmap (
- GTK_PIXMAP_MENU_ITEM (item), pixmap);
- }
-
- return item;
-}
-
-GtkMenu *
-e_popup_menu_create (EPopupMenu *menu_list, int disable_mask, int hide_mask, void *closure)
-{
- GtkMenu *menu = GTK_MENU (gtk_menu_new ());
- int i;
- gboolean last_item_seperator = TRUE;
- gint last_non_seperator = -1;
-
- for (i = 0; menu_list[i].name; i++) {
- if (strcmp("", menu_list[i].name) && !(menu_list [i].disable_mask & hide_mask)) {
- last_non_seperator = i;
- }
- }
-
- for (i = 0; i <= last_non_seperator; i++) {
- GtkWidget *item;
- gboolean seperator;
-
- seperator = !strcmp("", menu_list[i].name);
-
- if ((!(seperator && last_item_seperator)) && !(menu_list [i].disable_mask & hide_mask)) {
-
- item = make_item (menu, menu_list [i].name,
- menu_list [i].pixname);
-
- if (menu_list [i].fn)
- gtk_signal_connect (
- GTK_OBJECT (item), "activate",
- GTK_SIGNAL_FUNC (menu_list [i].fn),
- closure);
-
- if (menu_list [i].disable_mask & disable_mask)
- gtk_widget_set_sensitive (item, FALSE);
-
- gtk_widget_show (item);
- gtk_menu_append (menu, item);
- }
- last_item_seperator = seperator;
- }
-
- return menu;
-}
-
-void
-e_popup_menu_run (EPopupMenu *menu_list, GdkEventButton *event, int disable_mask, int hide_mask, void *closure)
-{
- GtkMenu *menu;
-
- g_return_if_fail (menu_list != NULL);
- g_return_if_fail (event != NULL);
-
- menu = e_popup_menu_create (menu_list, disable_mask, hide_mask, closure);
-
- e_popup_menu (menu, event);
-}
-
diff --git a/e-util/e-popup-menu.h b/e-util/e-popup-menu.h
deleted file mode 100644
index ed54a632a5..0000000000
--- a/e-util/e-popup-menu.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#ifndef E_POPUP_MENU_H
-#define E_POPUP_MENU_H
-
-#include <gtk/gtkwidget.h>
-
-typedef struct {
- char const * const name;
- char const * const pixname;
- void (*fn)(GtkWidget *widget, void *closure);
- int disable_mask;
-} EPopupMenu;
-
-GtkMenu *e_popup_menu_create (EPopupMenu *menu_list,
- int disable_mask,
- int hide_mask,
- void *closure);
-
-void e_popup_menu_run (EPopupMenu *menu_list,
- GdkEventButton *event,
- int disable_mask,
- int hide_mask,
- void *closure);
-
-#endif /* E_POPUP_MENU_H */
diff --git a/e-util/e-printable.c b/e-util/e-printable.c
deleted file mode 100644
index ed982469b8..0000000000
--- a/e-util/e-printable.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-printable.c: an object printer.
- *
- * Author:
- * Christopher James Lahey <clahey@helixcode.com>
- *
- * (C) 2000 Helix Code, Inc.
- */
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "e-util.h"
-#include "e-printable.h"
-
-#define EP_CLASS(e) ((EPrintableClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE gtk_object_get_type ()
-
-
-static GtkObjectClass *e_printable_parent_class;
-
-enum {
- PRINT_PAGE,
- DATA_LEFT,
- RESET,
- HEIGHT,
- WILL_FIT,
- LAST_SIGNAL
-};
-
-static guint e_printable_signals [LAST_SIGNAL] = { 0, };
-
-static void
-e_printable_class_init (GtkObjectClass *object_class)
-{
- EPrintableClass *klass = E_PRINTABLE_CLASS(object_class);
- e_printable_parent_class = gtk_type_class (PARENT_TYPE);
-
- e_printable_signals [PRINT_PAGE] =
- gtk_signal_new ("print_page",
- GTK_RUN_LAST,
- object_class->type,
- 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_printable_signals [DATA_LEFT] =
- gtk_signal_new ("data_left",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EPrintableClass, data_left),
- gtk_marshal_BOOL__NONE,
- GTK_TYPE_BOOL, 0, GTK_TYPE_NONE);
-
- e_printable_signals [RESET] =
- gtk_signal_new ("reset",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EPrintableClass, reset),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0, GTK_TYPE_NONE);
-
- e_printable_signals [HEIGHT] =
- gtk_signal_new ("height",
- GTK_RUN_LAST,
- object_class->type,
- 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_printable_signals [WILL_FIT] =
- gtk_signal_new ("will_fit",
- GTK_RUN_LAST,
- object_class->type,
- 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);
-
- gtk_object_class_add_signals (object_class, e_printable_signals, LAST_SIGNAL);
-
- klass->print_page = NULL;
- klass->data_left = NULL;
- klass->reset = NULL;
- klass->height = NULL;
- klass->will_fit = NULL;
-}
-
-
-guint
-e_printable_get_type (void)
-{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "EPrintable",
- sizeof (EPrintable),
- sizeof (EPrintableClass),
- (GtkClassInitFunc) e_printable_class_init,
- NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (gtk_object_get_type (), &info);
- }
-
- return type;
-}
-
-EPrintable *
-e_printable_new(void)
-{
- return E_PRINTABLE(gtk_type_new(e_printable_get_type()));
-}
-
-void
-e_printable_print_page (EPrintable *e_printable,
- GnomePrintContext *context,
- gdouble width,
- gdouble height,
- gboolean quantized)
-{
- g_return_if_fail (e_printable != NULL);
- g_return_if_fail (E_IS_PRINTABLE (e_printable));
-
- gtk_signal_emit (GTK_OBJECT (e_printable),
- e_printable_signals [PRINT_PAGE],
- context,
- width,
- height,
- quantized);
-}
-
-gboolean
-e_printable_data_left (EPrintable *e_printable)
-{
- gboolean ret_val;
-
- g_return_val_if_fail (e_printable != NULL, FALSE);
- g_return_val_if_fail (E_IS_PRINTABLE (e_printable), FALSE);
-
- gtk_signal_emit (GTK_OBJECT (e_printable),
- e_printable_signals [DATA_LEFT],
- &ret_val);
-
- return ret_val;
-}
-
-void
-e_printable_reset (EPrintable *e_printable)
-{
- g_return_if_fail (e_printable != NULL);
- g_return_if_fail (E_IS_PRINTABLE (e_printable));
-
- gtk_signal_emit (GTK_OBJECT (e_printable),
- e_printable_signals [RESET]);
-}
-
-gdouble
-e_printable_height (EPrintable *e_printable,
- GnomePrintContext *context,
- gdouble width,
- gdouble max_height,
- gboolean quantized)
-{
- gdouble ret_val;
-
- g_return_val_if_fail (e_printable != NULL, -1);
- g_return_val_if_fail (E_IS_PRINTABLE (e_printable), -1);
-
- gtk_signal_emit (GTK_OBJECT (e_printable),
- e_printable_signals [HEIGHT],
- context,
- width,
- max_height,
- quantized,
- &ret_val);
-
- return ret_val;
-}
-
-gboolean
-e_printable_will_fit (EPrintable *e_printable,
- GnomePrintContext *context,
- gdouble width,
- gdouble max_height,
- gboolean quantized)
-{
- gboolean ret_val;
-
- g_return_val_if_fail (e_printable != NULL, -1);
- g_return_val_if_fail (E_IS_PRINTABLE (e_printable), -1);
-
- gtk_signal_emit (GTK_OBJECT (e_printable),
- e_printable_signals [WILL_FIT],
- context,
- width,
- max_height,
- quantized,
- &ret_val);
-
- return ret_val;
-}
diff --git a/e-util/e-printable.h b/e-util/e-printable.h
deleted file mode 100644
index 18e6ec8472..0000000000
--- a/e-util/e-printable.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-printable.h: an object printer.
- *
- * Author:
- * Christopher James Lahey <clahey@helixcode.com>
- *
- * (C) 2000 Helix Code, Inc.
- */
-#ifndef _E_PRINTABLE_H_
-#define _E_PRINTABLE_H_
-
-#include <gtk/gtkobject.h>
-#include <libgnomeprint/gnome-print.h>
-
-#define E_PRINTABLE_TYPE (e_printable_get_type ())
-#define E_PRINTABLE(o) (GTK_CHECK_CAST ((o), E_PRINTABLE_TYPE, EPrintable))
-#define E_PRINTABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_PRINTABLE_TYPE, EPrintableClass))
-#define E_IS_PRINTABLE(o) (GTK_CHECK_TYPE ((o), E_PRINTABLE_TYPE))
-#define E_IS_PRINTABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_PRINTABLE_TYPE))
-
-typedef struct {
- GtkObject base;
-} EPrintable;
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /*
- * Signals
- */
-
- void (*print_page) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble height, gboolean quantized);
- gboolean (*data_left) (EPrintable *etm);
- void (*reset) (EPrintable *etm);
- gdouble (*height) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble max_height, gboolean quantized);
-
- /* e_printable_will_fit (ep, ...) should be equal in value to
- * (e_printable_print_page (ep, ...),
- * !e_printable_data_left(ep)) except that the latter has the
- * side effect of doing the printing and advancing the
- * position of the printable.
- */
-
- gboolean (*will_fit) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble max_height, gboolean quantized);
-} EPrintableClass;
-
-GtkType e_printable_get_type (void);
-
-EPrintable *e_printable_new (void);
-
-/*
- * Routines for emitting signals on the e_table */
-void e_printable_print_page (EPrintable *e_printable,
- GnomePrintContext *context,
- gdouble width,
- gdouble height,
- gboolean quantized);
-gboolean e_printable_data_left (EPrintable *e_printable);
-void e_printable_reset (EPrintable *e_printable);
-gdouble e_printable_height (EPrintable *e_printable,
- GnomePrintContext *context,
- gdouble width,
- gdouble max_height,
- gboolean quantized);
-gboolean e_printable_will_fit (EPrintable *e_printable,
- GnomePrintContext *context,
- gdouble width,
- gdouble max_height,
- gboolean quantized);
-
-#endif /* _E_PRINTABLE_H_ */
diff --git a/e-util/e-sexp.c b/e-util/e-sexp.c
deleted file mode 100644
index cc0452b6b2..0000000000
--- a/e-util/e-sexp.c
+++ /dev/null
@@ -1,1163 +0,0 @@
-/*
- * Copyright 2000 HelixCode (http://www.helixcode.com).
- *
- * A simple, extensible s-exp evaluation engine.
- *
- * Author :
- * Michael Zucchi <notzed@helixcode.com>
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- The following built-in s-exp's are supported:
-
- list = (and list*)
- perform an intersection of a number of lists, and return that.
-
- bool = (and bool*)
- perform a boolean AND of boolean values.
-
- list = (or list*)
- perform a union of a number of lists, returning the new list.
-
- bool = (or bool*)
- perform a boolean OR of boolean values.
-
- int = (+ int*)
- Add integers.
-
- string = (+ string*)
- Concat strings.
-
- int = (- int int*)
- Subtract integers from the first.
-
- Comparison operators:
-
- bool = (< int int)
- bool = (> int int)
- bool = (= int int)
-
- bool = (< string string)
- bool = (> string string)
- bool = (= string string)
- Perform a comparision of 2 integers, or 2 string values.
-
- Function flow:
-
- type = (if bool function)
- type = (if bool function function)
- Choose a flow path based on a boolean value
-
- type = (begin func func func)
- Execute a sequence. The last function return is the return type.
-*/
-
-#include <glib.h>
-#include <stdio.h>
-#include <time.h>
-#include <string.h>
-
-#include "e-sexp.h"
-
-#define p(x) /* parse debug */
-#define r(x) /* run debug */
-#define d(x) /* general debug */
-
-
-static struct _ESExpTerm * parse_list(ESExp *f, int gotbrace);
-static struct _ESExpTerm * parse_value(ESExp *f);
-
-static void parse_dump_term(struct _ESExpTerm *t, int depth);
-
-static GtkObjectClass *parent_class;
-
-
-
-static GScannerConfig scanner_config =
-{
- ( " \t\r\n") /* cset_skip_characters */,
- ( G_CSET_a_2_z
- "_+-<=>"
- G_CSET_A_2_Z) /* cset_identifier_first */,
- ( G_CSET_a_2_z
- "_0123456789-<>"
- G_CSET_A_2_Z
- G_CSET_LATINS
- G_CSET_LATINC ) /* cset_identifier_nth */,
- ( ";\n" ) /* cpair_comment_single */,
-
- FALSE /* case_sensitive */,
-
- TRUE /* skip_comment_multi */,
- TRUE /* skip_comment_single */,
- TRUE /* scan_comment_multi */,
- TRUE /* scan_identifier */,
- TRUE /* scan_identifier_1char */,
- FALSE /* scan_identifier_NULL */,
- TRUE /* scan_symbols */,
- FALSE /* scan_binary */,
- TRUE /* scan_octal */,
- TRUE /* scan_float */,
- TRUE /* scan_hex */,
- FALSE /* scan_hex_dollar */,
- TRUE /* scan_string_sq */,
- TRUE /* scan_string_dq */,
- TRUE /* numbers_2_int */,
- FALSE /* int_2_float */,
- FALSE /* identifier_2_string */,
- TRUE /* char_2_token */,
- FALSE /* symbol_2_token */,
- FALSE /* scope_0_fallback */,
-};
-
-struct _ESExpResult *
-e_sexp_result_new(int type)
-{
- struct _ESExpResult *r = g_malloc0(sizeof(*r));
- r->type = type;
- return r;
-}
-
-void
-e_sexp_result_free(struct _ESExpResult *t)
-{
- if (t == NULL)
- return;
-
- switch(t->type) {
- case ESEXP_RES_ARRAY_PTR:
- g_ptr_array_free(t->value.ptrarray, TRUE);
- break;
- case ESEXP_RES_BOOL:
- case ESEXP_RES_INT:
- break;
- case ESEXP_RES_STRING:
- g_free(t->value.string);
- break;
- case ESEXP_RES_UNDEFINED:
- break;
- }
- g_free(t);
-}
-
-/* implementations for the builtin functions */
-
-/* can you tell, i dont like glib? */
-/* we can only itereate a hashtable from a called function */
-struct _glib_sux_donkeys {
- int count;
- GPtrArray *uids;
-};
-
-/* ok, store any values that are in all sets */
-static void
-g_lib_sux_htand(char *key, int value, struct _glib_sux_donkeys *fuckup)
-{
- if (value == fuckup->count) {
- g_ptr_array_add(fuckup->uids, key);
- }
-}
-
-/* or, store all unique values */
-static void
-g_lib_sux_htor(char *key, int value, struct _glib_sux_donkeys *fuckup)
-{
- g_ptr_array_add(fuckup->uids, key);
-}
-
-static ESExpResult *
-term_eval_and(struct _ESExp *f, int argc, struct _ESExpTerm **argv, void *data)
-{
- struct _ESExpResult *r, *r1;
- GHashTable *ht = g_hash_table_new(g_str_hash, g_str_equal);
- struct _glib_sux_donkeys lambdafoo;
- int type=-1;
- int bool = TRUE;
- int i;
-
- r(printf("( and\n"));
-
- r = e_sexp_result_new(ESEXP_RES_UNDEFINED);
-
- for (i=0;bool && i<argc;i++) {
- r1 = e_sexp_term_eval(f, argv[i]);
- if (type == -1)
- type = r1->type;
- if (type != r1->type) {
- printf("invalid types in and operation, all types must be the same\n");
- } else if ( r1->type == ESEXP_RES_ARRAY_PTR ) {
- char **a1;
- int l1, j;
-
- a1 = (char **)r1->value.ptrarray->pdata;
- l1 = r1->value.ptrarray->len;
- for (j=0;j<l1;j++) {
- int n;
- n = (int)g_hash_table_lookup(ht, a1[j]);
- g_hash_table_insert(ht, a1[j], (void *)n+1);
- }
- } else if ( r1->type == ESEXP_RES_BOOL ) {
- bool &= r1->value.bool;
- }
- e_sexp_result_free(r1);
- }
-
- if (type == ESEXP_RES_ARRAY_PTR) {
- lambdafoo.count = argc;
- lambdafoo.uids = g_ptr_array_new();
- g_hash_table_foreach(ht, (GHFunc)g_lib_sux_htand, &lambdafoo);
- r->type = ESEXP_RES_ARRAY_PTR;
- r->value.ptrarray = lambdafoo.uids;
- } else if (type == ESEXP_RES_BOOL) {
- r->type = ESEXP_RES_BOOL;
- r->value.bool = bool;
- }
-
- g_hash_table_destroy(ht);
-
- return r;
-}
-
-static ESExpResult *
-term_eval_or(struct _ESExp *f, int argc, struct _ESExpTerm **argv, void *data)
-{
- struct _ESExpResult *r, *r1;
- GHashTable *ht = g_hash_table_new(g_str_hash, g_str_equal);
- struct _glib_sux_donkeys lambdafoo;
- int type = -1;
- int bool = FALSE;
- int i;
-
- r(printf("(or \n"));
-
- r = e_sexp_result_new(ESEXP_RES_UNDEFINED);
-
- for (i=0;!bool && i<argc;i++) {
- r1 = e_sexp_term_eval(f, argv[i]);
- if (type == -1)
- type = r1->type;
- if (r1->type != type) {
- printf("wrong types in or operation\n");
- } else if (r1->type == ESEXP_RES_ARRAY_PTR) {
- char **a1;
- int l1, j;
-
- a1 = (char **)r1->value.ptrarray->pdata;
- l1 = r1->value.ptrarray->len;
- for (j=0;j<l1;j++) {
- g_hash_table_insert(ht, a1[j], (void *)1);
- }
- } else if (r1->type == ESEXP_RES_BOOL) {
- bool |= r1->value.bool;
- }
- e_sexp_result_free(r1);
- }
-
- if (type == ESEXP_RES_ARRAY_PTR) {
- lambdafoo.count = argc;
- lambdafoo.uids = g_ptr_array_new();
- g_hash_table_foreach(ht, (GHFunc)g_lib_sux_htor, &lambdafoo);
- r->type = ESEXP_RES_ARRAY_PTR;
- r->value.ptrarray = lambdafoo.uids;
- } else if (type == ESEXP_RES_BOOL) {
- r->type = ESEXP_RES_BOOL;
- r->value.bool = bool;
- }
- g_hash_table_destroy(ht);
-
- return r;
-}
-
-static ESExpResult *
-term_eval_not(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- int res = TRUE;
- ESExpResult *r;
-
- if (argc>0) {
- if (argv[0]->type == ESEXP_RES_BOOL
- && argv[0]->value.bool)
- res = FALSE;
- }
- r = e_sexp_result_new(ESEXP_RES_BOOL);
- r->value.bool = res;
- return r;
-}
-
-/* this should support all arguments ...? */
-static ESExpResult *
-term_eval_lt(struct _ESExp *f, int argc, struct _ESExpTerm **argv, void *data)
-{
- struct _ESExpResult *r, *r1, *r2;
-
- r = e_sexp_result_new(ESEXP_RES_UNDEFINED);
-
- if (argc == 2) {
- r1 = e_sexp_term_eval(f, argv[0]);
- r2 = e_sexp_term_eval(f, argv[1]);
- if (r1->type != r2->type) {
- printf("error, invalid types in compare\n");
- } else if (r1->type == ESEXP_RES_INT) {
- r->type = ESEXP_RES_BOOL;
- r->value.bool = r1->value.number < r2->value.number;
- } else if (r1->type == ESEXP_RES_STRING) {
- r->type = ESEXP_RES_BOOL;
- r->value.bool = strcmp(r1->value.string, r2->value.string) < 0;
- }
- }
- return r;
-}
-
-/* this should support all arguments ...? */
-static ESExpResult *
-term_eval_gt(struct _ESExp *f, int argc, struct _ESExpTerm **argv, void *data)
-{
- struct _ESExpResult *r, *r1, *r2;
-
- r = e_sexp_result_new(ESEXP_RES_UNDEFINED);
-
- if (argc == 2) {
- r1 = e_sexp_term_eval(f, argv[0]);
- r2 = e_sexp_term_eval(f, argv[1]);
- if (r1->type != r2->type) {
- printf("error, invalid types in compare\n");
- } else if (r1->type == ESEXP_RES_INT) {
- r->type = ESEXP_RES_BOOL;
- r->value.bool = r1->value.number > r2->value.number;
- } else if (r1->type == ESEXP_RES_STRING) {
- r->type = ESEXP_RES_BOOL;
- r->value.bool = strcmp(r1->value.string, r2->value.string) > 0;
- }
- }
- return r;
-}
-
-/* this should support all arguments ...? */
-static ESExpResult *
-term_eval_eq(struct _ESExp *f, int argc, struct _ESExpTerm **argv, void *data)
-{
- struct _ESExpResult *r, *r1, *r2;
-
- r = e_sexp_result_new(ESEXP_RES_BOOL);
-
- if (argc == 2) {
- r1 = e_sexp_term_eval(f, argv[0]);
- r2 = e_sexp_term_eval(f, argv[1]);
- if (r1->type != r2->type) {
- r->value.bool = FALSE;
- } else if (r1->type == ESEXP_RES_INT) {
- r->value.bool = r1->value.number == r2->value.number;
- } else if (r1->type == ESEXP_RES_BOOL) {
- r->value.bool = r1->value.bool == r2->value.bool;
- } else if (r1->type == ESEXP_RES_STRING) {
- r->value.bool = strcmp(r1->value.string, r2->value.string) == 0;
- }
- }
- return r;
-}
-
-static ESExpResult *
-term_eval_plus(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- struct _ESExpResult *r=NULL;
- int type;
- int i;
-
- if (argc>0) {
- type = argv[0]->type;
- switch(type) {
- case ESEXP_RES_INT: {
- int total = argv[0]->value.number;
- for (i=1;i<argc && argv[i]->type == ESEXP_RES_INT;i++) {
- total += argv[i]->value.number;
- }
- if (i<argc) {
- g_warning("Wrong type trying to add integers: ignored");
- }
- r = e_sexp_result_new(ESEXP_RES_INT);
- r->value.number = total;
- break; }
- case ESEXP_RES_STRING: {
- GString *s = g_string_new(argv[0]->value.string);
- for (i=1;i<argc && argv[i]->type == ESEXP_RES_STRING;i++) {
- g_string_append(s, argv[i]->value.string);
- }
- if (i<argc) {
- g_warning("Wrong type trying to concat strings: ignored");
- }
- r = e_sexp_result_new(ESEXP_RES_STRING);
- r->value.string = s->str;
- g_string_free(s, FALSE);
- break; }
-
- }
- }
-
- if (!r) {
- r = e_sexp_result_new(ESEXP_RES_INT);
- r->value.number = 0;
- }
- return r;
-}
-
-static ESExpResult *
-term_eval_sub(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- struct _ESExpResult *r=NULL;
- int type;
- int i;
-
- if (argc>0) {
- type = argv[0]->type;
- switch(type) {
- case ESEXP_RES_INT: {
- int total = argv[0]->value.number;
- for (i=1;i<argc && argv[i]->type == ESEXP_RES_INT;i++) {
- total -= argv[i]->value.number;
- }
- if (i<argc) {
- g_warning("Wrong type trying to subtract numbers: ignored");
- }
- r = e_sexp_result_new(ESEXP_RES_INT);
- r->value.number = total;
- break; }
- }
- }
-
- if (!r) {
- r = e_sexp_result_new(ESEXP_RES_INT);
- r->value.number = 0;
- }
- return r;
-}
-
-/* implements 'if' function */
-static ESExpResult *
-term_eval_if(struct _ESExp *f, int argc, struct _ESExpTerm **argv, void *data)
-{
- struct _ESExpResult *r;
- int doit;
-
- if (argc >=2 && argc<=3) {
- r = e_sexp_term_eval(f, argv[0]);
- doit = (r->type == ESEXP_RES_BOOL && r->value.bool);
- e_sexp_result_free(r);
- if (doit) {
- return e_sexp_term_eval(f, argv[1]);
- } else if (argc>2) {
- return e_sexp_term_eval(f, argv[2]);
- }
- }
- return e_sexp_result_new(ESEXP_RES_UNDEFINED);
-}
-
-/* implements 'begin' statement */
-static ESExpResult *
-term_eval_begin(struct _ESExp *f, int argc, struct _ESExpTerm **argv, void *data)
-{
- struct _ESExpResult *r=NULL;
- int i;
-
- for (i=0;i<argc;i++) {
- if (r)
- e_sexp_result_free(r);
- r = e_sexp_term_eval(f, argv[i]);
- }
- if (r)
- return r;
- else
- return e_sexp_result_new(ESEXP_RES_UNDEFINED);
-}
-
-
-struct _ESExpResult *
-e_sexp_term_eval(struct _ESExp *f, struct _ESExpTerm *t)
-{
- struct _ESExpResult *r, *r1;
- int i;
-
- g_return_val_if_fail(t != NULL, NULL);
-
- r(printf("eval term :\n"));
- r(parse_dump_term(t, 0));
-
- r = g_malloc0(sizeof(*r));
- r->type = ESEXP_RES_UNDEFINED;
-
- switch (t->type) {
- case ESEXP_TERM_STRING:
- r(printf(" (string \"%s\")\n", t->value.string));
- r->type = ESEXP_RES_STRING;
- /* erk, this shoul;dn't need to strdup this ... */
- r->value.string = g_strdup(t->value.string);
- break;
- case ESEXP_TERM_INT:
- r(printf(" (int %d)\n", t->value.number));
- r->type = ESEXP_RES_INT;
- r->value.number = t->value.number;
- break;
- case ESEXP_TERM_BOOL:
- r(printf(" (int %d)\n", t->value.number));
- r->type = ESEXP_RES_BOOL;
- r->value.bool = t->value.bool;
- break;
- case ESEXP_TERM_IFUNC: {
- if (t->value.func.sym->f.ifunc) {
- r1 = t->value.func.sym->f.ifunc(f, t->value.func.termcount, t->value.func.terms, t->value.func.sym->data);
- if (r1) {
- e_sexp_result_free(r);
- r = r1;
- }
- }
- break; }
- case ESEXP_TERM_FUNC: {
- struct _ESExpResult **argv;
-
- /* first evaluate all arguments to result types */
- argv = alloca(sizeof(argv[0]) * t->value.func.termcount);
- for (i=0;i<t->value.func.termcount;i++) {
- argv[i] = e_sexp_term_eval(f, t->value.func.terms[i]);
- }
- /* call the function */
- if (t->value.func.sym->f.func) {
- r1 = t->value.func.sym->f.func(f, t->value.func.termcount, argv, t->value.func.sym->data);
- if (r1) {
- e_sexp_result_free(r);
- r = r1;
- }
- }
- for (i=0;i<t->value.func.termcount;i++) {
- e_sexp_result_free(argv[i]);
- }
- break; }
- default:
- printf("Warning: Unknown type encountered in parse tree: %d\n", t->type);
- r->type = ESEXP_RES_UNDEFINED;
- }
-
- return r;
-}
-
-#if 0
-static void
-eval_dump_result(ESExpResult *r, int depth)
-{
- int i;
-
- if (r==NULL) {
- printf("null result???\n");
- return;
- }
-
- for (i=0;i<depth;i++)
- printf(" ");
-
- switch (r->type) {
- case ESEXP_RES_ARRAY_PTR:
- printf("array pointers\n");
- break;
- case ESEXP_RES_INT:
- printf("int: %d\n", r->value.number);
- break;
- case ESEXP_RES_STRING:
- printf("string: '%s'\n", r->value.string);
- break;
- case ESEXP_RES_BOOL:
- printf("bool: %c\n", r->value.bool?'t':'f');
- break;
- case ESEXP_RES_UNDEFINED:
- printf(" <undefined>\n");
- break;
- }
- printf("\n");
-}
-#endif
-
-static void
-parse_dump_term(struct _ESExpTerm *t, int depth)
-{
- int i;
-
- if (t==NULL) {
- printf("null term??\n");
- return;
- }
-
- for (i=0;i<depth;i++)
- printf(" ");
-
- switch (t->type) {
- case ESEXP_TERM_STRING:
- printf(" \"%s\"", t->value.string);
- break;
- case ESEXP_TERM_INT:
- printf(" %d", t->value.number);
- break;
- case ESEXP_TERM_BOOL:
- printf(" #%c", t->value.bool?'t':'f');
- break;
- case ESEXP_TERM_IFUNC:
- case ESEXP_TERM_FUNC:
- printf(" (function %s\n", t->value.func.sym->name);
- /*printf(" [%d] ", t->value.func.termcount);*/
- for (i=0;i<t->value.func.termcount;i++) {
- parse_dump_term(t->value.func.terms[i], depth+1);
- }
- for (i=0;i<depth;i++)
- printf(" ");
- printf(" )");
- break;
- case ESEXP_TERM_VAR:
- printf(" (variable %s )\n", t->value.var->name);
- break;
- default:
- printf("unknown type: %d\n", t->type);
- }
-
- printf("\n");
-}
-
-/*
- PARSER
-*/
-
-static struct _ESExpTerm *
-parse_new_term(int type)
-{
- struct _ESExpTerm *s = g_malloc0(sizeof(*s));
- s->type = type;
- return s;
-}
-
-static void
-parse_term_free(struct _ESExpTerm *t)
-{
- int i;
-
- if (t==NULL) {
- return;
- }
-
- switch (t->type) {
- case ESEXP_TERM_FUNC:
- case ESEXP_TERM_IFUNC:
- for (i=0;i<t->value.func.termcount;i++) {
- parse_term_free(t->value.func.terms[i]);
- }
- g_free(t->value.func.terms);
- break;
- case ESEXP_TERM_VAR:
- break;
- case ESEXP_TERM_STRING:
- g_free(t->value.string);
- break;
- case ESEXP_TERM_INT:
- break;
- default:
- printf("parse_term_free: unknown type: %d\n", t->type);
- }
- g_free(t);
-}
-
-static struct _ESExpTerm **
-parse_values(ESExp *f, int *len)
-{
- int token;
- struct _ESExpTerm **terms;
- int i=0;
- GScanner *gs = f->scanner;
-
- p(printf("parsing values\n"));
-
- /* FIXME: This hardcoded nonsense!!! :) */
- terms = g_malloc0(20*sizeof(*terms));
-
- while ( (token = g_scanner_peek_next_token(gs)) != G_TOKEN_EOF
- && token != ')') {
- terms[i]=parse_value(f);
- i++;
- }
-
- p(printf("found %d subterms\n", i));
- *len = i;
-
- p(printf("dont parsing values\n"));
- return terms;
-}
-
-static struct _ESExpTerm *
-parse_value(ESExp *f)
-{
- int token;
- struct _ESExpTerm *t = NULL;
- GScanner *gs = f->scanner;
- struct _ESExpSymbol *s;
-
- p(printf("parsing value\n"));
-
- token = g_scanner_get_next_token(gs);
- switch(token) {
- case G_TOKEN_LEFT_PAREN:
- p(printf("got brace, its a list!\n"));
- return parse_list(f, TRUE);
- case G_TOKEN_STRING:
- p(printf("got string\n"));
- t = parse_new_term(ESEXP_TERM_STRING);
- t->value.string = g_strdup(g_scanner_cur_value(gs).v_string);
- break;
- case G_TOKEN_INT:
- t = parse_new_term(ESEXP_TERM_INT);
- t->value.number = g_scanner_cur_value(gs).v_int;
- p(printf("got int\n"));
- break;
- case '#':
- printf("got bool?\n");
- token = g_scanner_get_next_token(gs);
- t = parse_new_term(ESEXP_TERM_BOOL);
- t->value.bool = token=='t';
- break;
- case G_TOKEN_SYMBOL:
- s = g_scanner_cur_value(gs).v_symbol;
- switch (s->type) {
- case ESEXP_TERM_FUNC:
- case ESEXP_TERM_IFUNC:
- /* this is basically invalid, since we can't use function
- pointers, but let the runtime catch it ... */
- t = parse_new_term(s->type);
- t->value.func.sym = s;
- t->value.func.terms = parse_values(f, &t->value.func.termcount);
- break;
- case ESEXP_TERM_VAR:
- t = parse_new_term(s->type);
- t->value.var = s;
- break;
- default:
- printf("Invalid symbol type: %d\n", s->type);
- }
- break;
- case G_TOKEN_IDENTIFIER:
- printf("Unknown identifier encountered: %s\n", g_scanner_cur_value(gs).v_identifier);
- break;
- default:
- printf("Innvalid token trying to parse a list of values\n");
- }
- p(printf("done parsing value\n"));
- return t;
-}
-
-/* FIXME: this needs some robustification */
-static struct _ESExpTerm *
-parse_list(ESExp *f, int gotbrace)
-{
- int token;
- struct _ESExpTerm *t = NULL;
- GScanner *gs = f->scanner;
-
- p(printf("parsing list\n"));
- if (gotbrace)
- token = '(';
- else
- token = g_scanner_get_next_token(gs);
- if (token =='(') {
- token = g_scanner_get_next_token(gs);
- switch(token) {
- case G_TOKEN_SYMBOL: {
- struct _ESExpSymbol *s;
-
- s = g_scanner_cur_value(gs).v_symbol;
- p(printf("got funciton: %s\n", s->name));
- t = parse_new_term(s->type);
- p(printf("created new list %p\n", t));
- /* if we have a variable, find out its base type */
- while (s->type == ESEXP_TERM_VAR) {
- s = ((ESExpTerm *)(s->data))->value.var;
- }
- if (s->type == ESEXP_TERM_FUNC
- || s->type == ESEXP_TERM_IFUNC) {
- t->value.func.sym = s;
- t->value.func.terms = parse_values(f, &t->value.func.termcount);
- } else {
- printf("Error, trying to call variable as function\n");
- }
- break; }
- case G_TOKEN_IDENTIFIER:
- printf("Unknown identifier: %s\n", g_scanner_cur_value(gs).v_identifier);
- break;
- default:
- printf("unknown sequence encountered, type = %d\n", token);
- }
- token = g_scanner_get_next_token(gs);
- if (token != ')') {
- printf("Error, expected ')' not found\n");
- }
- } else {
- printf("Error, list term without opening (\n");
- }
-
- p(printf("returning list %p\n", t));
- return t;
-}
-
-#if 0
-GList *
-camel_mbox_folder_search_by_expression(CamelFolder *folder, char *expression, CamelException *ex)
-{
- GScanner *gs;
- int i;
- struct _ESExpTerm *t;
- struct _searchcontext *ctx;
- struct _ESExpResult *r;
- GList *matches = NULL;
-
- gs = g_scanner_new(&scanner_config);
- for(i=0;i<sizeof(symbols)/sizeof(symbols[0]);i++)
- g_scanner_scope_add_symbol(gs, 0, symbols[i].name, &symbols[i]);
-
- g_scanner_input_text(gs, expression, strlen(expression));
- t = parse_list(gs, 0);
-
- if (t) {
- ctx = g_malloc0(sizeof(*ctx));
- ctx->folder = folder;
- ctx->summary = camel_folder_get_summary(folder, ex);
- ctx->message_info = camel_folder_summary_get_message_info_list(ctx->summary);
-#ifdef HAVE_IBEX
- ctx->index = ibex_open(CAMEL_MBOX_FOLDER(folder)->index_file_path, FALSE);
- if (!ctx->index) {
- perror("Cannot open index file, body searches will be ignored\n");
- }
-#endif
- r = term_eval(ctx, t);
-
- /* now create a folder summary to return?? */
- if (r
- && r->type == ESEXP_RES_ARRAY_PTR) {
- d(printf("got result ...\n"));
- for (i=0;i<r->value.ptrarray->len;i++) {
- d(printf("adding match: %s\n", (char *)g_ptr_array_index(r->value.ptrarray, i)));
- matches = g_list_prepend(matches, g_strdup(g_ptr_array_index(r->value.ptrarray, i)));
- }
- e_sexp_result_free(r);
- }
-
- if (ctx->index)
- ibex_close(ctx->index);
-
- gtk_object_unref((GtkObject *)ctx->summary);
- g_free(ctx);
- parse_term_free(t);
- } else {
- printf("Warning, Could not parse expression!\n %s\n", expression);
- }
-
- g_scanner_destroy(gs);
-
- return matches;
-}
-#endif
-
-
-static void e_sexp_finalise(GtkObject *);
-
-static void
-e_sexp_class_init (ESExpClass *class)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *) class;
-
- object_class->finalize = e_sexp_finalise;
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-}
-
-/* 'builtin' functions */
-static struct {
- char *name;
- ESExpFunc *func;
- int type; /* set to 1 if a function can perform shortcut evaluation, or
- doesn't execute everything, 0 otherwise */
-} symbols[] = {
- { "and", (ESExpFunc *)term_eval_and, 1 },
- { "or", (ESExpFunc *)term_eval_or, 1 },
- { "not", (ESExpFunc *)term_eval_not, 0 },
- { "<", (ESExpFunc *)term_eval_lt, 1 },
- { ">", (ESExpFunc *)term_eval_gt, 1 },
- { "=", (ESExpFunc *)term_eval_eq, 1 },
- { "+", (ESExpFunc *)term_eval_plus, 0 },
- { "-", (ESExpFunc *)term_eval_sub, 0 },
- { "if", (ESExpFunc *)term_eval_if, 1 },
- { "begin", (ESExpFunc *)term_eval_begin, 1 },
-};
-
-static void
-free_symbol(void *key, void *value, void *data)
-{
- struct _ESExpSymbol *s = value;
-
- g_free(s->name);
- g_free(s);
-}
-
-static void
-e_sexp_finalise(GtkObject *o)
-{
- ESExp *s = (ESExp *)o;
-
- if (s->tree) {
- parse_term_free(s->tree);
- s->tree = NULL;
- }
-
- g_scanner_scope_foreach_symbol(s->scanner, 0, free_symbol, 0);
- g_scanner_destroy(s->scanner);
-
- ((GtkObjectClass *)(parent_class))->finalize((GtkObject *)o);
-}
-
-static void
-e_sexp_init (ESExp *s)
-{
- int i;
-
- s->scanner = g_scanner_new(&scanner_config);
-
- /* load in builtin symbols? */
- for(i=0;i<sizeof(symbols)/sizeof(symbols[0]);i++) {
- if (symbols[i].type == 1) {
- e_sexp_add_ifunction(s, 0, symbols[i].name, (ESExpIFunc *)symbols[i].func, &symbols[i]);
- } else {
- e_sexp_add_function(s, 0, symbols[i].name, symbols[i].func, &symbols[i]);
- }
- }
-}
-
-guint
-e_sexp_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "ESExp",
- sizeof (ESExp),
- sizeof (ESExpClass),
- (GtkClassInitFunc) e_sexp_class_init,
- (GtkObjectInitFunc) e_sexp_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- type = gtk_type_unique (gtk_object_get_type (), &type_info);
- }
-
- return type;
-}
-
-ESExp *
-e_sexp_new (void)
-{
- ESExp *f = E_SEXP ( gtk_type_new (e_sexp_get_type ()));
-
- return f;
-}
-
-void
-e_sexp_add_function(ESExp *f, int scope, char *name, ESExpFunc *func, void *data)
-{
- struct _ESExpSymbol *s;
-
- g_return_if_fail(FILTER_IS_SEXP(f));
- g_return_if_fail(name != NULL);
-
- s = g_malloc0(sizeof(*s));
- s->name = g_strdup(name);
- s->f.func = func;
- s->type = ESEXP_TERM_FUNC;
- s->data = data;
- g_scanner_scope_add_symbol(f->scanner, scope, s->name, s);
-}
-
-void
-e_sexp_add_ifunction(ESExp *f, int scope, char *name, ESExpIFunc *ifunc, void *data)
-{
- struct _ESExpSymbol *s;
-
- g_return_if_fail(FILTER_IS_SEXP(f));
- g_return_if_fail(name != NULL);
-
- s = g_malloc0(sizeof(*s));
- s->name = g_strdup(name);
- s->f.ifunc = ifunc;
- s->type = ESEXP_TERM_IFUNC;
- s->data = data;
- g_scanner_scope_add_symbol(f->scanner, scope, s->name, s);
-}
-
-void
-e_sexp_add_variable(ESExp *f, int scope, char *name, ESExpTerm *value)
-{
- struct _ESExpSymbol *s;
-
- g_return_if_fail(FILTER_IS_SEXP(f));
- g_return_if_fail(name != NULL);
-
- s = g_malloc0(sizeof(*s));
- s->name = g_strdup(name);
- s->type = ESEXP_TERM_VAR;
- s->data = value;
- g_scanner_scope_add_symbol(f->scanner, scope, s->name, s);
-}
-
-void
-e_sexp_remove_symbol(ESExp *f, int scope, char *name)
-{
- int oldscope;
- struct _ESExpSymbol *s;
-
- g_return_if_fail(FILTER_IS_SEXP(f));
- g_return_if_fail(name != NULL);
-
- oldscope = g_scanner_set_scope(f->scanner, scope);
- s = g_scanner_lookup_symbol(f->scanner, name);
- g_scanner_scope_remove_symbol(f->scanner, scope, name);
- g_scanner_set_scope(f->scanner, oldscope);
- if (s) {
- g_free(s->name);
- g_free(s);
- }
-}
-
-int
-e_sexp_set_scope(ESExp *f, int scope)
-{
- g_return_val_if_fail(FILTER_IS_SEXP(f), 0);
-
- return g_scanner_set_scope(f->scanner, scope);
-}
-
-void
-e_sexp_input_text(ESExp *f, const char *text, int len)
-{
- g_return_if_fail(FILTER_IS_SEXP(f));
- g_return_if_fail(text != NULL);
-
- g_scanner_input_text(f->scanner, text, len);
-}
-
-void
-e_sexp_input_file (ESExp *f, int fd)
-{
- g_return_if_fail(FILTER_IS_SEXP(f));
-
- g_scanner_input_file(f->scanner, fd);
-}
-
-/* needs some error return? */
-void
-e_sexp_parse(ESExp *f)
-{
- g_return_if_fail(FILTER_IS_SEXP(f));
-
- if (f->tree)
- parse_term_free(f->tree);
-
- f->tree = parse_list(f, FALSE);
-}
-
-struct _ESExpResult *
-e_sexp_eval(ESExp *f)
-{
- g_return_val_if_fail(FILTER_IS_SEXP(f), NULL);
- g_return_val_if_fail(f->tree != NULL, NULL);
-
- return e_sexp_term_eval(f, f->tree);
-}
-
-/**
- * e_sexp_encode_bool:
- * @s:
- * @state:
- *
- * Encode a bool into an s-expression @s. Bools are
- * encoded using #t #f syntax.
- **/
-void
-e_sexp_encode_bool(GString *s, gboolean state)
-{
- if (state)
- g_string_append(s, " #t");
- else
- g_string_append(s, " #f");
-}
-
-/**
- * e_sexp_encode_string:
- * @s: Destination string.
- * @string: String expression.
- *
- * Add a c string @string to the s-expression stored in
- * the gstring @s. Quotes are added, and special characters
- * are escaped appropriately.
- **/
-void
-e_sexp_encode_string(GString *s, const char *string)
-{
- char c;
- const char *p;
-
- p = string;
- g_string_append(s, " \"");
- while ( (c = *p++) ) {
- if (c=='\\' || c=='\"' || c=='\'')
- g_string_append_c(s, '\\');
- g_string_append_c(s, c);
- }
- g_string_append(s, "\"");
-}
-
-#ifdef TESTER
-int main(int argc, char **argv)
-{
- ESExp *f;
- char *t = "(+ \"foo\" \"\\\"\" \"bar\" \"\\\\ blah \\x \")";
- ESExpResult *r;
-
- gtk_init(&argc, &argv);
-
- f = e_sexp_new();
-
- e_sexp_add_variable(f, 0, "test", NULL);
-
- e_sexp_input_text(f, t, strlen(t));
- e_sexp_parse(f);
-
- if (f->tree) {
- parse_dump_term(f->tree, 0);
- }
-
- r = e_sexp_eval(f);
- if (r) {
- eval_dump_result(r, 0);
- } else {
- printf("no result?|\n");
- }
-
- return 0;
-}
-#endif
diff --git a/e-util/e-sexp.h b/e-util/e-sexp.h
deleted file mode 100644
index 1030531133..0000000000
--- a/e-util/e-sexp.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- generic s-exp evaluator class
-*/
-#ifndef _E_SEXP_H
-#define _E_SEXP_H
-
-#include <glib.h>
-#include <gtk/gtk.h>
-
-#define E_SEXP(obj) GTK_CHECK_CAST (obj, e_sexp_get_type (), ESExp)
-#define E_SEXP_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_sexp_get_type (), ESExpClass)
-#define FILTER_IS_SEXP(obj) GTK_CHECK_TYPE (obj, e_sexp_get_type ())
-
-typedef struct _ESExp ESExp;
-typedef struct _ESExpClass ESExpClass;
-
-typedef struct _ESExpSymbol ESExpSymbol;
-typedef struct _ESExpResult ESExpResult;
-typedef struct _ESExpTerm ESExpTerm;
-
-typedef struct _ESExpResult *(ESExpFunc)(struct _ESExp *sexp,
- int argc,
- struct _ESExpResult **argv,
- void *data);
-
-typedef struct _ESExpResult *(ESExpIFunc)(struct _ESExp *sexp,
- int argc,
- struct _ESExpTerm **argv,
- void *data);
-enum _ESExpResultType {
- ESEXP_RES_ARRAY_PTR=0, /* type is a ptrarray, what it points to is implementation dependant */
- ESEXP_RES_INT, /* type is a number */
- ESEXP_RES_STRING, /* type is a pointer to a single string */
- ESEXP_RES_BOOL, /* boolean type */
- ESEXP_RES_UNDEFINED /* unknown type */
-};
-
-struct _ESExpResult {
- enum _ESExpResultType type;
- union {
- GPtrArray *ptrarray;
- int number;
- char *string;
- int bool;
- } value;
-};
-
-enum _ESExpTermType {
- ESEXP_TERM_INT = 0, /* integer literal */
- ESEXP_TERM_BOOL, /* boolean literal */
- ESEXP_TERM_STRING, /* string literal */
- ESEXP_TERM_FUNC, /* normal function, arguments are evaluated before calling */
- ESEXP_TERM_IFUNC, /* immediate function, raw terms are arguments */
- ESEXP_TERM_VAR, /* variable reference */
-};
-
-struct _ESExpSymbol {
- int type; /* ESEXP_TERM_FUNC or ESEXP_TERM_VAR */
- char *name;
- void *data;
- union {
- ESExpFunc *func;
- ESExpIFunc *ifunc;
- } f;
-};
-
-struct _ESExpTerm {
- enum _ESExpTermType type;
- union {
- char *string;
- int number;
- int bool;
- struct {
- struct _ESExpSymbol *sym;
- struct _ESExpTerm **terms;
- int termcount;
- } func;
- struct _ESExpSymbol *var;
- } value;
-};
-
-
-
-struct _ESExp {
- GtkObject object;
-
- GScanner *scanner; /* for parsing text version */
- ESExpTerm *tree; /* root of expression tree */
-};
-
-struct _ESExpClass {
- GtkObjectClass parent_class;
-
-};
-
-guint e_sexp_get_type (void);
-ESExp *e_sexp_new (void);
-void e_sexp_add_function (ESExp *f, int scope, char *name, ESExpFunc *func, void *data);
-void e_sexp_add_ifunction (ESExp *f, int scope, char *name, ESExpIFunc *func, void *data);
-void e_sexp_add_variable (ESExp *f, int scope, char *name, ESExpTerm *value);
-void e_sexp_remove_symbol (ESExp *f, int scope, char *name);
-int e_sexp_set_scope (ESExp *f, int scope);
-
-void e_sexp_input_text (ESExp *f, const char *text, int len);
-void e_sexp_input_file (ESExp *f, int fd);
-
-
-void e_sexp_parse (ESExp *f);
-ESExpResult *e_sexp_eval (ESExp *f);
-
-ESExpResult *e_sexp_term_eval (struct _ESExp *f, struct _ESExpTerm *t);
-ESExpResult *e_sexp_result_new (int type);
-void e_sexp_result_free (struct _ESExpResult *t);
-
-/* utility functions for creating s-exp strings. */
-void e_sexp_encode_bool(GString *s, gboolean state);
-void e_sexp_encode_string(GString *s, const char *string);
-
-#endif /* _E_SEXP_H */
diff --git a/e-util/e-text-event-processor-emacs-like.c b/e-util/e-text-event-processor-emacs-like.c
deleted file mode 100644
index be323d028f..0000000000
--- a/e-util/e-text-event-processor-emacs-like.c
+++ /dev/null
@@ -1,372 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-text-event-processor.c
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <gnome.h>
-#include "e-text-event-processor-emacs-like.h"
-static void e_text_event_processor_emacs_like_init (ETextEventProcessorEmacsLike *card);
-static void e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass *klass);
-static gint e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event);
-
-static ETextEventProcessorClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0
-};
-
-static const ETextEventProcessorCommand control_keys[26] =
-{
- { E_TEP_START_OF_LINE, E_TEP_MOVE, 0, "" }, /* a */
- { E_TEP_BACKWARD_CHARACTER, E_TEP_MOVE, 0, "" }, /* b */
- { E_TEP_SELECTION, E_TEP_COPY, 0, "" }, /* c */
- { E_TEP_FORWARD_CHARACTER, E_TEP_DELETE, 0, "" }, /* d */
- { E_TEP_END_OF_LINE, E_TEP_MOVE, 0, "" }, /* e */
- { E_TEP_FORWARD_CHARACTER, E_TEP_MOVE, 0, "" }, /* f */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* g */
- { E_TEP_BACKWARD_CHARACTER, E_TEP_DELETE, 0, "" }, /* h */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* i */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* j */
- { E_TEP_END_OF_LINE, E_TEP_DELETE, 0, "" }, /* k */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* l */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* m */
- { E_TEP_FORWARD_LINE, E_TEP_MOVE, 0, "" }, /* n */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* o */
- { E_TEP_BACKWARD_LINE, E_TEP_MOVE, 0, "" }, /* p */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* q */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* r */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* s */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* t */
- { E_TEP_START_OF_LINE, E_TEP_DELETE, 0, "" }, /* u */
- { E_TEP_SELECTION, E_TEP_PASTE, 0, "" }, /* v */
- { E_TEP_SELECTION, E_TEP_DELETE, 0, "" }, /* w */
- { E_TEP_SELECTION, E_TEP_DELETE, 0, "" }, /* x */
- { E_TEP_SELECTION, E_TEP_PASTE, 0, "" }, /* y */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" } /* z */
-};
-
-static const ETextEventProcessorCommand alt_keys[26] =
-{
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* a */
- { E_TEP_BACKWARD_WORD, E_TEP_MOVE, 0, "" }, /* b */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* c */
- { E_TEP_FORWARD_WORD, E_TEP_DELETE, 0, "" }, /* d */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* e */
- { E_TEP_FORWARD_WORD, E_TEP_MOVE, 0, "" }, /* f */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* g */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* h */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* i */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* j */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* k */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* l */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* m */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* n */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* o */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* p */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* q */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* r */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* s */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* t */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* u */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* v */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* w */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* x */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* y */
- { E_TEP_SELECTION, E_TEP_NOP, 0, "" } /* z */
-
-};
-
-GtkType
-e_text_event_processor_emacs_like_get_type (void)
-{
- static GtkType text_event_processor_emacs_like_type = 0;
-
- if (!text_event_processor_emacs_like_type)
- {
- static const GtkTypeInfo text_event_processor_emacs_like_info =
- {
- "ETextEventProcessorEmacsLike",
- sizeof (ETextEventProcessorEmacsLike),
- sizeof (ETextEventProcessorEmacsLikeClass),
- (GtkClassInitFunc) e_text_event_processor_emacs_like_class_init,
- (GtkObjectInitFunc) e_text_event_processor_emacs_like_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- text_event_processor_emacs_like_type = gtk_type_unique (e_text_event_processor_get_type (), &text_event_processor_emacs_like_info);
- }
-
- return text_event_processor_emacs_like_type;
-}
-
-static void
-e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass *klass)
-{
- GtkObjectClass *object_class;
- ETextEventProcessorClass *processor_class;
-
- object_class = (GtkObjectClass*) klass;
- processor_class = (ETextEventProcessorClass*) klass;
-
- parent_class = gtk_type_class (e_text_event_processor_get_type ());
-
- processor_class->event = e_text_event_processor_emacs_like_event;
-}
-
-static void
-e_text_event_processor_emacs_like_init (ETextEventProcessorEmacsLike *tep)
-{
-}
-
-static gint
-e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event)
-{
- ETextEventProcessorCommand command;
- ETextEventProcessorEmacsLike *tep_el = E_TEXT_EVENT_PROCESSOR_EMACS_LIKE(tep);
- command.action = E_TEP_NOP;
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- if (event->button.button == 1) {
- command.action = E_TEP_GRAB;
- command.time = event->button.time;
- gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command);
- if (event->button.state & GDK_SHIFT_MASK)
- command.action = E_TEP_SELECT;
- else
- command.action = E_TEP_MOVE;
- command.position = E_TEP_VALUE;
- command.value = event->button.position;
- command.time = event->button.time;
- tep_el->mouse_down = TRUE;
- }
- break;
- case GDK_2BUTTON_PRESS:
- if (event->button.button == 1) {
- command.action = E_TEP_SELECT;
- command.position = E_TEP_SELECT_WORD;
- command.time = event->button.time;
- }
- break;
- case GDK_3BUTTON_PRESS:
- if (event->button.button == 1) {
- command.action = E_TEP_SELECT;
- command.position = E_TEP_SELECT_ALL;
- command.time = event->button.time;
- }
- break;
- case GDK_BUTTON_RELEASE:
- if (event->button.button == 1) {
- command.action = E_TEP_UNGRAB;
- command.time = event->button.time;
- gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command);
- command.time = event->button.time;
- tep_el->mouse_down = FALSE;
- command.action = E_TEP_NOP;
- } else if (event->button.button == 2) {
- command.action = E_TEP_MOVE;
- command.position = E_TEP_VALUE;
- command.value = event->button.position;
- command.time = event->button.time;
- gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command);
-
- command.action = E_TEP_GET_SELECTION;
- command.position = E_TEP_SELECTION;
- command.value = 0;
- command.time = event->button.time;
- }
- break;
- case GDK_MOTION_NOTIFY:
- if (tep_el->mouse_down) {
- command.action = E_TEP_SELECT;
- command.position = E_TEP_VALUE;
- command.time = event->motion.time;
- command.value = event->motion.position;
- }
- break;
- case GDK_KEY_PRESS:
- {
- ETextEventProcessorEventKey key = event->key;
- command.time = event->key.time;
- if (key.state & GDK_SHIFT_MASK)
- command.action = E_TEP_SELECT;
- else
- command.action = E_TEP_MOVE;
- switch(key.keyval) {
- case GDK_Home:
- if (key.state & GDK_CONTROL_MASK)
- command.position = E_TEP_START_OF_BUFFER;
- else
- command.position = E_TEP_START_OF_LINE;
- break;
- case GDK_End:
- if (key.state & GDK_CONTROL_MASK)
- command.position = E_TEP_END_OF_BUFFER;
- else
- command.position = E_TEP_END_OF_LINE;
- break;
- case GDK_Page_Up: command.position = E_TEP_BACKWARD_PAGE; break;
- case GDK_Page_Down: command.position = E_TEP_FORWARD_PAGE; break;
- /* CUA has Ctrl-Up/Ctrl-Down as paragraph up down */
- case GDK_Up: command.position = E_TEP_BACKWARD_LINE; break;
- case GDK_Down: command.position = E_TEP_FORWARD_LINE; break;
- case GDK_Left:
- if (key.state & GDK_CONTROL_MASK)
- command.position = E_TEP_BACKWARD_WORD;
- else
- command.position = E_TEP_BACKWARD_CHARACTER;
- break;
- case GDK_Right:
- if (key.state & GDK_CONTROL_MASK)
- command.position = E_TEP_FORWARD_WORD;
- else
- command.position = E_TEP_FORWARD_CHARACTER;
- break;
-
- case GDK_BackSpace:
- command.action = E_TEP_DELETE;
- if (key.state & GDK_CONTROL_MASK)
- command.position = E_TEP_BACKWARD_WORD;
- else
- command.position = E_TEP_BACKWARD_CHARACTER;
- break;
- case GDK_Clear:
- command.action = E_TEP_DELETE;
- command.position = E_TEP_END_OF_LINE;
- break;
- case GDK_Insert:
- if (key.state & GDK_SHIFT_MASK) {
- command.action = E_TEP_PASTE;
- command.position = E_TEP_SELECTION;
- } else if (key.state & GDK_CONTROL_MASK) {
- command.action = E_TEP_COPY;
- command.position = E_TEP_SELECTION;
- } else {
- /* gtk_toggle_insert(text) -- IMPLEMENT */
- }
- break;
- case GDK_Delete:
- if (key.state & GDK_CONTROL_MASK){
- command.action = E_TEP_DELETE;
- command.position = E_TEP_FORWARD_WORD;
- } else if (key.state & GDK_SHIFT_MASK) {
- command.action = E_TEP_COPY;
- command.position = E_TEP_SELECTION;
- gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command);
-
- command.action = E_TEP_DELETE;
- command.position = E_TEP_SELECTION;
- } else {
- command.action = E_TEP_DELETE;
- command.position = E_TEP_FORWARD_CHARACTER;
- }
- break;
- case GDK_Tab:
- /* Don't insert literally */
- command.action = E_TEP_NOP;
- command.position = E_TEP_SELECTION;
- break;
- case GDK_Return:
- if (key.state & GDK_CONTROL_MASK) {
- command.action = E_TEP_ACTIVATE;
- command.position = E_TEP_SELECTION;
- } else {
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "\n";
- }
- break;
- case GDK_Escape:
- /* Don't insert literally */
- command.action = E_TEP_NOP;
- command.position = E_TEP_SELECTION;
- break;
-
- default:
- if (key.state & GDK_CONTROL_MASK) {
- if ((key.keyval >= 'A') && (key.keyval <= 'Z'))
- key.keyval -= 'A' - 'a';
-
- if ((key.keyval >= 'a') && (key.keyval <= 'z')) {
- command.position = control_keys[(int) (key.keyval - 'a')].position;
- if (control_keys[(int) (key.keyval - 'a')].action != E_TEP_MOVE)
- command.action = control_keys[(int) (key.keyval - 'a')].action;
- command.value = control_keys[(int) (key.keyval - 'a')].value;
- command.string = control_keys[(int) (key.keyval - 'a')].string;
- }
-
- if (key.keyval == 'x' || key.keyval == 'w') {
- command.action = E_TEP_COPY;
- command.position = E_TEP_SELECTION;
- gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command);
-
- command.action = E_TEP_DELETE;
- command.position = E_TEP_SELECTION;
- }
-
- break;
- } else if (key.state & GDK_MOD1_MASK) {
- if ((key.keyval >= 'A') && (key.keyval <= 'Z'))
- key.keyval -= 'A' - 'a';
-
- if ((key.keyval >= 'a') && (key.keyval <= 'z')) {
- command.position = alt_keys[(int) (key.keyval - 'a')].position;
- if (alt_keys[(int) (key.keyval - 'a')].action != E_TEP_MOVE)
- command.action = alt_keys[(int) (key.keyval - 'a')].action;
- command.value = alt_keys[(int) (key.keyval - 'a')].value;
- command.string = alt_keys[(int) (key.keyval - 'a')].string;
- }
- } else if (key.length > 0) {
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = strlen(key.string);
- command.string = key.string;
-
- } else {
- command.action = E_TEP_NOP;
- }
- }
- break;
- case GDK_KEY_RELEASE:
- command.time = event->key.time;
- command.action = E_TEP_NOP;
- break;
- default:
- command.action = E_TEP_NOP;
- break;
- }
- }
- if (command.action != E_TEP_NOP) {
- gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command);
- return 1;
- }
- else
- return 0;
-}
-
-ETextEventProcessor *
-e_text_event_processor_emacs_like_new (void)
-{
- ETextEventProcessorEmacsLike *retval = gtk_type_new (e_text_event_processor_emacs_like_get_type ());
- return E_TEXT_EVENT_PROCESSOR (retval);
-}
-
diff --git a/e-util/e-text-event-processor-emacs-like.h b/e-util/e-text-event-processor-emacs-like.h
deleted file mode 100644
index 651bb552b3..0000000000
--- a/e-util/e-text-event-processor-emacs-like.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-text-event-processor-emacs-like.h
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifndef __E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_H__
-#define __E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_H__
-
-#include <gnome.h>
-#include "e-text-event-processor.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* ETextEventProcessorEmacsLike - Turns events on a text widget into commands. Uses an emacs-ish interface.
- *
- */
-
-#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE (e_text_event_processor_emacs_like_get_type ())
-#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE(obj) (GTK_CHECK_CAST ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, ETextEventProcessorEmacsLike))
-#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, ETextEventProcessorEmacsLikeClass))
-#define E_IS_TEXT_EVENT_PROCESSOR_EMACS_LIKE(obj) (GTK_CHECK_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE))
-#define E_IS_TEXT_EVENT_PROCESSOR_EMACS_LIKE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE))
-
-
-typedef struct _ETextEventProcessorEmacsLike ETextEventProcessorEmacsLike;
-typedef struct _ETextEventProcessorEmacsLikeClass ETextEventProcessorEmacsLikeClass;
-
-struct _ETextEventProcessorEmacsLike
-{
- ETextEventProcessor parent;
-
- /* object specific fields */
- gboolean mouse_down;
-};
-
-struct _ETextEventProcessorEmacsLikeClass
-{
- ETextEventProcessorClass parent_class;
-};
-
-
-GtkType e_text_event_processor_emacs_like_get_type (void);
-ETextEventProcessor *e_text_event_processor_emacs_like_new (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_H__ */
diff --git a/e-util/e-text-event-processor-types.h b/e-util/e-text-event-processor-types.h
deleted file mode 100644
index 8f2ffbaf39..0000000000
--- a/e-util/e-text-event-processor-types.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-text-event-processor.h
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#ifndef __E_TEXT_EVENT_PROCESSOR_TYPES_H__
-#define __E_TEXT_EVENT_PROCESSOR_TYPES_H__
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#include <gdk/gdktypes.h>
-
-typedef enum _ETextEventProcessorCommandPosition ETextEventProcessorCommandPosition;
-typedef enum _ETextEventProcessorCommandAction ETextEventProcessorCommandAction;
-typedef struct _ETextEventProcessorCommand ETextEventProcessorCommand;
-
-typedef union _ETextEventProcessorEvent ETextEventProcessorEvent;
-typedef struct _ETextEventProcessorEventButton ETextEventProcessorEventButton;
-typedef struct _ETextEventProcessorEventKey ETextEventProcessorEventKey;
-typedef struct _ETextEventProcessorEventMotion ETextEventProcessorEventMotion;
-
-enum _ETextEventProcessorCommandPosition {
- E_TEP_VALUE,
- E_TEP_SELECTION,
-
- E_TEP_START_OF_BUFFER,
- E_TEP_END_OF_BUFFER,
-
- E_TEP_START_OF_LINE,
- E_TEP_END_OF_LINE,
-
- E_TEP_FORWARD_CHARACTER,
- E_TEP_BACKWARD_CHARACTER,
-
- E_TEP_FORWARD_WORD,
- E_TEP_BACKWARD_WORD,
-
- E_TEP_FORWARD_LINE,
- E_TEP_BACKWARD_LINE,
-
- E_TEP_FORWARD_PARAGRAPH,
- E_TEP_BACKWARD_PARAGRAPH,
-
- E_TEP_FORWARD_PAGE,
- E_TEP_BACKWARD_PAGE,
-
- E_TEP_SELECT_WORD,
- E_TEP_SELECT_ALL
-
-};
-
-enum _ETextEventProcessorCommandAction {
- E_TEP_MOVE,
- E_TEP_SELECT,
- E_TEP_DELETE,
- E_TEP_INSERT,
-
- E_TEP_COPY,
- E_TEP_PASTE,
- E_TEP_GET_SELECTION,
- E_TEP_SET_SELECT_BY_WORD,
- E_TEP_ACTIVATE,
-
- E_TEP_GRAB,
- E_TEP_UNGRAB,
-
- E_TEP_NOP
-};
-
-struct _ETextEventProcessorCommand {
- ETextEventProcessorCommandPosition position;
- ETextEventProcessorCommandAction action;
- int value;
- char *string;
- guint32 time;
-};
-
-struct _ETextEventProcessorEventButton {
- GdkEventType type;
- guint32 time;
- guint state;
- guint button;
- gint position;
-};
-
-struct _ETextEventProcessorEventKey {
- GdkEventType type;
- guint32 time;
- guint state;
- guint keyval;
- gint length;
- gchar *string;
-};
-
-struct _ETextEventProcessorEventMotion {
- GdkEventType type;
- guint32 time;
- guint state;
- gint position;
-};
-
-union _ETextEventProcessorEvent {
- GdkEventType type;
- ETextEventProcessorEventButton button;
- ETextEventProcessorEventKey key;
- ETextEventProcessorEventMotion motion;
-};
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#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
deleted file mode 100644
index 47f028ca62..0000000000
--- a/e-util/e-text-event-processor.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-text-event-processor.c
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <gnome.h>
-#include "e-text-event-processor.h"
-static void e_text_event_processor_init (ETextEventProcessor *card);
-static void e_text_event_processor_class_init (ETextEventProcessorClass *klass);
-
-static GtkObjectClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0
-};
-
-enum {
- E_TEP_EVENT,
- E_TEP_LAST_SIGNAL
-};
-
-static guint e_tep_signals[E_TEP_LAST_SIGNAL] = { 0 };
-
-GtkType
-e_text_event_processor_get_type (void)
-{
- static GtkType text_event_processor_type = 0;
-
- if (!text_event_processor_type)
- {
- static const GtkTypeInfo text_event_processor_info =
- {
- "ETextEventProcessor",
- sizeof (ETextEventProcessor),
- sizeof (ETextEventProcessorClass),
- (GtkClassInitFunc) e_text_event_processor_class_init,
- (GtkObjectInitFunc) e_text_event_processor_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- text_event_processor_type = gtk_type_unique (gtk_object_get_type (), &text_event_processor_info);
- }
-
- return text_event_processor_type;
-}
-
-static void
-e_text_event_processor_class_init (ETextEventProcessorClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- e_tep_signals[E_TEP_EVENT] =
- gtk_signal_new ("command",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETextEventProcessorClass, command),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
-
- gtk_object_class_add_signals (object_class, e_tep_signals, E_TEP_LAST_SIGNAL);
-
- klass->event = NULL;
- klass->command = NULL;
-}
-
-static void
-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 {
- return 0;
- }
-}
diff --git a/e-util/e-text-event-processor.h b/e-util/e-text-event-processor.h
deleted file mode 100644
index 1fc79f3f70..0000000000
--- a/e-util/e-text-event-processor.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-text-event-processor.h
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifndef __E_TEXT_EVENT_PROCESSOR_H__
-#define __E_TEXT_EVENT_PROCESSOR_H__
-
-#include <gnome.h>
-#include "e-text-event-processor-types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* ETextEventProcessor - Turns events on a text widget into commands.
- *
- */
-
-#define E_TEXT_EVENT_PROCESSOR_TYPE (e_text_event_processor_get_type ())
-#define E_TEXT_EVENT_PROCESSOR(obj) (GTK_CHECK_CAST ((obj), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessor))
-#define E_TEXT_EVENT_PROCESSOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessorClass))
-#define E_IS_TEXT_EVENT_PROCESSOR(obj) (GTK_CHECK_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_TYPE))
-#define E_IS_TEXT_EVENT_PROCESSOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_TYPE))
-
-
-typedef struct _ETextEventProcessor ETextEventProcessor;
-typedef struct _ETextEventProcessorClass ETextEventProcessorClass;
-
-struct _ETextEventProcessor
-{
- GtkObject parent;
-
- /* object specific fields */
-
-};
-
-struct _ETextEventProcessorClass
-{
- GtkObjectClass parent_class;
-
- /* signals */
- void (* command) (ETextEventProcessor *tep, ETextEventProcessorCommand *command);
-
- /* virtual functions */
- gint (* event) (ETextEventProcessor *tep, ETextEventProcessorEvent *event);
-};
-
-
-GtkType e_text_event_processor_get_type (void);
-gint e_text_event_processor_handle_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_TEXT_EVENT_PROCESSOR_H__ */
diff --git a/e-util/e-util.c b/e-util/e-util.c
deleted file mode 100644
index 90a5697fb0..0000000000
--- a/e-util/e-util.c
+++ /dev/null
@@ -1,475 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-xml-utils.c
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <glib.h>
-#include <gtk/gtkobject.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <string.h>
-
-#include "e-util.h"
-#if 0
-#include <libgnomevfs/gnome-vfs.h>
-#endif
-
-int
-g_str_compare(const void *x, const void *y)
-{
- return strcmp(x, y);
-}
-
-int
-g_int_compare(const void *x, const void *y)
-{
- if ( GPOINTER_TO_INT(x) < GPOINTER_TO_INT(y) )
- return -1;
- else if ( GPOINTER_TO_INT(x) == GPOINTER_TO_INT(y) )
- return 0;
- else
- return 1;
-}
-
-char *
-e_strdup_strip(char *string)
-{
- int i;
- int length = 0;
- int initial = 0;
- for ( i = 0; string[i]; i++ ) {
- if (initial == i && isspace(string[i])) {
- initial ++;
- }
- if (!isspace(string[i])) {
- length = i - initial + 1;
- }
- }
- return g_strndup(string + initial, length);
-}
-
-void
-e_free_object_list (GList *list)
-{
- GList *p;
-
- for (p = list; p != NULL; p = p->next)
- gtk_object_unref (GTK_OBJECT (p->data));
-
- g_list_free (list);
-}
-
-void
-e_free_string_list (GList *list)
-{
- GList *p;
-
- for (p = list; p != NULL; p = p->next)
- g_free (p->data);
-
- g_list_free (list);
-}
-
-#define BUFF_SIZE 1024
-
-char *
-e_read_file(const char *filename)
-{
- int fd;
- char buffer[BUFF_SIZE];
- GList *list = NULL, *list_iterator;
- GList *lengths = NULL, *lengths_iterator;
- int length = 0;
- int bytes;
- char *ret_val;
-
- fd = open(filename, O_RDONLY);
- if (fd == -1)
- return NULL;
- bytes = read(fd, buffer, BUFF_SIZE);
- while (bytes) {
- if (bytes > 0) {
- char *temp = g_malloc(bytes);
- memcpy (temp, buffer, bytes);
- list = g_list_prepend(list, temp);
- lengths = g_list_prepend(lengths, GINT_TO_POINTER(bytes));
- length += bytes;
- } else {
- if (errno != EINTR) {
- close(fd);
- g_list_foreach(list, (GFunc) g_free, NULL);
- g_list_free(list);
- g_list_free(lengths);
- return NULL;
- }
- }
- bytes = read(fd, buffer, BUFF_SIZE);
- }
- ret_val = g_new(char, length + 1);
- ret_val[length] = 0;
- lengths_iterator = lengths;
- list_iterator = list;
- for ( ; list_iterator; list_iterator = list_iterator->next, lengths_iterator = lengths_iterator->next) {
- int this_length = GPOINTER_TO_INT(lengths_iterator->data);
- length -= this_length;
- memcpy(ret_val + length, list_iterator->data, this_length);
- }
- close(fd);
- g_list_foreach(list, (GFunc) g_free, NULL);
- g_list_free(list);
- g_list_free(lengths);
- return ret_val;
-}
-
-gint
-e_write_file(const char *filename, const char *data, int flags)
-{
- int fd;
- int length = strlen(data);
- int bytes;
- fd = open(filename, flags, 0666);
- if (fd == -1)
- return errno;
- while (length > 0) {
- bytes = write(fd, data, length);
- if (bytes > 0) {
- length -= bytes;
- data += bytes;
- } else {
- if (errno != EINTR && errno != EAGAIN) {
- int save_errno = errno;
- close(fd);
- return save_errno;
- }
- }
- }
- close(fd);
- return 0;
-}
-
-#if 0
-char *
-e_read_uri(const char *uri)
-{
- GnomeVFSHandle *handle;
- GList *list = NULL, *list_iterator;
- GList *lengths = NULL, *lengths_iterator;
- gchar buffer[1025];
- gchar *ret_val;
- int length = 0;
- GnomeVFSFileSize bytes;
-
- gnome_vfs_open(&handle, uri, GNOME_VFS_OPEN_READ);
-
- gnome_vfs_read(handle, buffer, 1024, &bytes);
- while (bytes) {
- if (bytes) {
- char *temp = g_malloc(bytes);
- memcpy (temp, buffer, bytes);
- list = g_list_prepend(list, temp);
- lengths = g_list_prepend(lengths, GINT_TO_POINTER((gint) bytes));
- length += bytes;
- }
- gnome_vfs_read(handle, buffer, 1024, &bytes);
- }
-
- ret_val = g_new(char, length + 1);
- ret_val[length] = 0;
- lengths_iterator = lengths;
- list_iterator = list;
- for ( ; list_iterator; list_iterator = list_iterator->next, lengths_iterator = lengths_iterator->next) {
- int this_length = GPOINTER_TO_INT(lengths_iterator->data);
- length -= this_length;
- memcpy(ret_val + length, list_iterator->data, this_length);
- }
- gnome_vfs_close(handle);
- g_list_foreach(list, (GFunc) g_free, NULL);
- g_list_free(list);
- g_list_free(lengths);
- return ret_val;
-}
-#endif
-
-typedef gint (*GtkSignal_INT__INT_INT_POINTER) (GtkObject * object,
- gint arg1,
- gint arg2,
- gpointer arg3,
- gpointer user_data);
-
-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 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_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 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 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);
-}
-
-gchar**
-e_strsplit (const gchar *string,
- const gchar *delimiter,
- gint max_tokens)
-{
- GSList *string_list = NULL, *slist;
- gchar **str_array, *s;
- guint i, n = 1;
-
- g_return_val_if_fail (string != NULL, NULL);
- g_return_val_if_fail (delimiter != NULL, NULL);
-
- if (max_tokens < 1)
- max_tokens = G_MAXINT;
-
- s = strstr (string, delimiter);
- if (s)
- {
- guint delimiter_len = strlen (delimiter);
-
- do
- {
- guint len;
- gchar *new_string;
-
- len = s - string;
- new_string = g_new (gchar, len + 1);
- strncpy (new_string, string, len);
- new_string[len] = 0;
- string_list = g_slist_prepend (string_list, new_string);
- n++;
- string = s + delimiter_len;
- s = strstr (string, delimiter);
- }
- while (--max_tokens && s);
- }
-
- n++;
- string_list = g_slist_prepend (string_list, g_strdup (string));
-
- str_array = g_new (gchar*, n);
-
- i = n - 1;
-
- str_array[i--] = NULL;
- for (slist = string_list; slist; slist = slist->next)
- str_array[i--] = slist->data;
-
- g_slist_free (string_list);
-
- return str_array;
-}
-
-const gchar *
-e_strstrcase (const gchar *haystack, const gchar *needle)
-{
- /* find the needle in the haystack neglecting case */
- gchar *ptr;
- guint len;
-
- g_return_val_if_fail (haystack != NULL, NULL);
- g_return_val_if_fail (needle != NULL, NULL);
-
- len = strlen(needle);
- if (len > strlen(haystack))
- return NULL;
-
- if (len == 0)
- return (char *)haystack;
-
- for (ptr = (char *)haystack; *(ptr + len - 1) != '\0'; ptr++)
- if (!g_strncasecmp(ptr, needle, len))
- return ptr;
-
- return NULL;
-}
diff --git a/e-util/e-util.c-8611 b/e-util/e-util.c-8611
deleted file mode 100644
index 90a5697fb0..0000000000
--- a/e-util/e-util.c-8611
+++ /dev/null
@@ -1,475 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-xml-utils.c
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <glib.h>
-#include <gtk/gtkobject.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <string.h>
-
-#include "e-util.h"
-#if 0
-#include <libgnomevfs/gnome-vfs.h>
-#endif
-
-int
-g_str_compare(const void *x, const void *y)
-{
- return strcmp(x, y);
-}
-
-int
-g_int_compare(const void *x, const void *y)
-{
- if ( GPOINTER_TO_INT(x) < GPOINTER_TO_INT(y) )
- return -1;
- else if ( GPOINTER_TO_INT(x) == GPOINTER_TO_INT(y) )
- return 0;
- else
- return 1;
-}
-
-char *
-e_strdup_strip(char *string)
-{
- int i;
- int length = 0;
- int initial = 0;
- for ( i = 0; string[i]; i++ ) {
- if (initial == i && isspace(string[i])) {
- initial ++;
- }
- if (!isspace(string[i])) {
- length = i - initial + 1;
- }
- }
- return g_strndup(string + initial, length);
-}
-
-void
-e_free_object_list (GList *list)
-{
- GList *p;
-
- for (p = list; p != NULL; p = p->next)
- gtk_object_unref (GTK_OBJECT (p->data));
-
- g_list_free (list);
-}
-
-void
-e_free_string_list (GList *list)
-{
- GList *p;
-
- for (p = list; p != NULL; p = p->next)
- g_free (p->data);
-
- g_list_free (list);
-}
-
-#define BUFF_SIZE 1024
-
-char *
-e_read_file(const char *filename)
-{
- int fd;
- char buffer[BUFF_SIZE];
- GList *list = NULL, *list_iterator;
- GList *lengths = NULL, *lengths_iterator;
- int length = 0;
- int bytes;
- char *ret_val;
-
- fd = open(filename, O_RDONLY);
- if (fd == -1)
- return NULL;
- bytes = read(fd, buffer, BUFF_SIZE);
- while (bytes) {
- if (bytes > 0) {
- char *temp = g_malloc(bytes);
- memcpy (temp, buffer, bytes);
- list = g_list_prepend(list, temp);
- lengths = g_list_prepend(lengths, GINT_TO_POINTER(bytes));
- length += bytes;
- } else {
- if (errno != EINTR) {
- close(fd);
- g_list_foreach(list, (GFunc) g_free, NULL);
- g_list_free(list);
- g_list_free(lengths);
- return NULL;
- }
- }
- bytes = read(fd, buffer, BUFF_SIZE);
- }
- ret_val = g_new(char, length + 1);
- ret_val[length] = 0;
- lengths_iterator = lengths;
- list_iterator = list;
- for ( ; list_iterator; list_iterator = list_iterator->next, lengths_iterator = lengths_iterator->next) {
- int this_length = GPOINTER_TO_INT(lengths_iterator->data);
- length -= this_length;
- memcpy(ret_val + length, list_iterator->data, this_length);
- }
- close(fd);
- g_list_foreach(list, (GFunc) g_free, NULL);
- g_list_free(list);
- g_list_free(lengths);
- return ret_val;
-}
-
-gint
-e_write_file(const char *filename, const char *data, int flags)
-{
- int fd;
- int length = strlen(data);
- int bytes;
- fd = open(filename, flags, 0666);
- if (fd == -1)
- return errno;
- while (length > 0) {
- bytes = write(fd, data, length);
- if (bytes > 0) {
- length -= bytes;
- data += bytes;
- } else {
- if (errno != EINTR && errno != EAGAIN) {
- int save_errno = errno;
- close(fd);
- return save_errno;
- }
- }
- }
- close(fd);
- return 0;
-}
-
-#if 0
-char *
-e_read_uri(const char *uri)
-{
- GnomeVFSHandle *handle;
- GList *list = NULL, *list_iterator;
- GList *lengths = NULL, *lengths_iterator;
- gchar buffer[1025];
- gchar *ret_val;
- int length = 0;
- GnomeVFSFileSize bytes;
-
- gnome_vfs_open(&handle, uri, GNOME_VFS_OPEN_READ);
-
- gnome_vfs_read(handle, buffer, 1024, &bytes);
- while (bytes) {
- if (bytes) {
- char *temp = g_malloc(bytes);
- memcpy (temp, buffer, bytes);
- list = g_list_prepend(list, temp);
- lengths = g_list_prepend(lengths, GINT_TO_POINTER((gint) bytes));
- length += bytes;
- }
- gnome_vfs_read(handle, buffer, 1024, &bytes);
- }
-
- ret_val = g_new(char, length + 1);
- ret_val[length] = 0;
- lengths_iterator = lengths;
- list_iterator = list;
- for ( ; list_iterator; list_iterator = list_iterator->next, lengths_iterator = lengths_iterator->next) {
- int this_length = GPOINTER_TO_INT(lengths_iterator->data);
- length -= this_length;
- memcpy(ret_val + length, list_iterator->data, this_length);
- }
- gnome_vfs_close(handle);
- g_list_foreach(list, (GFunc) g_free, NULL);
- g_list_free(list);
- g_list_free(lengths);
- return ret_val;
-}
-#endif
-
-typedef gint (*GtkSignal_INT__INT_INT_POINTER) (GtkObject * object,
- gint arg1,
- gint arg2,
- gpointer arg3,
- gpointer user_data);
-
-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 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_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 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 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);
-}
-
-gchar**
-e_strsplit (const gchar *string,
- const gchar *delimiter,
- gint max_tokens)
-{
- GSList *string_list = NULL, *slist;
- gchar **str_array, *s;
- guint i, n = 1;
-
- g_return_val_if_fail (string != NULL, NULL);
- g_return_val_if_fail (delimiter != NULL, NULL);
-
- if (max_tokens < 1)
- max_tokens = G_MAXINT;
-
- s = strstr (string, delimiter);
- if (s)
- {
- guint delimiter_len = strlen (delimiter);
-
- do
- {
- guint len;
- gchar *new_string;
-
- len = s - string;
- new_string = g_new (gchar, len + 1);
- strncpy (new_string, string, len);
- new_string[len] = 0;
- string_list = g_slist_prepend (string_list, new_string);
- n++;
- string = s + delimiter_len;
- s = strstr (string, delimiter);
- }
- while (--max_tokens && s);
- }
-
- n++;
- string_list = g_slist_prepend (string_list, g_strdup (string));
-
- str_array = g_new (gchar*, n);
-
- i = n - 1;
-
- str_array[i--] = NULL;
- for (slist = string_list; slist; slist = slist->next)
- str_array[i--] = slist->data;
-
- g_slist_free (string_list);
-
- return str_array;
-}
-
-const gchar *
-e_strstrcase (const gchar *haystack, const gchar *needle)
-{
- /* find the needle in the haystack neglecting case */
- gchar *ptr;
- guint len;
-
- g_return_val_if_fail (haystack != NULL, NULL);
- g_return_val_if_fail (needle != NULL, NULL);
-
- len = strlen(needle);
- if (len > strlen(haystack))
- return NULL;
-
- if (len == 0)
- return (char *)haystack;
-
- for (ptr = (char *)haystack; *(ptr + len - 1) != '\0'; ptr++)
- if (!g_strncasecmp(ptr, needle, len))
- return ptr;
-
- return NULL;
-}
diff --git a/e-util/e-util.h b/e-util/e-util.h
deleted file mode 100644
index 87af6032c2..0000000000
--- a/e-util/e-util.h
+++ /dev/null
@@ -1,94 +0,0 @@
-#ifndef _E_UTIL_H_
-#define _E_UTIL_H_
-
-#include <glib.h>
-#include <gtk/gtktypeutils.h>
-
-#define E_MAKE_TYPE(l,str,t,ci,i,parent) \
-GtkType 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;\
-}
-
-typedef enum {
- E_FOCUS_NONE,
- E_FOCUS_CURRENT,
- E_FOCUS_START,
- E_FOCUS_END
-} EFocus;
-
-int g_str_compare (const void *x, const void *y);
-int g_int_compare (const void *x, const void *y);
-
-char *e_strdup_strip (char *string);
-
-void e_free_object_list (GList *list);
-void e_free_string_list (GList *list);
-
-char *e_read_file (const char *filename);
-gint e_write_file(const char *filename, const char *data, int flags);
-#if 0
-char *e_read_uri (const char *uri);
-#endif
-
-gchar **e_strsplit (const gchar *string,
- const gchar *delimiter,
- gint max_tokens);
-
-const gchar *e_strstrcase (const gchar *haystack,
- const gchar *needle);
-
-void e_marshal_INT__INT_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_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_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_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);
-
-#endif /* _E_UTIL_H_ */
diff --git a/e-util/e-util.h-29002 b/e-util/e-util.h-29002
deleted file mode 100644
index 87af6032c2..0000000000
--- a/e-util/e-util.h-29002
+++ /dev/null
@@ -1,94 +0,0 @@
-#ifndef _E_UTIL_H_
-#define _E_UTIL_H_
-
-#include <glib.h>
-#include <gtk/gtktypeutils.h>
-
-#define E_MAKE_TYPE(l,str,t,ci,i,parent) \
-GtkType 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;\
-}
-
-typedef enum {
- E_FOCUS_NONE,
- E_FOCUS_CURRENT,
- E_FOCUS_START,
- E_FOCUS_END
-} EFocus;
-
-int g_str_compare (const void *x, const void *y);
-int g_int_compare (const void *x, const void *y);
-
-char *e_strdup_strip (char *string);
-
-void e_free_object_list (GList *list);
-void e_free_string_list (GList *list);
-
-char *e_read_file (const char *filename);
-gint e_write_file(const char *filename, const char *data, int flags);
-#if 0
-char *e_read_uri (const char *uri);
-#endif
-
-gchar **e_strsplit (const gchar *string,
- const gchar *delimiter,
- gint max_tokens);
-
-const gchar *e_strstrcase (const gchar *haystack,
- const gchar *needle);
-
-void e_marshal_INT__INT_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_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_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_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);
-
-#endif /* _E_UTIL_H_ */
diff --git a/e-util/e-xml-utils.c b/e-util/e-xml-utils.c
deleted file mode 100644
index 89f8591e8a..0000000000
--- a/e-util/e-xml-utils.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-xml-utils.c
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <locale.h>
-#include "e-xml-utils.h"
-#include <gnome-xml/parser.h>
-#include <gnome-xml/xmlmemory.h>
-
-
-xmlNode *e_xml_get_child_by_name(xmlNode *parent, const xmlChar *child_name)
-{
- xmlNode *child;
-
- g_return_val_if_fail(parent != NULL, NULL);
- g_return_val_if_fail(child_name != NULL, NULL);
-
- for (child = parent->childs; child; child = child->next) {
- if ( !xmlStrcmp( child->name, child_name ) ) {
- return child;
- }
- }
- return NULL;
-}
-
-/* Returns the first child with the name child_name and the "lang"
- * attribute that matches the current LC_MESSAGES, or else, the first
- * child with the name child_name and no "lang" attribute.
- */
-xmlNode *
-e_xml_get_child_by_name_by_lang(xmlNode *parent, const xmlChar *child_name, const char *lang)
-{
- xmlNode *child;
- /* This is the default version of the string. */
- xmlNode *C = NULL;
-
- g_return_val_if_fail(parent != NULL, NULL);
- g_return_val_if_fail(child_name != NULL, NULL);
-
- if (lang == NULL)
- lang = setlocale(LC_MESSAGES, NULL);
-
- for (child = parent->childs; child; child = child->next) {
- if ( !xmlStrcmp( child->name, child_name ) ) {
- char *this_lang = xmlGetProp(child, "lang");
- if ( this_lang == NULL ) {
- C = child;
- }
- else if (!strcmp(this_lang, "lang"))
- return child;
- }
- }
- return C;
-}
-
-int
-e_xml_get_integer_prop_by_name(xmlNode *parent, const xmlChar *prop_name)
-{
- xmlChar *prop;
- int ret_val = 0;
-
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- prop = xmlGetProp(parent, prop_name);
- if (prop) {
- ret_val = atoi(prop);
- xmlFree(prop);
- }
- return ret_val;
-}
-
-void
-e_xml_set_integer_prop_by_name(xmlNode *parent, const xmlChar *prop_name, int value)
-{
- xmlChar *valuestr;
-
- g_return_if_fail (parent != NULL);
- g_return_if_fail (prop_name != NULL);
-
- valuestr = g_strdup_printf("%d", value);
- xmlSetProp(parent, prop_name, valuestr);
- g_free (valuestr);
-}
-
-
diff --git a/e-util/e-xml-utils.c-56826 b/e-util/e-xml-utils.c-56826
deleted file mode 100644
index 89f8591e8a..0000000000
--- a/e-util/e-xml-utils.c-56826
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-xml-utils.c
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <locale.h>
-#include "e-xml-utils.h"
-#include <gnome-xml/parser.h>
-#include <gnome-xml/xmlmemory.h>
-
-
-xmlNode *e_xml_get_child_by_name(xmlNode *parent, const xmlChar *child_name)
-{
- xmlNode *child;
-
- g_return_val_if_fail(parent != NULL, NULL);
- g_return_val_if_fail(child_name != NULL, NULL);
-
- for (child = parent->childs; child; child = child->next) {
- if ( !xmlStrcmp( child->name, child_name ) ) {
- return child;
- }
- }
- return NULL;
-}
-
-/* Returns the first child with the name child_name and the "lang"
- * attribute that matches the current LC_MESSAGES, or else, the first
- * child with the name child_name and no "lang" attribute.
- */
-xmlNode *
-e_xml_get_child_by_name_by_lang(xmlNode *parent, const xmlChar *child_name, const char *lang)
-{
- xmlNode *child;
- /* This is the default version of the string. */
- xmlNode *C = NULL;
-
- g_return_val_if_fail(parent != NULL, NULL);
- g_return_val_if_fail(child_name != NULL, NULL);
-
- if (lang == NULL)
- lang = setlocale(LC_MESSAGES, NULL);
-
- for (child = parent->childs; child; child = child->next) {
- if ( !xmlStrcmp( child->name, child_name ) ) {
- char *this_lang = xmlGetProp(child, "lang");
- if ( this_lang == NULL ) {
- C = child;
- }
- else if (!strcmp(this_lang, "lang"))
- return child;
- }
- }
- return C;
-}
-
-int
-e_xml_get_integer_prop_by_name(xmlNode *parent, const xmlChar *prop_name)
-{
- xmlChar *prop;
- int ret_val = 0;
-
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- prop = xmlGetProp(parent, prop_name);
- if (prop) {
- ret_val = atoi(prop);
- xmlFree(prop);
- }
- return ret_val;
-}
-
-void
-e_xml_set_integer_prop_by_name(xmlNode *parent, const xmlChar *prop_name, int value)
-{
- xmlChar *valuestr;
-
- g_return_if_fail (parent != NULL);
- g_return_if_fail (prop_name != NULL);
-
- valuestr = g_strdup_printf("%d", value);
- xmlSetProp(parent, prop_name, valuestr);
- g_free (valuestr);
-}
-
-
diff --git a/e-util/e-xml-utils.h b/e-util/e-xml-utils.h
deleted file mode 100644
index 41b0f0b9d6..0000000000
--- a/e-util/e-xml-utils.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-xml-utils.h
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __E_XML_UTILS__
-#define __E_XML_UTILS__
-
-#include <gnome.h>
-#include <gnome-xml/tree.h>
-
-xmlNode *e_xml_get_child_by_name(xmlNode *parent, const xmlChar *child_name);
-/* lang set to NULL means use the current locale. */
-xmlNode *e_xml_get_child_by_name_by_lang(xmlNode *parent, const xmlChar *child_name, const char *lang);
-int e_xml_get_integer_prop_by_name(xmlNode *parent, const xmlChar *prop_name);
-void e_xml_set_integer_prop_by_name(xmlNode *parent, const xmlChar *prop_name, int value);
-
-#endif /* __E_XML_UTILS__ */
diff --git a/e-util/e-xml-utils.h-82548 b/e-util/e-xml-utils.h-82548
deleted file mode 100644
index 41b0f0b9d6..0000000000
--- a/e-util/e-xml-utils.h-82548
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-xml-utils.h
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __E_XML_UTILS__
-#define __E_XML_UTILS__
-
-#include <gnome.h>
-#include <gnome-xml/tree.h>
-
-xmlNode *e_xml_get_child_by_name(xmlNode *parent, const xmlChar *child_name);
-/* lang set to NULL means use the current locale. */
-xmlNode *e_xml_get_child_by_name_by_lang(xmlNode *parent, const xmlChar *child_name, const char *lang);
-int e_xml_get_integer_prop_by_name(xmlNode *parent, const xmlChar *prop_name);
-void e_xml_set_integer_prop_by_name(xmlNode *parent, const xmlChar *prop_name, int value);
-
-#endif /* __E_XML_UTILS__ */
diff --git a/e-util/ename/.cvsignore b/e-util/ename/.cvsignore
deleted file mode 100644
index 4f8c173841..0000000000
--- a/e-util/ename/.cvsignore
+++ /dev/null
@@ -1,8 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-*.la
-test-ename-western
-test-ename-western-gtk
diff --git a/e-util/ename/Makefile.am b/e-util/ename/Makefile.am
deleted file mode 100644
index 25a67a929c..0000000000
--- a/e-util/ename/Makefile.am
+++ /dev/null
@@ -1,50 +0,0 @@
-INCLUDES = \
- -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DG_LOG_DOMAIN=\"EName\" \
- -I$(srcdir) \
- -I$(srcdir)/.. \
- -I$(top_srcdir) \
- -I. \
- -I.. \
- -I$(top_builddir) \
- -I$(includedir) \
- $(GNOME_INCLUDEDIR)
-
-gnome_libs = \
- $(BONOBO_GNOME_LIBS) \
- $(INTLLIBS)
-
-ename_libs = \
- libename.la \
- $(gnome_libs)
-
-lib_LTLIBRARIES = libename.la
-
-libename_la_SOURCES = \
- e-name-western.c
-
-libenameincludedir = $(includedir)/ename
-
-libenameinclude_HEADERS = \
- e-name-western-tables.h \
- e-name-western.h
-
-
-noinst_LTLIBRARIES = libename-static.la
-libename_static_la_SOURCES = $(libename_la_SOURCES)
-libename_static_la_LDFLAGS = --all-static
-
-
-noinst_PROGRAMS = \
- test-ename-western \
- test-ename-western-gtk
-
-test_ename_western_SOURCES = \
- test-ename-western.c
-
-test_ename_western_LDADD = $(ename_libs)
-
-test_ename_western_gtk_SOURCES = \
- test-ename-western-gtk.c
-
-test_ename_western_gtk_LDADD = $(ename_libs) $(gnome_libs)
diff --git a/e-util/ename/TODO b/e-util/ename/TODO
deleted file mode 100644
index 669661eea7..0000000000
--- a/e-util/ename/TODO
+++ /dev/null
@@ -1,2 +0,0 @@
-* Support other naming systems.
-* Handle misspelled suffixes better.
diff --git a/e-util/ename/e-name-western-tables.h b/e-util/ename/e-name-western-tables.h
deleted file mode 100644
index bb29cc5292..0000000000
--- a/e-util/ename/e-name-western-tables.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef __E_NAME_WESTERN_TABLES_H__
-#define __E_NAME_WESTERN_TABLES_H__
-
-char *e_name_western_pfx_table[] = {
-
- /*
- * English.
- */
- "mister", "miss.", "mr.", "mrs.", "ms.",
- "miss", "mr", "mrs", "ms", "sir",
- "professor", "prof.", "dr", "dr.", "doctor",
- "reverend", "president", "judge", "senator",
- "congressman", "congresswoman", "commander",
- "lieutenant", "colonel", "major", "general",
-
- "the honorable", "the reverend", "his holiness",
- "his eminence",
-
-
- /*
- * French.
- */
- "monsieur", "mr.", "mademoiselle", "melle.",
- "madame", "mme.", "professeur",
-
- /*
- * Spanish.
- */
- "senor", "senora", "senorita",
-
- NULL};
-
-char *e_name_western_sfx_table[] = {
-
- /*
- * English.
- */
- "junior", "senior", "jr", "sr", "I", "II", "III", "IV", "V",
- "phd", "ms", "md", "esq", "esq.", "esquire",
-
- NULL};
-
-char *e_name_western_twopart_sfx_table[] = {
-
- /*
- * English.
- */
- "the first", "the second", "the third",
-
- NULL};
-
-char *e_name_western_complex_last_table[] = {"van", "von", "de", NULL};
-
-#endif /* ! __E_NAME_WESTERN_TABLES_H__ */
diff --git a/e-util/ename/e-name-western.c b/e-util/ename/e-name-western.c
deleted file mode 100644
index 698cceec0b..0000000000
--- a/e-util/ename/e-name-western.c
+++ /dev/null
@@ -1,868 +0,0 @@
-/*
- * A simple Western name parser.
- *
- * <Nat> Jamie, do you know anything about name parsing?
- * <jwz> Are you going down that rat hole? Bring a flashlight.
- *
- * Author:
- * Nat Friedman (nat@helixcode.com)
- *
- * Copyright 1999, Helix Code, Inc.
- */
-
-#include <ctype.h>
-#include <string.h>
-#include <glib.h>
-
-#include <ename/e-name-western.h>
-#include <ename/e-name-western-tables.h>
-
-typedef struct {
- int prefix_idx;
- int first_idx;
- int middle_idx;
- int nick_idx;
- int last_idx;
- int suffix_idx;
-} ENameWesternIdxs;
-
-static int
-e_name_western_str_count_words (char *str)
-{
- int word_count;
- char *p;
-
- word_count = 0;
-
- for (p = str; p != NULL; p = strchr (p, ' ')) {
- word_count ++;
- p ++;
- }
-
- return word_count;
-}
-
-static void
-e_name_western_cleanup_string (char **str)
-{
- char *newstr;
- char *p;
-
- if (*str == NULL)
- return;
-
- /* skip any spaces and commas at the start of the string */
- p = *str;
- while (isspace (*p) || *p == ',')
- p ++;
-
- /* make the copy we're going to return */
- newstr = g_strdup (p);
-
- if ( strlen(newstr) > 0) {
- /* now search from the back, skipping over any spaces and commas */
- p = newstr + strlen (newstr) - 1;
- while (isspace (*p) || *p == ',')
- p --;
- /* advance p to after the character that caused us to exit the
- previous loop, and end the string. */
- if ((! isspace (*p)) && *p != ',')
- p ++;
- *p = '\0';
- }
-
- g_free (*str);
- *str = newstr;
-}
-
-static char *
-e_name_western_get_words_at_idx (char *str, int idx, int num_words)
-{
- char *words;
- char *p;
- int word_count;
- int words_len;
-
- /*
- * Walk to the end of the words.
- */
- word_count = 0;
- p = str + idx;
- while (word_count < num_words && *p != '\0') {
- while (! isspace (*p) && *p != '\0')
- p ++;
-
- while (isspace (*p) && *p != '\0')
- p ++;
-
- word_count ++;
- }
-
- words_len = p - str - idx - 1;
-
- if (*p == '\0')
- words_len ++;
-
- words = g_malloc0 (1 + words_len);
- strncpy (words, str + idx, words_len);
-
- return words;
-}
-
-/*
- * What the fuck is wrong with glib's MAX macro.
- */
-static int
-e_name_western_max (const int a, const int b)
-{
- if (a > b)
- return a;
-
- return b;
-}
-
-static gboolean
-e_name_western_word_is_suffix (char *word)
-{
- int i;
-
- for (i = 0; e_name_western_sfx_table [i] != NULL; i ++) {
- if (g_strcasecmp (word, e_name_western_sfx_table [i]))
- continue;
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static char *
-e_name_western_get_one_prefix_at_str (char *str)
-{
- char *word;
- int i;
-
- /*
- * Check for prefixes from our table.
- */
- for (i = 0; e_name_western_pfx_table [i] != NULL; i ++) {
- int pfx_words;
- char *words;
-
- pfx_words = e_name_western_str_count_words (e_name_western_pfx_table [i]);
- words = e_name_western_get_words_at_idx (str, 0, pfx_words);
-
- if (! g_strcasecmp (words, e_name_western_pfx_table [i]))
- return words;
-
- g_free (words);
- }
-
- /*
- * Check for prefixes we don't know about. These are always a
- * sequence of more than one letters followed by a period.
- */
- word = e_name_western_get_words_at_idx (str, 0, 1);
-
- if (strlen (word) > 2 && isalpha (word [0]) && isalpha (word [1]) &&
- word [strlen (word) - 1] == '.')
- return word;
-
- g_free (word);
-
- return NULL;
-}
-
-static char *
-e_name_western_get_prefix_at_str (char *str)
-{
- char *pfx;
- char *pfx1;
- char *pfx2;
- char *p;
-
- /* Get the first prefix. */
- pfx1 = e_name_western_get_one_prefix_at_str (str);
-
- if (pfx1 == NULL)
- return NULL;
-
- /* Check for a second prefix. */
- p = str + strlen (pfx1);
- while (isspace (*p) && *p != '\0')
- p ++;
-
- pfx2 = e_name_western_get_one_prefix_at_str (p);
-
- if (pfx2 != NULL) {
- int pfx_len;
-
- pfx_len = (p + strlen (pfx2)) - str;
- pfx = g_malloc0 (pfx_len + 1);
- strncpy (pfx, str, pfx_len);
- } else {
- pfx = g_strdup (pfx1);
- }
-
- g_free (pfx1);
- g_free (pfx2);
-
- return pfx;
-}
-
-static void
-e_name_western_extract_prefix (ENameWestern *name, ENameWesternIdxs *idxs)
-{
- char *pfx;
-
- pfx = e_name_western_get_prefix_at_str (name->full);
-
- if (pfx == NULL)
- return;
-
- idxs->prefix_idx = 0;
- name->prefix = pfx;
-}
-
-static gboolean
-e_name_western_is_complex_last_beginning (char *word)
-{
- int i;
-
- for (i = 0; e_name_western_complex_last_table [i] != NULL; i ++) {
-
- if (! g_strcasecmp (
- word, e_name_western_complex_last_table [i]))
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-e_name_western_extract_first (ENameWestern *name, ENameWesternIdxs *idxs)
-{
- /*
- * If there's a prefix, then the first name is right after it.
- */
- if (idxs->prefix_idx != -1) {
- int first_idx;
- char *p;
-
- first_idx = idxs->prefix_idx + strlen (name->prefix);
-
- /* Skip past white space. */
- p = name->full + first_idx;
- while (isspace (*p) && *p != '\0')
- p++;
-
- if (*p == '\0')
- return;
-
- idxs->first_idx = p - name->full;
- name->first = e_name_western_get_words_at_idx (
- name->full, idxs->first_idx, 1);
-
- } else {
-
- /*
- * Otherwise, the first name is probably the first string.
- */
- idxs->first_idx = 0;
- name->first = e_name_western_get_words_at_idx (
- name->full, idxs->first_idx, 1);
- }
-
- /*
- * Check that we didn't just assign the beginning of a
- * compound last name to the first name.
- */
- if (name->first != NULL) {
- if (e_name_western_is_complex_last_beginning (name->first)) {
- g_free (name->first);
- name->first = NULL;
- idxs->first_idx = -1;
- }
- }
-}
-
-static void
-e_name_western_extract_middle (ENameWestern *name, ENameWesternIdxs *idxs)
-{
- char *word;
- int middle_idx;
-
- /*
- * Middle names can only exist if you have a first name.
- */
- if (idxs->first_idx == -1)
- return;
-
- middle_idx = idxs->first_idx + strlen (name->first) + 1;
-
- if (middle_idx > strlen (name->full))
- return;
-
- /*
- * Search for the first space (or the terminating \0)
- */
- while (isspace (name->full [middle_idx]) &&
- name->full [middle_idx] != '\0')
- middle_idx ++;
-
- if (name->full [middle_idx] == '\0')
- return;
-
- /*
- * Skip past the nickname, if it's there.
- */
- if (name->full [middle_idx] == '\"') {
- if (idxs->nick_idx == -1)
- return;
-
- middle_idx = idxs->nick_idx + strlen (name->nick) + 1;
-
- while (isspace (name->full [middle_idx]) &&
- name->full [middle_idx] != '\0')
- middle_idx ++;
-
- if (name->full [middle_idx] == '\0')
- return;
- }
-
- /*
- * Make sure this isn't the beginning of a complex last name.
- */
- word = e_name_western_get_words_at_idx (name->full, middle_idx, 1);
- if (e_name_western_is_complex_last_beginning (word)) {
- g_free (word);
- return;
- }
-
- /*
- * Make sure this isn't a suffix.
- */
- e_name_western_cleanup_string (& word);
- if (e_name_western_word_is_suffix (word)) {
- g_free (word);
- return;
- }
-
- /*
- * Make sure we didn't just grab a cute nickname.
- */
- if (word [0] == '\"') {
- g_free (word);
- return;
- }
-
- idxs->middle_idx = middle_idx;
- name->middle = word;
-}
-
-static void
-e_name_western_extract_nickname (ENameWestern *name, ENameWesternIdxs *idxs)
-{
- int idx;
- int start_idx;
- char *str;
-
- if (idxs->first_idx == -1)
- return;
-
- if (idxs->middle_idx > idxs->first_idx)
- idx = idxs->middle_idx + strlen (name->middle);
- else
- idx = idxs->first_idx + strlen (name->first);
-
- while (name->full [idx] != '\"' && name->full [idx] != '\0')
- idx ++;
-
- if (name->full [idx] != '\"')
- return;
-
- start_idx = idx;
-
- /*
- * Advance to the next double quote.
- */
- idx ++;
-
- while (name->full [idx] != '\"' && name->full [idx] != '\0')
- idx ++;
-
- if (name->full [idx] == '\0')
- return;
-
- str = g_malloc0 (idx - start_idx + 2);
- strncpy (str, name->full + start_idx, idx - start_idx + 1);
-
- name->nick = str;
- idxs->nick_idx = start_idx;
-}
-
-static int
-e_name_western_last_get_max_idx (ENameWestern *name, ENameWesternIdxs *idxs)
-{
- int max_idx = -1;
-
- if (name->prefix != NULL)
- max_idx = e_name_western_max (
- max_idx, idxs->prefix_idx + strlen (name->prefix));
-
- if (name->first != NULL)
- max_idx = e_name_western_max (
- max_idx, idxs->first_idx + strlen (name->first));
-
- if (name->middle != NULL)
- max_idx = e_name_western_max (
- max_idx, idxs->middle_idx + strlen (name->middle));
-
- if (name->nick != NULL)
- max_idx = e_name_western_max (
- max_idx, idxs->nick_idx + strlen (name->nick));
-
- return max_idx;
-}
-
-static void
-e_name_western_extract_last (ENameWestern *name, ENameWesternIdxs *idxs)
-{
- char *word;
- int idx = -1;
-
- idx = e_name_western_last_get_max_idx (name, idxs);
-
- /*
- * In the case where there is no preceding name element, the
- * name is either just a first name ("Nat", "John"), is a
- * single-element name ("Cher", which we treat as a first
- * name), or is just a last name. The only time we can
- * differentiate a last name alone from a single-element name
- * or a first name alone is if it's a complex last name ("de
- * Icaza", "van Josephsen"). So if there is no preceding name
- * element, we check to see whether or not the first part of
- * the name is the beginning of a complex name. If it is,
- * we subsume the entire string. If we accidentally subsume
- * the suffix, this will get fixed in the fixup routine.
- */
- if (idx == -1) {
- word = e_name_western_get_words_at_idx (name->full, 0, 1);
- if (! e_name_western_is_complex_last_beginning (word)) {
- g_free (word);
- return;
- }
-
- name->last = g_strdup (name->full);
- idxs->last_idx = 0;
- return;
- }
-
- /* Skip past the white space. */
- while (isspace (name->full [idx]) && name->full [idx] != '\0')
- idx ++;
-
- if (name->full [idx] == '\0')
- return;
-
- word = e_name_western_get_words_at_idx (name->full, idx, 1);
- e_name_western_cleanup_string (& word);
- if (e_name_western_word_is_suffix (word)) {
- g_free (word);
- return;
- }
- g_free (word);
-
- /*
- * Subsume the rest of the string into the last name. If we
- * accidentally include the prefix, it will get fixed later.
- * This is the only way to handle things like "Miguel de Icaza
- * Amozorrutia" without dropping data and forcing the user
- * to retype it.
- */
- name->last = g_strdup (name->full + idx);
- idxs->last_idx = idx;
-}
-
-static char *
-e_name_western_get_preceding_word (char *str, int idx)
-{
- int word_len;
- char *word;
- char *p;
-
- p = str + idx;
-
- while (isspace (*p) && p > str)
- p --;
-
- while (! isspace (*p) && p > str)
- p --;
-
- if (isspace (*p))
- p ++;
-
- word_len = (str + idx) - p;
- word = g_malloc0 (word_len + 1);
- if (word_len > 0)
- strncpy (word, p, word_len);
-
- return word;
-}
-
-static char *
-e_name_western_get_suffix_at_str_end (char *str)
-{
- char *suffix;
- char *p;
-
- /*
- * Walk backwards till we reach the beginning of the
- * (potentially-comma-separated) list of suffixes.
- */
- p = str + strlen (str);
- while (1) {
- char *nextp;
- char *word;
-
- word = e_name_western_get_preceding_word (str, p - str);
- nextp = p - strlen (word) - 1;
-
- e_name_western_cleanup_string (& word);
-
- if (e_name_western_word_is_suffix (word)) {
- p = nextp;
- g_free (word);
- } else {
- g_free (word);
- break;
- }
- }
-
- if (p == (str + strlen (str)))
- return NULL;
-
- suffix = g_strdup (p);
- e_name_western_cleanup_string (& suffix);
-
- if (strlen (suffix) == 0) {
- g_free (suffix);
- return NULL;
- }
-
- return suffix;
-}
-
-static void
-e_name_western_extract_suffix (ENameWestern *name, ENameWesternIdxs *idxs)
-{
-
- name->suffix = e_name_western_get_suffix_at_str_end (name->full);
-
- if (name->suffix == NULL)
- return;
-
- idxs->suffix_idx = strlen (name->full) - strlen (name->suffix);
-}
-
-static gboolean
-e_name_western_detect_backwards (ENameWestern *name, ENameWesternIdxs *idxs)
-{
- char *comma;
- char *word;
-
- comma = strchr (name->full, ',');
-
- if (comma == NULL)
- return FALSE;
-
- /*
- * If there's a comma, we need to detect whether it's
- * separating the last name from the first or just separating
- * suffixes. So we grab the word which comes before the
- * comma and check if it's a suffix.
- */
- word = e_name_western_get_preceding_word (name->full, comma - name->full);
-
- if (e_name_western_word_is_suffix (word)) {
- g_free (word);
- return FALSE;
- }
-
- g_free (word);
- return TRUE;
-}
-
-static void
-e_name_western_reorder_asshole (ENameWestern *name, ENameWesternIdxs *idxs)
-{
- char *prefix;
- char *last;
- char *suffix;
- char *firstmidnick;
- char *newfull;
-
- char *comma;
- char *p;
-
- if (! e_name_western_detect_backwards (name, idxs))
- return;
-
- /*
- * Convert
- * <Prefix> <Last name>, <First name> <Middle[+nick] name> <Suffix>
- * to
- * <Prefix> <First name> <Middle[+nick] name> <Last name> <Suffix>
- */
-
- /*
- * Grab the prefix from the beginning.
- */
- prefix = e_name_western_get_prefix_at_str (name->full);
-
- /*
- * Everything from the end of the prefix to the comma is the
- * last name.
- */
- comma = strchr (name->full, ',');
- if (comma == NULL)
- return;
-
- p = name->full + (prefix == NULL ? 0 : strlen (prefix));
-
- while (isspace (*p) && *p != '\0')
- p ++;
-
- last = g_malloc0 (comma - p + 1);
- strncpy (last, p, comma - p);
-
- /*
- * Get the suffix off the end.
- */
- suffix = e_name_western_get_suffix_at_str_end (name->full);
-
- /*
- * Firstmidnick is everything from the comma to the beginning
- * of the suffix.
- */
- p = comma + 1;
-
- while (isspace (*p) && *p != '\0')
- p ++;
-
- if (suffix != NULL) {
- char *q;
-
- /*
- * Point q at the beginning of the suffix.
- */
- q = name->full + strlen (name->full) - strlen (suffix) - 1;
-
- /*
- * Walk backwards until we hit the space which
- * separates the suffix from firstmidnick.
- */
- while (! isspace (*q) && q > comma)
- q --;
-
- if ((q - p + 1) > 0) {
- firstmidnick = g_malloc0 (q - p + 1);
- strncpy (firstmidnick, p, q - p);
- } else
- firstmidnick = NULL;
- } else {
- firstmidnick = g_strdup (p);
- }
-
- /*
- * Create our new reordered version of the name.
- */
-#define NULLSTR(a) ((a) == NULL ? "" : (a))
- newfull = g_strdup_printf ("%s %s %s %s", NULLSTR (prefix), NULLSTR (firstmidnick),
- NULLSTR (last), NULLSTR (suffix));
- g_strstrip (newfull);
- g_free (name->full);
- name->full = newfull;
-
-
- g_free (prefix);
- g_free (firstmidnick);
- g_free (last);
- g_free (suffix);
-}
-
-static void
-e_name_western_zap_nil (char **str, int *idx)
-{
- if (*str == NULL)
- return;
-
- if (strlen (*str) != 0)
- return;
-
- *idx = -1;
- g_free (*str);
- *str = NULL;
-}
-
-static void
-e_name_western_fixup (ENameWestern *name, ENameWesternIdxs *idxs)
-{
- /*
- * The middle and last names cannot be the same.
- */
- if (idxs->middle_idx != -1 && idxs->middle_idx == idxs->last_idx) {
- idxs->middle_idx = -1;
- g_free (name->middle);
- name->middle = NULL;
- }
-
- /*
- * If we have a middle name and no last name, then we mistook
- * the last name for the middle name.
- */
- if (idxs->last_idx == -1 && idxs->middle_idx != -1) {
- idxs->last_idx = idxs->middle_idx;
- name->last = name->middle;
- name->middle = NULL;
- idxs->middle_idx = -1;
- }
-
- /*
- * Check to see if we accidentally included the suffix in the
- * last name.
- */
- if (idxs->suffix_idx != -1 && idxs->last_idx != -1 &&
- idxs->suffix_idx < (idxs->last_idx + strlen (name->last))) {
- char *sfx;
-
- sfx = name->last + (idxs->suffix_idx - idxs->last_idx);
- if (sfx != NULL) {
- char *newlast;
- char *p;
-
- p = sfx - 1;
- while (isspace (*p) && p > name->last)
- p --;
- p ++;
-
- newlast = g_malloc0 (p - name->last + 1);
- strncpy (newlast, name->last, p - name->last);
- g_free (name->last);
- name->last = newlast;
- }
- }
-
- /*
- * If we have a prefix and a first name, but no last name,
- * then we need to assign the first name to the last name.
- * This way we get things like "Mr Friedman" correctly.
- */
- if (idxs->first_idx != -1 && idxs->prefix_idx != -1 &&
- idxs->last_idx == -1) {
- name->last = name->first;
- idxs->last_idx = idxs->first_idx;
- idxs->first_idx = -1;
- name->first = NULL;
- }
-
- /*
- * Remove stray spaces and commas (although there don't seem
- * to be any in the test cases, they might show up later).
- */
- e_name_western_cleanup_string (& name->prefix);
- e_name_western_cleanup_string (& name->first);
- e_name_western_cleanup_string (& name->middle);
- e_name_western_cleanup_string (& name->nick);
- e_name_western_cleanup_string (& name->last);
- e_name_western_cleanup_string (& name->suffix);
-
- /*
- * Make zero-length strings just NULL.
- */
- e_name_western_zap_nil (& name->prefix, & idxs->prefix_idx);
- e_name_western_zap_nil (& name->first, & idxs->first_idx);
- e_name_western_zap_nil (& name->middle, & idxs->middle_idx);
- e_name_western_zap_nil (& name->nick, & idxs->nick_idx);
- e_name_western_zap_nil (& name->last, & idxs->last_idx);
- e_name_western_zap_nil (& name->suffix, & idxs->suffix_idx);
-}
-
-/**
- * e_name_western_western_parse_fullname:
- * @full_name: A string containing a Western name.
- *
- * Parses @full_name and returns an #ENameWestern object filled with
- * the component parts of the name.
- */
-ENameWestern *
-e_name_western_parse (const char *full_name)
-{
- ENameWesternIdxs *idxs;
- ENameWestern *wname;
-
- wname = g_new0 (ENameWestern, 1);
-
- wname->full = g_strdup (full_name);
-
- idxs = g_new0 (ENameWesternIdxs, 1);
-
- idxs->prefix_idx = -1;
- idxs->first_idx = -1;
- idxs->middle_idx = -1;
- idxs->nick_idx = -1;
- idxs->last_idx = -1;
- idxs->suffix_idx = -1;
-
- /*
- * An extremely simple algorithm.
- *
- * The goal here is to get it right 95% of the time for
- * Western names.
- *
- * First we check to see if this is an ass-backwards name
- * ("Prefix Last, First Middle Suffix"). These names really
- * suck (imagine "Dr von Johnson, Albert Roderick Jr"), so
- * we reorder them first and then parse them.
- *
- * Next, we grab the most obvious assignments for the various
- * parts of the name. Once this is done, we check for stupid
- * errors and fix them up.
- */
- e_name_western_reorder_asshole (wname, idxs);
-
- e_name_western_extract_prefix (wname, idxs);
- e_name_western_extract_first (wname, idxs);
- e_name_western_extract_nickname (wname, idxs);
- e_name_western_extract_middle (wname, idxs);
- e_name_western_extract_last (wname, idxs);
- e_name_western_extract_suffix (wname, idxs);
-
- e_name_western_fixup (wname, idxs);
-
- g_free (idxs);
-
- return wname;
-}
-
-/**
- * e_name_western_free:
- * @name: An ENameWestern object which needs to be freed.
- *
- * Deep-frees @name
- */
-void
-e_name_western_free (ENameWestern *w)
-{
-
- g_free (w->prefix);
- g_free (w->first);
- g_free (w->middle);
- g_free (w->nick);
- g_free (w->last);
- g_free (w->suffix);
-
- g_free (w->full);
-
- g_free (w);
-}
diff --git a/e-util/ename/e-name-western.h b/e-util/ename/e-name-western.h
deleted file mode 100644
index fa5bac494c..0000000000
--- a/e-util/ename/e-name-western.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef __E_NAME_WESTERN_H__
-#define __E_NAME_WESTERN_H__
-
-typedef struct {
-
- /* Public */
- char *prefix;
- char *first;
- char *middle;
- char *nick;
- char *last;
- char *suffix;
-
- /* Private */
- char *full;
-} ENameWestern;
-
-ENameWestern *e_name_western_parse (const char *full_name);
-void e_name_western_free (ENameWestern *w);
-
-#endif /* ! __E_NAME_WESTERN_H__ */
diff --git a/e-util/ename/test-ename-western-gtk.c b/e-util/ename/test-ename-western-gtk.c
deleted file mode 100644
index 17daf42b30..0000000000
--- a/e-util/ename/test-ename-western-gtk.c
+++ /dev/null
@@ -1,148 +0,0 @@
-#include <gnome.h>
-#include <ename/e-name-western.h>
-
-ENameWestern *name;
-GtkWidget *full;
-GtkWidget *prefix;
-GtkWidget *first;
-GtkWidget *middle;
-GtkWidget *nick;
-GtkWidget *last;
-GtkWidget *suffix;
-
-static void
-fill_entries (void)
-{
-
-#define SET(a,b) (gtk_entry_set_text (GTK_ENTRY (a), (b) == NULL ? "" : (b)))
- SET(prefix, name->prefix);
- SET(first, name->first);
- SET(middle, name->middle);
- SET(nick, name->nick);
- SET(last, name->last);
- SET(suffix, name->suffix);
-}
-
-static void
-full_changed_cb (GtkEntry *fulle)
-{
- e_name_western_free (name);
- name = e_name_western_parse (gtk_entry_get_text (fulle));
- fill_entries ();
-}
-
-static void
-create_window (void)
-{
- GtkWidget *app;
- GtkTable *table;
-
- GtkWidget *prefix_label;
- GtkWidget *first_label;
- GtkWidget *middle_label;
- GtkWidget *nick_label;
- GtkWidget *last_label;
- GtkWidget *suffix_label;
-
- app = gnome_app_new ("test", "Evolution Western Name Parser");
-
- table = GTK_TABLE (gtk_table_new (3, 6, FALSE));
-
- full = gtk_entry_new ();
- prefix = gtk_entry_new ();
- first = gtk_entry_new ();
- middle = gtk_entry_new ();
- nick = gtk_entry_new ();
- last = gtk_entry_new ();
- suffix = gtk_entry_new ();
-
- gtk_widget_set_usize (prefix, 100, 0);
- gtk_widget_set_usize (first, 100, 0);
- gtk_widget_set_usize (middle, 100, 0);
- gtk_widget_set_usize (nick, 100, 0);
- gtk_widget_set_usize (last, 100, 0);
- gtk_widget_set_usize (suffix, 100, 0);
-
- gtk_table_attach (table, full, 0, 6, 0, 1,
- GTK_EXPAND | GTK_FILL, 0,
- 0, 0);
-
- gtk_table_attach (table, prefix, 0, 1, 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0,
- 0, 0);
-
- gtk_table_attach (table, first, 1, 2, 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0,
- 0, 0);
-
- gtk_table_attach (table, middle, 2, 3, 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0,
- 0, 0);
-
- gtk_table_attach (table, nick, 3, 4, 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0,
- 0, 0);
-
- gtk_table_attach (table, last, 4, 5, 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0,
- 0, 0);
-
- gtk_table_attach (table, suffix, 5, 6, 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0,
- 0, 0);
-
- prefix_label = gtk_label_new ("Prefix");
- first_label = gtk_label_new ("First");
- middle_label = gtk_label_new ("Middle");
- nick_label = gtk_label_new ("Nick");
- last_label = gtk_label_new ("Last");
- suffix_label = gtk_label_new ("Suffix");
-
- gtk_table_attach (table, prefix_label, 0, 1, 2, 3,
- GTK_SHRINK, 0,
- 0, 0);
-
- gtk_table_attach (table, first_label, 1, 2, 2, 3,
- GTK_SHRINK, 0,
- 0, 0);
-
- gtk_table_attach (table, middle_label, 2, 3, 2, 3,
- GTK_SHRINK, 0,
- 0, 0);
-
- gtk_table_attach (table, nick_label, 3, 4, 2, 3,
- GTK_SHRINK, 0,
- 0, 0);
-
- gtk_table_attach (table, last_label, 4, 5, 2, 3,
- GTK_SHRINK, 0,
- 0, 0);
-
- gtk_table_attach (table, suffix_label, 5, 6, 2, 3,
- GTK_SHRINK, 0,
- 0, 0);
-
- gnome_app_set_contents (GNOME_APP (app), GTK_WIDGET (table));
-
- gtk_widget_show_all (app);
-
- gtk_entry_set_text (GTK_ENTRY (full),
- "The Honorable Doctor van Jacobsen, Albert Roderick \"The Clenched Fist\" Jr, MD, PhD, Esquire");
-
- name = e_name_western_parse ("The Honorable Doctor van Jacobsen, Albert Roderick \"The Clenched Fist\" Jr, MD, PhD, Esquire");
- fill_entries ();
-
- gtk_signal_connect (GTK_OBJECT (full), "changed", full_changed_cb, NULL);
-}
-
-int
-main (int argc, char **argv)
-{
- gnome_init ("Test EName", "Test EName", argc, argv);
-
- create_window ();
-
- gtk_main ();
-
- return 0;
-}
diff --git a/e-util/ename/test-ename-western.c b/e-util/ename/test-ename-western.c
deleted file mode 100644
index 6d3beaf16f..0000000000
--- a/e-util/ename/test-ename-western.c
+++ /dev/null
@@ -1,70 +0,0 @@
-#include <gnome.h>
-#include <ctype.h>
-
-#include <ename/e-name-western.h>
-
-static void
-do_name (char *n)
-{
- ENameWestern *wname;
-
- wname = e_name_western_parse (n);
-
- printf ("Full Name: [%s]\n", n);
-
- printf ("Prefix: [%s]\n", wname->prefix);
- printf ("First: [%s]\n", wname->first);
- printf ("Middle: [%s]\n", wname->middle);
- printf ("Nick: [%s]\n", wname->nick);
- printf ("Last: [%s]\n", wname->last);
- printf ("Suffix: [%s]\n", wname->suffix);
-
- printf ("\n");
-
- e_name_western_free (wname);
-}
-
-int
-main (int argc, char **argv)
-{
- if (argc == 2) {
- while (! feof (stdin)) {
- char s[256];
-
- if (fgets (s, sizeof (s), stdin) == NULL)
- return 0;
-
- g_strstrip (s);
-
- do_name (s);
- }
-
- return 0;
- }
-
- do_name ("Nat");
- do_name ("Karl Anders Carlsson");
- do_name ("Miguel de Icaza Amozorrutia");
- do_name ("The Honorable Doctor de Icaza, Miguel \"Sparky\" Junior, PhD, MD");
- do_name ("Nat Friedman MD, Phd");
- do_name ("Nat Friedman PhD");
- do_name ("Friedman, Nat");
- do_name ("Miguel de Icaza Esquire");
- do_name ("Dr Miguel \"Sparky\" de Icaza");
- do_name ("Robert H.B. Netzer");
- do_name ("W. Richard Stevens");
- do_name ("Nat Friedman");
- do_name ("N. Friedman");
- do_name ("Miguel de Icaza");
- do_name ("Drew Johnson");
- do_name ("President Bill \"Slick Willy\" Clinton");
- do_name ("The Honorable Mark J. Einstein Jr");
- do_name ("Friedman, Nat");
- do_name ("de Icaza, Miguel");
- do_name ("Mr de Icaza, Miguel");
- do_name ("Smith, John Jr");
- do_name ("Nick Glennie-Smith");
- do_name ("Dr von Johnson, Albert Roderick Jr");
-
- return 0;
-}