aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authornobody <nobody@localhost>2003-12-09 09:57:09 +0800
committernobody <nobody@localhost>2003-12-09 09:57:09 +0800
commita4753c52a1711599bde4fdd7f857a5012e7e8f7f (patch)
tree75bb0caf9afd4b94842023406d6a7938c5d8b2b7 /e-util
parent0031a7166cd0f3fc0cec0b60c468ca22a8c45b0b (diff)
downloadgsoc2013-evolution-GTKHTML_3_1_8.tar.gz
gsoc2013-evolution-GTKHTML_3_1_8.tar.zst
gsoc2013-evolution-GTKHTML_3_1_8.zip
This commit was manufactured by cvs2svn to create tagGTKHTML_3_1_8
'GTKHTML_3_1_8'. svn path=/tags/GTKHTML_3_1_8/; revision=23832
Diffstat (limited to 'e-util')
-rw-r--r--e-util/.cvsignore9
-rw-r--r--e-util/ChangeLog340
-rw-r--r--e-util/ChangeLog.pre-1-42649
-rw-r--r--e-util/Makefile.am117
-rw-r--r--e-util/e-account-list.c472
-rw-r--r--e-util/e-account-list.h75
-rw-r--r--e-util/e-account.c560
-rw-r--r--e-util/e-account.h106
-rw-r--r--e-util/e-bit-array.c429
-rw-r--r--e-util/e-bit-array.h104
-rw-r--r--e-util/e-categories-config.c202
-rw-r--r--e-util/e-categories-config.h34
-rw-r--r--e-util/e-categories-master-list-wombat.c183
-rw-r--r--e-util/e-categories-master-list-wombat.h31
-rw-r--r--e-util/e-component-listener.c171
-rw-r--r--e-util/e-component-listener.h47
-rw-r--r--e-util/e-config-listener.c607
-rw-r--r--e-util/e-config-listener.h80
-rw-r--r--e-util/e-corba-utils.c42
-rw-r--r--e-util/e-corba-utils.h30
-rw-r--r--e-util/e-dialog-utils.c284
-rw-r--r--e-util/e-dialog-utils.h45
-rw-r--r--e-util/e-dialog-widgets.c811
-rw-r--r--e-util/e-dialog-widgets.h60
-rw-r--r--e-util/e-gtk-utils.c216
-rw-r--r--e-util/e-gtk-utils.h49
-rw-r--r--e-util/e-gui-utils.c171
-rw-r--r--e-util/e-gui-utils.h14
-rw-r--r--e-util/e-host-utils.c380
-rw-r--r--e-util/e-host-utils.h38
-rw-r--r--e-util/e-html-utils.c521
-rw-r--r--e-util/e-html-utils.h39
-rw-r--r--e-util/e-i18n.h74
-rw-r--r--e-util/e-iconv.c614
-rw-r--r--e-util/e-iconv.h49
-rw-r--r--e-util/e-iterator.c183
-rw-r--r--e-util/e-iterator.h71
-rw-r--r--e-util/e-lang-utils.c68
-rw-r--r--e-util/e-lang-utils.h31
-rw-r--r--e-util/e-list-iterator.c249
-rw-r--r--e-util/e-list-iterator.h46
-rw-r--r--e-util/e-list.c191
-rw-r--r--e-util/e-list.h71
-rw-r--r--e-util/e-marshal.list51
-rw-r--r--e-util/e-memory.c1306
-rw-r--r--e-util/e-memory.h74
-rw-r--r--e-util/e-meta.c521
-rw-r--r--e-util/e-meta.h60
-rw-r--r--e-util/e-mktemp.c271
-rw-r--r--e-util/e-mktemp.h32
-rw-r--r--e-util/e-msgport.c1041
-rw-r--r--e-util/e-msgport.h88
-rw-r--r--e-util/e-passwords.c594
-rw-r--r--e-util/e-passwords.h59
-rw-r--r--e-util/e-path.c255
-rw-r--r--e-util/e-path.h36
-rw-r--r--e-util/e-pilot-map.c448
-rw-r--r--e-util/e-pilot-map.h58
-rw-r--r--e-util/e-pilot-settings.c150
-rw-r--r--e-util/e-pilot-settings.h73
-rw-r--r--e-util/e-pilot-util.c62
-rw-r--r--e-util/e-pilot-util.h29
-rw-r--r--e-util/e-request.c102
-rw-r--r--e-util/e-request.h33
-rw-r--r--e-util/e-sexp.c1379
-rw-r--r--e-util/e-sexp.h172
-rw-r--r--e-util/e-sorter-array.c259
-rw-r--r--e-util/e-sorter-array.h77
-rw-r--r--e-util/e-sorter.c153
-rw-r--r--e-util/e-sorter.h82
-rw-r--r--e-util/e-text-event-processor-emacs-like.c495
-rw-r--r--e-util/e-text-event-processor-emacs-like.h70
-rw-r--r--e-util/e-text-event-processor-types.h132
-rw-r--r--e-util/e-text-event-processor.c148
-rw-r--r--e-util/e-text-event-processor.h77
-rw-r--r--e-util/e-time-utils.c492
-rw-r--r--e-util/e-time-utils.h58
-rw-r--r--e-util/e-trie.c345
-rw-r--r--e-util/e-trie.h47
-rw-r--r--e-util/e-uid.c61
-rw-r--r--e-util/e-uid.h28
-rw-r--r--e-util/e-url.c341
-rw-r--r--e-util/e-url.h56
-rw-r--r--e-util/e-util-marshal.list2
-rw-r--r--e-util/e-util.c1230
-rw-r--r--e-util/e-util.h231
-rw-r--r--e-util/e-xml-hash-utils.c252
-rw-r--r--e-util/e-xml-hash-utils.h69
-rw-r--r--e-util/e-xml-utils.c502
-rw-r--r--e-util/e-xml-utils.h101
-rw-r--r--e-util/eggtrayicon.c341
-rw-r--r--e-util/eggtrayicon.h76
-rw-r--r--e-util/md5-utils.c363
-rw-r--r--e-util/md5-utils.h52
94 files changed, 0 insertions, 23597 deletions
diff --git a/e-util/.cvsignore b/e-util/.cvsignore
deleted file mode 100644
index cfb049f0e3..0000000000
--- a/e-util/.cvsignore
+++ /dev/null
@@ -1,9 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-*.lo
-*.la
-e-util-marshal.c
-e-util-marshal.h
-test-source-list \ No newline at end of file
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
deleted file mode 100644
index 067996d97c..0000000000
--- a/e-util/ChangeLog
+++ /dev/null
@@ -1,340 +0,0 @@
-2003-12-06 JP Rosevear <jpr@ximian.com>
-
- * Makefile.am: Remove hard coded disable deprecated flags
-
-2003-11-23 JP Rosevear <jpr@ximian.com>
-
- * Makefile.am (INCLUDES): remove gtk deprecated flag
-
-2003-11-18 JP Rosevear <jpr@ximian.com>
-
- * Makefile.am: remove db3 library, if you really want it, get it
- from e-d-s
-
-2003-11-14 JP Rosevear <jpr@ximian.com>
-
- * Makefile.am: don't build the e-source stuff anymore, its in
- e-d-s now
-
-2003-11-14 JP Rosevear <jpr@ximian.com>
-
- * test-source-list.c (on_idle_do_stuff): we only need the uid to
- remove and peek at stuff
-
- * e-source-list.h: update proto types
-
- * e-source-list.c (e_source_list_peek_source_by_uid): allow peek
- by uid only
- (e_source_list_remove_source_by_uid): allow removal by uid only
-
-2003-11-07 Dan Winship <danw@ximian.com>
-
- * ename/*: Removed. No longer used by evolution except via
- evolution-data-server.
-
- * Makefile.am (SUBDIRS): Remove ename
-
-2003-11-07 JP Rosevear <jpr@ximian.com>
-
- * Makefile.am: remove build sources from dist
-
-2003-11-07 JP Rosevear <jpr@ximian.com>
-
- * Makefile.am: make sure the marshal header and source are in the
- source list
-
-2003-10-31 Hans Petter Jansson <hpj@ximian.com>
-
- * e-source.c (e_source_get_uri): Don't compress trailing slashes in
- URI elements.
-
-2003-10-31 Not Zed <NotZed@Ximian.com>
-
- * e-account.c (e_account_(sg)et_from_xml): add encrypt_key id, and
- change some of the names around to be more meaningful.
-
-2003-10-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-host-utils.c (e_gethostbyname_r): If the system defines
- AI_ADDRCONFIG, set this flag on the hints.ai_flags member as well
- so that we don't resolve a host to an IPv6 addr when the node
- doesn't have any IPv6 source addresses.
-
-2003-10-24 Dan Winship <danw@ximian.com>
-
- * Makefile.am (libedb3util_la_LIBADD): add $(DB3_LDADD)
-
-2003-10-22 Dan Winship <danw@ximian.com>
-
- * e-bonobo-factory-util.[ch]: Gone; unused since 1.2
-
- * e-proxy.[ch]: Gone; nothing in evo uses soup any more.
-
- * Makefile.am (eutilinclude_HEADERS, libeutil_la_SOURCES): Remove
- e-proxy.[ch]
-
-2003-10-20 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am (pilot_compile) [! ENABLE_PILOT_CONDUITS]: Add
- md5-utils.c so it compiles even if you have no Pilot support.
-
-2003-10-16 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-source-list.c (e_source_list_sync): use gconf_client_notify_remove
- instead of g_source_remove for GConf notification IDs.
- (impl_finalize): remove the GConf notification also here.
-
-2003-10-13 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-source-group.[ch] (e_source_group_peek_source_by_name): added
- new function.
-
-2003-10-10 Not Zed <NotZed@Ximian.com>
-
- * e-account-list.c (e_account_list_find): add FIND_UID find type.
-
-2003-09-26 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-host-utils.c (e_gethostbyaddr_r): IPv6 implementation
- rewritten to use getnameinfo() which is the proper function to use
- in this case. Fixes bug #46006 the Right Way (tm).
-
-2003-09-25 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-host-utils.c (e_gethostbyaddr_r): Make sure that
- res->ai_canonname is non-NULL and that it doesn't match the
- numeric host address that we were trying to resolve. Fixes the
- second half of bug #46006.
-
-2003-09-19 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-host-utils.c (e_gethostbyaddr_r): Work around a bug in glibc
- 2.3.2's gethostbyaddr_r() implementation.
-
-2003-09-15 Larry Ewing <lewing@ximian.com>
-
- * e-source.c (e_source_dump_to_xml_node): make sure declarations
- precede the body.
-
-2003-09-11 Dan Winship <danw@ximian.com>
-
- * Makefile.am (noinst_LTLIBRARIES): Remove libeutil-static.la and
- libeconduit-static.la
-
- * ename/Makefile.am (noinst_LTLIBRARIES): Remove
- libename-static.la
-
-2003-08-28 Hans Petter Jansson <hpj@ximian.com>
-
- * eggtrayicon.[ch]: Added for tray icon support. To be removed when
- libgnomeui sports this functionality.
-
- * Makefile.am: Include eggtrayicon.
-
-2003-08-27 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-mktemp.c (e_mktemp_cleanup): We need to unlink the full paths
- in the tmpdirs, not just the base path.
-
-2003-08-20 Suresh Chandrasekharan <suresh.chandrasekharan@sun.com>
-
- * e-time-utils.c (parse_with_strptime): Fixes #43558 Appointment
- Editor always gives time validation error for apptmnts in non
- UTF-8/non ASCII locales.
-
-2003-08-17 Ettore Perazzoli <ettore@ximian.com>
-
- * test-source-list.c: No short letter for --key.
-
-2003-08-15 Ettore Perazzoli <ettore@ximian.com>
-
- * e-uid.c: #include <glib/gstrfuncs.h>
-
- * test-source-list.c: Add options to display, set and unset the
- color as well.
-
- * e-source.c: New members has_color, color in struct
- ESourcePrivate.
- (e_source_update_from_xml_node): Parse a color property from the
- XML node. Protect from NULL name and relative_uri members as
- well.
- (e_source_dump_to_xml_node): Set a color property on the XML node.
- (e_source_get_color): New.
- (e_source_set_color): New.
- (e_source_unset_color): New.
- (e_source_new_from_xml_node): Use e_source_update_from_xml_node()
- instead of getting the data from the XML yourself.
-
-2003-08-14 Ettore Perazzoli <ettore@ximian.com>
-
- Add UIDs to ESource* items so we can distinguish renames from
- removals/additions.
-
- * test-source-list.c: Made --source and --group get UIDs instead
- of names.
- (on_idle_do_stuff): Updated behavior accordingly.
- (dump_list): Print "(No items)" if there are no groups.
- (dump_group): Print the UID of the group.
- (dump_source): Print the UID of the source.
-
- * e-source-list.c (load_from_gconf): Match with group UIDs instead
- of group names.
- (e_source_list_peek_source_by_uid): New.
- (e_source_list_peek_source_by_name): Removed.
- (e_source_list_peek_group_by_uid): New.
- (e_source_list_peek_group_by_name): Removed.
- (e_source_list_remove_group_by_uid): New.
- (e_source_list_remove_group_by_name): Removed.
- (e_source_list_remove_source_by_uid): New.
- (e_source_list_remove_source_by_name): Removed.
-
- * e-source-group.c: New member uid in struct ESourceGroupPrivate.
- (impl_finalize): Free it.
- (e_source_group_new): Set the uid member using e_uid_new().
- (e_source_group_peek_source_by_uid): New.
- (e_source_group_peek_source_by_name): Removed.
- (e_source_group_add_source): Check that the UID is unique, instead
- of the name.
- (e_source_group_remove_source_by_uid): New.
- (e_source_group_remove_source_by_name): Removed.
- (e_source_group_update_from_xmldoc): Use the UID to figure out
- which source has changed, instead of the name.
- (e_source_group_uid_from_xmldoc): New.
- (e_source_group_name_from_xmldoc): Removed.
- (e_source_group_new_from_xmldoc): Set the UID in the new group
- from the XML.
- (e_source_group_to_xml): Set a UID property in the XML.
-
- * e-source.c: New member uid in struct ESourcePrivate.
- (e_source_new): Initialize using e_uid_new().
- (impl_finalize): Free.
- (e_source_peek_uid): New.
- (e_source_new_from_xml_node): Set the UID from the XML node.
- (e_source_name_from_xml_node): Removed.
- (e_source_uid_from_xml_node): New.
- (e_source_dump_to_xml_node): Set the "uid" property on the XML
- node.
-
- * e-account.c (e_account_gen_uid): Removed.
- (e_account_new): Use e_uid_new() instead of e_account_gen_uid().
-
- * e-uid.c (e_uid_new): New file, new function.
-
-2003-08-13 Ettore Perazzoli <ettore@ximian.com>
-
- Fix up the semantics of "changed" signals on GConf changes.
-
- * e-source-group.c (e_source_group_update_from_xmldoc): Added new
- member ignore_source_changed in struct _ESourceGroupPrivate.
- (e_source_group_update_from_xmldoc): Increment
- ignore_source_changed before calling
- e_source_update_from_xml_node(), decrement afterwards.
- (source_changed_callback): Only emit "changed" if
- ignore_source_changed is zero.
- (e_source_group_update_from_xmldoc): Properly emit the "changed"
- signal when the base_uri or the name change.
-
- * e-source-list.c: Changed type of sync_idle_id from gboolean (!)
- to int and added new member ignore_group_changed in struct
- _ESourceListPrivate.
- (load_from_gconf): Increment ignore_group_changed before calling
- e_source_group_update_from_xmldoc() and decrement it afterwards.
- (group_changed_callback): Only emit the signal if
- ignore_group_changed is zero.
-
- * e-source.c (e_source_update_from_xml_node): Removed arg
- emit_signals. Always emit signals.
-
- * e-source-group.c (e_source_group_update_from_xmldoc): Removed
- arg emit_signals. Always emit signals.
- (e_source_group_update_from_xml): Likewise.
-
-2003-08-11 Ettore Perazzoli <ettore@ximian.com>
-
- * e-source.c (e_source_set_group): Weak_unref the current group if
- not NULL and properly handle the case where a NULL group is being
- passed in.
-
-2003-08-11 Ettore Perazzoli <ettore@ximian.com>
-
- * e-source-group.c: New file.
- * e-source-group.h: New file.
- * e-source-list.h: New file.
- * e-source-list.c: New file.
- * e-source.c: New file.
- * e-source.h: New file.
- * test-source-list.c: New file to test the above.
-
-2003-08-11 Not Zed <NotZed@Ximian.com>
-
- * e-msgport.c (e_thread_put): check pthread_create return code
- properly.
- (e_mutex_lock): check pthread* return codes properly.
- (e_mutex_unlock): Same here.
- (e_mutex_cond_wait): and here.
-
-2003-08-05 Dan Winship <danw@ximian.com>
-
- * e-html-utils.c (special_chars): add a flag for non-url chars
- (controls, whitespace, ", and |)
- (url_extract): Use that. When urlifying just a hostname, make sure
- it really is a hostname, and not just something like "www.c".
- (e_text_to_html_full): Deal with url_extract returning NULL in the
- "www." case
- (main): add a regression test, #ifdef E_HTML_UTILS_TEST
-
-2003-07-24 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-config-listener.c (add_key): just preload one level of GConf keys,
- since preloading all makes the calendar startup slow.
-
-2003-07-23 Dan Winship <danw@ximian.com>
-
- * Makefile.am: Use EVO_MARSHAL_RULE
-
- * e-component-listener.c (connection_listen_cb): Fix a non-ANSI
- switch label.
-
- * e-gui-utils.c: only include "art/empty.xpm" if
- HAVE_LIBGNOMEUI_GNOME_ICON_LOOKUP_H isn't defined
-
- * e-xml-hash-utils.c (e_xml_to_hash): Deconstify a non-const
- variable to fix a warning.
-
-2003-07-03 JP Rosevear <jpr@ximian.com>
-
- * e-xml-hash-utils.c (foreach_save_func): encode the text
- (e_xml_from_hash): pass xmlDoc to foreach method
- (e_xmlhash_new): check for file existence
- (e_xmlhash_destroy): only destroy the hash if it exists
-
-2003-07-01 Dan Winship <danw@ximian.com>
-
- * e-gui-utils.c (e_icon_for_mime_type): New function to return an
- icon for a MIME type, using GnomeIconTheme if available or
- gnome-vfs and gnome-mime-data if not.
-
-2003-06-19 Dan Winship <danw@ximian.com>
-
- * e-xml-hash-utils.c (e_xml_to_hash): don't leak an extra copy of
- the values
-
-2003-06-14 Larry Ewing <lewing@ximian.com>
-
- * e-name-western.c (e_name_western_get_suffix_at_str_end): free
- word before breaking out of the loop.
-
-2003-06-12 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-config-listener.c (add_key): use GCONF_CLIENT_PRELOAD_RECURSIVE
- when adding watched directories to avoid GConfd round-trips.
-
-2003-06-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-trie.c (e_trie_free): Free the fail_states array.
-
-2003-05-30 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-meta.c (meta_load): Stat the file to make sure it exists
- before trying to parse it using xmlParseFile().
-
diff --git a/e-util/ChangeLog.pre-1-4 b/e-util/ChangeLog.pre-1-4
deleted file mode 100644
index 3cbac0eade..0000000000
--- a/e-util/ChangeLog.pre-1-4
+++ /dev/null
@@ -1,2649 +0,0 @@
-2003-05-29 JP Rosevear <jpr@ximian.com>
-
- Fixes #43775
-
- * e-time-utils.c (locale_supports_12_hour_format): use e_utf8_strftime
- (e_time_format_date_and_time): ditto
- (e_time_format_time): ditto
-
-2003-05-16 Dan Winship <danw@ximian.com>
-
- * e-proxy.c (e_proxy_init): Removing trailing / in key name passed
- to gconf_client_notify_add to kill a warning. (Part of #43159)
-
-2003-05-16 Jeremy Katz <katzj@redhat.com>
-
- * e-sexp.c (term_eval_and): Use glib macros for pointer/int
- conversion.
-
-2003-05-07 Rodrigo Moya <rodrigo@ximian.com>
-
- Fixes crash in #42212
-
- * e-url.c (e_uri_new): check for 'uri_string' being NULL.
-
-2003-05-02 Not Zed <NotZed@Ximian.com>
-
- * e-request.c (e_request_string): remove the assert, if we dont
- understand the response, assume it's a cancel.
- GTK_RESPONSE_DELETE_EVENT wasn't handled [#42038].
-
-2003-04-30 Ettore Perazzoli <ettore@ximian.com>
-
- * e-request.c (e_request_string): Handle GTK_RESPONSE_NONE.
- [#42038]
-
-2003-04-24 Chris Toshok <toshok@ximian.com>
-
- [ for bug #41211 ]
-
- * e-gui-utils.h (e_button_new_with_stock_icon): add prototype.
-
- * e-gui-utils.c (e_button_new_with_stock_icon): new function,
- allow us to create a custom labeled button with a stock icon.
-
-2003-04-28 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-host-utils.c: Added #include <netinet/in.h> for the
- sockaddr_in6 typedef for at least MacOS X.
-
-2003-04-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-host-utils.c (e_gethostbyname_r): Keep our buf ptr aligned to
- sizeof (char *). Should fix bug #41362.
- (e_gethostbyaddr_r): Same.
-
-2003-04-18 Anna Marie Dirks <anna@ximian.com>
-
- * e-request.c (e_request_string): Added appropriate spacing/padding
- to the rename dialogs. Fixes bugs #41040, #41036, #41038
-
-2003-04-18 Ettore Perazzoli <ettore@ximian.com>
-
- * e-gtk-utils.c (e_gtk_button_new_with_icon): Remove debugging
- message.
-
-2003-04-14 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-sexp.c: Finished an #if 0'd out port to GObject from an #if
- 0'd out GtkObject subclassing.
-
-2003-04-15 Hans Petter Jansson <hpj@ximian.com>
-
- * e-sexp.c (e_sexp_add_function)
- (e_sexp_add_ifunction): Make sure any old symbol with the same name
- as the one being added, is removed first.
-
-2003-04-14 Not Zed <NotZed@Ximian.com>
-
- * e-gtk-utils.c (e_gtk_button_new_with_icon): Utility function to
- create a button with a stock icon.
-
-2003-04-09 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-host-utils.c (e_gethostbyaddr_r): Change the 'len' argument to
- 'addrlen' so that when IPv6 is enabled, our temp vriable (also
- named len) does not cause confusion. Fixes bug #40979.
-
-2003-04-05 Ettore Perazzoli <ettore@ximian.com>
-
- * e-passwords.c (e_passwords_remember_password): Removed debugging
- message that would spit out the actual password, albeit in encoded
- form.
-
-2003-04-04 Dan Winship <danw@ximian.com>
-
- * e-account-list.c (gconf_accounts_changed): Don't start emitting
- ACCOUNT_ADDED signals until we've added all of the new accounts to
- our list. Otherwise if the signal handler calls
- e_account_list_get_default_account() it will end up causing the
- first account in the list to become the default. #40675
-
-2003-04-04 Chris Toshok <toshok@ximian.com>
-
- * ename/e-name-western.c (e_name_western_extract_middle): fix abr.
- (e_name_western_get_suffix_at_str_end): same.
-
-2003-04-02 Not Zed <NotZed@Ximian.com>
-
- * e-passwords.c (e_passwords_forget_passwords): Delete all
- Passwords-* sections. Should make this work.
-
-2003-03-31 Chris Toshok <toshok@ximian.com>
-
- * ename/test-ename-western.c (do_name): print "" if the value is
- NULL.
- (main): add a couple of utf8 test cases (that still use western
- orderings).
-
- * ename/e-name-western.c (e_name_western_str_count_words):
- utf8-ize this.
- (e_name_western_cleanup_string): same.
- (e_name_western_get_words_at_idx): same.
- (e_name_western_get_one_prefix_at_str): same.
- (e_name_western_get_prefix_at_str): same.
- (e_name_western_extract_first): same.
- (e_name_western_extract_middle): same.
- (e_name_western_extract_nickname): same.
- (e_name_western_extract_last): same.
- (e_name_western_get_preceding_word): same.
- (e_name_western_get_suffix_at_str_end): same.
- (e_name_western_detect_backwards): same.
- (e_name_western_reorder_asshole): same.
- (FINISH_CHECK_MIDDLE_NAME_FOR_CONJUNCTION): same.
- (e_name_western_fixup): same.
- (e_name_western_parse): validate the string and truncate it if
- need be.
-
-2003-03-27 JP Rosevear <jpr@ximian.com>
-
- * e-account-list.c (e_account_list_find): guard against NULL keys
-
-2003-03-25 Dan Winship <danw@ximian.com>
-
- * e-dialog-utils.c (e_notice): Move this here from gal. Use
- e_dialog_set_transient_for so it DTRT for out-of-proc components.
- (e_notice_with_xid): Like e_notice but with an X Window ID as the
- parent window
- (e_gnome_dialog_set_parent): Remove this, since it was marked
- deprecated and only used in one place.
- (e_file_dialog_save): Make this use GtkMessageDialog instead of
- GnomeDialog
- (e_dialog_set_transient_for_xid): #ifdef out gtk 2.2 api usage
-
-2003-03-25 Not Zed <NotZed@Ximian.com>
-
- * e-meta.c (meta_filename): fix a typo & some missing headers.
-
-2003-03-24 Dan Winship <danw@ximian.com>
-
- * e-dialog-utils.c (e_dialog_set_transient_for,
- e_dialog_set_transient_for_xid): Rename, rewrite, make them
- actually work.
-
-2003-03-25 Not Zed <NotZed@Ximian.com>
-
- * Makefile.am: Added e-meta.[ch] to libeutil
-
- * e-meta.[ch]: simple api to implement meta-data for keyed
- objects.
-
-2003-03-20 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-trie.c (e_trie_search): If the gunichar is 0xfffe, just skip
- processing it. Maybe this will fix bug #39900.
- (trie_utf8_getc): Removed unused labels to shutup the compiler.
-
-2003-03-19 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-sexp.h: Fix ESExpClass to never be an empty struct. Also make
- ESExp optionally a subclass of GObject rather than GtkObject (not
- that we'll probably ever make it so, but for completeness sake?).
-
-2003-03-18 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-trie.c (trie_utf8_getc): Don't use __inline__ as it is not
- always defined.
-
-2003-03-13 Dan Winship <danw@ximian.com>
-
- * ename/e-address-western.c (e_address_western_parse): When
- declaring a line to be part of "extended" because we don't know
- what else to call it, keep the preceding "\n" so that the address
- still looks the same when we reassemble the pieces later. Fixes
- handling of non-US addresses
-
-2003-03-12 Dan Winship <danw@ximian.com>
-
- * e-xml-hash-utils.c (e_xml_to_hash): Update for a libxml2 change
- that was making this code g_warn a lot
-
-2003-03-06 Ettore Perazzoli <ettore@ximian.com>
-
- * e-request.c (e_request_string): Make the entry activate the
- default response in the dialog.
-
-2003-03-03 Rodney Dawes <dobey@ximian.com>
-
- * e-proxy.c: Use gnome2 proxy settings
-
-2003-03-02 Rodney Dawes <dobey@ximian.com>
-
- * e-pilot-util.c: s/gnome-xml/libxml/
-
-2003-02-27 JP Rosevear <jpr@ximian.com>
-
- * Makefile.am: include gnome-pilot cflags
-
-2003-02-23 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-account-list.c (gconf_accounts_changed): 'uid' should not be
- const.
-
-2003-02-20 Not Zed <NotZed@Ximian.com>
-
- * e-account-list.c (e_account_list_get_default): helper to get the
- dfault account.
- (e_account_list_set_default): helper to set the default account.
- (e_account_list_find): Helper to find accounts based on differnet
- key types.
- (e_account_list_add): helper to add account + emit added event.
- (e_account_list_change): helper to emit changed event.
- (e_account_list_remove): herlper to remove account + emit changed event.
-
-2003-02-22 Hans Petter Jansson <hpj@ximian.com>
-
- * e-categories-config.c (e_categories_config_open_dialog_for_entry):
- A result of 0 no longer indicates success; GTK_RESPONSE_OK does.
-
-2003-02-17 Chris Toshok <toshok@ximian.com>
-
- * e-account-list.c (gconf_accounts_changed): fix memleak - free
- uid.
-
-2003-02-11 Not Zed <NotZed@Ximian.com>
-
- * e-trie.c (trie_utf8_getc): Instead of simply ignoring bad chars,
- return the sentinal invalid char 0xfffe, so that we properly track
- the start of sequences.
-
-2003-02-10 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am (libeutil_static_la_DEPENDENCIES): Make
- libeutil-static.la depend on libeutil.la so that parallel
- compilations work; building them at the same time confuses
- libtool.
- (e-util-marshal.h, e-util-marshal.c): Use different tmp files so
- these rules can happen in parallel.
-
-2003-02-05 Dan Winship <danw@ximian.com>
-
- * Makefile.am (eutilincludedir, etc): define in terms of
- privincludedir.
-
- * ename/Makefile.am (libenameincludedir): Likewise
-
- * e-account.c: Fix warnings
- * e-account-list.c: Likewise
- * e-config-listener.c: Likewise
- * e-gui-utils.c: Likewise.
- * e-lang-utils.c: Likewise
- * e-msgport.c: Likewise
- * e-passwords.c: Likewise
-
- * e-categories-config.c
- (e_categories_config_open_dialog_for_entry): Use g_object_get/_set
- rather than gtk_
-
- * e-url.c (e_uri_new): Use g_ascii_strdown instead of deprecated
- g_strdown.
-
-2003-01-27 Ettore Perazzoli <ettore@ximian.com>
-
- * e-request.c (e_request_string): Port to GtkDialog. Strdup the
- text returned by GtkEntry after destroying the dialog, not before.
- Use gtk_editable_select_region() instead of
- gtk_entry_select_region(). Add a little bit of padding to make it
- look less crampy and set a default width.
-
- * e-dialog-utils.h (e_gnome_dialog_set_parent): Declare only if
- GNOME_DISABLE_DEPRECATED is not #defined.
- (e_gnome_warning_dialog_parented): Likewise.
- (e_gnome_ok_cancel_dialog_parented): Likewise.
-
-2003-01-26 Chris Toshok <toshok@ximian.com>
-
- * e-pilot-settings.c (e_pilot_settings_new): ref/sink the pilot
- settings to clear up that gtk warning.
-
-2003-01-25 Chris Toshok <toshok@ximian.com>
-
- * e-pilot-map.c (e_pilot_map_read): g_file_exists -> g_file_test.
- (e_pilot_map_write): don't use doc->root.
-
-2003-01-25 Chris Toshok <toshok@ximian.com>
-
- * e-pilot-settings.[ch]: GObjectify this.
-
-2003-01-24 Hans Petter Jansson <hpj@ximian.com>
-
- * e-categories-config.c (initialize_categories_config): Enable
- getting the categories master list from wombat.
- (e_categories_config_open_dialog_for_entry): It's now a GtkDialog.
-
-2003-01-22 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am (eutilincludedir): Version using $(BASE_VERSION).
- (econdincludedir): Likewise.
- (edb3includedir): Likewise.
- (imagesdir): Likewise.
-
- * ename/Makefile.am: Install libename in $(privlibdir) and
- $(includedir)/evolution-$(BASE_VERSION)/ename.
-
-2003-01-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-account-list.c: Changed signal names to use - instead of _
- like the rest of Gtk2.
-
- * e-account.c (e_account_import): New function that is basically
- the old account_copy().
-
-2003-01-17 Dan Winship <danw@ximian.com>
-
- * e-xml-hash-utils.c: New, sort of from evolution-recurid-branch.
-
-2003-01-16 Dan Winship <danw@ximian.com>
-
- * e-account.c: New class, based on MailConfigAccount, for
- describing an evolution (mail) account.
-
- * e-account-list.c: New class for tracking the list of configured
- accounts. (Also uses some code from mail-config.)
-
- * e-list.c (e_list_construct, e_list_remove): New
-
-2003-01-14 Ettore Perazzoli <ettore@ximian.com>
-
- * e-dialog-utils.c: Do not #include <e-bonobo-widget.h>.
- (e_set_dialog_parent): Remove the BonoboWidget handling stuff (it
- doesn't really work anyways).
-
-2003-01-14 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am (eutilinclude_HEADERS): Add e-dialog-utils.h.
-
-2003-01-09 Chris Toshok <toshok@ximian.com>
-
- * e-gui-utils.c (e_create_image_widget): change this to use
- GtkImage instead of GnomeCanvas.
-
-2003-01-08 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am: Images are now in $(datadir)/evolution/images
- instead of $(datadir)/images/evolution.
-
-2003-01-07 Dan Winship <danw@ximian.com>
-
- * e-config-listener.c (e_config_listener_remove_value): New.
-
- * e-passwords.c (e_passwords_get_password): Don't look at the
- passwords hash until calling e_passwords_init().
-
-2003-01-06 Dan Winship <danw@ximian.com>
-
- * e-html-utils.c: Add this back: Connector needs it, and there's
- no reason for addressbook and calendar to be using camel to get
- this functionality.
-
- * Makefile.am (libeutil_la_SOURCES): re-add e-html-utils
-
-2003-01-02 Jeffrey Stedfast <fejj@ximian.com>
-
- A bunch of fixes to make e-util build with -DG_DISABLE_DEPRECATED
- and -DGTK_DISABLE_DEPRECATED.
-
-2003-01-02 Ettore Perazzoli <ettore@ximian.com>
-
- * e-gtk-utils.c (e_signal_connect_full_while_alive): Get to
- compile.
- (e_signal_connect_while_alive): Like.
-
-2002-12-19 Ettore Perazzoli <ettore@ximian.com>
-
- * e-gtk-utils.c (e_signal_connect_while_alive): New.
- (e_signal_connect_full_while_alive): Renamed from
- e_gtk_signal_connect_full_while_alive().
-
-2002-12-16 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-html-utils.[c,h]: Removed. Back to the fiery depths of hell
- from whence ye came!
-
-2002-12-10 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-config-listener.[ch] (e_config_listener_remove_dir): new
- function.
-
-2002-12-09 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-trie.c: New implementation of an Aho-Corasick trie.
-
-2002-12-09 Chris Toshok <toshok@ximian.com>
-
- * e-passwords.h: track changes to api (e_passwords_init is gone,
- and several functions take the component name as an arg.)
-
- * e-passwords.c (e_passwords_init): make this static, and allow
- multiple calls. Also, it no longer takes the component name.
- (e_passwords_shutdown): make this deal with the case where
- e_passwords_init wasn't called (no hashtable), and it no longer
- needs to free component_name.
- (e_passwords_forget_passwords): call e_passwords_init.
- (e_passwords_clear_component_passwords): take component_name as an
- arg, and call e_passwords_init.
- (password_path): take component_name as an arg.
- (e_passwords_remember_password): same, and call e_passwords_init.
- (e_passwords_forget_password): same.
- (e_passwords_get_password): same.
- (e_passwords_add_password): call e_passwords_init.
- (e_passwords_ask_password): take component_name as an arg.
-
-2002-12-07 Not Zed <NotZed@Ximian.com>
-
- * e-msgport.c (e_mutex_cond_wait): Allow an e-mutex to be used
- with standard condition variables.
-
-2002-12-06 Chris Toshok <toshok@ximian.com>
-
- * e-categories-master-list-wombat.c (ecmlw_load): change to a more
- gconf-like path (with underscores, etc.)
- (ecmlw_save): same.
-
-2002-11-26 Dan Winship <danw@ximian.com>
-
- * e-lang-utils.c (e_get_language_list): If the language is
- something like "fr_FR", return both "fr_FR" and "fr" in the list.
- Oaf doesn't consider "fr_FR" to match a "-fr" translation.
-
-2002-11-22 Not Zed <NotZed@Ximian.com>
-
- * e-msgport.c (EMsgPort): Added an optional nspr pipe field.
- (e_msgport_new): Init nspr pipe to null.
- (e_msgport_destroy): close prfiledesc's if they're open.
- (e_msgport_prfd): get the prfiledesc to wait asynchronously on.
- (e_msgport_put): Write notify to nspr pipe if it exists.
- (e_msgport_wait): poll nspr pipe fd if it is set, and the pipe fd
- isn't.
- (e_msgport_get): skim off a notify byte on the pr pipe if set.
- (): Include config.h, and nspr stuff if HAVE_NSS is set.
-
-2002-11-13 Ettore Perazzoli <ettore@ximian.com>
-
- * e-config-listener.c (e_config_listener_get_string_with_default):
- Make sure we don't use a string value from a GConfValue that got
- freed.
-
-2002-11-12 Chris Toshok <toshok@ximian.com>
-
- * Makefile.am
- (eutilinclude_HEADERS): add e-password.h
- (libeutil_la_SOURCES): add e-password.c
-
- * e-passwords.[ch]: port this to gnome2's gnome-config-private.
-
-2002-11-11 Ettore Perazzoli <ettore@ximian.com>
-
- * e-config-listener.c (add_key): g_strdup() the value in the case
- of a string value.
-
-2002-11-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * Makefile.am: Re-add e-proxy.c to the build.
-
-2002-11-08 Chris Toshok <toshok@ximian.com>
-
- * Makefile.am (eutilinclude_HEADERS): add e-categories-config.h
- and e-categories-master-list-wombat.h
- (libeutil_la_SOURCES): add e-categories-master-list-wombat.c
-
- * e-categories-master-list-wombat.[ch]: port work.
-
-2002-11-07 JP Rosevear <jpr@ximian.com>
-
- * e-categories-config.c (e_categories_config_get_icon_for): pass
- extra pixbuf param
-
- * e-categories-config.h: use G_*_DECLS
-
- * e-dialog-utils.c (save_ok): update g_file_test params
-
- * Makefile.am: Compile some additional files
-
-2002-11-06 Chris Toshok <toshok@ximian.com>
-
- * e-config-listener.c (e_config_listener_set_boolean): init err to
- NULL so if there isn't an error we aren't left with an unitialized
- GError. Fixes crash.
- (e_config_listener_set_float): same.
- (e_config_listener_set_long): same.
- (e_config_listener_set_string): same.
-
-2002-11-05 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-component-listener.[ch]: ported to GObject.
-
- * Makefile.am: re-enabled e-component-listener.[ch]
-
-2002-11-03 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-config-listener.[ch] (e_config_listener_get_boolean,
- e_config_listener_get_float, e_config_listener_get_long,
- e_config_listener_get_string): new simpler functions, without
- a default value.
-
-2002-11-03 Ettore Perazzoli <ettore@ximian.com>
-
- * e-config-listener.c (e_config_listener_get_float_with_default):
- Removed unused variable.
- (e_config_listener_get_long_with_default): Likewise.
- (e_config_listener_get_string_with_default): Likewise.
-
- * Makefile.am: Compile e-config-listener.[ch].
-
-2002-11-02 Chris Toshok <toshok@ximian.com>
-
- * Makefile.am: add marshal building stuff, add e-util-marshal.c to
- SOURCES, and add e-util-marshal.list to EXTRA_DIST.
-
- * e-util-marshal.list: add marshallers for e-util.
-
- * e-list.c: convert to GObject.
-
- * e-list.h: convert to GObject.
-
- * e-iterator.c: convert to GObject.
-
- * e-iterator.h: convert to GObject.
-
- * e-list-iterator.c: convert to GObject.
-
- * e-list-iterator.h: convert to GObject.
-
- * .cvsignore: ignore e-util-marshal.[ch]
-
-2002-11-02 Ettore Perazzoli <ettore@ximian.com>
-
- * ename/Makefile.am (INCLUDES): Removed -I$(includedir).
-
- * ename/test-ename-western-gtk.c: #include
- <libgnomeui/gnome-ui-init.h> instead of <libgnomeui/gnome-init.h>.
- (create_window): Added GTK_SIGNAL_FUNC() cast.
- (main): Use gnome_program_init().
-
- * e-db3-utils.c: Do not #include <libgnome/gnome-defs.h>.
-
- * e-request.c: Do not #include <libgnomeui/gnome-stock.h>.
-
- * e-memory.c (e_memchunk_clean): Replace GSearchFunc with
- GCompareFunc.
-
- * e-iterator.c (e_iterator_class_init): GTK2-ified.
- (ECI_CLASS): Likewise.
-
- * e-html-utils.c: Do not #include <gal/unicode/gunicode.h>.
-
- * e-gui-utils.c: Don't #include <libgnome/gnome-defs.h>.
- (e_create_image_widget): Pass NULL to gdk_pixbuf_new_from_file()
- for the error arg.
-
- * e-corba-utils.h: #include <orbit/orbit.h> instead of
- <orb/orbit.h>.
-
- * Makefile.am: Removed bonobo-factory-util.c,
- bonobo-factory-util.h, e-categories-master-list-wombat.h,
- e-categories-master-list-wombat.c, e-dialog-utils.c,
- e-dialog-utils.h, e-proxy.c e-proxy.h for now.
-
-2002-11-02 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-config-listener.[ch]: ported to GConf and GObject.
-
-2002-11-01 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-config-listener.[ch]:
- * e-component-listener.[ch]: compilation fixes for GNOME 2 porting.
-
-2002-10-24 Rodrigo Moya <rodrigo@ximian.com>
-
- Fixes #32764
-
- * e-config-listener.c (add_key): store the value returned by
- bonobo_event_source_client_add_listener, so that we can remove it
- later, when freeing the key structure.
- (free_key_hash): remove listener.
- (e_config_listener_set_boolean):
- (e_config_listener_set_float):
- (e_config_listener_set_long):
- (e_config_listener_set_string): only set the cache values if there's
- no exception.
- (e_config_listener_destroy): remove all keys before unrefing the db
- component.
-
-2002-10-23 Dan Winship <danw@ximian.com>
-
- * ename/e-name-western.c: Cast chars to unsigned char before
- passing to ctype macros since they are not defined on negative
- numbers. Fixes parsing problems with names with accented
- characters on Solaris. (At least part of #32146)
-
-2002-09-25 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-component-listener.c (ping_component_callback): added a comment
- about the fix for #30918.
-
-2002-09-23 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-component-listener.c (ping_component_callback): gtk_object_ref the
- component listener before emitting the "component_died" signal, since
- in most cases, the component listener will be destroyed in the
- callbacks for that signal.
-
-2002-09-22 Dan Winship <danw@ximian.com>
-
- * e-config-listener.c: Fix some non-ANSI switch statements
-
- * e-path.c: #include <sys/types.h> for OS X
-
-2002-09-11 Chris Toshok <toshok@ximian.com>
-
- [ Fixes #27546 ]
- * ename/e-name-western-tables.h
- (e_name_western_complex_last_table): add "di" to
- e_name_western_complex_last_table.
-
-2002-09-05 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-config-listener.c (e_config_listener_set_boolean,
- e_config_listener_set_float, e_config_listener_set_long,
- e_config_listener_set_string): update the local copy (if we've
- got one) so that we don't return values if asked before getting
- the change notification.
-
-2002-09-04 Dan Winship <danw@ximian.com>
-
- * e-time-utils.c (e_mktime_utc): New. Like mktime(3), but assumes
- the input time is UTC.
- (e_localtime_with_offset): New. Like localtime_r(3), but also
- returns an offset from UTC.
-
-2002-08-29 Dan Winship <danw@ximian.com>
-
- * e-list.c (e_list_destroy): Don't call g_list_foreach with the
- free func if the free func is NULL.
-
-2002-08-28 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-html-utils.c (e_text_to_html_full): Convert file: urls
- too. Fixes bug #29557.
-
- * e-proxy.[c,h] (e_proxy_init): New convenience function to
- initialise the proxy settings for soup to use.
-
-2002-08-27 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-config-listener.c[ch] (e_config_listener_get_float_with_default,
- e_config_listener_set_boolean, e_config_listener_set_float): new
- functions.
- (property_change_cb, add_key): added support for FLOAT values.
- (e_config_listener_set_string): free strings before returning.
-
-2002-08-26 Peter Williams <peterw@ximian.com>
-
- * e-dialog-utils.c (set_transient_for_gdk): If gdk_window_foreign_new
- returned NULL, we're probably screwed, but try to avoid a segfault.
- (Preemptive fix suggested by kmaraas).
-
-2002-08-26 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-config-listener.c (e_config_listener_get_string_with_default):
- call g_strdup in the correct place, or we'll return the internal copy.
-
-2002-08-26 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-config-listener.c (e_config_listener_set_long): only set the key
- if the value is different from what we've already read from the
- database, to avoid extra change notifications.
- (e_config_listener_set_string): likewise.
-
-2002-08-22 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-config-listener.[ch]: added "key_changed" signal to class.
- (property_change_cb): emit "key_changed" signal.
- (e_config_listener_set_long): new function.
- (e_config_listener_get_long_with_default): new function.
-
-2002-08-22 Dan Winship <danw@ximian.com>
-
- * e-path.c (e_path_rmdir): Remove an e_path directory, and its
- parent "subfolders" dir if it's now empty.
-
-2002-08-22 JP Rosevear <jpr@ximian.com>
-
- * e-time-utils.c (e_time_parse_date): if the year was two digits,
- add the current century
-
- Fixes # 17252
-
-2002-08-16 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-config-listener.[ch]: new class for config database access and
- monitoring.
-
- * Makefile.am: added new files.
-
-2002-08-14 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-component-listener.[ch]: new class for controlling a component,
- to detect when it dies.
-
-2002-08-01 Dan Winship <danw@ximian.com>
-
- * e-html-utils.c (is_citation): Remove the logic that assumes
- "Rupert> " is a citation, since it misfires more often than it
- hits.
-
-2002-07-31 Dan Winship <danw@ximian.com>
-
- * e-html-utils.c (is_addr_char, is_trailing_garbage): Don't use
- "isprint(c)" to mean "c >= 32 && c < 128" since it doesn't in most
- locales.
- (is_domain_name_char): new macro for dns-valid characters
- (email_address_extract): Use is_domain_name_char rather than
- is_addr_char for the part after the @.
-
-2002-07-30 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-host-utils.c (e_gethostbyname_r): If the user has enabled IPv6
- support, use getaddrinfo to resolve hostnames and then manually
- fit the result into a struct hostent.
- (e_gethostbyaddr_r): Same.
-
-2002-07-25 Not Zed <NotZed@Ximian.com>
-
- * e-msgport.c (e_dlist_length): Return the actual count, rather
- than always 0!
-
-2002-07-03 Peter Williams <peterw@ximian.com>
-
- * Makefile.am: Install libeutil, libeconduit, and libedb3util and
- their headers.
-
-2002-07-15 Not Zed <NotZed@Ximian.com>
-
- * e-sexp.c (term_eval_caststring): Cast to a string type.
- (term_eval_castint): Cast to an int type.
- (symbols[]): Add to symbol table.
-
-2002-07-09 Dan Winship <danw@ximian.com>
-
- * e-categories-config.c: #include <string.h>
-
-2002-07-02 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-categories-config.c (e_categories_config_get_icon_for): changed to
- return a gboolean (TRUE if the icon is found, FALSE if not).
-
-2002-06-07 Not Zed <NotZed@Ximian.com>
-
- * e-dialog-utils.c (e_gnome_warning_dialog_parented):
- (e_gnome_ok_cancel_dialog_parented): Use connect_while_alive, so
- we're not called after we've quit. See bug #15397.
-
-2002-06-03 Not Zed <NotZed@Ximian.com>
-
- * e-msgport.c (e_msgport_wait): Protect against EINTR (irix?), see
- bug #24086.
-
-2002-05-07 Ettore Perazzoli <ettore@ximian.com>
-
- * e-corba-utils.c (e_safe_corba_string_dup): New.
-
-2002-05-06 Not Zed <NotZed@Ximian.com>
-
- * e-msgport.c (e_thread_destroy): Destroy our mutex too.
- (e_thread_new): Add thread to a new list of all threads.
- (e_thread_destroy): Remove thread from list of all threads.
- (e_thread_busy): New function, returh true if we're busy somewhere
- processing work.
-
-2002-04-19 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-passwords.c (e_passwords_get_password): Don't leak the base64
- encoded password buffer.
-
-2002-04-16 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-host-utils.c (e_gethostbyaddr_r): New wrapper around
- gethostbyaddr_r if the system has it, else a whole new
- implementation.
-
-2002-04-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-sexp.c (parse_value): Handle parsing negative integers.
-
-2002-03-29 JP Rosevear <jpr@ximian.com>
-
- * e-dialog-utils.c (e_file_dialog_save): open a file selection
- dialog with the given title and return the selected file name
- (save_ok): if the ok button is clicked, make sure the file doesn't
- already exist and if it does, see if the user wants to over write
- it
-
- * e-dialog-utils.h: new proto
-
-2002-03-22 Ettore Perazzoli <ettore@ximian.com>
-
- * e-lang-utils.c: New.
- * e-lang-utils.h: New.
-
-2002-03-22 Dan Winship <danw@ximian.com>
-
- * e-request.c (e_request_string): Document the fact that this
- takes two locale charset strings and one UTF8 string and returns a
- UTF8 string. (Huh.)
-
-2002-03-04 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-mktemp.c: #include <string.h> for strcmp.
-
-2002-02-22 Dan Winship <danw@ximian.com>
-
- * e-html-utils.c (e_text_to_html_full): Fix for if the buffer ends
- with an email address (and no newline).
-
-2002-02-09 JP Rosevear <jpr@ximian.com>
-
- * e-pilot-settings.h: add row and column defines
-
-2002-01-27 Ettore Perazzoli <ettore@ximian.com>
-
- * ename/Makefile.am: Use E_NAME_CFLAGS and E_NAME_LIBS.
-
- * Makefile.am: Use E_UTIL_CFLAGS and E_UTIL_LIBS.
-
-2002-01-14 JP Rosevear <jpr@ximian.com>
-
- * Makefile.am: compile new files
-
- * e-pilot-settings.[hc]: beginnings of a general conduit
- configuration gui
-
-2002-01-10 Christopher James Lahey <clahey@ximian.com>
-
- * ename/e-name-western.c (e_name_western_word_is_suffix): Allow
- for a period after suffixes. Fixes Ximian bug #17012.
-
-2002-01-04 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-memory.c (e_memchunk_clean): Prune free'd nodes from our free
- list otherwise we'll end up re-using free'd memory blocks and
- that's not a Good Thing (tm).
-
-2002-01-02 Jeffrey Stedfast <fejj@ximian.com>
-
- * md5-utils.h: Reverted.
-
-2002-01-02 Jeffrey Stedfast <fejj@ximian.com>
-
- * md5-utils.h: Move the struct into md5-utils.c - this is a
- kludgey hack around the fact that NSS also defines
- MD5Context. Besides, this should be a private struct anyway.
-
-2002-01-02 JP Rosevear <jpr@ximian.com>
-
- * e-dialog-utils.c (e_gnome_dialog_set_parent): util function
- moved from mail-callbacks, also destroys the dialog if the parent
- is destroyed
- (e_gnome_warning_dialog_parented): similarly
- (e_gnome_ok_cancel_dialog_parented): ditto
-
- * e-dialog-utils.h: new protos
-
-2001-12-17 JP Rosevear <jpr@ximian.com>
-
- * e-pilot-map.c (e_pilot_map_clear): clear all info from the map
-
- * e-pilot-map.h: add proto
-
-2001-12-10 JP Rosevear <jpr@ximian.com>
-
- * e-pilot-util.c (e_pilot_utf8_to_pchar): use UTF-8 instead of
- UTF8 as the source char set
- (e_pilot_utf8_from_pchar): use UTF-8 instead of UTF8 as the
- destination char set
-
-2001-11-20 Dan Winship <danw@ximian.com>
-
- * e-passwords.c (e_passwords_forget_password): Clear the password
- in bonobo-conf as well. Fixes ximian 14893.
-
-2001-11-13 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am (libeutil_la_LIBADD): Remove `-lc'. It makes the
- mailer do strange things when it calls `fork()', thus breaking
- e.g. mail sending through sendmail.
-
-2001-11-13 JP Rosevear <jpr@ximian.com>
-
- * e-pilot-map.c (real_e_pilot_map_insert): only insert non-0 pids
- into the pid map
- (e_pilot_map_insert): remove and free old keys/values here -
- including possibly orphaned keys
- (e_pilot_map_remove_by_uid): only free things if they should have
- been found
-
-2001-11-13 JP Rosevear <jpr@ximian.com>
-
- * Makefile.am (libeutil_la_LIBADD): Explicitly add -lc
-
-2001-10-30 Damon Chaplin <damon@ximian.com>
-
- * e-time-utils.c (e_time_parse_date): added a 2nd format, with the
- weekday and the date. We need this so we can try to parse DATE values
- in the ECalendarTable.
-
-2001-10-29 Ettore Perazzoli <ettore@ximian.com>
-
- * e-dialog-utils.c (e_set_dialog_parent): Remove a g_warning.
-
-2001-10-29 Christopher James Lahey <clahey@ximian.com>
-
- * ename/e-name-western.c (e_name_western_fixup): Added French
- conjunction.
-
- * e-host-utils.c: Don't define gethost_mutex unless we need it.
-
-2001-10-29 Christopher James Lahey <clahey@ximian.com>
-
- * ename/e-name-western.c: Cleaned this up a bit.
-
-2001-10-29 Christopher James Lahey <clahey@ximian.com>
-
- * ename/e-name-western.c (e_name_western_fixup): Check for
- compound first names here (X & Y). Fixes Ximian bug #13859.
-
-2001-10-28 JP Rosevear <jpr@ximian.com>
-
- * e-pilot-map.c (e_pilot_map_remove_by_pid): make sure to free the
- keys as well
- (e_pilot_map_remove_by_uid): ditto
-
-2001-10-27 JP Rosevear <jpr@ximian.com>
-
- * e-pilot-map.h: update proto
-
- * e-pilot-map.c (e_pilot_map_lookup_pid): touch the nodes if
- indicated and found
- (e_pilot_map_lookup_uid): ditto
-
-2001-10-26 JP Rosevear <jpr@ximian.com>
-
- * e-pilot-map.c (real_e_pilot_map_insert): take an extra param on
- whether to mark touched
- (map_sax_start_element): use above
- (e_pilot_map_insert): ditto
- (e_pilot_map_write): pass in extra info to foreach call
- (map_write_foreach): if we are in touched only mode, write out the
- map only if its been touched
-
- * e-pilot-map.h: add new member
-
-2001-10-26 JP Rosevear <jpr@ximian.com>
-
- * e-pilot-map.c (map_sax_start_element): add archived records
- with pilot id of 0
- (map_write_foreach): use the uid map for writing
- (e_pilot_map_write): write using the uid map
-
-2001-10-26 JP Rosevear <jpr@ximian.com>
-
- * e-pilot-map.c (e_pilot_map_insert): free up old memory first
- (e_pilot_map_destroy): free allocated memory when destroying
-
-2001-10-22 JP Rosevear <jpr@ximian.com>
-
- * e-pilot-map.c (map_set_node_timet): plug leak
-
-2001-10-23 Dan Winship <danw@ximian.com>
-
- * e-html-utils.c (e_text_to_html_full): Change " " to "&nbsp;" at
- start of line.
-
-2001-10-22 Dan Winship <danw@ximian.com>
-
- * e-passwords.c (e_passwords_get_password): Pass a
- CORBA_Environment to bonobo_config_get_string so it doesn't g_warn
- on error. (Since the "error" is most likely just that the password
- isn't cached.)
- (e_passwords_remember_password, e_passwords_get_password,
- e_passwords_add_password): Change "if (foo) { entire function; }"
- to "if (!foo) return;"
-
- * e-html-utils.c (special_chars): Don't allow single quote or
- backtick in email addresses, or pipes following URLs.
-
-2001-10-22 JP Rosevear <jpr@ximian.com>
-
- * e-dbhash.c (e_dbhash_foreach_key): null out DBT memory prior to
- usage (from Edd Dumbill <edd@usefulinc.com>)
-
-2001-10-17 Ettore Perazzoli <ettore@ximian.com>
-
- * e-dialog-utils.c (e_set_dialog_parent_from_xid): New.
-
-2001-10-12 Chris Toshok <toshok@ximian.com>
-
- * e-passwords.h: new parameter to e_passwords_init, and add
- prototype for e_passwords_clear_component_passwords.
-
- * e-passwords.c (e_passwords_init): copy off the component name.
- (e_passwords_shutdown): free/NULL the component name.
- (e_passwords_clear_component_passwords): new function. remove the
- subtree rooted at /Passwords/<ComponentName>.
- (e_passwords_remember_password): use component_name when building
- up the path.
- (e_passwords_get_password): same.
- (e_passwords_add_password): remove/free the currently stored
- session password for this key if there is one, before adding the
- new one.
-
-2001-10-11 Chris Toshok <toshok@ximian.com>
-
- * e-passwords.h: change prototype for e_passwords_get_password.
-
- * e-passwords.c (e_passwords_get_password): remove 'const' from
- return type - the return type is now allocated and must be freed
- by the caller.
-
-2001-10-11 Chris Toshok <toshok@ximian.com>
-
- * e-passwords.c (e_passwords_init): open the bonobo config db for
- our passwords.
- (e_passwords_shutdown): sync and unref the bonobo db, and clear
- out the per session hash.
- (e_passwords_forget_passwords): remove the bonobo config db
- /Passwords path, and free up the session hash (but don't destroy
- it).
- (e_passwords_remember_password): remove the key/value from the
- session hash, after inserting it into the bonobo db.
- (e_passwords_get_password): look up a session password for the
- uri, and if it's not there, consult the bonobo db.
- (e_passwords_ask_password): quiet gcc's warnings, and only consult
- the toggle button state if we actaully created it.
-
-2001-10-09 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-url.c (e_uri_to_string): don't add the host if it's null
-
-2001-10-06 Christopher James Lahey <clahey@ximian.com>
-
- * ename/e-address-western.c (e_address_western_parse): Made this
- refuse to parse more than 2047 characters of address.
-
-2001-10-04 Dan Winship <danw@ximian.com>
-
- * e-passwords.c (e_passwords_add_password): Make this dup the
- strings it's passed.
- (*) Add lots of docs.
-
-2001-10-03 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-url.c (e_uri_new): default protocol to file: if not specified
-
-2001-10-02 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-url.c (e_uri_copy): duplicate also the params member
-
-2001-10-02 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-url.[ch] (e_uri_copy, e_uri_to_string): new functions
-
-2001-10-01 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-url.[ch]: added basic URI management functions
-
- * Makefile.am: added BONOBO flags to make it compile with latest
- Bonobo, which installs headers in a version-based directory
-
-2001-10-01 Dan Winship <danw@ximian.com>
-
- * e-passwords.c (e_passwords_ask_password): New, copied/renamed
- from mailer and gnome-libs.
-
-2001-09-30 Chris Toshok <toshok@ximian.com>
-
- * Makefile.am (libeutil_la_SOURCES): add e-passwords.[ch]
-
-2001-09-30 Chris Toshok <toshok@ximian.com>
-
- * e-passwords.c: copy/rename the mail specific password stuff
- here.
-
- * e-passwords.h: same.
-
-2001-09-28 <NotZed@Ximian.com>
-
- * e-msgport.c (e_msgport_put): Write the pipe notification outside
- the lock. This way if the pipe fills up because of too many
- outstanding request, the queue isn't deadlocked. This only
- happens wiht 4096 outstanding messages, so something is getting
- VERY busy! Fixes #11121.
-
-2001-09-24 Christopher James Lahey <clahey@ximian.com>
-
- * e-categories-master-list-wombat.c (ecmlw_load, ecmlw_save): Make
- the printouts here conditionally compiled out.
-
-2001-09-21 <NotZed@Ximian.com>
-
- * e-msgport.c (e_thread_destroy): Instead of using
- pthread_cancel() which seems to have numerous implementation
- issues, send a special quit message to the subordinate thread.
- (thread_dispatch): When it gets a quit message, well, quit!
-
-2001-09-18 Ettore Perazzoli <ettore@ximian.com>
-
- * e-gtk-utils.c (widget_realize_callback_for_backing_store): Use
- ->bin_window [instead of ->window] if the widget is a GtkLayout.
-
-2001-09-17 Damon Chaplin <damon@ximian.com>
-
- * e-time-utils.c (e_time_parse_date): only use 1 format, so we are
- consistent everywhere. If we support multiple formats we have to
- support that in e_time_parse_date_and_time() which means an explosion
- of different formats. I don't think the alternatives are that useful,
- anyway.
- (e_time_parse_date_and_time): parse everything in one go, to avoid
- i18n problems. Also only use '%p' if the locale has am/pm strings.
- (e_time_parse_time): Only use '%p' if locale has am/pm strings.
-
-2001-09-17 Ettore Perazzoli <ettore@ximian.com>
-
- * e-gtk-utils.c (gtk_radio_button_get_nth_selected): Removed.
- (gtk_radio_button_select_nth): Removed.
- (e_make_widget_backing_stored): New.
-
-2001-09-13 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-mktemp.c (e_mktemp_cleanup): Make sure the dir pointer is
- non-NULL before using it.
-
-2001-09-08 Dan Winship <danw@ximian.com>
-
- * e-html-utils.c (e_text_to_html_full): Fix some broken calls to
- check_size that could result in memory corruption displaying short
- replies.
-
-2001-09-06 Dan Winship <danw@ximian.com>
-
- * e-html-utils.c (e_text_to_html_full): Add E_TEXT_TO_HTML_CITE,
- to prepend "> " to each line.
-
-2001-09-05 Dan Winship <danw@ximian.com>
-
- * e-mktemp.c (get_path): Fix the check for the case when mkdir()
- returns EEXIST to check S_ISDIR on the right structure component.
- Fixes bug #8775.
-
-2001-08-31 Federico Mena Quintero <federico@ximian.com>
-
- * e-time-utils.c (e_time_parse_date_and_time): Added format for
- "7 PM" and equivalents. Fixes bug #7456.
- (e_time_parse_time): Likewise.
-
-2001-08-28 Not Zed <NotZed@Ximian.com>
-
- * e-categories-master-list-wombat.c (ecmlw_load): Dont call
- g_print with a NULL string. See bug #7396.
-
-2001-08-24 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-mktemp.c (get_path): Make more robust.
-
-2001-08-24 Jeffrey Stedfast <fejj@ximian.com>
-
- * Makefile.am: Added e-mktemp.[c,h] to the build.
-
- * e-mktemp.c (e_mktemp): A new wrapper around mktemp so that we
- can keep track of temp files for later cleanup.
- (e_mkstemp): Same but obviously for the mkstemp call.
- (e_mkdtemp): And finally a mkdtemp wrapper.
-
-2001-08-24 Zbigniew Chyla <cyba@gnome.pl>
-
- * Makefile.am (libeutil_la_SOURCES): Added e-unicode-i18n.c and
- e-unicode-i18n.h.
-
- * e-unicode-i18n.[ch]: New files with two extra functions
- (e_utf8_gettext, e_utf8_dgettext) and U_() macro.
- Should be used instead of _() if we need UTF-8 string.
-
-2001-08-23 Zbigniew Chyla <cyba@gnome.pl>
-
- * e-request.c (e_request_string): Modified to accept and return
- UTF-8 string. It's currently used only in
- shell/e-shortcuts-view.c and we need UTF-8 there.
-
-2001-08-20 Damon Chaplin <damon@ximian.com>
-
- * e-time-utils.c (e_time_parse_date): added comments to help
- translators a bit.
-
-2001-08-09 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-categories-config.c (e_categories_config_get_icon_for): return
- when there's no icon associated with the category
-
- * e-categories-config.c: reworked to use the
- ECategoriesMasterListWombat class. Also, load correctly images
- (fixes #6794)
-
-2001-08-09 Federico Mena Quintero <federico@ximian.com>
-
- * e-categories-master-list-wombat.c (ecmlw_destroy): Chain to the
- destroy handler in the parent class!
-
- * e-list-iterator.c (e_list_iterator_destroy): Likewise. Sigh.
-
- * e-list.c (e_list_destroy): Likewise. Double sigh.
-
-2001-08-08 Ettore Perazzoli <ettore@ximian.com>
-
- * e-dialog-utils.h: New.
- * e-dialog-utils.c: New.
-
-2001-08-04 Ettore Perazzoli <ettore@ximian.com>
-
- * e-bonobo-factory-util.c
- (e_bonobo_generic_factory_multi_display_new): New function to
- create a factory that creates separate component instances for
- different displays.
-
-2001-08-03 Christopher James Lahey <clahey@ximian.com>
-
- * e-list-iterator.c (e_list_iterator_next): Made it so that
- e_list_iterator_next goes to the first element if it's set to
- NULL. This makes deleting the first element and then doing
- e_list_iterator_next go to the new first element. Did the analogy
- for e_list_iterator_prev for completeness and consistency's sakes.
- Fixes Ximian bug #6057.
-
-2001-08-01 Christopher James Lahey <clahey@ximian.com>
-
- * e-categories-master-list-wombat.c (ecmlw_load): Fixed the load
- statement here by just using array_from_string.
- (ecmlw_save): Removed the part where we save the icons and colors
- since that's handled in the array_to_string function. Fixes
- Ximian bug #4451.
-
-2001-07-27 JP Rosevear <jpr@ximian.com>
-
- * e-dbhash.c (string_to_dbt): memset everything to 0
- (md5_to_dbt): ditto
-
-2001-07-20 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-categories-config.c (initialize_categories_config): use the 2
- new category icons (16_category_suppliers.png and
- 16_category_time-and-expenses.png)
-
-2001-07-19 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-categories-config.c (initialize_categories_config): use the 2
- new category icons
-
- * Makefile.am: s/imagedir/imagesdir
-
-2001-07-17 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-categories-config.c (initialize_categories_config): generate
- default configuration for icons-per-category the first time. And
- use a global (for this file) Bonobo_ConfigDatabase
-
-2001-07-16 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-categories-config.c (e_categories_config_get_icon_for):
- (e_categories_config_get_icon_file_for):
- (e_categories_config_set_icon_file_for): use GdkPixbuf to load images
-
-2001-07-16 Federico Mena Quintero <federico@ximian.com>
-
- * e-time-utils.c (parse_with_strptime): Generalized function for
- trying a number of strptime() formats on a string.
- (e_time_parse_time): Use parse_with_strptime().
- (e_time_parse_date): New function, analogous to the previous one,
- but uses a number of date formats.
-
-2001-07-12 Federico Mena Quintero <federico@ximian.com>
-
- * e-time-utils.c (e_time_parse_date_and_time): If the string is
- empty, clear the struct tm before returning.
-
-2001-07-12 Jon Trowbridge <trow@ximian.com>
-
- * e-html-utils.c: Added is_addr_char_no_pipes macro, which specifically
- does not consider '|' ("pipe") to be a legal address character.
- (email_address_extract): Use is_addr_char_no_pipes when looking for
- e-mail addresses to turn into HTML links. (Bug #3940)
-
-2001-07-05 Not Zed <NotZed@Ximian.com>
-
- * e-memory.c: Added some malloc check stuff.
-
-2001-07-04 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-categories-master-list-wombat.c (ecmlw_load): load all icons
- and colors for each category
-
- (ecmlw_save): save all icons and categories associated with
- each category
-
- * e-categories-config.c: use BonoboConf to store/retrieve settings,
- and use ECategoriesMasterListWombat when creating a ECategories
- dialog widget
-
-2001-07-02 Christopher James Lahey <clahey@ximian.com>
-
- * Makefile.am (libeutil_la_SOURCES): Added
- e-categories-master-list-wombat.c and
- e-categories-master-list-wombat.h.
- (INCLUDES): Added $(BONOBO_CONF_CFLAGS).
-
- * e-categories-master-list-wombat.c,
- e-categories-master-list-wombat.h: New class implementing a master
- list that stores its state using bonobo-conf.
-
-2001-07-02 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-categories-config.[ch]: new file for a set of functions for
- managing category-related (icons, colors) configuration
-
-2001-07-01 Ettore Perazzoli <ettore@ximian.com>
-
- * e-request.c: New.
- * e-request.h: New.
-
-2001-06-25 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-sexp.c (term_eval_and): When ANDing two bools, don't use a
- bitwise AND.
-
-2001-06-18 Dan Winship <danw@ximian.com>
-
- * Makefile.am: Split e-db3-utils and e-dbhash off into libedb3util
- so eutil won't depend on db3.
-
-2001-06-15 Not Zed <NotZed@Ximian.com>
-
- * e-sexp.c (parse_values): REmove a silly hardcoded term limit,
- oops forgot about that.
-
-2001-06-11 Damon Chaplin <damon@ximian.com>
-
- * e-time-utils.c (e_time_parse_date_and_time): skip any non-digits
- while looking for dates and times. This should fix some translation
- problems. Though there is still a problem with Japanese, where the
- am/pm flag comes before the time so we will skip it incorrectly.
-
-2001-06-10 Damon Chaplin <damon@ximian.com>
-
- * e-time-utils.c (e_time_parse_date_and_time):
- (e_time_parse_time): got rid of '%n' at end of each format string
- for strptime. I don't know how I managed to put them in there.
-
-2001-05-31 Christopher James Lahey <clahey@ximian.com>
-
- * Makefile.am (INCLUDES): Added db3 cflags.
-
- * e-dbhash.c: Made this use db3.
-
- * e-db3-utils.c, e-db3-utils.h: New files with some helper
- functions.
-
-2001-05-27 Dan Winship <danw@ximian.com>
-
- * e-gui-utils.c: Remove e_pixmaps_update (moved to libeshell) so
- libeutil won't depend on bonobo.
-
-2001-05-19 Ettore Perazzoli <ettore@ximian.com>
-
- * e-host-utils.c (e_gethostbyname_r)
- [HAVE_GETHOSTBYNAME_R && GETHOSTBYNAME_R_FIVE_ARGS]: Set `*herr'
- to zero if the function returns a non-NULL pointer to the hostent.
- According to the docs, a returned non-NULL hostent always means
- "no error" no matter what the returned value of `herr' is. [And
- in fact, at least on libc 2.2.3, trying to resolve `localhost'
- sets herr to `HOST_NOT_FOUND' even if the name is resolved
- correctly and the returned hostent is non-NULL.]
-
-2001-05-16 Dan Winship <danw@ximian.com>
-
- * e-html-utils.c (e_text_to_html_full): add
- E_TEXT_TO_HTML_ESCAPE_8BIT to turn non-US-ASCII characters into
- "?"s.
-
-2001-05-14 Jon Trowbridge <trow@ximian.com>
-
- * e-html-utils.c (is_citation): Check for bad utf8.
-
-2001-05-08 Dan Winship <danw@ximian.com>
-
- * e-path.c (e_path_find_folders): Walk a hierarchy using the
- "/subfolders/" convention and call a callback for each folder
- found.
-
-2001-05-01 Dan Winship <danw@ximian.com>
-
- * e-msgport.c (e_mutex_assert_locked): Debugging routine. (Only
- works for recursive mutexes right now.)
-
- * e-html-utils.c (e_text_to_html_full): Don't use g_utf8_next_char
- on text that isn't valid UTF8, since it won't work (and might even
- get into an infinite loop).
-
-2001-04-29 Dan Winship <danw@ximian.com>
-
- * e-html-utils.c (email_address_extract): Make this smarter. Now
- e_text_to_html_full calls it when it sees a '@', and
- email_address_extract deals with scanning both forward and
- backward to find the bounds of the email address. It's still
- fooled by Message-IDs, but there's not a whole lot we can do
- there...
-
-2001-04-26 Dan Winship <danw@ximian.com>
-
- * e-host-utils.c (e_gethostbyname_r): Make the Solaris and
- no-gethostbyname_r implementations behave more like the Linux one.
- Document.
-
- * Makefile.am (INCLUDES): Remove UNICODE_CFLAGS
- (libeutil_la_LIBADD): Change UNICODE_LIBS to GAL_LIBS
-
-2001-04-26 Not Zed <NotZed@Ximian.com>
-
- * e-memory.c (e_poolv_get): Modified to match e_strv_get
- behaviour. Assert on bad cases, and return "" rather than NULL
- for empty/unset strings.
- (e_poolv_new): Simplify the mutex cases, only have a single mutex
- for mempool and hashtable references.
- (e_poolv_set): Simplify mutex code. Fixed a #ifdef orde prob in
- profile stuff. Always copy string to our own memory when we add
- it to the hash, even if we free it; I think this would have led to
- dangling references otherwise.
- (e_poolv_destroy): Renamed from poolv_free, for consistency with
- the rest of the allocators here.
- (e_poolv_set): Add optional refcounting code here, not currently
- enabled/used, but should make proper string collection work
- easily.
- (e_poolv_destroy): Unrefcount the strings here.
- (e_poolv_cpy): Add refcounting code here.
-
- * e-memory.[ch]: Applied Jacob's patches <jacob@ximian.com> for
- 'e-poolv' type, added his name to the authors list.
-
-2001-04-24 Dan Winship <danw@ximian.com>
-
- * e-html-utils.c (check_size): If the buffer is too small, making
- it twice as big does not guarantee it will be big enough. "Duh".
- Also, a bunch of the check_size calls don't seem to be taking
- trailing NULs into account, so add in a +1 here.
-
-2001-04-24 Kjartan Maraas <kmaraas@gnome.org>
-
- * e-gui-utils.c, e-memory, e-msgport.c, e-pilot-map, e-sexp.c:
- Added #include <glib.h> and move corresponding local headers
- to the top to catch missing includes in them. Tip from clahey.
-
-2001-04-24 Chris Toshok <toshok@ximian.com>
-
- * e-host-utils.h: remove prototype for e_gethostbyname_init.
-
- * e-host-utils.c (e_gethostbyname_r): don't dynamically allocate
- anything - store everything in the buffer that's passed in. Also,
- stop using EMutex. Switch to a static GMutex (so we can
- initialize it without having e_gethostbyname_init).
- (e_gethostbyname_init): removed.
-
-2001-04-23 Jon Trowbridge <trow@ximian.com>
-
- * e-html-utils.c (e_text_to_html_full): Removed attempts to use
- Radek's evil <DATA> hacks, which were just causing me
- (and GtkHTML) grief.
-
-2001-04-23 Jon Trowbridge <trow@ximian.com>
-
- * e-host-utils.c: Include glib.h, so that the g_warning in
- e_gethostbyname_r will be treated as a macro and not as an
- unresolved symbol.
-
-2001-04-22 Chris Toshok <toshok@ximian.com>
-
- * Makefile.am (libeutil_la_SOURCES): add e-host-utils.[ch]
-
- * e-host-utils.c: new file, with e_gethostbyname_r.
-
- * e-host-utils.h: new file.
-
-2001-04-19 Dan Winship <danw@ximian.com>
-
- * e-html-utils.c (is_citation): ">From" is not a citation unless
- the previous or following line is a citation.
- (e_text_to_html_full): Update for is_citation change. Also, when
- marking citations, unmangle mbox From-mangling.
-
-2001-04-15 Federico Mena Quintero <federico@ximian.com>
-
- * e-sexp.c (e_sexp_parse): Start parsing the sexp with
- parse_value(), not parse_list(), because we may have immediate
- values (e.g. "#f") as the whole sexp.
-
-2001-04-08 JP Rosevear <jpr@ximian.com>
-
- * Makefile.am: Setup up the conduit library building better so the
- files get disted
-
-2001-04-06 Federico Mena Quintero <federico@ximian.com>
-
- * e-sexp.c (scanner_config): Added a question mark to the set of
- valid characters for symbol names.
- (parse_value): Fixed parsing of boolean values.
- (parse_term_free): Added missing clause for ESEXP_TERM_BOOL.
-
-2001-04-04 Kjartan Maraas <kmaraas@gnome.org>
-
- * ename/test-ename-western-gtk.c: Fix headers.
-
-2001-04-03 Federico Mena Quintero <federico@ximian.com>
-
- * e-sexp.h (ESExpResultType): Added ESEXP_RES_TIME for time
- values.
- (ESExpResult): Added a "time_t value.time" field.
- (ESExpTermType): Added ESEXP_TERM_TIME.
- (ESExpTerm): Added a "time_t value.time" field.
-
- * e-sexp.c (e_sexp_result_free): Deal with time values. Also, be
- more paranoid; added a default clause with g_assert_not_reached().
- (term_eval_lt): Deal with time values.
- (term_eval_gt): Likewise.
- (term_eval_eq): Likewise.
- (term_eval_plus): Likewise.
- (term_eval_sub): Likewise.
- (e_sexp_term_eval): Likewise.
- (eval_dump_result): Likewise.
- (parse_dump_term): Likewise.
- (parse_term_free): Likewise.
-
-2001-04-01 Gediminas Paulauskas <menesis@delfi.lt>
-
- * e-gui-utils.h: new type EPixmap, which is used to cache pixmaps for
- bonobo components. use e_pixmaps_update to load icons into ui
- component.
- * e-gui-utils.c: implementation of EPixmap cache, moved here from
- mail/folder-browser-factory.c.
-
-2001-03-31 Jon Trowbridge <trow@ximian.com>
-
- * e-url.c (e_url_shroud): Check that first_colon < last_at,
- to prevent horrible things from happening. Removed spew.
- (e_url_equal): Removed spew.
-
-2001-03-30 Jon Trowbridge <trow@ximian.com>
-
- * e-html-utils.c (e_text_to_html_full): Add support for converting
- e-mail addresses to links.
- (is_email_address): Added. Identifies e-mail addresses.
- (email_address_extract): Added. Extracts a copy of the e-mail
- address from the text.
-
- * e-html-utils.h (E_TEXT_TO_HTML_CONVERT_ADDRESSES): Added.
-
- * e-url.c (e_url_shroud): Added. Copy a url, replacing
- any plaintext passwords with a single *.
- (e_url_equal): Compare two urls, taking into account that
- they may or may not be shrouded.
-
-2001-03-29 Kjartan Maraas <kmaraas@gnome.org>
-
- * e-corba-utils.h: Remove #include <glib.h>
- * e-dialog-widgets.c: Shuffle some headers.
- * e-dialog-widgets.h: Remove #include <libgnomeui/gnome-propertybox.h>
- * e-gtk-utils.c: #include <gtk/gtksignal.h>
- * e-gtk-utils.h: Replace #include <gtk/gtk.h>
- * e-gui-utils.c: Replace #include <gnome.h>
- * e-html-utils.c: Shuffle headers.
- * e-iterator.c: Replace #include <gtk/gtk.h>
- * e-iterator.h: Replace #include <gtk/gtk.h>
- * e-list-iterator.c: Remove #include <gtk/gtk.h>
- * e-list-iterator.h: Replace #include <gtk/gtk.h>
- * e-list.c: Remove #include <gtk/gtk.h>
- * e-list.h: Replace #include <gtk/gtk.h>
- * e-memory.c: #include <string.h> and <stdlib.h>
- * e-msgport.c: Move around some includes. s/%d/%ld/g in a printf()
- call to fix a warning.
- * e-pilot-map.c: #include <string.h>. Replace #include <gnome.h>
- * e-pilot-util.c: Remove #include <gnome.h>
- * e-sexp.c: Remove #include <glib.h>
- * e-sexp.h: Replace #include <gtk/gtk.h>
- * e-time-utils.c: #include <string.h>
- * md5-utils.c: Shuffle headers.
- * test-ename-western-gtk.c: Replace #include <gnome.h>
- * test-ename-western.c: Same here.
-
-2001-03-20 Radek Doulik <rodo@ximian.com>
-
- * e-html-utils.c (e_text_to_html_full): new function, extracted
- from e_text_to_html, added color parameter
-
-2001-03-19 Radek Doulik <rodo@ximian.com>
-
- * e-html-utils.c (e_text_to_html): support mark citation
-
- * e-html-utils.h (E_TEXT_TO_HTML_MARK_CITATION): added
- E_TEXT_TO_HTML_MARK_CITATION
-
-2001-03-18 Damon Chaplin <damon@ximian.com>
-
- * e-time-utils.c (e_time_format_time): added function to format just
- the time.
-
-2001-03-16 Dan Winship <danw@ximian.com>
-
- * e-path.c (e_path_to_physical): Fix a bug noticed by kmaraas
-
-2001-03-15 Dan Winship <danw@ximian.com>
-
- * e-html-utils.c (url_extract): Fix a bit: [mailto:foo] shouldn't
- grab the ']'
-
-2001-03-12 JP Rosevear <jpr@ximian.com>
-
- * Makefile.am: update cflag macros
-
-2001-03-07 Dan Winship <danw@ximian.com>
-
- * e-html-utils.c (url_extract): Fix an off-by-one in the "is this
- for real?" check so that "http:// " won't get URLified
-
-2001-03-04 Damon Chaplin <damon@ximian.com>
-
- * e-time-utils.[hc]: new files to contain functions to parse and
- format dates and times for various calendar widgets.
-
-2001-03-01 Dan Winship <danw@ximian.com>
-
- * e-path.c (e_path_to_physical): New function to turn foo/bar into
- foo/subfolders/bar. The inverse function doesn't exist yet because
- I didn't need it. Also, if the shell were going to use this, we'd
- need a few more tools...
-
- * Makefile.am (libeutil_la_SOURCES): Add e-path.[ch]
-
-2001-03-01 Not Zed <NotZed@Ximian.com>
-
- * e-sexp.c (e_sexp_encode_string): Make it handle a NULL string as
- an empty string.
-
-2001-02-23 Not Zed <NotZed@Ximian.com>
-
- * e-msgport.c (e_thread_destroy): Wait a lot lot longer for
- threads to finish.
- : Turned off some of the debug.
-
-2001-02-08 Not Zed <NotZed@Ximian.com>
-
- * e-memory.c (EMemChunk): Changed to allocate raw blocks for the
- data, and keep track of them with an array, this is so the native
- malloc alignment is not lost at the allocation stage.
-
-2001-01-30 Not Zed <NotZed@Ximian.com>
-
- * e-msgport.c (e_thread_destroy): Turn on joining of cancelled threads.
- (e_msgport_wait): Put a cleanup handler to clear the mp lock if it
- happens in cond_wait, since it will be locked again.
-
-2001-01-29 Not Zed <NotZed@Ximian.com>
-
- * e-msgport.c (e_thread_put): If we have waiting threads, then
- dont start a new one for the NEW case.
- (thread_dispatch): For the NEW case, dont exit, just keep running,
- waiting for a new message to come along.
- (e_thread_destroy): When cleaning up NEW threads, cancel any
- non-busy threads.
-
-2001-01-24 Not Zed <NotZed@Ximian.com>
-
- * e-sexp.h (ESExp): Add chunk allocators.
-
- * e-sexp.c: Removed some redundant debug printfs.
- (e_sexp_term_eval): Dont allocate result till we have it. so we
- can have a fatal error, and not leak it.
- (term_eval_plus): If we have to abort, free our arguments.
- (term_eval_sub): Same.
- (parse_new_term): Renamed to parse_term_new for consistency.
- Fixed callers.
- (e_sexp_result_new): Add the esexp as an argument. Ouch, lots of
- code to change for this. Allocate blocks from an ememchunk.
- Fixed all callers.
- (e_sexp_result_free): Same as above, free blocks from the
- ememchunk. Fixed all callers.
- (parse_term_new):
- (parse_term_free): Similarly, add the esexp to the argument, and
- alloc/free from memchunks. Fixed all local callers.
- (e_sexp_init): Setup the memory chunk allocators.
- (e_sexp_finalise): Destroy memchunk allocators.
-
-2001-01-23 Not Zed <NotZed@Ximian.com>
-
- * e-sexp.c (e_sexp_parse): Setup error return and return error on
- parse error.
- (parse_list): Fail if we have a problem.
- (parse_value): Here too.
- (fatal_error): Fatal error handling function, jumps back to the
- top caller.
- (term_eval_and):
- (e_sexp_term_eval):
- (term_eval_sub):
- (term_eval_plus):
- (term_eval_gt):
- (term_eval_lt):
- (term_eval_or): Fail on error.
- (e_sexp_term_eval): Added a comment about where this can be
- called, which is only from inside e_sexp_eval().
- (e_sexp_eval): Setup setjmp error handler.
- (e_sexp_error): Error accessor function.
-
- * e-sexp.h: Added a longjmp environment to the structure, and an
- error return to parse.
-
-2001-01-22 JP Rosevear <jpr@ximian.com>
-
- * e-dbhash.c (md5_to_dbt): New function, can't use strlen on the md5
- hash because it might have null chars in it.
- (e_dbhash_add): use md5_to_dbt
-
-2001-01-19 JP Rosevear <jpr@ximian.com>
-
- * e-pilot-map.c (e_pilot_map_remove_by_pid): Remove an item by pid
- (e_pilot_map_remove_by_uid): ditto for uid
-
- * e-pilot-map.h: new protos
-
-2001-01-17 Jason Leach <jasonleach@usa.net>
-
- * e-gtk-utils.c (gtk_radio_button_get_nth_selected): New function,
- name describes it well.
- (gtk_radio_button_select_nth): New function.
-
-2001-01-17 Federico Mena Quintero <federico@ximian.com>
-
- * e-dialog-widgets.[ch]: Ximianified.
-
-2001-01-15 JP Roseveaer <jpr@ximian.com>
-
- * e-pilot-util.c (e_pilot_utf8_from_pchar): Dup the string passed
- in, not the temporary string. d'oh.
-
-2001-01-04 Dan Winship <danw@helixcode.com>
-
- * e-msgport.c: #define E_THREAD_NONE as ((pthread_t)~0) and use
- that instead of ~0 throughout. (pthread_t is a pointer type on my
- system, so there are lots of warnings without the cast.)
-
-2000-12-24 Not Zed <NotZed@HelixCode.com>
-
- * Merge from camel-mt-branch.
-
-2000-12-20 JP Rosevear <jpr@helixcode.com>
-
- * e-pilot-util.c (e_pilot_utf8_to_pchar): Check for null strings
- (e_pilot_utf8_from_pchar): ditto
-
-2000-12-19 JP Rosevear <jpr@helixcode.com>
-
- * e-pilot-util.c (e_pilot_utf8_to_pchar): Convert utf8 strings to
- pilot character set
- (e_pilot_utf8_from_pchar): vice versa
-
- * Makefile.am: Conditionally build e-pilot-util.[hc] because
- they depend on pilot-link stuff
-
-2000-12-23 Not Zed <NotZed@HelixCode.com>
-
- * e-msgport.c (e_dlist_length): Util function.
- (e_thread_new): Another new thread primitive. This one is a
- re-usable 'server thread' thingy.
-
-2000-12-21 Not Zed <NotZed@HelixCode.com>
-
- * Makefile.am (libeutil_la_SOURCES): Added msgport stuff.
-
- * e-msgport.[ch]: Some thread primitives. e_dlist, a
- double-linked list (ok, not a thread primitive, but used in ...),
- e_msgport - an asynchronous, non-copying message passing
- rendesvous port, and e_mutex, a portably configurable mutex.
-
-2000-12-19 Not Zed <NotZed@HelixCode.com>
-
- * e-sexp.c: Make the code compile without being a gtk object (the
- old code can still be built as a gtk object if required). Also
- removed some dead code.
- (e_sexp_ref): New function to ref if we're not a gkt object.
- (e_sexp_unref): Same for unref.
-
-2000-12-13 Larry Ewing <lewing@helixcode.com>
-
- * e-html-utils.c (e_text_to_html): make sure we actually make
- enough space for "&nbsp;".
-
-2000-12-08 Federico Mena Quintero <federico@helixcode.com>
-
- * e-dialog-widgets.c (e_dialog_editable_get): Updated
- documentation comment.
-
-2000-12-04 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-corba-utils.h: New.
-
- * e-corba-utils.c: New.
- (e_safe_corba_string): New.
-
-2000-11-30 Not Zed <NotZed@HelixCode.com>
-
- * e-memory.c (e_strv_new): Fix typename of args (for all funcs).
- (e_strv_set_ref): Assert the index is in range.
- (e_strv_set_ref_free): "
- (e_strv_set): "
- (e_strv_get): "
-
-2000-11-29 Not Zed <NotZed@HelixCode.com>
-
- * e-sexp.c (term_eval_lt): Plug a memleak, need to free results
- from term_eval().
- (term_eval_gt):
- (term_eval_eq):
-
-2000-11-27 Not Zed <NotZed@HelixCode.com>
-
- * e-memory.c (e_mempool_new): Added some locking to global data.
- This should make the interfaces mt-safe, although each object is
- only per-thread safe.
-
-2000-11-22 Not Zed <NotZed@HelixCode.com>
-
- * e-memory.c (e_mempool_alloc): If we dont get a big enough chunk
- in the first node, give up. Otherwise we spend too much time
- searching.
- (e_mempool_strdup): Doh, and allocate enough for the terminating
- NUL at that.
- (e_strv_set_ref_free): New function, set a reference to a string
- that is then owned/free'd by the strv.
- (e_strv_destroy): If there are any strings to destroy, free them
- here.
-
-2000-11-21 Not Zed <NotZed@HelixCode.com>
-
- * e-memory.c (e_memchunk_alloc0): New function to allocate a
- zero'd out chunk.
- (e_mempool_strdup): New function to strdup into a mempool.
-
-2000-11-20 Not Zed <NotZed@HelixCode.com>
-
- * e-memory.[ch]: New routines for fast memory management and
- compact string array storage.
-
- * Makefile.am (libeutil_la_SOURCES): Added e-memory.[ch].
-
-2000-11-09 JP Rosevear <jpr@helixcode.com>
-
- * e-dbhash.h: oops thats func not *func
-
- * e-dbhash.c (e_dbhash_foreach_key): Memset the data DBT to 0
-
-2000-11-07 JP Rosevear <jpr@helixcode.com>
-
- * Makefile.am: Build e-dbhash.[hc]
-
- * e-dbhash.[hc]: New routines to manage a db database on disk that
- contains md5 hashed data and indexed by uids. Provides comparison
- functions and such so the caller does not have to do the md5 bits.
-
-200-10-30 Kjartan Maraas <kmaraas@gnome.org>
-
- * e-dialog-widgets.c: #include <string.h> to quench warning.
- * e-sexp.c: #include <stdlib.h> for same reason.
-
-2000-10-27 <jpr@helixcode.com>
-
- * Makefile.am: build md5-utils
-
- * md5-utils.c: Make part of util, get rid of camel stream util
- function include string.h
-
- * md5-utils.h: ditto
-
-2000-10-27 <jpr@helixcode.com>
-
- * e-pilot-map.c (e_pilot_map_lookup_uid): Return null if no
- pnode was found.
-
-2000-10-27 JP Rosevear <jpr@helixcode.com>
-
- * e-pilot-map.c (map_sax_start_element): Get archive field while
- parsing
- (map_write_foreach): Write out archive field
- (e_pilot_map_pid_is_archived): implement
- (e_pilot_map_uid_is_archived): ditto
- (e_pilot_map_insert): Insert new node structures
- (e_pilot_map_lookup_pid): Take into account the list is now
- a list of structures
- (e_pilot_map_lookup_uid): ditto
-
-2000-10-26 Michael Meeks <michael@helixcode.com>
-
- * ename/e-address-western.c (e_address_western_is_postal):
- unsigned chars.
-
- * ename/e-name-western.c (e_name_western_get_one_prefix_at_str):
- cast to unsigned char.
-
-2000-10-25 Dan Winship <danw@helixcode.com>
-
- * e-html-utils.c (e_text_to_html): Deal properly with URLs at the
- end of the buffer. (The old code would append a "&#0;" to the
- text.)
-
-2000-10-23 JP Rosevear <jpr@helixcode.com>
-
- * e-pilot-map.c (e_pilot_map_lookup_pid): Lookup a pid by uid.
- (e_pilot_map_lookup_uid): Lookup a uid by pid.
- Now this is wrapped, we can store archive info internally
-
- * e-pilot-map.h: New accessor prototypes
-
-2000-10-23 Dan Winship <danw@helixcode.com>
-
- * ename/Makefile.am (INCLUDES): Remove unused GNOMELOCALEDIR
- setting.
-
-2000-10-23 JP Rosevear <jpr@helixcode.com>
-
- * e-pilot-map.c: Operate with EPilotMap structure so things are
- abstract to the caller
- (e_pilot_map_pid_is_archived): Infrastructure for marking records
- as archived
- (e_pilot_map_uid_is_archived): ditto
-
- * e-pilot-map.h: Add more to public interface, including EPilotMap
- structure
-
-2000-10-23 JP Rosevear <jpr@helixcode.com>
-
- * e-pilot-map.c: Pilot map functions grabbed from existing conduits
-
- * e-pilot-map.h (e_pilot_map_write): Header
-
-2000-10-18 Dan Winship <danw@helixcode.com>
-
- * e-html-utils.c (e_text_to_html): If unicode_get_utf8 returns -1,
- assume it was actually undeclared iso-8859-1 text.
-
-2000-10-17 Jesse Pavel <jpavel@helixcode.com>
-
- * ename/e-address-western.c: made the routines use the stardard
- e_strstrcase instead of the included function that existed
- earlier.
-
-2000-10-11 Iain Holmes <iain@helixcode.com>
-
- * ename/e-address-western.c (e_address_western_parse): g_strconcat
- needs to be NULL terminated or it goes funny.
-
-Tue Sep 26 16:48:49 2000 Christopher James Lahey <clahey@helixcode.com>
-
- * Makefile.am: Added $(EXTRA_GNOME_CFLAGS).
-
-2000-09-25 Jeffrey Stedfast <fejj@helixcode.com>
-
- * Makefile.am: add ename as a SUBDIR
-
-2000-09-18 Christopher James Lahey <clahey@helixcode.com>
-
- * e-list-iterator.c, e-list.c, e-list.h: Made e_list a bit more
- reentrant. If a iterator gets its data pulled out from under it
- while in a loop, it goes back one so that loops will be able to
- continue.
-
-2000-09-18 Christopher James Lahey <clahey@helixcode.com>
-
- * Makefile.am: Removed all the files moved to gal.
-
- * e-dialog-widgets.c: Fixed the #include lines to deal properly
- with gal.
-
- * e-gui-utils.c, e-gui-utils.h: Removed all of the functionality
- that was moved to gal.
-
- * e-canvas-utils.c, e-canvas-utils.h, e-canvas-vbox.c,
- e-canvas-vbox.h, e-canvas.c, e-canvas.h, e-cursors.c, e-cursors.h,
- e-font.c, e-font.h, e-popup-menu.c, e-popup-menu.h, e-printable.c,
- e-printable.h, e-unicode.c, e-unicode.h, e-util.c, e-util.h,
- e-xml-utils.c, e-xml-utils.h: Moved to gal.
-
-2000-09-13 Christopher James Lahey <clahey@helixcode.com>
-
- * e-font.c: Fixed an uninitialized variable.
-
-2000-09-12 Lauris Kaplinski <lauris@helixcode.com>
-
- * e-unicode.c (e_utf8_to_gtk_string_sized): Use underscores
- for untranslatable characters
- (e_utf8_from_gtk_string_sized): Ditto
-
-2000-09-12 Dan Winship <danw@helixcode.com>
-
- * e-font.c (e_font_from_gdk_font): Change this a bit so that if
- you pass it a bold font, it puts that in font->bold and finds a
- lighter font for font->font (if it can). This is for themes like
- Metal where the default font is bold.
- (find_variants): renamed from find_best_bold
-
-2000-09-11 Dan Winship <danw@helixcode.com>
-
- * e-font.c (find_best_bold): Thou shalt leave space for the
- trailing \0.
-
- * e-util.c (e_strstrcase): The return value should not be
- const. (Well, unless the input was, but you can't know that.)
-
-2000-09-11 Christopher James Lahey <clahey@helixcode.com>
-
- * e-unicode.c, e-unicode.h: Added e_utf8_gtk_editable_get_text and
- e_utf8_gtk_editable_set_text.
-
-2000-09-11 Lauris Kaplinski <lauris@helixcode.com>
-
- * e-font.c: Try to find real bold variant of X font, fall
- to double stroke only if not found
-
-2000-09-10 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-gtk-utils.c: New.
- (e_gtk_signal_connect_full_while_alive): New.
-
- * e-gtk-utils.h: New.
-
-2000-09-08 Lauris Kaplinski <lauris@helixcode.com>
-
- * e-font.c: Use experimental 16-bit font stuff for EFonts
-
-2000-09-08 Dan Winship <danw@helixcode.com>
-
- * e-popup-menu.h: remove consts from the EPopupMenu structure: the
- caller may want to modify its own EPopupMenu before calling
- e_popup_menu_run.
-
-2000-09-07 Lauris Kaplinski <lauris@helixcode.com>
-
- * e-dialog-widgets.c (e_dialog_editable_get): Use UTF-8
- (e_dialog_editable_set): Use UTF-8
-
- * e-font.c (translate_encoding): More encodings
- (e_gdk_font_encoding): Use experimental stuff
-
- * e-unicode.* (e_utf8_gtk_editable_insert_text): New wrapper
-
-2000-09-07 Federico Mena Quintero <federico@helixcode.com>
-
- * e-canvas.c (emit_event): Remove incorrect optimization. Events
- are read-only!
-
-2000-09-04 Lauris Kaplinski <lauris@helixcode.com>
-
- * e-unicode.c: Added new font code, but comment it out now
- * e-font.h, e-font.c: Test code for font analyzing
-
-2000-09-02 Lauris Kaplinski <lauris@helixcode.com>
-
- * e-unicode.h, e-unicode.c: New functions
- e_utf8_gtk_clist_append, e_utf8_gtk_clist_set_text
- e_unicode_init
-
-2000-08-31 Lauris Kaplinski <lauris@helixcode.com>
-
- * e-html-utils.c (e_text_to_html): Use UTF-8
-
- * e-unicode.h:
- * e-unicode.c (g_unichar_to_utf8): glib 1.3 function
- (gdk_keyval_to_unicode): gdk 1.3 function
- (e_utf8_from_gdk_event_key): Use keyval, not string
-
-2000-08-30 Lauris Kaplinski <lauris@helixcode.com>
-
- * e-unicode.h: #define gnome_font_get_size and
- gnome_font_get_width, and gnome_font_lookup_default,
- if compiling with gnome-print 0.20
-
-2000-08-30 Dan Winship <danw@helixcode.com>
-
- * Makefile.am (libeutil_la_LIBADD): make e-util depend on
- libunicode
-
- * e-popup-menu.c (make_item): Use GtkMenuItem rather than
- GtkPixmapMenuItem for items with no pixmaps, so that if the whole
- menu is pixmapless, you don't get a column of blank pixmaps.
-
-2000-08-24 Lauris Kaplinski <lauris@helixcode.com>
-
- * e-unicode.h:
- * e-unicode.c (e_utf8_gtk_menu_item_new_with_label): New wrapper
-
-2000-08-23 Lauris Kaplinski <lauris@helixcode.com>
-
- * e-unicode.h:
- * e-unicode.c (e_utf8_strstrcase): New function
-
-2000-08-23 Federico Mena Quintero <federico@helixcode.com>
-
- * e-dialog-widgets.c (e_dialog_editable_set): Constify.
-
-2000-08-22 Lauris Kaplinski <lauris@helixcode.com>
-
- * e-unicode.h:
- * e-unicode.c: e_utf8_gtk_editable_get_chars
- e_utf8_gtk_entry_get_text
- e_utf8_gtk_entry_set_text
- e_utf8_to_gtk_string: New convenience functions
-
-2000-08-22 Lauris Kaplinski <lauris@helixcode.com>
-
- * e-unicode.h:
- * e-unicode.c: Some convenience functions to deal with Gtk+ and UTF-8
-
- * Makefile.am: Added e-unicode.h, e-unicode.c
-
-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 3f181ddd45..0000000000
--- a/e-util/Makefile.am
+++ /dev/null
@@ -1,117 +0,0 @@
-eutilincludedir = $(privincludedir)/e-util
-econdincludedir = $(privincludedir)/e-conduit
-
-INCLUDES = \
- -I$(top_srcdir) \
- -DEVOLUTION_IMAGES=\""$(imagesdir)"\" \
- -DEVOLUTION_CATEGORY_ICONS=\""$(imagesdir)/categories"\" \
- -DG_LOG_DOMAIN=\"e-utils\" \
- $(GNOME_PILOT_CFLAGS) \
- $(E_UTIL_CFLAGS)
-
-privlib_LTLIBRARIES = libeutil.la libeconduit.la
-
-eutilinclude_HEADERS = \
- e-account-list.h \
- e-account.h \
- e-categories-config.h \
- e-categories-master-list-wombat.h \
- e-component-listener.h \
- e-config-listener.h \
- e-corba-utils.h \
- e-dialog-utils.h \
- e-dialog-widgets.h \
- e-gtk-utils.h \
- e-gui-utils.h \
- e-host-utils.h \
- e-html-utils.h \
- e-iterator.h \
- e-lang-utils.h \
- e-list-iterator.h \
- e-list.h \
- e-memory.h \
- e-meta.h \
- e-mktemp.h \
- e-msgport.h \
- e-passwords.h \
- e-path.h \
- e-request.h \
- e-sexp.h \
- e-time-utils.h \
- e-trie.h \
- e-uid.h \
- e-url.h \
- e-xml-hash-utils.h \
- md5-utils.h
-
-libeutil_la_SOURCES = \
- $(MARSHAL_GENERATED) \
- $(eutilinclude_HEADERS) \
- e-account-list.c \
- e-account.c \
- e-categories-config.c \
- e-categories-master-list-wombat.c \
- e-component-listener.c \
- e-config-listener.c \
- e-corba-utils.c \
- e-dialog-utils.c \
- e-dialog-widgets.c \
- e-gtk-utils.c \
- e-gui-utils.c \
- e-host-utils.c \
- e-html-utils.c \
- e-iterator.c \
- e-lang-utils.c \
- e-list-iterator.c \
- e-list.c \
- e-memory.c \
- e-meta.c \
- e-mktemp.c \
- e-msgport.c \
- e-passwords.c \
- e-path.c \
- e-request.c \
- e-sexp.c \
- e-time-utils.c \
- e-trie.c \
- e-uid.c \
- e-url.c \
- e-xml-hash-utils.c \
- eggtrayicon.c \
- eggtrayicon.h \
- md5-utils.c
-
-MARSHAL_GENERATED = e-util-marshal.c e-util-marshal.h
-@EVO_MARSHAL_RULE@
-
-libeutil_la_LIBADD = $(E_UTIL_LIBS)
-
-econdinclude_HEADERS = \
- e-pilot-map.h \
- e-pilot-settings.h \
- e-pilot-util.h
-
-pilot_sources = \
- $(econdinclude_HEADERS) \
- e-pilot-map.c \
- e-pilot-settings.c \
- e-pilot-util.c
-
-if ENABLE_PILOT_CONDUITS
-pilot_compile = $(pilot_sources)
-else
-pilot_compile = md5-utils.c
-endif
-
-libeconduit_la_SOURCES = $(pilot_compile)
-
-EXTRA_DIST = \
- $(pilot_sources) \
- ChangeLog.pre-1-4 \
- e-util-marshal.list
-
-BUILT_SOURCES = $(MARSHAL_GENERATED)
-CLEANFILES = $(BUILT_SOURCES)
-
-dist-hook:
- cd $(distdir); rm -f $(BUILT_SOURCES) \ No newline at end of file
diff --git a/e-util/e-account-list.c b/e-util/e-account-list.c
deleted file mode 100644
index d0463a810b..0000000000
--- a/e-util/e-account-list.c
+++ /dev/null
@@ -1,472 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2003 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "e-account-list.h"
-#include "e-account.h"
-#include "e-util-marshal.h"
-
-#include <string.h>
-#include <gal/util/e-util.h>
-
-struct EAccountListPrivate {
- GConfClient *gconf;
- guint notify_id;
-};
-
-enum {
- ACCOUNT_ADDED,
- ACCOUNT_CHANGED,
- ACCOUNT_REMOVED,
- LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL] = { 0 };
-
-#define PARENT_TYPE E_TYPE_LIST
-static EListClass *parent_class = NULL;
-
-static void dispose (GObject *);
-static void finalize (GObject *);
-
-static void
-class_init (GObjectClass *object_class)
-{
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- /* virtual method override */
- object_class->dispose = dispose;
- object_class->finalize = finalize;
-
- /* signals */
- signals[ACCOUNT_ADDED] =
- g_signal_new ("account-added",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EAccountListClass, account_added),
- NULL, NULL,
- e_util_marshal_NONE__OBJECT,
- G_TYPE_NONE, 1,
- E_TYPE_ACCOUNT);
- signals[ACCOUNT_CHANGED] =
- g_signal_new ("account-changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EAccountListClass, account_changed),
- NULL, NULL,
- e_util_marshal_NONE__OBJECT,
- G_TYPE_NONE, 1,
- E_TYPE_ACCOUNT);
- signals[ACCOUNT_REMOVED] =
- g_signal_new ("account-removed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EAccountListClass, account_removed),
- NULL, NULL,
- e_util_marshal_NONE__OBJECT,
- G_TYPE_NONE, 1,
- E_TYPE_ACCOUNT);
-}
-
-static void
-init (GObject *object)
-{
- EAccountList *account_list = E_ACCOUNT_LIST (object);
-
- account_list->priv = g_new0 (EAccountListPrivate, 1);
-}
-
-static void
-dispose (GObject *object)
-{
- EAccountList *account_list = E_ACCOUNT_LIST (object);
-
- if (account_list->priv->gconf) {
- if (account_list->priv->notify_id) {
- gconf_client_notify_remove (account_list->priv->gconf,
- account_list->priv->notify_id);
- }
- g_object_unref (account_list->priv->gconf);
- account_list->priv->gconf = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-finalize (GObject *object)
-{
- EAccountList *account_list = E_ACCOUNT_LIST (object);
-
- g_free (account_list->priv);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-E_MAKE_TYPE (e_account_list, "EAccountList", EAccountList, class_init, init, PARENT_TYPE)
-
-
-static void
-gconf_accounts_changed (GConfClient *client, guint cnxn_id,
- GConfEntry *entry, gpointer user_data)
-{
- EAccountList *account_list = user_data;
- GSList *list, *l, *new_accounts = NULL;
- EAccount *account;
- EList *old_accounts;
- EIterator *iter;
- char *uid;
-
- old_accounts = e_list_duplicate (E_LIST (account_list));
-
- list = gconf_client_get_list (client, "/apps/evolution/mail/accounts",
- GCONF_VALUE_STRING, NULL);
- for (l = list; l; l = l->next) {
- uid = e_account_uid_from_xml (l->data);
- if (!uid)
- continue;
-
- /* See if this is an existing account */
- for (iter = e_list_get_iterator (old_accounts);
- e_iterator_is_valid (iter);
- e_iterator_next (iter)) {
- account = (EAccount *)e_iterator_get (iter);
- if (!strcmp (account->uid, uid)) {
- /* The account still exists, so remove
- * it from "old_accounts" and update it.
- */
- e_iterator_delete (iter);
- if (e_account_set_from_xml (account, l->data))
- g_signal_emit (account_list, signals[ACCOUNT_CHANGED], 0, account);
- goto next;
- }
- }
-
- /* Must be a new account */
- account = e_account_new_from_xml (l->data);
- e_list_append (E_LIST (account_list), account);
- new_accounts = g_slist_prepend (new_accounts, account);
-
- next:
- g_free (uid);
- g_object_unref (iter);
- }
-
- /* Now emit signals for each added account. (We do this after
- * adding all of them because otherwise if the signal handler
- * calls e_account_list_get_default_account() it will end up
- * causing the first account in the list to become the
- * default.)
- */
- for (l = new_accounts; l; l = l->next) {
- account = l->data;
- g_signal_emit (account_list, signals[ACCOUNT_ADDED], 0, account);
- g_object_unref (account);
- }
- g_slist_free (new_accounts);
-
- /* Anything left in old_accounts must have been deleted */
- for (iter = e_list_get_iterator (old_accounts);
- e_iterator_is_valid (iter);
- e_iterator_next (iter)) {
- account = (EAccount *)e_iterator_get (iter);
- e_list_remove (E_LIST (account_list), account);
- g_signal_emit (account_list, signals[ACCOUNT_REMOVED], 0, account);
- }
- g_object_unref (iter);
- g_object_unref (old_accounts);
-}
-
-static void *
-copy_func (const void *data, void *closure)
-{
- GObject *object = (GObject *)data;
-
- g_object_ref (object);
- return object;
-}
-
-static void
-free_func (void *data, void *closure)
-{
- g_object_unref (data);
-}
-
-/**
- * e_account_list_new:
- * @gconf: a #GConfClient
- *
- * Reads the list of accounts from @gconf and listens for changes.
- * Will emit %account_added, %account_changed, and %account_removed
- * signals according to notifications from GConf.
- *
- * You can modify the list using e_list_append(), e_list_remove(), and
- * e_iterator_delete(). After adding, removing, or changing accounts,
- * you must call e_account_list_save() to push the changes back to
- * GConf.
- *
- * Return value: the list of accounts
- **/
-EAccountList *
-e_account_list_new (GConfClient *gconf)
-{
- EAccountList *account_list;
-
- g_return_val_if_fail (GCONF_IS_CLIENT (gconf), NULL);
-
- account_list = g_object_new (E_TYPE_ACCOUNT_LIST, NULL);
- e_account_list_construct (account_list, gconf);
-
- return account_list;
-}
-
-void
-e_account_list_construct (EAccountList *account_list, GConfClient *gconf)
-{
- g_return_if_fail (GCONF_IS_CLIENT (gconf));
-
- e_list_construct (E_LIST (account_list), copy_func, free_func, NULL);
- account_list->priv->gconf = gconf;
- g_object_ref (gconf);
-
- gconf_client_add_dir (account_list->priv->gconf,
- "/apps/evolution/mail/accounts",
- GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- account_list->priv->notify_id =
- gconf_client_notify_add (account_list->priv->gconf,
- "/apps/evolution/mail/accounts",
- gconf_accounts_changed, account_list,
- NULL, NULL);
-
- gconf_accounts_changed (account_list->priv->gconf,
- account_list->priv->notify_id,
- NULL, account_list);
-}
-
-/**
- * e_account_list_save:
- * @account_list: an #EAccountList
- *
- * Saves @account_list to GConf. Signals will be emitted for changes.
- **/
-void
-e_account_list_save (EAccountList *account_list)
-{
- GSList *list = NULL;
- EAccount *account;
- EIterator *iter;
- char *xmlbuf;
-
- for (iter = e_list_get_iterator (E_LIST (account_list));
- e_iterator_is_valid (iter);
- e_iterator_next (iter)) {
- account = (EAccount *)e_iterator_get (iter);
-
- xmlbuf = e_account_to_xml (account);
- if (xmlbuf)
- list = g_slist_append (list, xmlbuf);
- }
- g_object_unref (iter);
-
- gconf_client_set_list (account_list->priv->gconf,
- "/apps/evolution/mail/accounts",
- GCONF_VALUE_STRING, list, NULL);
-
- while (list) {
- g_free (list->data);
- list = g_slist_remove (list, list->data);
- }
-
- gconf_client_suggest_sync (account_list->priv->gconf, NULL);
-}
-
-/**
- * e_account_list_add:
- * @accounts:
- * @account:
- *
- * Add an account to the account list. Will emit the account-changed
- * event.
- **/
-void
-e_account_list_add(EAccountList *accounts, EAccount *account)
-{
- /* FIXME: should we check for duplicate accounts? */
-
- e_list_append ((EList *)accounts, account);
- g_signal_emit(accounts, signals[ACCOUNT_ADDED], 0, account);
-}
-
-/**
- * e_account_list_change:
- * @accounts:
- * @account:
- *
- * Signal that the details of an account have changed.
- **/
-void
-e_account_list_change(EAccountList *accounts, EAccount *account)
-{
- /* maybe the account should do this itself ... */
- g_signal_emit(accounts, signals[ACCOUNT_CHANGED], 0, account);
-}
-
-/**
- * e_account_list_remove:
- * @accounts:
- * @account:
- *
- * Remove an account from the account list, and emit the
- * account-removed signal. If the account was the default account,
- * then reset the default to the first account.
- **/
-void
-e_account_list_remove(EAccountList *accounts, EAccount *account)
-{
- if (account == e_account_list_get_default(accounts))
- gconf_client_unset (accounts->priv->gconf, "/apps/evolution/mail/default_account", NULL);
-
- /* not sure if need to ref but no harm */
- g_object_ref (account);
- e_list_remove ((EList *) accounts, account);
- g_signal_emit(accounts, signals[ACCOUNT_REMOVED], 0, account);
- g_object_unref (account);
-}
-
-/**
- * e_account_list_get_default:
- * @accounts:
- *
- * Get the default account. If no default is specified, or the default
- * has become stale, then the first account is made the default.
- *
- * Return value: The account or NULL if no accounts are defined.
- **/
-const EAccount *
-e_account_list_get_default(EAccountList *accounts)
-{
- char *uid;
- EIterator *it;
- const EAccount *account = NULL;
-
- uid = gconf_client_get_string (accounts->priv->gconf, "/apps/evolution/mail/default_account", NULL);
- it = e_list_get_iterator ((EList *)accounts);
-
- if (uid) {
- for (;e_iterator_is_valid (it);e_iterator_next (it)) {
- account = (const EAccount *)e_iterator_get (it);
-
- if (!strcmp(uid, account->uid))
- break;
- account = NULL;
- }
- e_iterator_reset(it);
- }
-
- /* no uid or uid not found, @it will be at the first account */
- if (account == NULL && e_iterator_is_valid(it)) {
- account = (const EAccount *) e_iterator_get (it);
- gconf_client_set_string (accounts->priv->gconf, "/apps/evolution/mail/default_account", account->uid, NULL);
- }
-
- g_object_unref(it);
- g_free(uid);
-
- return account;
-}
-
-/**
- * e_account_list_set_default:
- * @accounts:
- * @account:
- *
- * Set the account @account to be the default account.
- **/
-void
-e_account_list_set_default(EAccountList *accounts, EAccount *account)
-{
- gconf_client_set_string (accounts->priv->gconf, "/apps/evolution/mail/default_account", account->uid, NULL);
-}
-
-/**
- * e_account_list_find:
- * @accounts:
- * @type: Type of search.
- * @key: Search key.
- *
- * Perform a search of the account list on a single key.
- *
- * @type must be set from one of the following search types:
- * E_ACCOUNT_FIND_NAME - Find an account by account name.
- * E_ACCOUNT_FIND_ID_NAME - Find an account by the owner's identity name.
- * E_ACCOUNT_FIND_ID_ADDRESS - Find an account by the owner's identity address.
- *
- * Return value: The account or NULL if it doesn't exist.
- **/
-const EAccount *
-e_account_list_find(EAccountList *accounts, e_account_find_t type, const char *key)
-{
- char *val;
- EIterator *it;
- const EAccount *account = NULL;
-
- /* this could use a callback for more flexibility ...
- ... but this makes the common cases easier */
-
- if (!key)
- return NULL;
-
- for (it = e_list_get_iterator ((EList *)accounts);
- e_iterator_is_valid (it);
- e_iterator_next (it)) {
- int found = 0;
-
- account = (const EAccount *)e_iterator_get (it);
-
- val = NULL;
- switch(type) {
- case E_ACCOUNT_FIND_NAME:
- found = strcmp(account->name, key) == 0;
- break;
- case E_ACCOUNT_FIND_UID:
- found = strcmp(account->uid, key) == 0;
- break;
- case E_ACCOUNT_FIND_ID_NAME:
- if (account->id)
- found = strcmp(account->id->name, key) == 0;
- break;
- case E_ACCOUNT_FIND_ID_ADDRESS:
- if (account->id)
- found = g_ascii_strcasecmp(account->id->address, key) == 0;
- break;
- }
-
- if (found)
- break;
-
- account = NULL;
- }
- g_object_unref(it);
-
- return account;
-}
-
diff --git a/e-util/e-account-list.h b/e-util/e-account-list.h
deleted file mode 100644
index b47efb42ae..0000000000
--- a/e-util/e-account-list.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2003 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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_ACCOUNT_LIST__
-#define __E_ACCOUNT_LIST__
-
-#include "e-list.h"
-#include "e-account.h"
-#include <gconf/gconf-client.h>
-
-#define E_TYPE_ACCOUNT_LIST (e_account_list_get_type ())
-#define E_ACCOUNT_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_ACCOUNT_LIST, EAccountList))
-#define E_ACCOUNT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_ACCOUNT_LIST, EAccountListClass))
-#define E_IS_ACCOUNT_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_ACCOUNT_LIST))
-#define E_IS_ACCOUNT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_ACCOUNT_LIST))
-
-typedef struct EAccountListPrivate EAccountListPrivate;
-
-/* search options for the find command */
-typedef enum _e_account_find_t {
- E_ACCOUNT_FIND_NAME,
- E_ACCOUNT_FIND_UID,
- E_ACCOUNT_FIND_ID_NAME,
- E_ACCOUNT_FIND_ID_ADDRESS,
-} e_account_find_t;
-
-typedef struct {
- EList parent_object;
-
- EAccountListPrivate *priv;
-} EAccountList;
-
-typedef struct {
- EListClass parent_class;
-
- /* signals */
- void (*account_added) (EAccountList *, EAccount *);
- void (*account_changed) (EAccountList *, EAccount *);
- void (*account_removed) (EAccountList *, EAccount *);
-} EAccountListClass;
-
-
-GType e_account_list_get_type (void);
-
-EAccountList *e_account_list_new (GConfClient *gconf);
-void e_account_list_construct (EAccountList *account_list,
- GConfClient *gconf);
-
-void e_account_list_save (EAccountList *account_list);
-
-void e_account_list_add (EAccountList *, EAccount *);
-void e_account_list_change (EAccountList *, EAccount *);
-void e_account_list_remove (EAccountList *, EAccount *);
-
-const EAccount *e_account_list_get_default(EAccountList *);
-void e_account_list_set_default(EAccountList *, EAccount *);
-const EAccount *e_account_list_find (EAccountList *, e_account_find_t type, const char *key);
-
-#endif /* __E_ACCOUNT_LIST__ */
diff --git a/e-util/e-account.c b/e-util/e-account.c
deleted file mode 100644
index dbbfccb6e3..0000000000
--- a/e-util/e-account.c
+++ /dev/null
@@ -1,560 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2003 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "e-account.h"
-
-#include "e-uid.h"
-
-#include <string.h>
-
-#include <gal/util/e-util.h>
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-#include <libxml/xmlmemory.h>
-
-#define PARENT_TYPE G_TYPE_OBJECT
-static GObjectClass *parent_class = NULL;
-
-static void finalize (GObject *);
-
-static void
-class_init (GObjectClass *object_class)
-{
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- /* virtual method override */
- object_class->finalize = finalize;
-}
-
-static void
-init (EAccount *account)
-{
- account->id = g_new0 (EAccountIdentity, 1);
- account->source = g_new0 (EAccountService, 1);
- account->transport = g_new0 (EAccountService, 1);
-}
-
-static void
-identity_destroy (EAccountIdentity *id)
-{
- if (!id)
- return;
-
- g_free (id->name);
- g_free (id->address);
- g_free (id->reply_to);
- g_free (id->organization);
-
- g_free (id);
-}
-
-static void
-service_destroy (EAccountService *service)
-{
- if (!service)
- return;
-
- g_free (service->url);
-
- g_free (service);
-}
-
-static void
-finalize (GObject *object)
-{
- EAccount *account = E_ACCOUNT (object);
-
- g_free (account->name);
- g_free (account->uid);
-
- identity_destroy (account->id);
- service_destroy (account->source);
- service_destroy (account->transport);
-
- g_free (account->drafts_folder_uri);
- g_free (account->sent_folder_uri);
-
- g_free (account->cc_addrs);
- g_free (account->bcc_addrs);
-
- g_free (account->pgp_key);
- g_free (account->smime_sign_key);
- g_free (account->smime_encrypt_key);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-E_MAKE_TYPE (e_account, "EAccount", EAccount, class_init, init, PARENT_TYPE)
-
-
-/**
- * e_account_new:
- *
- * Return value: a blank new account which can be filled in and
- * added to an #EAccountList.
- **/
-EAccount *
-e_account_new (void)
-{
- EAccount *account;
-
- account = g_object_new (E_TYPE_ACCOUNT, NULL);
- account->uid = e_uid_new ();
-
- return account;
-}
-
-/**
- * e_account_new_from_xml:
- * @xml: an XML account description
- *
- * Return value: a new #EAccount based on the data in @xml, or %NULL
- * if @xml could not be parsed as valid account data.
- **/
-EAccount *
-e_account_new_from_xml (const char *xml)
-{
- EAccount *account;
-
- account = g_object_new (E_TYPE_ACCOUNT, NULL);
- if (!e_account_set_from_xml (account, xml)) {
- g_object_unref (account);
- return NULL;
- }
-
- return account;
-}
-
-
-static gboolean
-xml_set_bool (xmlNodePtr node, const char *name, gboolean *val)
-{
- gboolean bool;
- char *buf;
-
- if ((buf = xmlGetProp (node, name))) {
- bool = (!strcmp (buf, "true") || !strcmp (buf, "yes"));
- xmlFree (buf);
-
- if (bool != *val) {
- *val = bool;
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static gboolean
-xml_set_int (xmlNodePtr node, const char *name, int *val)
-{
- int number;
- char *buf;
-
- if ((buf = xmlGetProp (node, name))) {
- number = strtol (buf, NULL, 10);
- xmlFree (buf);
-
- if (number != *val) {
- *val = number;
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static gboolean
-xml_set_prop (xmlNodePtr node, const char *name, char **val)
-{
- char *buf, *new_val;
-
- buf = xmlGetProp (node, name);
- new_val = g_strdup (buf);
- xmlFree (buf);
-
- /* We can use strcmp here whether the value is UTF8 or
- * not, since we only care if the bytes changed.
- */
- if (!*val || strcmp (*val, new_val)) {
- g_free (*val);
- *val = new_val;
- return TRUE;
- } else {
- g_free (new_val);
- return FALSE;
- }
-}
-
-static gboolean
-xml_set_content (xmlNodePtr node, char **val)
-{
- char *buf, *new_val;
-
- buf = xmlNodeGetContent (node);
- new_val = g_strdup (buf);
- xmlFree (buf);
-
- /* We can use strcmp here whether the value is UTF8 or
- * not, since we only care if the bytes changed.
- */
- if (!*val || strcmp (*val, new_val)) {
- g_free (*val);
- *val = new_val;
- return TRUE;
- } else {
- g_free (new_val);
- return FALSE;
- }
-}
-
-static gboolean
-xml_set_identity (xmlNodePtr node, EAccountIdentity *id)
-{
- gboolean changed = FALSE;
-
- for (node = node->children; node; node = node->next) {
- if (!strcmp (node->name, "name"))
- changed |= xml_set_content (node, &id->name);
- else if (!strcmp (node->name, "addr-spec"))
- changed |= xml_set_content (node, &id->address);
- else if (!strcmp (node->name, "reply-to"))
- changed |= xml_set_content (node, &id->reply_to);
- else if (!strcmp (node->name, "organization"))
- changed |= xml_set_content (node, &id->organization);
- else if (!strcmp (node->name, "signature")) {
- changed |= xml_set_bool (node, "auto", &id->auto_signature);
- changed |= xml_set_int (node, "default", &id->def_signature);
- }
- }
-
- return changed;
-}
-
-static gboolean
-xml_set_service (xmlNodePtr node, EAccountService *service)
-{
- gboolean changed = FALSE;
-
- changed |= xml_set_bool (node, "save-passwd", &service->save_passwd);
- changed |= xml_set_bool (node, "keep-on-server", &service->keep_on_server);
-
- changed |= xml_set_bool (node, "auto-check", &service->auto_check);
- changed |= xml_set_int (node, "auto-check-timeout", &service->auto_check_time);
- if (service->auto_check && service->auto_check_time <= 0) {
- service->auto_check = FALSE;
- service->auto_check_time = 0;
- }
-
- for (node = node->children; node; node = node->next) {
- if (!strcmp (node->name, "url")) {
- changed |= xml_set_content (node, &service->url);
- break;
- }
- }
-
- return changed;
-}
-
-/**
- * e_account_set_from_xml:
- * @account: an #EAccount
- * @xml: an XML account description.
- *
- * Changes @account to match @xml.
- *
- * Return value: %TRUE if @account was changed, %FALSE if @account
- * already matched @xml or @xml could not be parsed
- **/
-gboolean
-e_account_set_from_xml (EAccount *account, const char *xml)
-{
- xmlNodePtr node, cur;
- xmlDocPtr doc;
- gboolean changed = FALSE;
-
- if (!(doc = xmlParseDoc ((char *)xml)))
- return FALSE;
-
- node = doc->children;
- if (strcmp (node->name, "account") != 0) {
- xmlFreeDoc (doc);
- return FALSE;
- }
-
- if (!account->uid)
- xml_set_prop (node, "uid", &account->uid);
-
- changed |= xml_set_prop (node, "name", &account->name);
- changed |= xml_set_bool (node, "enabled", &account->enabled);
-
- for (node = node->children; node; node = node->next) {
- if (!strcmp (node->name, "identity")) {
- changed |= xml_set_identity (node, account->id);
- } else if (!strcmp (node->name, "source")) {
- changed |= xml_set_service (node, account->source);
- } else if (!strcmp (node->name, "transport")) {
- changed |= xml_set_service (node, account->transport);
- } else if (!strcmp (node->name, "drafts-folder")) {
- changed |= xml_set_content (node, &account->drafts_folder_uri);
- } else if (!strcmp (node->name, "sent-folder")) {
- changed |= xml_set_content (node, &account->sent_folder_uri);
- } else if (!strcmp (node->name, "auto-cc")) {
- changed |= xml_set_bool (node, "always", &account->always_cc);
- changed |= xml_set_content (node, &account->cc_addrs);
- } else if (!strcmp (node->name, "auto-bcc")) {
- changed |= xml_set_bool (node, "always", &account->always_bcc);
- changed |= xml_set_content (node, &account->bcc_addrs);
- } else if (!strcmp (node->name, "pgp")) {
- changed |= xml_set_bool (node, "encrypt-to-self", &account->pgp_encrypt_to_self);
- changed |= xml_set_bool (node, "always-trust", &account->pgp_always_trust);
- changed |= xml_set_bool (node, "always-sign", &account->pgp_always_sign);
- changed |= xml_set_bool (node, "no-imip-sign", &account->pgp_no_imip_sign);
-
- if (node->children) {
- for (cur = node->children; cur; cur = cur->next) {
- if (!strcmp (cur->name, "key-id")) {
- changed |= xml_set_content (cur, &account->pgp_key);
- break;
- }
- }
- }
- } else if (!strcmp (node->name, "smime")) {
- changed |= xml_set_bool (node, "sign-default", &account->smime_sign_default);
- changed |= xml_set_bool (node, "encrypt-to-self", &account->smime_encrypt_to_self);
- changed |= xml_set_bool (node, "encrypt-default", &account->smime_encrypt_default);
-
- if (node->children) {
- for (cur = node->children; cur; cur = cur->next) {
- if (!strcmp (cur->name, "sign-key-id")) {
- changed |= xml_set_content (cur, &account->smime_sign_key);
- } else if (!strcmp (cur->name, "encrypt-key-id")) {
- changed |= xml_set_content (cur, &account->smime_encrypt_key);
- break;
- }
- }
- }
- }
- }
-
- xmlFreeDoc (doc);
-
- return changed;
-}
-
-
-/**
- * e_account_import:
- * @dest: destination account object
- * @src: source account object
- *
- * Import the settings from @src to @dest.
- **/
-void
-e_account_import (EAccount *dest, EAccount *src)
-{
- g_free (dest->name);
- dest->name = g_strdup (src->name);
-
- dest->enabled = src->enabled;
-
- g_free (dest->id->name);
- dest->id->name = g_strdup (src->id->name);
- g_free (dest->id->address);
- dest->id->address = g_strdup (src->id->address);
- g_free (dest->id->reply_to);
- dest->id->reply_to = g_strdup (src->id->reply_to);
- g_free (dest->id->organization);
- dest->id->organization = g_strdup (src->id->organization);
- dest->id->def_signature = src->id->def_signature;
- dest->id->auto_signature = src->id->auto_signature;
-
- g_free (dest->source->url);
- dest->source->url = g_strdup (src->source->url);
- dest->source->keep_on_server = src->source->keep_on_server;
- dest->source->auto_check = src->source->auto_check;
- dest->source->auto_check_time = src->source->auto_check_time;
- dest->source->save_passwd = src->source->save_passwd;
-
- g_free (dest->transport->url);
- dest->transport->url = g_strdup (src->transport->url);
- dest->transport->save_passwd = src->transport->save_passwd;
-
- g_free (dest->drafts_folder_uri);
- dest->drafts_folder_uri = g_strdup (src->drafts_folder_uri);
-
- g_free (dest->sent_folder_uri);
- dest->sent_folder_uri = g_strdup (src->sent_folder_uri);
-
- dest->always_cc = src->always_cc;
- g_free (dest->cc_addrs);
- dest->cc_addrs = g_strdup (src->cc_addrs);
-
- dest->always_bcc = src->always_bcc;
- g_free (dest->bcc_addrs);
- dest->bcc_addrs = g_strdup (src->bcc_addrs);
-
- g_free (dest->pgp_key);
- dest->pgp_key = g_strdup (src->pgp_key);
- dest->pgp_encrypt_to_self = src->pgp_encrypt_to_self;
- dest->pgp_always_sign = src->pgp_always_sign;
- dest->pgp_no_imip_sign = src->pgp_no_imip_sign;
- dest->pgp_always_trust = src->pgp_always_trust;
-
- dest->smime_sign_default = src->smime_sign_default;
- g_free (dest->smime_sign_key);
- dest->smime_sign_key = g_strdup (src->smime_sign_key);
-
- dest->smime_encrypt_default = src->smime_encrypt_default;
- dest->smime_encrypt_to_self = src->smime_encrypt_to_self;
- g_free (dest->smime_encrypt_key);
- dest->smime_encrypt_key = g_strdup (src->smime_encrypt_key);
-}
-
-
-/**
- * e_account_to_xml:
- * @account: an #EAccount
- *
- * Return value: an XML representation of @account, which the caller
- * must free.
- **/
-char *
-e_account_to_xml (EAccount *account)
-{
- xmlNodePtr root, node, id, src, xport;
- char *tmp, buf[20];
- xmlChar *xmlbuf;
- xmlDocPtr doc;
- int n;
-
- doc = xmlNewDoc ("1.0");
-
- root = xmlNewDocNode (doc, NULL, "account", NULL);
- xmlDocSetRootElement (doc, root);
-
- xmlSetProp (root, "name", account->name);
- xmlSetProp (root, "uid", account->uid);
- xmlSetProp (root, "enabled", account->enabled ? "true" : "false");
-
- id = xmlNewChild (root, NULL, "identity", NULL);
- if (account->id->name)
- xmlNewTextChild (id, NULL, "name", account->id->name);
- if (account->id->address)
- xmlNewTextChild (id, NULL, "addr-spec", account->id->address);
- if (account->id->reply_to)
- xmlNewTextChild (id, NULL, "reply-to", account->id->reply_to);
- if (account->id->organization)
- xmlNewTextChild (id, NULL, "organization", account->id->organization);
-
- node = xmlNewChild (id, NULL, "signature",NULL);
- xmlSetProp (node, "auto", account->id->auto_signature ? "true" : "false");
- sprintf (buf, "%d", account->id->def_signature);
- xmlSetProp (node, "default", buf);
-
- src = xmlNewChild (root, NULL, "source", NULL);
- xmlSetProp (src, "save-passwd", account->source->save_passwd ? "true" : "false");
- xmlSetProp (src, "keep-on-server", account->source->keep_on_server ? "true" : "false");
- xmlSetProp (src, "auto-check", account->source->auto_check ? "true" : "false");
- sprintf (buf, "%d", account->source->auto_check_time);
- xmlSetProp (src, "auto-check-timeout", buf);
- if (account->source->url)
- xmlNewTextChild (src, NULL, "url", account->source->url);
-
- xport = xmlNewChild (root, NULL, "transport", NULL);
- xmlSetProp (xport, "save-passwd", account->transport->save_passwd ? "true" : "false");
- if (account->transport->url)
- xmlNewTextChild (xport, NULL, "url", account->transport->url);
-
- xmlNewTextChild (root, NULL, "drafts-folder", account->drafts_folder_uri);
- xmlNewTextChild (root, NULL, "sent-folder", account->sent_folder_uri);
-
- node = xmlNewChild (root, NULL, "auto-cc", NULL);
- xmlSetProp (node, "always", account->always_cc ? "true" : "false");
- if (account->cc_addrs)
- xmlNewTextChild (node, NULL, "recipients", account->cc_addrs);
-
- node = xmlNewChild (root, NULL, "auto-bcc", NULL);
- xmlSetProp (node, "always", account->always_bcc ? "true" : "false");
- if (account->bcc_addrs)
- xmlNewTextChild (node, NULL, "recipients", account->bcc_addrs);
-
- node = xmlNewChild (root, NULL, "pgp", NULL);
- xmlSetProp (node, "encrypt-to-self", account->pgp_encrypt_to_self ? "true" : "false");
- xmlSetProp (node, "always-trust", account->pgp_always_trust ? "true" : "false");
- xmlSetProp (node, "always-sign", account->pgp_always_sign ? "true" : "false");
- xmlSetProp (node, "no-imip-sign", account->pgp_no_imip_sign ? "true" : "false");
- if (account->pgp_key)
- xmlNewTextChild (node, NULL, "key-id", account->pgp_key);
-
- node = xmlNewChild (root, NULL, "smime", NULL);
- xmlSetProp (node, "sign-default", account->smime_sign_default ? "true" : "false");
- xmlSetProp (node, "encrypt-default", account->smime_encrypt_default ? "true" : "false");
- xmlSetProp (node, "encrypt-to-self", account->smime_encrypt_to_self ? "true" : "false");
- if (account->smime_sign_key)
- xmlNewTextChild (node, NULL, "sign-key-id", account->smime_sign_key);
- if (account->smime_encrypt_key)
- xmlNewTextChild (node, NULL, "encrypt-key-id", account->smime_encrypt_key);
-
- xmlDocDumpMemory (doc, &xmlbuf, &n);
- xmlFreeDoc (doc);
-
- /* remap to glib memory */
- tmp = g_malloc (n + 1);
- memcpy (tmp, xmlbuf, n);
- tmp[n] = '\0';
- xmlFree (xmlbuf);
-
- return tmp;
-}
-
-
-/**
- * e_account_uid_from_xml:
- * @xml: an XML account description
- *
- * Return value: the permanent UID of the account described by @xml
- * (or %NULL if @xml could not be parsed or did not contain a uid).
- * The caller must free this string.
- **/
-char *
-e_account_uid_from_xml (const char *xml)
-{
- xmlNodePtr node;
- xmlDocPtr doc;
- char *uid = NULL;
-
- if (!(doc = xmlParseDoc ((char *)xml)))
- return NULL;
-
- node = doc->children;
- if (strcmp (node->name, "account") != 0) {
- xmlFreeDoc (doc);
- return NULL;
- }
-
- xml_set_prop (node, "uid", &uid);
- xmlFreeDoc (doc);
-
- return uid;
-}
diff --git a/e-util/e-account.h b/e-util/e-account.h
deleted file mode 100644
index e50c773991..0000000000
--- a/e-util/e-account.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2003 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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_ACCOUNT__
-#define __E_ACCOUNT__
-
-#include <glib-object.h>
-
-#define E_TYPE_ACCOUNT (e_account_get_type ())
-#define E_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_ACCOUNT, EAccount))
-#define E_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_ACCOUNT, EAccountClass))
-#define E_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_ACCOUNT))
-#define E_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_ACCOUNT))
-
-typedef struct {
- char *name;
- char *address;
- char *reply_to;
- char *organization;
-
- int def_signature;
- gboolean auto_signature;
-} EAccountIdentity;
-
-typedef struct {
- char *url;
- gboolean keep_on_server;
- gboolean auto_check;
- int auto_check_time;
- gboolean save_passwd;
-} EAccountService;
-
-
-typedef struct {
- GObject parent_object;
-
- char *name;
- char *uid;
-
- gboolean enabled;
-
- EAccountIdentity *id;
- EAccountService *source;
- EAccountService *transport;
-
- char *drafts_folder_uri, *sent_folder_uri;
-
- gboolean always_cc;
- char *cc_addrs;
- gboolean always_bcc;
- char *bcc_addrs;
-
- char *pgp_key;
- gboolean pgp_encrypt_to_self;
- gboolean pgp_always_sign;
- gboolean pgp_no_imip_sign;
- gboolean pgp_always_trust;
-
- char *smime_sign_key;
- char *smime_encrypt_key;
- gboolean smime_sign_default;
- gboolean smime_encrypt_to_self;
- gboolean smime_encrypt_default;
-} EAccount;
-
-typedef struct {
- GObjectClass parent_class;
-
-} EAccountClass;
-
-
-GType e_account_get_type (void);
-
-EAccount *e_account_new (void);
-
-EAccount *e_account_new_from_xml (const char *xml);
-
-gboolean e_account_set_from_xml (EAccount *account,
- const char *xml);
-
-void e_account_import (EAccount *dest,
- EAccount *src);
-
-char *e_account_to_xml (EAccount *account);
-
-
-char *e_account_uid_from_xml (const char *xml);
-
-
-#endif /* __E_ACCOUNT__ */
diff --git a/e-util/e-bit-array.c b/e-util/e-bit-array.c
deleted file mode 100644
index bb98a3f465..0000000000
--- a/e-util/e-bit-array.c
+++ /dev/null
@@ -1,429 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-bit-array.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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 <gtk/gtksignal.h>
-#include "e-bit-array.h"
-#include "gal/util/e-util.h"
-
-#define PARENT_TYPE G_TYPE_OBJECT
-
-#define ONES ((guint32) 0xffffffff)
-
-#define BOX(n) ((n) / 32)
-#define OFFSET(n) (31 - ((n) % 32))
-#define BITMASK(n) ((guint32)(((guint32) 0x1) << OFFSET((n))))
-#define BITMASK_LEFT(n) ((((n) % 32) == 0) ? 0 : (ONES << (32 - ((n) % 32))))
-#define BITMASK_RIGHT(n) ((guint32)(((guint32) ONES) >> ((n) % 32)))
-
-static GObjectClass *parent_class;
-
-static void
-e_bit_array_insert_real(EBitArray *eba, int row)
-{
- int box;
- int i;
- if(eba->bit_count >= 0) {
- /* Add another word if needed. */
- if ((eba->bit_count & 0x1f) == 0) {
- eba->data = g_renew(guint32, eba->data, (eba->bit_count >> 5) + 1);
- eba->data[eba->bit_count >> 5] = 0;
- }
-
- /* The box is the word that our row is in. */
- box = BOX(row);
- /* Shift all words to the right of our box right one bit. */
- for (i = eba->bit_count >> 5; i > box; i--) {
- eba->data[i] = (eba->data[i] >> 1) | (eba->data[i - 1] << 31);
- }
-
- /* Shift right half of box one bit to the right. */
- eba->data[box] = (eba->data[box] & BITMASK_LEFT(row)) | ((eba->data[box] & BITMASK_RIGHT(row)) >> 1);
- eba->bit_count ++;
- }
-}
-
-static void
-e_bit_array_delete_real(EBitArray *eba, int row, gboolean move_selection_mode)
-{
- int box;
- int i;
- int last;
- int selected = FALSE;
- if(eba->bit_count >= 0) {
- guint32 bitmask;
- box = row >> 5;
- last = eba->bit_count >> 5;
-
- /* Build bitmasks for the left and right half of the box */
- bitmask = BITMASK_RIGHT(row) >> 1;
- if (move_selection_mode)
- selected = e_bit_array_value_at(eba, row);
- /* Shift right half of box one bit to the left. */
- eba->data[box] = (eba->data[box] & BITMASK_LEFT(row))| ((eba->data[box] & bitmask) << 1);
-
- /* Shift all words to the right of our box left one bit. */
- if (box < last) {
- eba->data[box] &= eba->data[box + 1] >> 31;
-
- for (i = box + 1; i < last; i++) {
- eba->data[i] = (eba->data[i] << 1) | (eba->data[i + 1] >> 31);
- }
- /* this over-runs our memory! */
- /*eba->data[i] = eba->data[i] << 1; */
- }
- eba->bit_count --;
- /* Remove the last word if not needed. */
- if ((eba->bit_count & 0x1f) == 0) {
- eba->data = g_renew(guint32, eba->data, eba->bit_count >> 5);
- }
- if (move_selection_mode && selected && eba->bit_count > 0) {
- e_bit_array_select_single_row (eba, row == eba->bit_count ? row - 1 : row);
- }
- }
-}
-
-/* FIXME : Improve efficiency here. */
-void
-e_bit_array_delete(EBitArray *eba, int row, int count)
-{
- int i;
- for (i = 0; i < count; i++)
- e_bit_array_delete_real(eba, row, FALSE);
-}
-
-/* FIXME : Improve efficiency here. */
-void
-e_bit_array_delete_single_mode(EBitArray *eba, int row, int count)
-{
- int i;
- for (i = 0; i < count; i++)
- e_bit_array_delete_real(eba, row, TRUE);
-}
-
-/* FIXME : Improve efficiency here. */
-void
-e_bit_array_insert(EBitArray *eba, int row, int count)
-{
- int i;
- for (i = 0; i < count; i++)
- e_bit_array_insert_real(eba, row);
-}
-
-/* FIXME: Implement this more efficiently. */
-void
-e_bit_array_move_row(EBitArray *eba, int old_row, int new_row)
-{
- e_bit_array_delete_real(eba, old_row, FALSE);
- e_bit_array_insert_real(eba, new_row);
-}
-
-static void
-eba_dispose (GObject *object)
-{
- EBitArray *eba;
-
- eba = E_BIT_ARRAY (object);
-
- if (eba->data)
- g_free(eba->data);
- eba->data = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-/**
- * e_selection_model_is_row_selected
- * @selection: #EBitArray to check
- * @n: The row to check
- *
- * This routine calculates whether the given row is selected.
- *
- * Returns: %TRUE if the given row is selected
- */
-gboolean
-e_bit_array_value_at (EBitArray *eba,
- gint n)
-{
- if (eba->bit_count < n || eba->bit_count == 0)
- return 0;
- else
- return (eba->data[BOX(n)] >> OFFSET(n)) & 0x1;
-}
-
-/**
- * e_selection_model_foreach
- * @selection: #EBitArray to traverse
- * @callback: The callback function to call back.
- * @closure: The closure
- *
- * This routine calls the given callback function once for each
- * selected row, passing closure as the closure.
- */
-void
-e_bit_array_foreach (EBitArray *eba,
- EForeachFunc callback,
- gpointer closure)
-{
- int i;
- int last = (eba->bit_count + 31) / 32;
- for (i = 0; i < last; i++) {
- if (eba->data[i]) {
- int j;
- guint32 value = eba->data[i];
- for (j = 0; j < 32; j++) {
- if (value & 0x80000000) {
- callback(i * 32 + j, closure);
- }
- value <<= 1;
- }
- }
- }
-}
-
-/**
- * e_selection_model_clear
- * @selection: #EBitArray to clear
- *
- * This routine clears the selection to no rows selected.
- */
-void
-e_bit_array_clear(EBitArray *eba)
-{
- g_free(eba->data);
- eba->data = NULL;
- eba->bit_count = 0;
-}
-
-#define PART(x,n) (((x) & (0x01010101 << n)) >> n)
-#define SECTION(x, n) (((x) >> (n * 8)) & 0xff)
-
-/**
- * e_selection_model_selected_count
- * @selection: #EBitArray to count
- *
- * This routine calculates the number of rows selected.
- *
- * Returns: The number of rows selected in the given model.
- */
-gint
-e_bit_array_selected_count (EBitArray *eba)
-{
- gint count;
- int i;
- int last;
-
- if (!eba->data)
- return 0;
-
- count = 0;
-
- last = BOX(eba->bit_count - 1);
-
- for (i = 0; i <= last; i++) {
- int j;
- guint32 thiscount = 0;
- for (j = 0; j < 8; j++)
- thiscount += PART(eba->data[i], j);
- for (j = 0; j < 4; j++)
- count += SECTION(thiscount, j);
- }
-
- return count;
-}
-
-/**
- * e_selection_model_select_all
- * @selection: #EBitArray to select all
- *
- * This routine selects all the rows in the given
- * #EBitArray.
- */
-void
-e_bit_array_select_all (EBitArray *eba)
-{
- int i;
-
- if (!eba->data)
- eba->data = g_new0 (guint32, (eba->bit_count + 31) / 32);
-
- for (i = 0; i < (eba->bit_count + 31) / 32; i ++) {
- eba->data[i] = ONES;
- }
-
- /* need to zero out the bits corresponding to the rows not
- selected in the last full 32 bit mask */
- if (eba->bit_count % 32) {
- int unselected_mask = 0;
- int num_unselected_in_last_byte = 32 - eba->bit_count % 32;
-
- for (i = 0; i < num_unselected_in_last_byte; i ++)
- unselected_mask |= 1 << i;
-
- eba->data[(eba->bit_count + 31) / 32 - 1] &= ~unselected_mask;
- }
-}
-
-/**
- * e_selection_model_invert_selection
- * @selection: #EBitArray to invert
- *
- * This routine inverts all the rows in the given
- * #EBitArray.
- */
-void
-e_bit_array_invert_selection (EBitArray *eba)
-{
- int i;
-
- if (!eba->data)
- eba->data = g_new0 (guint32, (eba->bit_count + 31) / 32);
-
- for (i = 0; i < (eba->bit_count + 31) / 32; i ++) {
- eba->data[i] = ~eba->data[i];
- }
-}
-
-int
-e_bit_array_bit_count (EBitArray *eba)
-{
- return eba->bit_count;
-}
-
-gboolean
-e_bit_array_cross_and (EBitArray *eba)
-{
- int i;
- for (i = 0; i < eba->bit_count / 32; i++) {
- if (eba->data[i] != ONES)
- return FALSE;
- }
- if ((eba->bit_count % 32) && ((eba->data[i] & BITMASK_LEFT(eba->bit_count)) != BITMASK_LEFT(eba->bit_count)))
- return FALSE;
- return TRUE;
-}
-
-gboolean
-e_bit_array_cross_or (EBitArray *eba)
-{
- int i;
- for (i = 0; i < eba->bit_count / 32; i++) {
- if (eba->data[i] != 0)
- return TRUE;
- }
- if ((eba->bit_count % 32) && ((eba->data[i] & BITMASK_LEFT(eba->bit_count)) != 0))
- return TRUE;
- return FALSE;
-}
-
-#define OPERATE(object, i,mask,grow) ((grow) ? (((object)->data[(i)]) |= ((guint32) ~(mask))) : (((object)->data[(i)]) &= (mask)))
-
-void
-e_bit_array_change_one_row(EBitArray *eba, int row, gboolean grow)
-{
- int i;
- i = BOX(row);
-
- OPERATE(eba, i, ~BITMASK(row), grow);
-}
-
-void
-e_bit_array_change_range(EBitArray *eba, int start, int end, gboolean grow)
-{
- int i, last;
- if (start != end) {
- i = BOX(start);
- last = BOX(end);
-
- if (i == last) {
- OPERATE(eba, i, BITMASK_LEFT(start) | BITMASK_RIGHT(end), grow);
- } else {
- OPERATE(eba, i, BITMASK_LEFT(start), grow);
- if (grow)
- for (i ++; i < last; i++)
- eba->data[i] = ONES;
- else
- for (i ++; i < last; i++)
- eba->data[i] = 0;
- OPERATE(eba, i, BITMASK_RIGHT(end), grow);
- }
- }
-}
-
-void
-e_bit_array_select_single_row (EBitArray *eba, int row)
-{
- int i;
- for (i = 0; i < ((eba->bit_count + 31) / 32); i++) {
- if (!((i == BOX(row) && eba->data[i] == BITMASK(row)) ||
- (i != BOX(row) && eba->data[i] == 0))) {
- g_free(eba->data);
- eba->data = g_new0(guint32, (eba->bit_count + 31) / 32);
- eba->data[BOX(row)] = BITMASK(row);
-
- break;
- }
- }
-}
-
-void
-e_bit_array_toggle_single_row (EBitArray *eba, int row)
-{
- if (eba->data[BOX(row)] & BITMASK(row))
- eba->data[BOX(row)] &= ~BITMASK(row);
- else
- eba->data[BOX(row)] |= BITMASK(row);
-}
-
-
-static void
-e_bit_array_init (EBitArray *eba)
-{
- eba->data = NULL;
- eba->bit_count = 0;
-}
-
-static void
-e_bit_array_class_init (EBitArrayClass *klass)
-{
- GObjectClass *object_class;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class = G_OBJECT_CLASS(klass);
-
- object_class->dispose = eba_dispose;
-}
-
-E_MAKE_TYPE(e_bit_array, "EBitArray", EBitArray,
- e_bit_array_class_init, e_bit_array_init, PARENT_TYPE)
-
-EBitArray *
-e_bit_array_new (int count)
-{
- EBitArray *eba = g_object_new (E_BIT_ARRAY_TYPE, NULL);
- eba->bit_count = count;
- eba->data = g_new0(guint32, (eba->bit_count + 31) / 32);
- return eba;
-}
diff --git a/e-util/e-bit-array.h b/e-util/e-bit-array.h
deleted file mode 100644
index ebfe644da6..0000000000
--- a/e-util/e-bit-array.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-bit-array.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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_BIT_ARRAY_H_
-#define _E_BIT_ARRAY_H_
-
-#include <glib-object.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_BIT_ARRAY_TYPE (e_bit_array_get_type ())
-#define E_BIT_ARRAY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_BIT_ARRAY_TYPE, EBitArray))
-#define E_BIT_ARRAY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_BIT_ARRAY_TYPE, EBitArrayClass))
-#define E_IS_BIT_ARRAY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_BIT_ARRAY_TYPE))
-#define E_IS_BIT_ARRAY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_BIT_ARRAY_TYPE))
-
-#ifndef _E_FOREACH_FUNC_H_
-#define _E_FOREACH_FUNC_H_
-typedef void (*EForeachFunc) (int model_row,
- gpointer closure);
-#endif
-
-typedef struct {
- GObject base;
-
- gint bit_count;
- guint32 *data;
-} EBitArray;
-
-typedef struct {
- GObjectClass parent_class;
-} EBitArrayClass;
-
-
-GType e_bit_array_get_type (void);
-EBitArray *e_bit_array_new (int count);
-
-gboolean e_bit_array_value_at (EBitArray *selection,
- gint n);
-void e_bit_array_foreach (EBitArray *selection,
- EForeachFunc callback,
- gpointer closure);
-void e_bit_array_clear (EBitArray *selection);
-gint e_bit_array_selected_count (EBitArray *selection);
-void e_bit_array_select_all (EBitArray *selection);
-void e_bit_array_invert_selection (EBitArray *selection);
-int e_bit_array_bit_count (EBitArray *selection);
-void e_bit_array_change_one_row (EBitArray *selection,
- int row,
- gboolean grow);
-void e_bit_array_change_range (EBitArray *selection,
- int start,
- int end,
- gboolean grow);
-void e_bit_array_select_single_row (EBitArray *eba,
- int row);
-void e_bit_array_toggle_single_row (EBitArray *eba,
- int row);
-
-void e_bit_array_insert (EBitArray *esm,
- int row,
- int count);
-void e_bit_array_delete (EBitArray *esm,
- int row,
- int count);
-void e_bit_array_delete_single_mode (EBitArray *esm,
- int row,
- int count);
-void e_bit_array_move_row (EBitArray *esm,
- int old_row,
- int new_row);
-gint e_bit_array_bit_count (EBitArray *esm);
-
-gboolean e_bit_array_cross_and (EBitArray *esm);
-gboolean e_bit_array_cross_or (EBitArray *esm);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* _E_BIT_ARRAY_H_ */
diff --git a/e-util/e-categories-config.c b/e-util/e-categories-config.c
deleted file mode 100644
index e5e4c0592e..0000000000
--- a/e-util/e-categories-config.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Categories configuration.
- *
- * Author:
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright 2001, Ximian, Inc.
- */
-
-#include <string.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnome/gnome-i18n.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gal/widgets/e-categories.h>
-#include "e-categories-config.h"
-#include "e-categories-master-list-wombat.h"
-
-static gboolean initialized = FALSE;
-static ECategoriesMasterListWombat *ecmlw = NULL;
-static GHashTable *icons_table = NULL;
-
-static void
-initialize_categories_config (void)
-{
- g_return_if_fail (initialized == FALSE);
-
- ecmlw = E_CATEGORIES_MASTER_LIST_WOMBAT (e_categories_master_list_wombat_new ());
- icons_table = g_hash_table_new (g_str_hash, g_str_equal);
- /* FIXME: must free the two objects above when exiting */
-
- initialized = TRUE;
-}
-
-/**
- * e_categories_config_get_color_for:
- * @category: Category to get the color for.
- *
- * Returns the representation of the color configured for the given
- * category
- *
- * Returns: An X color specification.
- */
-const char *
-e_categories_config_get_color_for (const char *category)
-{
- int n;
-
- g_return_val_if_fail (category != NULL, NULL);
-
- if (!initialized)
- initialize_categories_config ();
-
- for (n = 0;
- n < e_categories_master_list_count (E_CATEGORIES_MASTER_LIST (ecmlw));
- n++) {
- char *tmp_cat;
-
- tmp_cat = (char *) e_categories_master_list_nth (E_CATEGORIES_MASTER_LIST (ecmlw), n);
- if (tmp_cat && !strcmp (tmp_cat, category))
- return e_categories_master_list_nth_color (E_CATEGORIES_MASTER_LIST (ecmlw), n);
- }
-
- return NULL; /* not found */
-}
-
-/**
- * e_categories_config_set_color_for
- */
-void
-e_categories_config_set_color_for (const char *category, const char *color)
-{
- /* FIXME: implement */
-}
-
-/**
- * e_categories_config_get_icon_for:
- * @category: Category for which to get the icon.
- * @icon: A pointer to where the pixmap will be returned.
- * @mask: A pointer to where the mask will be returned.
- *
- * Returns the icon (and associated mask) configured for the
- * given category.
- */
-gboolean
-e_categories_config_get_icon_for (const char *category, GdkPixmap **pixmap, GdkBitmap **mask)
-{
- char *icon_file;
- GdkPixbuf *pixbuf;
- GdkBitmap *tmp_mask;
-
- g_return_val_if_fail (pixmap != NULL, FALSE);
-
- icon_file = (char *) e_categories_config_get_icon_file_for (category);
- if (!icon_file) {
- *pixmap = NULL;
- if (mask != NULL)
- *mask = NULL;
- return FALSE;
- }
-
- /* load the icon in our list */
- pixbuf = g_hash_table_lookup (icons_table, icon_file);
- if (!pixbuf) {
- pixbuf = gdk_pixbuf_new_from_file (icon_file, NULL);
- if (!pixbuf) {
- *pixmap = NULL;
- if (mask != NULL)
- *mask = NULL;
- return FALSE;
- }
-
- g_hash_table_insert (icons_table, g_strdup (icon_file), pixbuf);
- }
-
- /* render the pixbuf to the pixmap and mask passed */
- gdk_pixbuf_render_pixmap_and_mask (pixbuf, pixmap, &tmp_mask, 1);
- if (mask != NULL)
- *mask = tmp_mask;
-
- return TRUE;
-}
-
-/**
- * e_categories_config_get_icon_file_for
- * @category: Category for which to get the icon file
- */
-const char *
-e_categories_config_get_icon_file_for (const char *category)
-{
- int n;
-
- g_return_val_if_fail (category != NULL, NULL);
-
- if (!initialized)
- initialize_categories_config ();
-
- for (n = 0;
- n < e_categories_master_list_count (E_CATEGORIES_MASTER_LIST (ecmlw));
- n++) {
- char *tmp_cat;
-
- tmp_cat = (char *) e_categories_master_list_nth (E_CATEGORIES_MASTER_LIST (ecmlw), n);
- if (tmp_cat && !strcmp (tmp_cat, category))
- return e_categories_master_list_nth_icon (E_CATEGORIES_MASTER_LIST (ecmlw), n);
- }
-
- return NULL; /* not found */
-}
-
-/**
- * e_categories_config_set_icon_for
- * @category: Category for which to set the icon.
- * @icon_file: Full path of the icon file.
- */
-void
-e_categories_config_set_icon_for (const char *category, const char *icon_file)
-{
-}
-
-/**
- * e_categories_config_open_dialog_for_entry:
- * entry: A GtkEntry on which to get/set the categories list.
- *
- * This is a self-contained function that lets you open a popup dialog for
- * the user to select a list of categories.
- *
- * The @entry parameter is used, at initialization time, as the list of
- * initial categories that are selected in the categories selection dialog.
- * Then, when the user commits its changes, the list of selected categories
- * is put back on the entry widget.
- */
-void
-e_categories_config_open_dialog_for_entry (GtkEntry *entry)
-{
- GtkDialog *dialog;
- const char *text;
- char *categories;
- int result;
-
- g_return_if_fail (entry != NULL);
- g_return_if_fail (GTK_IS_ENTRY (entry));
-
- if (!initialized)
- initialize_categories_config ();
-
- text = gtk_entry_get_text (GTK_ENTRY (entry));
- dialog = GTK_DIALOG (e_categories_new (text));
-
- g_object_set (dialog, "ecml", ecmlw, NULL);
-
- /* run the dialog */
- result = gtk_dialog_run (dialog);
-
- if (result == GTK_RESPONSE_OK) {
- g_object_get (dialog, "categories", &categories, NULL);
- gtk_entry_set_text (GTK_ENTRY (entry), categories);
- g_free (categories);
- }
-
- gtk_object_destroy (GTK_OBJECT (dialog));
-}
diff --git a/e-util/e-categories-config.h b/e-util/e-categories-config.h
deleted file mode 100644
index 3af14dfc7f..0000000000
--- a/e-util/e-categories-config.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Categories configuration.
- *
- * Author:
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright 2001, Ximian, Inc.
- */
-
-#ifndef __E_CATEGORIES_CONFIG_H__
-#define __E_CATEGORIES_CONFIG_H__
-
-#include <glib.h>
-#include <gdk/gdk.h>
-#include <gtk/gtkentry.h>
-
-G_BEGIN_DECLS
-
-const char *e_categories_config_get_color_for (const char *category);
-void e_categories_config_set_color_for (const char *category, const char *color);
-
-gboolean e_categories_config_get_icon_for (const char *category,
- GdkPixmap **icon,
- GdkBitmap **mask);
-const char *e_categories_config_get_icon_file_for (const char *category);
-void e_categories_config_set_icon_for (const char *category,
- const char *pixmap_file);
-
-void e_categories_config_open_dialog_for_entry (GtkEntry *entry);
-
-G_END_DECLS
-
-#endif
diff --git a/e-util/e-categories-master-list-wombat.c b/e-util/e-categories-master-list-wombat.c
deleted file mode 100644
index 9e45199877..0000000000
--- a/e-util/e-categories-master-list-wombat.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-categories-master-list.c: the master list of categories.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * (C) 1999, 2000 Ximian, Inc.
- */
-#include <config.h>
-
-#include "e-categories-master-list-wombat.h"
-#include "e-categories-config.h"
-#include "e-config-listener.h"
-
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-
-#define PARENT_TYPE e_categories_master_list_array_get_type ()
-
-#define d(x)
-
-struct _ECategoriesMasterListWombatPriv {
- EConfigListener *listener;
- guint listener_id;
-};
-
-static ECategoriesMasterListArrayClass *parent_class;
-
-static void
-ecmlw_load (ECategoriesMasterListWombat *ecmlw)
-{
- char *string;
- gboolean def;
-
- string = e_config_listener_get_string_with_default (ecmlw->priv->listener,
- "/apps/evolution/general/category_master_list",
- NULL,
- &def);
- /* parse the XML string */
- if (!def) {
- e_categories_master_list_array_from_string (E_CATEGORIES_MASTER_LIST_ARRAY (ecmlw),
- string);
- }
-
- d(g_print ("load: %s\n", string?string:"(nil)"));
-
- g_free (string);
-}
-
-static void
-ecmlw_save (ECategoriesMasterListWombat *ecmlw)
-{
- char *string;
-
- string = e_categories_master_list_array_to_string (E_CATEGORIES_MASTER_LIST_ARRAY (ecmlw));
-
- d(g_print ("save: %s\n", string));
-
- e_config_listener_set_string (ecmlw->priv->listener,
- "/apps/evolution/general/category_master_list",
- string);
-
- g_free (string);
-}
-
-/**
- * ecmlw_commit:
- * @ecml: the master list to remove from.
- */
-static void
-ecmlw_commit (ECategoriesMasterList *ecml)
-{
- ECategoriesMasterListWombat *ecmlw = E_CATEGORIES_MASTER_LIST_WOMBAT (ecml);
-
- ((ECategoriesMasterListClass *) parent_class)->commit (ecml);
-
- ecmlw_save (ecmlw);
-}
-
-
-/**
- * ecmlw_reset:
- * @ecml: the master list to reset.
- */
-static void
-ecmlw_reset (ECategoriesMasterList *ecml)
-{
- ECategoriesMasterListWombat *ecmlw = E_CATEGORIES_MASTER_LIST_WOMBAT (ecml);
-
- ((ECategoriesMasterListClass *) parent_class)->reset (ecml);
-
- ecmlw_save (ecmlw);
-}
-
-static void
-ecmlw_dispose (GObject *object)
-{
- ECategoriesMasterListWombat *ecmlw = E_CATEGORIES_MASTER_LIST_WOMBAT (object);
-
- if (ecmlw->priv) {
- /* remove the listener */
- g_signal_handler_disconnect (ecmlw->priv->listener,
- ecmlw->priv->listener_id);
-
- g_object_unref (ecmlw->priv->listener);
-
- g_free (ecmlw->priv);
- ecmlw->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-
-static void
-ecmlw_class_init (GObjectClass *object_class)
-{
- ECategoriesMasterListClass *ecml_class = E_CATEGORIES_MASTER_LIST_CLASS(object_class);
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- ecml_class->commit = ecmlw_commit;
-
- ecml_class->reset = ecmlw_reset ;
-
- object_class->dispose = ecmlw_dispose;
-}
-
-static void
-property_change_cb (EConfigListener *listener,
- char *key,
- gpointer user_data)
-{
- ecmlw_load (user_data);
-}
-
-static void
-ecmlw_init (ECategoriesMasterListWombat *ecmlw)
-{
- ecmlw->priv = g_new (ECategoriesMasterListWombatPriv, 1);
- ecmlw->priv->listener = e_config_listener_new ();
-
- /* add a listener */
- ecmlw->priv->listener_id =
- g_signal_connect (ecmlw->priv->listener,
- "key_changed",
- G_CALLBACK (property_change_cb),
- ecmlw);
-
- ecmlw_load (ecmlw);
-}
-
-GType
-e_categories_master_list_wombat_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (ECategoriesMasterListWombatClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ecmlw_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (ECategoriesMasterListWombat),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ecmlw_init,
- };
-
- type = g_type_register_static (PARENT_TYPE, "ECategoriesMasterListWombat", &info, 0);
- }
-
- return type;
-}
-
-ECategoriesMasterList *
-e_categories_master_list_wombat_new (void)
-{
- return E_CATEGORIES_MASTER_LIST (g_object_new (E_TYPE_CATEGORIES_MASTER_LIST_WOMBAT, NULL));
-}
diff --git a/e-util/e-categories-master-list-wombat.h b/e-util/e-categories-master-list-wombat.h
deleted file mode 100644
index 024d7644e7..0000000000
--- a/e-util/e-categories-master-list-wombat.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#ifndef _E_CATEGORIES_MASTER_LIST_WOMBAT_H_
-#define _E_CATEGORIES_MASTER_LIST_WOMBAT_H_
-
-#include <gal/widgets/e-categories-master-list-array.h>
-
-G_BEGIN_DECLS
-
-#define E_TYPE_CATEGORIES_MASTER_LIST_WOMBAT (e_categories_master_list_wombat_get_type ())
-#define E_CATEGORIES_MASTER_LIST_WOMBAT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_CATEGORIES_MASTER_LIST_WOMBAT, ECategoriesMasterListWombat))
-#define E_CATEGORIES_MASTER_LIST_WOMBAT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_CATEGORIES_MASTER_LIST_WOMBAT, ECategoriesMasterListWombatClass))
-#define E_IS_CATEGORIES_MASTER_LIST_WOMBAT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_CATEGORIES_MASTER_LIST_WOMBAT))
-#define E_IS_CATEGORIES_MASTER_LIST_WOMBAT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_CATEGORIES_MASTER_LIST_WOMBAT))
-
-typedef struct _ECategoriesMasterListWombatPriv ECategoriesMasterListWombatPriv;
-
-typedef struct {
- ECategoriesMasterListArray base;
- ECategoriesMasterListWombatPriv *priv;
-} ECategoriesMasterListWombat;
-
-typedef struct {
- ECategoriesMasterListArrayClass parent_class;
-} ECategoriesMasterListWombatClass;
-
-GType e_categories_master_list_wombat_get_type (void);
-ECategoriesMasterList *e_categories_master_list_wombat_new (void);
-
-G_END_DECLS
-
-#endif /* _E_CATEGORIES_MASTER_LIST_WOMBAT_H_ */
diff --git a/e-util/e-component-listener.c b/e-util/e-component-listener.c
deleted file mode 100644
index 1e7027f33d..0000000000
--- a/e-util/e-component-listener.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Component listener.
- *
- * Author:
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright 2002, Ximian, Inc.
- */
-
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-object.h>
-#include "e-component-listener.h"
-#include <libgnome/gnome-i18n.h>
-
-#define PARENT_TYPE GTK_TYPE_OBJECT
-
-struct _EComponentListenerPrivate {
- Bonobo_Unknown component;
-};
-
-static void e_component_listener_class_init (EComponentListenerClass *klass);
-static void e_component_listener_init (EComponentListener *cl, EComponentListenerClass *klass);
-static void e_component_listener_finalize (GObject *object);
-
-static GObjectClass *parent_class = NULL;
-static GList *watched_connections = NULL;
-
-enum {
- COMPONENT_DIED,
- LAST_SIGNAL
-};
-
-static guint comp_listener_signals[LAST_SIGNAL];
-
-static void
-connection_listen_cb (gpointer object, gpointer user_data)
-{
- GList *l, *next = NULL;
- EComponentListener *cl;
-
- for (l = watched_connections; l != NULL; l = next) {
- next = l->next;
- cl = l->data;
-
- switch (ORBit_small_get_connection_status (cl->priv->component)) {
- case ORBIT_CONNECTION_DISCONNECTED :
- watched_connections = g_list_delete_link (watched_connections, l);
-
- g_object_ref (cl);
- g_signal_emit (cl, comp_listener_signals[COMPONENT_DIED], 0);
- cl->priv->component = CORBA_OBJECT_NIL;
- g_object_unref (cl);
- break;
- default :
- break;
- }
- }
-}
-
-static void
-e_component_listener_class_init (EComponentListenerClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = e_component_listener_finalize;
- klass->component_died = NULL;
-
- comp_listener_signals[COMPONENT_DIED] =
- g_signal_new ("component_died",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EComponentListenerClass, component_died),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-static void
-e_component_listener_init (EComponentListener *cl, EComponentListenerClass *klass)
-{
- /* allocate internal structure */
- cl->priv = g_new (EComponentListenerPrivate, 1);
- cl->priv->component = CORBA_OBJECT_NIL;
-}
-
-static void
-e_component_listener_finalize (GObject *object)
-{
- EComponentListener *cl = (EComponentListener *) object;
-
- g_return_if_fail (E_IS_COMPONENT_LISTENER (cl));
-
- watched_connections = g_list_remove (watched_connections, cl);
-
- if (cl->priv->component != CORBA_OBJECT_NIL)
- cl->priv->component = CORBA_OBJECT_NIL;
-
- /* free memory */
- g_free (cl->priv);
- cl->priv = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-GType
-e_component_listener_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static GTypeInfo info = {
- sizeof (EComponentListenerClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) e_component_listener_class_init,
- NULL, NULL,
- sizeof (EComponentListener),
- 0,
- (GInstanceInitFunc) e_component_listener_init
- };
- type = g_type_register_static (G_TYPE_OBJECT, "EComponentListener", &info, 0);
- }
-
- return type;
-}
-
-/**
- * e_component_listener_new
- * @comp: Component to listen for.
- *
- * Create a new #EComponentListener object, which allows to listen
- * for a given component and get notified when that component dies.
- *
- * Returns: a component listener object.
- */
-EComponentListener *
-e_component_listener_new (Bonobo_Unknown comp)
-{
- EComponentListener *cl;
-
- g_return_val_if_fail (comp != NULL, NULL);
-
- cl = g_object_new (E_COMPONENT_LISTENER_TYPE, NULL);
- cl->priv->component = comp;
-
- /* watch the connection */
- ORBit_small_listen_for_broken (comp, G_CALLBACK (connection_listen_cb), cl);
- watched_connections = g_list_prepend (watched_connections, cl);
-
- return cl;
-}
-
-Bonobo_Unknown
-e_component_listener_get_component (EComponentListener *cl)
-{
- g_return_val_if_fail (E_IS_COMPONENT_LISTENER (cl), CORBA_OBJECT_NIL);
- return cl->priv->component;
-}
-
-void
-e_component_listener_set_component (EComponentListener *cl, Bonobo_Unknown comp)
-{
- g_return_if_fail (E_IS_COMPONENT_LISTENER (cl));
-
- cl->priv->component = comp;
- ORBit_small_listen_for_broken (comp, G_CALLBACK (connection_listen_cb), cl);
-}
diff --git a/e-util/e-component-listener.h b/e-util/e-component-listener.h
deleted file mode 100644
index 3f5694ecd0..0000000000
--- a/e-util/e-component-listener.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Component listener
- *
- * Author:
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright 2002, Ximian, Inc.
- */
-
-#ifndef __E_COMPONENT_LISTENER_H__
-#define __E_COMPONENT_LISTENER_H__
-
-#include <glib-object.h>
-#include <bonobo/Bonobo.h>
-
-G_BEGIN_DECLS
-
-#define E_COMPONENT_LISTENER_TYPE (e_component_listener_get_type ())
-#define E_COMPONENT_LISTENER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_COMPONENT_LISTENER_TYPE, EComponentListener))
-#define E_COMPONENT_LISTENER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_COMPONENT_LISTENER_TYPE, EComponentListenerClass))
-#define E_IS_COMPONENT_LISTENER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_COMPONENT_LISTENER_TYPE))
-#define E_IS_COMPONENT_LISTENER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_COMPONENT_LISTENER_TYPE))
-
-typedef struct _EComponentListenerPrivate EComponentListenerPrivate;
-
-typedef struct {
- GObject object;
- EComponentListenerPrivate *priv;
-} EComponentListener;
-
-typedef struct {
- GObjectClass parent_class;
-
- void (* component_died) (EComponentListener *cl);
-} EComponentListenerClass;
-
-GType e_component_listener_get_type (void);
-EComponentListener *e_component_listener_new (Bonobo_Unknown comp);
-
-Bonobo_Unknown e_component_listener_get_component (EComponentListener *cl);
-void e_component_listener_set_component (EComponentListener *cl,
- Bonobo_Unknown comp);
-
-G_END_DECLS
-
-#endif
diff --git a/e-util/e-config-listener.c b/e-util/e-config-listener.c
deleted file mode 100644
index ecc1b45fce..0000000000
--- a/e-util/e-config-listener.c
+++ /dev/null
@@ -1,607 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Configuration component listener
- *
- * Author:
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright 2002, Ximian, Inc.
- */
-
-#include <string.h>
-#include <gconf/gconf-client.h>
-#include "e-config-listener.h"
-
-#define PARENT_TYPE G_TYPE_OBJECT
-
-typedef struct {
- EConfigListener *cl;
- guint lid;
- char *key;
- GConfValueType type;
- union {
- gboolean v_bool;
- float v_float;
- long v_long;
- char *v_str;
- } value;
- gboolean used_default;
-} KeyData;
-
-struct _EConfigListenerPrivate {
- GConfClient *db;
- GHashTable *keys;
-};
-
-static void e_config_listener_class_init (EConfigListenerClass *klass);
-static void e_config_listener_init (EConfigListener *cl, EConfigListenerClass *klass);
-static void e_config_listener_finalize (GObject *object);
-
-static GObjectClass *parent_class = NULL;
-
-enum {
- KEY_CHANGED,
- LAST_SIGNAL
-};
-
-static guint config_listener_signals[LAST_SIGNAL];
-
-static void
-e_config_listener_class_init (EConfigListenerClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = e_config_listener_finalize;
- klass->key_changed = NULL;
-
- config_listener_signals[KEY_CHANGED] =
- g_signal_new ("key_changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EConfigListenerClass, key_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
-
- /* make sure GConf is initialized */
- if (!gconf_is_initialized ())
- gconf_init (0, NULL, NULL);
-}
-
-static void
-e_config_listener_init (EConfigListener *cl, EConfigListenerClass *klass)
-{
- /* allocate internal structure */
- cl->priv = g_new0 (EConfigListenerPrivate, 1);
-
- cl->priv->keys = g_hash_table_new (g_str_hash, g_str_equal);
- cl->priv->db = gconf_client_get_default ();
-}
-
-static void
-free_key_hash (gpointer key, gpointer value, gpointer user_data)
-{
- KeyData *kd = (KeyData *) value;
-
- g_return_if_fail (kd != NULL);
-
- gconf_client_notify_remove (kd->cl->priv->db, kd->lid);
-
- g_free (kd->key);
- switch (kd->type) {
- case GCONF_VALUE_STRING :
- g_free (kd->value.v_str);
- break;
- default :
- break;
- }
-
- g_free (kd);
-}
-
-static void
-e_config_listener_finalize (GObject *object)
-{
- EConfigListener *cl = (EConfigListener *) object;
-
- g_return_if_fail (E_IS_CONFIG_LISTENER (cl));
-
- g_hash_table_foreach (cl->priv->keys, (GHFunc) free_key_hash, NULL);
- g_hash_table_destroy (cl->priv->keys);
- cl->priv->keys = NULL;
-
- if (cl->priv->db != NULL) {
- g_object_unref (G_OBJECT (cl->priv->db));
- cl->priv->db = NULL;
- }
-
- g_free (cl->priv);
- cl->priv = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-GType
-e_config_listener_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EConfigListenerClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) e_config_listener_class_init,
- NULL,
- NULL,
- sizeof (EConfigListener),
- 0,
- (GInstanceInitFunc) e_config_listener_init
- };
- type = g_type_register_static (PARENT_TYPE, "EConfigListener", &info, 0);
- }
-
- return type;
-}
-
-/**
- * e_config_listener_new
- *
- * Create a new configuration listener, which is an object which
- * allows to listen for changes in the configuration database. It keeps
- * an updated copy of all requested configuration entries, so that
- * access is much quicker and instantaneous.
- *
- * Returns: the newly created listener.
- */
-EConfigListener *
-e_config_listener_new (void)
-{
- EConfigListener *cl;
-
- cl = g_object_new (E_CONFIG_LISTENER_TYPE, NULL);
- return cl;
-}
-
-static void
-property_change_cb (GConfEngine *engine,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
-{
- KeyData *kd = (KeyData *) user_data;
-
- g_return_if_fail (entry != NULL);
- g_return_if_fail (kd != NULL);
-
- /* free previous value */
- if (kd->type == GCONF_VALUE_STRING)
- g_free (kd->value.v_str);
-
- /* set new value */
- if (entry->value->type == GCONF_VALUE_BOOL) {
- kd->type = GCONF_VALUE_BOOL;
- kd->value.v_bool = gconf_value_get_bool (entry->value);
- } else if (entry->value->type == GCONF_VALUE_FLOAT) {
- kd->type = GCONF_VALUE_FLOAT;
- kd->value.v_float = gconf_value_get_float (entry->value);
- } else if (entry->value->type == GCONF_VALUE_INT) {
- kd->type = GCONF_VALUE_INT;
- kd->value.v_long = gconf_value_get_int (entry->value);
- } else if (entry->value->type == GCONF_VALUE_STRING) {
- kd->type = GCONF_VALUE_STRING;
- kd->value.v_str = g_strdup (gconf_value_get_string (entry->value));
- } else
- return;
-
- g_signal_emit (G_OBJECT (kd->cl), config_listener_signals[KEY_CHANGED], 0, kd->key);
-}
-
-static KeyData *
-add_key (EConfigListener *cl, const char *key, GConfValueType type,
- gpointer value, gboolean used_default)
-{
- KeyData *kd;
-
- /* add the key to our hash table */
- kd = g_new0 (KeyData, 1);
- kd->cl = cl;
- kd->key = g_strdup (key);
- kd->type = type;
- switch (type) {
- case GCONF_VALUE_BOOL :
- memcpy (&kd->value.v_bool, value, sizeof (gboolean));
- break;
- case GCONF_VALUE_FLOAT :
- memcpy (&kd->value.v_float, value, sizeof (float));
- break;
- case GCONF_VALUE_INT :
- memcpy (&kd->value.v_long, value, sizeof (long));
- break;
- case GCONF_VALUE_STRING :
- kd->value.v_str = g_strdup ((const char *) value);
- break;
- default :
- break;
- }
-
- kd->used_default = used_default;
-
- /* add the listener for changes */
- gconf_client_add_dir (cl->priv->db, key, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- kd->lid = gconf_client_notify_add (cl->priv->db, key,
- (GConfClientNotifyFunc) property_change_cb,
- kd, NULL, NULL);
-
- g_hash_table_insert (cl->priv->keys, kd->key, kd);
-
- return kd;
-}
-
-gboolean
-e_config_listener_get_boolean (EConfigListener *cl, const char *key)
-{
- return e_config_listener_get_boolean_with_default (cl, key, FALSE, NULL);
-}
-
-gboolean
-e_config_listener_get_boolean_with_default (EConfigListener *cl,
- const char *key,
- gboolean def,
- gboolean *used_default)
-{
- GConfValue *conf_value;
- gboolean value;
- KeyData *kd;
- gpointer orig_key, orig_value;
-
- g_return_val_if_fail (E_IS_CONFIG_LISTENER (cl), FALSE);
- g_return_val_if_fail (key != NULL, FALSE);
-
- /* search for the key in our hash table */
- if (!g_hash_table_lookup_extended (cl->priv->keys, key, &orig_key, &orig_value)) {
- /* not found, so retrieve it from the configuration database */
- conf_value = gconf_client_get (cl->priv->db, key, NULL);
- if (conf_value) {
- value = gconf_value_get_bool (conf_value);
- kd = add_key (cl, key, GCONF_VALUE_BOOL, &value, FALSE);
- gconf_value_free (conf_value);
-
- if (used_default != NULL)
- *used_default = FALSE;
- } else {
- value = def;
- kd = add_key (cl, key, GCONF_VALUE_BOOL, &def, TRUE);
-
- if (used_default != NULL)
- *used_default = TRUE;
- }
- } else {
- kd = (KeyData *) orig_value;
- g_assert (kd != NULL);
-
- if (kd->type == GCONF_VALUE_BOOL) {
- value = kd->value.v_bool;
- if (used_default != NULL)
- *used_default = kd->used_default;
- } else
- return FALSE;
- }
-
- return value;
-}
-
-float
-e_config_listener_get_float (EConfigListener *cl, const char *key)
-{
- return e_config_listener_get_float_with_default (cl, key, 0.0, NULL);
-}
-
-float
-e_config_listener_get_float_with_default (EConfigListener *cl,
- const char *key,
- float def,
- gboolean *used_default)
-{
- GConfValue *conf_value;
- float value;
- KeyData *kd;
- gpointer orig_key, orig_value;
-
- g_return_val_if_fail (E_IS_CONFIG_LISTENER (cl), -1);
- g_return_val_if_fail (key != NULL, -1);
-
- /* search for the key in our hash table */
- if (!g_hash_table_lookup_extended (cl->priv->keys, key, &orig_key, &orig_value)) {
- /* not found, so retrieve it from the configuration database */
- conf_value = gconf_client_get (cl->priv->db, key, NULL);
- if (conf_value) {
- value = gconf_value_get_float (conf_value);
- kd = add_key (cl, key, GCONF_VALUE_FLOAT, &value, FALSE);
- gconf_value_free (conf_value);
-
- if (used_default != NULL)
- *used_default = FALSE;
- } else {
- value = def;
- kd = add_key (cl, key, GCONF_VALUE_FLOAT, &def, TRUE);
-
- if (used_default != NULL)
- *used_default = TRUE;
- }
- } else {
- kd = (KeyData *) orig_value;
- g_assert (kd != NULL);
-
- if (kd->type == GCONF_VALUE_FLOAT) {
- value = kd->value.v_float;
- if (used_default != NULL)
- *used_default = kd->used_default;
- } else
- return -1;
- }
-
- return value;
-}
-
-long
-e_config_listener_get_long (EConfigListener *cl, const char *key)
-{
- return e_config_listener_get_long_with_default (cl, key, 0, NULL);
-}
-
-long
-e_config_listener_get_long_with_default (EConfigListener *cl,
- const char *key,
- long def,
- gboolean *used_default)
-{
- GConfValue *conf_value;
- long value;
- KeyData *kd;
- gpointer orig_key, orig_value;
-
- g_return_val_if_fail (E_IS_CONFIG_LISTENER (cl), -1);
- g_return_val_if_fail (key != NULL, -1);
-
- /* search for the key in our hash table */
- if (!g_hash_table_lookup_extended (cl->priv->keys, key, &orig_key, &orig_value)) {
- /* not found, so retrieve it from the configuration database */
- conf_value = gconf_client_get (cl->priv->db, key, NULL);
- if (conf_value) {
- value = gconf_value_get_int (conf_value);
- kd = add_key (cl, key, GCONF_VALUE_INT, &value, FALSE);
- gconf_value_free (conf_value);
-
- if (used_default != NULL)
- *used_default = FALSE;
- } else {
- value = def;
- kd = add_key (cl, key, GCONF_VALUE_INT, &def, TRUE);
-
- if (used_default != NULL)
- *used_default = TRUE;
- }
- } else {
- kd = (KeyData *) orig_value;
- g_assert (kd != NULL);
-
- if (kd->type == GCONF_VALUE_INT) {
- value = kd->value.v_long;
- if (used_default != NULL)
- *used_default = kd->used_default;
- } else
- return -1;
- }
-
- return value;
-}
-
-char *
-e_config_listener_get_string (EConfigListener *cl, const char *key)
-{
- return e_config_listener_get_string_with_default (cl, key, NULL, NULL);
-}
-
-char *
-e_config_listener_get_string_with_default (EConfigListener *cl,
- const char *key,
- const char *def,
- gboolean *used_default)
-{
- GConfValue *conf_value;
- char *str;
- KeyData *kd;
- gpointer orig_key, orig_value;
-
- g_return_val_if_fail (E_IS_CONFIG_LISTENER (cl), NULL);
- g_return_val_if_fail (key != NULL, NULL);
-
- /* search for the key in our hash table */
- if (!g_hash_table_lookup_extended (cl->priv->keys, key, &orig_key, &orig_value)) {
- /* not found, so retrieve it from the configuration database */
- conf_value = gconf_client_get (cl->priv->db, key, NULL);
- if (conf_value) {
- str = g_strdup (gconf_value_get_string (conf_value));
- kd = add_key (cl, key, GCONF_VALUE_STRING, (gpointer) str, FALSE);
- gconf_value_free (conf_value);
-
- if (used_default != NULL)
- *used_default = FALSE;
- } else {
- str = g_strdup (def);
- kd = add_key (cl, key, GCONF_VALUE_STRING, (gpointer) str, TRUE);
-
- if (used_default != NULL)
- *used_default = TRUE;
- }
- } else {
- kd = (KeyData *) orig_value;
- g_assert (kd != NULL);
-
- if (kd->type == GCONF_VALUE_STRING) {
- str = g_strdup (kd->value.v_str);
- if (used_default != NULL)
- *used_default = kd->used_default;
- } else
- return NULL;
- }
-
- return str;
-}
-
-void
-e_config_listener_set_boolean (EConfigListener *cl, const char *key, gboolean value)
-{
- KeyData *kd;
- GError *err = NULL;
-
- g_return_if_fail (E_IS_CONFIG_LISTENER (cl));
- g_return_if_fail (key != NULL);
-
- /* check that the value is not the same */
- if (value == e_config_listener_get_boolean_with_default (cl, key, 0, NULL))
- return;
-
- gconf_client_set_bool (cl->priv->db, key, value, &err);
- if (err) {
- g_warning ("e_config_listener_set_bool: %s", err->message);
- g_error_free (err);
- } else {
- /* update the internal copy */
- kd = g_hash_table_lookup (cl->priv->keys, key);
- if (kd)
- kd->value.v_bool = value;
- }
-}
-
-void
-e_config_listener_set_float (EConfigListener *cl, const char *key, float value)
-{
- KeyData *kd;
- GError *err = NULL;
-
- g_return_if_fail (E_IS_CONFIG_LISTENER (cl));
- g_return_if_fail (key != NULL);
-
- /* check that the value is not the same */
- if (value == e_config_listener_get_float_with_default (cl, key, 0, NULL))
- return;
-
- gconf_client_set_float (cl->priv->db, key, value, &err);
- if (err) {
- g_warning ("e_config_listener_set_float: %s", err->message);
- g_error_free (err);
- } else {
- /* update the internal copy */
- kd = g_hash_table_lookup (cl->priv->keys, key);
- if (kd)
- kd->value.v_float = value;
- }
-}
-
-void
-e_config_listener_set_long (EConfigListener *cl, const char *key, long value)
-{
- KeyData *kd;
- GError *err = NULL;
-
- g_return_if_fail (E_IS_CONFIG_LISTENER (cl));
- g_return_if_fail (key != NULL);
-
- /* check that the value is not the same */
- if (value == e_config_listener_get_long_with_default (cl, key, 0, NULL))
- return;
-
- gconf_client_set_int (cl->priv->db, key, value, &err);
- if (err) {
- g_warning ("e_config_listener_set_long: %s", err->message);
- g_error_free (err);
- } else {
- /* update the internal copy */
- kd = g_hash_table_lookup (cl->priv->keys, key);
- if (kd)
- kd->value.v_long = value;
- }
-}
-
-void
-e_config_listener_set_string (EConfigListener *cl, const char *key, const char *value)
-{
- char *s1, *s2;
- KeyData *kd;
- GError *err = NULL;
-
- g_return_if_fail (E_IS_CONFIG_LISTENER (cl));
- g_return_if_fail (key != NULL);
-
- /* check that the value is not the same */
- s1 = (char *) value;
- s2 = e_config_listener_get_string_with_default (cl, key, NULL, NULL);
- if (!strcmp (s1 ? s1 : "", s2 ? s2 : "")) {
- g_free (s2);
- return;
- }
-
- g_free (s2);
-
- gconf_client_set_string (cl->priv->db, key, value, &err);
- if (err) {
- g_warning ("e_config_listener_set_bool: %s", err->message);
- g_error_free (err);
- } else {
- /* update the internal copy */
- kd = g_hash_table_lookup (cl->priv->keys, key);
- if (kd) {
- g_free (kd->value.v_str);
- kd->value.v_str = g_strdup (value);
- }
- }
-}
-
-void
-e_config_listener_remove_value (EConfigListener *cl, const char *key)
-{
- gpointer orig_key, orig_value;
-
- g_return_if_fail (E_IS_CONFIG_LISTENER (cl));
- g_return_if_fail (key != NULL);
-
- if (g_hash_table_lookup_extended (cl->priv->keys, key, &orig_key, &orig_value)) {
- KeyData *kd = orig_value;
-
- g_hash_table_remove (cl->priv->keys, key);
- g_free (kd->key);
- if (kd->type == GCONF_VALUE_STRING)
- g_free (kd->value.v_str);
- gconf_client_notify_remove (cl->priv->db, kd->lid);
-
- g_free (kd);
- }
-
- gconf_client_unset (cl->priv->db, key, NULL);
-}
-
-void
-e_config_listener_remove_dir (EConfigListener *cl, const char *dir)
-{
- GSList *slist, *iter;
- const gchar *key;
-
- g_return_if_fail (E_IS_CONFIG_LISTENER (cl));
- g_return_if_fail (dir != NULL);
-
- slist = gconf_client_all_entries (cl->priv->db, dir, NULL);
- for (iter = slist; iter != NULL; iter = iter->next) {
- GConfEntry *entry = iter->data;
-
- key = gconf_entry_get_key (entry);
- gconf_client_unset (cl->priv->db, key, NULL);
- gconf_entry_free (entry);
- }
-
- g_slist_free (slist);
-}
diff --git a/e-util/e-config-listener.h b/e-util/e-config-listener.h
deleted file mode 100644
index 9b331a7c8a..0000000000
--- a/e-util/e-config-listener.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Configuration component listener
- *
- * Author:
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright 2002, Ximian, Inc.
- */
-
-#ifndef __E_CONFIG_LISTENER_H__
-#define __E_CONFIG_LISTENER_H__
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define E_CONFIG_LISTENER_TYPE (e_config_listener_get_type ())
-#define E_CONFIG_LISTENER(o) (G_TYPE_CHECK_INSTANCECAST ((o), E_CONFIG_LISTENER_TYPE, EConfigListener))
-#define E_CONFIG_LISTENER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CONFIG_LISTENER_TYPE, EConfigListenerClass))
-#define E_IS_CONFIG_LISTENER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CONFIG_LISTENER_TYPE))
-#define E_IS_CONFIG_LISTENER_CLASS(k) (GT_TYPE_CHECK_CLASS_TYPE ((k), E_CONFIG_LISTENER_TYPE))
-
-typedef struct _EConfigListenerPrivate EConfigListenerPrivate;
-
-typedef struct {
- GObject object;
- EConfigListenerPrivate *priv;
-} EConfigListener;
-
-typedef struct {
- GObjectClass parent_class;
-
- void (* key_changed) (EConfigListener *cl, const char *key);
-} EConfigListenerClass;
-
-GType e_config_listener_get_type (void);
-EConfigListener *e_config_listener_new (void);
-
-gboolean e_config_listener_get_boolean (EConfigListener *cl, const char *key);
-gboolean e_config_listener_get_boolean_with_default (EConfigListener *cl,
- const char *key,
- gboolean def,
- gboolean *used_default);
-float e_config_listener_get_float (EConfigListener *cl, const char *key);
-float e_config_listener_get_float_with_default (EConfigListener *cl,
- const char *key,
- float def,
- gboolean *used_default);
-long e_config_listener_get_long (EConfigListener *cl, const char *key);
-long e_config_listener_get_long_with_default (EConfigListener *cl,
- const char *key,
- long def,
- gboolean *used_default);
-char *e_config_listener_get_string (EConfigListener *cl, const char *key);
-char *e_config_listener_get_string_with_default (EConfigListener *cl,
- const char *key,
- const char *def,
- gboolean *used_default);
-void e_config_listener_set_boolean (EConfigListener *cl,
- const char *key,
- gboolean value);
-void e_config_listener_set_float (EConfigListener *cl,
- const char *key,
- float value);
-void e_config_listener_set_long (EConfigListener *cl,
- const char *key,
- long value);
-void e_config_listener_set_string (EConfigListener *cl,
- const char *key,
- const char *value);
-
-void e_config_listener_remove_value (EConfigListener *cl,
- const char *key);
-void e_config_listener_remove_dir (EConfigListener *cl,
- const char *dir);
-
-G_END_DECLS
-
-#endif
diff --git a/e-util/e-corba-utils.c b/e-util/e-corba-utils.c
deleted file mode 100644
index b92b247656..0000000000
--- a/e-util/e-corba-utils.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-html-utils.c
-*
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Ettore Perazzoli <ettore@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-corba-utils.h"
-
-
-const CORBA_char *
-e_safe_corba_string (const char *s)
-{
- if (s == NULL)
- return (CORBA_char *) "";
-
- return s;
-}
-
-CORBA_char *
-e_safe_corba_string_dup (const char *s)
-{
- return CORBA_string_dup (e_safe_corba_string (s));
-}
diff --git a/e-util/e-corba-utils.h b/e-util/e-corba-utils.h
deleted file mode 100644
index b48a6e2dab..0000000000
--- a/e-util/e-corba-utils.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-corba-utils.h
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Ettore Perazzoli <ettore@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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_CORBA_UTILS_H
-#define E_CORBA_UTILS_H
-
-#include <orbit/orbit.h>
-
-const CORBA_char *e_safe_corba_string (const char *s);
-CORBA_char *e_safe_corba_string_dup (const char *s);
-
-#endif
diff --git a/e-util/e-dialog-utils.c b/e-util/e-dialog-utils.c
deleted file mode 100644
index a37519297e..0000000000
--- a/e-util/e-dialog-utils.c
+++ /dev/null
@@ -1,284 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-dialog-utils.h
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- *
- * Authors:
- * Michael Meeks <michael@ximian.com>
- * Ettore Perazzoli <ettore@ximian.com>
- */
-
-#include "e-dialog-utils.h"
-
-#include <gdk/gdkx.h>
-
-#include <gtk/gtkfilesel.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkplug.h>
-
-#include <libgnome/gnome-i18n.h>
-#include <libgnome/gnome-util.h>
-
-
-/**
- * e_notice:
- * @parent: the dialog's parent window, or %NULL
- * @type: the type of dialog (%GTK_MESSAGE_INFO, %GTK_MESSAGE_WARNING,
- * or %GTK_MESSAGE_ERROR)
- * @format: printf-style format string, followed by arguments
- *
- * Convenience function to show a dialog with a message and an "OK"
- * button.
- **/
-void
-e_notice (gpointer parent, GtkMessageType type, const char *format, ...)
-{
- GtkWidget *dialog;
- va_list args;
- char *str;
-
- va_start (args, format);
- str = g_strdup_vprintf (format, args);
- dialog = gtk_message_dialog_new (NULL,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- type,
- GTK_BUTTONS_OK,
- "%s",
- str);
- va_end (args);
- g_free (str);
-
- if (parent)
- e_dialog_set_transient_for (GTK_WINDOW (dialog), parent);
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-}
-
-/**
- * e_notice_with_xid:
- * @parent: the dialog's parent window, or %NULL
- * @type: the type of dialog (%GTK_MESSAGE_INFO, %GTK_MESSAGE_WARNING,
- * or %GTK_MESSAGE_ERROR)
- * @format: printf-style format string, followed by arguments
- *
- * Like e_notice(), but takes a GdkNativeWindow for the parent
- * window argument.
- **/
-void
-e_notice_with_xid (GdkNativeWindow parent, GtkMessageType type, const char *format, ...)
-{
- GtkWidget *dialog;
- va_list args;
- char *str;
-
- va_start (args, format);
- str = g_strdup_vprintf (format, args);
- dialog = gtk_message_dialog_new (NULL,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- type,
- GTK_BUTTONS_OK,
- "%s",
- str);
- va_end (args);
- g_free (str);
-
- if (parent)
- e_dialog_set_transient_for_xid (GTK_WINDOW (dialog), parent);
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-}
-
-
-/* Tests whether or not an X Window is being managed by the
- * window manager.
- */
-static gboolean
-window_is_wm_toplevel (Display *display, Window window)
-{
- static Atom WM_STATE = None;
- unsigned long nitems, after;
- unsigned char *data = NULL;
- Atom type = None;
- int format;
-
- if (!WM_STATE)
- WM_STATE = XInternAtom (display, "WM_STATE", False);
-
- if (XGetWindowProperty (display, window, WM_STATE, 0, 0, False,
- AnyPropertyType, &type, &format,
- &nitems, &after, &data) == Success) {
- if (data)
- XFree((char*)data);
- if (type)
- return TRUE;
- }
- return FALSE;
-}
-
-/**
- * e_dialog_set_transient_for:
- * @dialog: a dialog window
- * @parent_widget: the parent for @dialog
- *
- * This sets the parent for @dialog to be @parent_widget. Unlike
- * gtk_window_set_transient_for(), this doesn't need @parent_widget to
- * be the actual toplevel, and also works if @parent_widget is
- * embedded as a Bonobo control by an out-of-process container.
- * @parent_widget must already be realized before calling this
- * function, but @dialog does not need to be.
- **/
-void
-e_dialog_set_transient_for (GtkWindow *dialog,
- GtkWidget *parent_widget)
-{
- GtkWidget *toplevel;
- Window parent, root_ret, *children;
- unsigned int numchildren;
- Display *display;
- Status status;
-
- g_return_if_fail (GTK_IS_WINDOW (dialog));
- g_return_if_fail (GTK_IS_WIDGET (parent_widget));
-
- toplevel = gtk_widget_get_toplevel (parent_widget);
- if (toplevel == NULL)
- return;
-
- if (!GTK_IS_PLUG (toplevel)) {
- gtk_window_set_transient_for (GTK_WINDOW (dialog),
- GTK_WINDOW (toplevel));
- return;
- }
-
- /* Find the top-level windowmanager-managed X Window */
- display = GDK_WINDOW_XDISPLAY (parent_widget->window);
- parent = GDK_WINDOW_XID (parent_widget->window);
-
- while (parent && !window_is_wm_toplevel (display, parent)) {
- status = XQueryTree (display, parent, &root_ret,
- &parent, &children, &numchildren);
- if (status != 0)
- XFree (children);
- }
-
- e_dialog_set_transient_for_xid (dialog, parent);
-}
-
-static void
-dialog_realized (GtkWindow *dialog, gpointer xid)
-{
- e_dialog_set_transient_for_xid (dialog, (GdkNativeWindow)xid);
-}
-
-/**
- * e_dialog_set_transient_for_xid:
- * @dialog: a dialog window
- * @xid: the X Window parent
- *
- * Like e_dialog_set_transient_for(), but use an XID to specify the
- * parent window.
- **/
-void
-e_dialog_set_transient_for_xid (GtkWindow *dialog,
- GdkNativeWindow xid)
-{
-#ifdef GDK_MULTIHEAD_SAFE
- GdkDisplay *display;
-#endif
- GdkWindow *parent;
-
- g_return_if_fail (GTK_IS_WINDOW (dialog));
-
- if (!GTK_WIDGET_REALIZED (dialog)) {
- g_signal_connect (dialog, "realize",
- G_CALLBACK (dialog_realized),
- (gpointer) xid);
- return;
- }
-
-#ifdef GDK_MULTIHEAD_SAFE
- display = gdk_drawable_get_display (GDK_DRAWABLE (GTK_WIDGET (dialog)->window));
- parent = gdk_window_lookup_for_display (display, xid);
- if (!parent)
- parent = gdk_window_foreign_new_for_display (display, xid);
-#else
- parent = gdk_window_lookup (xid);
- if (!parent)
- parent = gdk_window_foreign_new (xid);
-#endif
- g_return_if_fail (parent != NULL);
-
- gdk_window_set_transient_for (GTK_WIDGET (dialog)->window, parent);
-}
-
-
-
-static void
-save_ok (GtkWidget *widget, gpointer data)
-{
- GtkWidget *fs;
- char **filename = data;
- const char *path;
- int btn = GTK_RESPONSE_YES;
-
- fs = gtk_widget_get_toplevel (widget);
- path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs));
-
- if (g_file_test (path, G_FILE_TEST_IS_REGULAR)) {
- GtkWidget *dlg;
-
- dlg = gtk_message_dialog_new (GTK_WINDOW (fs), 0,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_YES_NO,
- _("A file by that name already exists.\n"
- "Overwrite it?"));
- gtk_window_set_title (GTK_WINDOW (dlg), _("Overwrite file?"));
-
- btn = gtk_dialog_run (GTK_DIALOG (dlg));
- gtk_widget_destroy (dlg);
- }
-
- if (btn == GTK_RESPONSE_YES)
- *filename = g_strdup (path);
-
- gtk_main_quit ();
-}
-
-char *
-e_file_dialog_save (const char *title)
-{
- GtkFileSelection *fs;
- char *path, *filename = NULL;
-
- fs = GTK_FILE_SELECTION (gtk_file_selection_new (title));
- path = g_strdup_printf ("%s/", g_get_home_dir ());
- gtk_file_selection_set_filename (fs, path);
- g_free (path);
-
- g_signal_connect (fs->ok_button, "clicked", G_CALLBACK (save_ok), &filename);
- g_signal_connect (fs->cancel_button, "clicked", G_CALLBACK (gtk_main_quit), NULL);
-
- gtk_widget_show (GTK_WIDGET (fs));
- gtk_grab_add (GTK_WIDGET (fs));
- gtk_main ();
-
- gtk_widget_destroy (GTK_WIDGET (fs));
-
- return filename;
-}
-
-
diff --git a/e-util/e-dialog-utils.h b/e-util/e-dialog-utils.h
deleted file mode 100644
index 6e6cff8fb9..0000000000
--- a/e-util/e-dialog-utils.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-dialog-utils.h
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- *
- * Author: Ettore Perazzoli <ettore@ximian.com>
- */
-
-#ifndef E_DIALOG_UTILS_H
-#define E_DIALOG_UTILS_H
-
-#include <gtk/gtkmessagedialog.h>
-
-void e_notice (gpointer parent,
- GtkMessageType type,
- const char *format,
- ...);
-void e_notice_with_xid (GdkNativeWindow parent,
- GtkMessageType type,
- const char *format,
- ...);
-
-void e_dialog_set_transient_for (GtkWindow *dialog,
- GtkWidget *parent_widget);
-void e_dialog_set_transient_for_xid (GtkWindow *dialog,
- GdkNativeWindow xid);
-
-char *e_file_dialog_save (const char *title);
-
-
-#endif
diff --git a/e-util/e-dialog-widgets.c b/e-util/e-dialog-widgets.c
deleted file mode 100644
index d245917682..0000000000
--- a/e-util/e-dialog-widgets.c
+++ /dev/null
@@ -1,811 +0,0 @@
-/* Evolution internal utilities - Glade dialog widget utilities
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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 <string.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 <libgnomeui/gnome-propertybox.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 (DialogHooks *hooks, GObject *dialog)
-{
- g_slist_free (hooks->whooks);
- hooks->whooks = NULL;
-
- g_free (hooks);
- g_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 = g_object_get_data ((GObject *) dialog, "dialog-hooks");
- if (!hooks) {
- hooks = g_new0 (DialogHooks, 1);
- g_object_set_data ((GObject *) dialog, "dialog-hooks", hooks);
- g_object_weak_ref ((GObject *) dialog, (GWeakNotify) 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)
-{
- const int *value_map;
- GSList *group, *l;
- int *value;
-
- group = gtk_radio_button_get_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)
- g_signal_connect (l->data, "toggled", G_CALLBACK (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)
-{
- const int *value_map;
- int *value;
-
- /* 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)
- g_signal_connect (l->data, "activate", G_CALLBACK (activate_cb), dialog);
- }
-}
-
-/* Gets the value of an option menu */
-static void
-get_option_menu_value (GtkOptionMenu *omenu, gpointer value_var, gpointer info)
-{
- const int *value_map;
- int *value;
-
- 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))
- g_signal_connect (toggle, "toggled", G_CALLBACK (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))
- g_signal_connect (adj, "value_changed", G_CALLBACK (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))
- g_signal_connect (editable, "changed", G_CALLBACK (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, const char *value)
-{
- int pos = 0;
-
- 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)
- 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. You should free it when you are done with it.
- * This function can return NULL if the string could not be converted from
- * GTK+'s encoding into UTF8.
- **/
-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, *l;
- int i;
-
- 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_get_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, *l;
- int i, 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_get_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;
- }
-
- g_assert (l != NULL);
-
- /* 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;
- g_signal_emit_by_name (adj, "value_changed", 0);
-}
-
-/**
- * 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;
- }
-
- g_assert (l != NULL);
-
- 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 a006092e04..0000000000
--- a/e-util/e-dialog-widgets.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Evolution internal utilities - Glade dialog widget utilities
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Author: Federico Mena-Quintero <federico@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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>
-
-
-
-void e_dialog_editable_set (GtkWidget *widget, const 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-gtk-utils.c b/e-util/e-gtk-utils.c
deleted file mode 100644
index 99df6fe923..0000000000
--- a/e-util/e-gtk-utils.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-gtk-utils.c
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- *
- * Author: Ettore Perazzoli
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtklayout.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkwidget.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkalignment.h>
-
-#include <gdk/gdkx.h>
-
-#include <X11/Xlib.h>
-
-#include "e-gtk-utils.h"
-
-
-void
-e_signal_connect_while_alive (void *instance,
- const char *name,
- GCallback callback,
- void *callback_data,
- void *alive_instance)
-{
- GClosure *closure;
-
- g_return_if_fail (GTK_IS_OBJECT (instance));
-
- closure = g_cclosure_new (callback, callback_data, NULL);
- g_object_watch_closure (alive_instance, closure);
- g_signal_connect_closure_by_id (instance, g_signal_lookup (name, G_OBJECT_TYPE (instance)), 0,
- closure, FALSE);
-}
-
-
-/* (Cut and pasted from Gtk.) */
-
-typedef struct DisconnectInfo {
- unsigned int signal_handler;
-
- GtkObject *object1;
- unsigned int disconnect_handler1;
-
- GtkObject *object2;
- unsigned int disconnect_handler2;
-} DisconnectInfo;
-
-static unsigned int
-alive_disconnecter (GtkObject *object,
- DisconnectInfo *info)
-{
- g_assert (info != NULL);
-
- g_signal_handler_disconnect (info->object1, info->disconnect_handler1);
- g_signal_handler_disconnect (info->object1, info->signal_handler);
- g_signal_handler_disconnect (info->object2, info->disconnect_handler2);
-
- g_free (info);
-
- return 0;
-}
-
-/**
- * e_gtk_signal_connect_full_while_alive:
- * @object:
- * @name:
- * @func:
- * @marshal:
- * @data:
- * @destroy_func:
- * @object_signal:
- * @after:
- * @alive_object:
- *
- * Connect a signal like `gtk_signal_connect_while_alive()', but with full
- * params like `gtk_signal_connect_full()'.
- **/
-void
-e_signal_connect_full_while_alive (void *instance,
- const char *name,
- GtkSignalFunc func,
- GtkCallbackMarshal marshal,
- void *data,
- GtkDestroyNotify destroy_func,
- gboolean instance_signal,
- gboolean after,
- void *alive_instance)
-{
- DisconnectInfo *info;
-
- g_return_if_fail (GTK_IS_OBJECT (instance));
- g_return_if_fail (name != NULL);
- g_return_if_fail (func != NULL);
- g_return_if_fail (GTK_IS_OBJECT (alive_instance));
-
- info = g_new (DisconnectInfo, 1);
-
- info->signal_handler = gtk_signal_connect_full (instance, name,
- func, marshal, data,
- destroy_func,
- instance_signal, after);
-
- info->object1 = instance;
- info->disconnect_handler1 = g_signal_connect (instance, "destroy",
- G_CALLBACK (alive_disconnecter), info);
-
- info->object2 = alive_instance;
- info->disconnect_handler2 = g_signal_connect (alive_instance, "destroy",
- G_CALLBACK (alive_disconnecter), info);
-}
-
-
-/* BackingStore support. */
-
-static void
-widget_realize_callback_for_backing_store (GtkWidget *widget,
- void *data)
-{
- XSetWindowAttributes attributes;
- GdkWindow *window;
-
- if (GTK_IS_LAYOUT (widget))
- window = GTK_LAYOUT (widget)->bin_window;
- else
- window = widget->window;
-
- attributes.backing_store = Always;
- XChangeWindowAttributes (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XWINDOW (window),
- CWBackingStore, &attributes);
-}
-
-/**
- * e_make_widget_backing_stored:
- * @widget: A GtkWidget
- *
- * Make sure that the window for @widget has the BackingStore attribute set to
- * Always when realized. This will allow the widget to be refreshed by the X
- * server even if the application is currently not responding to X events (this
- * is e.g. very useful for the splash screen).
- *
- * Notice that this will not work 100% in all cases as the server might not
- * support that or just refuse to do so.
- **/
-void
-e_make_widget_backing_stored (GtkWidget *widget)
-{
- g_signal_connect (widget, "realize", G_CALLBACK (widget_realize_callback_for_backing_store), NULL);
-}
-
-
-/**
- * e_gtk_button_new_with_icon:
- * @text: The mnemonic text for the label.
- * @stock: The name of the stock item to get the icon from.
- *
- * Create a gtk button with a custom label and a stock icon.
- *
- *
- * Return value: The widget.
- **/
-GtkWidget *
-e_gtk_button_new_with_icon(const char *text, const char *stock)
-{
- GtkWidget *button, *label;
- GtkStockItem item;
-
- button = gtk_button_new();
- label = gtk_label_new_with_mnemonic(text);
- gtk_label_set_mnemonic_widget((GtkLabel *)label, button);
-
- if (gtk_stock_lookup(stock, &item)) {
- GtkWidget *image, *hbox, *align;
-
- image = gtk_image_new_from_stock(stock, GTK_ICON_SIZE_BUTTON);
- hbox = gtk_hbox_new(FALSE, 2);
- align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
- gtk_box_pack_start((GtkBox *)hbox, image, FALSE, FALSE, 0);
- gtk_box_pack_end((GtkBox *)hbox, label, FALSE, FALSE, 0);
- gtk_container_add((GtkContainer *)align, hbox);
- gtk_container_add((GtkContainer *)button, align);
- gtk_widget_show_all(align);
- } else {
- gtk_misc_set_alignment((GtkMisc *)label, 0.5, 0.5);
- gtk_container_add((GtkContainer *)button, label);
- gtk_widget_show(label);
- }
-
- return button;
-}
diff --git a/e-util/e-gtk-utils.h b/e-util/e-gtk-utils.h
deleted file mode 100644
index cebb5b757d..0000000000
--- a/e-util/e-gtk-utils.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-gtk-utils.c
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef E_GTK_UTILS_H
-#define E_GTK_UTILS_H
-
-#include <gtk/gtkobject.h>
-#include <gtk/gtkradiobutton.h>
-
-void e_signal_connect_while_alive (void *object,
- const char *name,
- GCallback callback,
- void *data,
- void *alive_instance);
-
-void e_signal_connect_full_while_alive (void *instance,
- const char *name,
- GtkSignalFunc func,
- GtkCallbackMarshal marshal,
- void *data,
- GtkDestroyNotify destroy_func,
- gboolean object_signal,
- gboolean after,
- void *alive_instance);
-
-void e_make_widget_backing_stored (GtkWidget *widget);
-
-GtkWidget *e_gtk_button_new_with_icon(const char *text, const char *stock);
-
-#endif
diff --git a/e-util/e-gui-utils.c b/e-util/e-gui-utils.c
deleted file mode 100644
index fc8e5921b2..0000000000
--- a/e-util/e-gui-utils.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * GUI utility functions
- *
- * Authors:
- * Miguel de Icaza (miguel@ximian.com)
- * Chris Toshok (toshok@ximian.com)
- *
- * Copyright (C) 1999 Miguel de Icaza
- * Copyright (C) 2000-2003 Ximian, Inc.
- */
-#include <config.h>
-
-#include <string.h>
-
-#include "e-gui-utils.h"
-
-#include <glib.h>
-#include <gtk/gtkalignment.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkhbox.h>
-
-#include <libgnome/gnome-program.h>
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-
-#ifdef HAVE_LIBGNOMEUI_GNOME_ICON_LOOKUP_H
-#include <libgnomeui/gnome-icon-lookup.h>
-#else
-#include "art/empty.xpm"
-#endif
-
-GtkWidget *e_create_image_widget(gchar *name,
- gchar *string1, gchar *string2,
- gint int1, gint int2)
-{
- char *filename;
- GtkWidget *alignment = NULL;
- if (string1) {
- GtkWidget *w;
-
- if (*string1 == '/')
- filename = g_strdup(string1);
- else
- filename = g_build_filename (EVOLUTION_IMAGES, string1, NULL);
-
- w = gtk_image_new_from_file (filename);
-
- alignment = gtk_widget_new(gtk_alignment_get_type(),
- "child", w,
- "xalign", (double) 0,
- "yalign", (double) 0,
- "xscale", (double) 0,
- "yscale", (double) 0,
- NULL);
-
- gtk_widget_show_all (alignment);
- g_free (filename);
- }
-
- return alignment;
-}
-
-GtkWidget *
-e_button_new_with_stock_icon (const char *label_str, const char *stockid)
-{
- GtkWidget *button, *hbox, *label, *align, *image;
-
- button = gtk_button_new ();
-
- label = gtk_label_new_with_mnemonic (label_str);
-
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
-
- image = gtk_image_new_from_stock (stockid, GTK_ICON_SIZE_BUTTON);
- hbox = gtk_hbox_new (FALSE, 2);
-
- align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
-
- gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
- gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-
- gtk_container_add (GTK_CONTAINER (button), align);
- gtk_container_add (GTK_CONTAINER (align), hbox);
- gtk_widget_show_all (align);
-
- return button;
-}
-
-/**
- * e_icon_for_mime_type:
- * @mime_type: a MIME type
- * @size_hint: the size the caller plans to display the icon at
- *
- * Tries to find an icon representing @mime_type that will display
- * nicely at @size_hint by @size_hint pixels. The returned icon
- * may or may not actually be that size.
- *
- * Return value: a pixbuf, which the caller must unref when it is done
- **/
-GdkPixbuf *
-e_icon_for_mime_type (const char *mime_type, int size_hint)
-{
- char *icon_name, *icon_path = NULL;
- GdkPixbuf *pixbuf = NULL;
-
-#ifdef HAVE_LIBGNOMEUI_GNOME_ICON_LOOKUP_H
- static GnomeIconTheme *icon_theme = NULL;
-
- /* Try the icon theme. (GNOME 2.2 or Sun GNOME 2.0).
- * This will also look in GNOME VFS.
- */
-
- if (!icon_theme)
- icon_theme = gnome_icon_theme_new ();
-
- icon_name = gnome_icon_lookup (icon_theme, NULL, NULL, NULL, NULL,
- mime_type, 0, NULL);
- if (icon_name) {
- icon_path = gnome_icon_theme_lookup_icon (
- icon_theme, icon_name, size_hint, NULL, NULL);
- g_free (icon_name);
- }
-
-#else
- const char *vfs_icon_name;
-
- /* Try gnome-vfs. (gnome-vfs.mime itself doesn't offer much,
- * but other software packages may define icons for
- * themselves.
- */
- vfs_icon_name = gnome_vfs_mime_get_icon (mime_type);
- if (vfs_icon_name) {
- icon_path = gnome_program_locate_file (
- NULL, GNOME_FILE_DOMAIN_PIXMAP,
- vfs_icon_name, TRUE, NULL);
- }
-
- if (!icon_path) {
- char *p;
-
- /* Try gnome-mime-data. */
- icon_name = g_strdup_printf ("document-icons/gnome-%s.png",
- mime_type);
- p = strrchr (icon_name, '/');
- if (p)
- *p = '-';
-
- icon_path = gnome_program_locate_file (
- NULL, GNOME_FILE_DOMAIN_PIXMAP,
- icon_name, TRUE, NULL);
- g_free (icon_name);
- }
-
- if (!icon_path) {
- /* Use the generic document icon. */
- icon_path = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP,
- "document-icons/i-regular.png", TRUE, NULL);
- if (!icon_path) {
- g_warning ("Could not get any icon for %s!",mime_type);
- return gdk_pixbuf_new_from_xpm_data((const char **)empty_xpm);
- }
- }
-#endif
-
- pixbuf = gdk_pixbuf_new_from_file (icon_path, NULL);
- g_free (icon_path);
- return pixbuf;
-}
-
diff --git a/e-util/e-gui-utils.h b/e-util/e-gui-utils.h
deleted file mode 100644
index 8701949cb0..0000000000
--- a/e-util/e-gui-utils.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef E_GUI_UTILS_H
-#define E_GUI_UTILS_H
-
-#include <gtk/gtkwidget.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-control.h>
-
-GtkWidget *e_create_image_widget (gchar *name, gchar *string1, gchar *string2, gint int1, gint int2);
-
-GtkWidget *e_button_new_with_stock_icon (const char *label_str, const char *stockid);
-
-GdkPixbuf *e_icon_for_mime_type (const char *mime_type, int size);
-
-#endif /* E_GUI_UTILS_H */
diff --git a/e-util/e-host-utils.c b/e-util/e-host-utils.c
deleted file mode 100644
index 4ca2daa6dc..0000000000
--- a/e-util/e-host-utils.c
+++ /dev/null
@@ -1,380 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-host-utils.c
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- *
- * Author: Chris Toshok, Jeffrey Stedfast
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <errno.h>
-
-#include "e-host-utils.h"
-
-
-#if !defined (HAVE_GETHOSTBYNAME_R) || !defined (HAVE_GETHOSTBYADDR_R)
-G_LOCK_DEFINE_STATIC (gethost_mutex);
-#endif
-
-
-#define ALIGN(x) (((x) + (sizeof (char *) - 1)) & ~(sizeof (char *) - 1))
-
-#define GETHOST_PROCESS(h, host, buf, buflen, herr) G_STMT_START { \
- int num_aliases = 0, num_addrs = 0; \
- int req_length; \
- char *p; \
- int i; \
- \
- /* check to make sure we have enough room in our buffer */ \
- req_length = 0; \
- if (h->h_aliases) { \
- for (i = 0; h->h_aliases[i]; i++) \
- req_length += strlen (h->h_aliases[i]) + 1; \
- num_aliases = i; \
- } \
- \
- if (h->h_addr_list) { \
- for (i = 0; h->h_addr_list[i]; i++) \
- req_length += h->h_length; \
- num_addrs = i; \
- } \
- \
- req_length += sizeof (char *) * (num_aliases + 1); \
- req_length += sizeof (char *) * (num_addrs + 1); \
- req_length += strlen (h->h_name) + 1; \
- \
- if (buflen < req_length) { \
- *herr = ERANGE; \
- G_UNLOCK (gethost_mutex); \
- return ERANGE; \
- } \
- \
- /* we store the alias/addr pointers in the buffer */ \
- /* their addresses here. */ \
- p = buf; \
- if (num_aliases) { \
- host->h_aliases = (char **) p; \
- p += sizeof (char *) * (num_aliases + 1); \
- } else \
- host->h_aliases = NULL; \
- \
- if (num_addrs) { \
- host->h_addr_list = (char **) p; \
- p += sizeof (char *) * (num_addrs + 1); \
- } else \
- host->h_addr_list = NULL; \
- \
- /* copy the host name into the buffer */ \
- host->h_name = p; \
- strcpy (p, h->h_name); \
- p += strlen (h->h_name) + 1; \
- host->h_addrtype = h->h_addrtype; \
- host->h_length = h->h_length; \
- \
- /* copy the aliases/addresses into the buffer */ \
- /* and assign pointers into the hostent */ \
- *p = 0; \
- if (num_aliases) { \
- for (i = 0; i < num_aliases; i++) { \
- strcpy (p, h->h_aliases[i]); \
- host->h_aliases[i] = p; \
- p += strlen (h->h_aliases[i]); \
- } \
- host->h_aliases[num_aliases] = NULL; \
- } \
- \
- if (num_addrs) { \
- for (i = 0; i < num_addrs; i++) { \
- memcpy (p, h->h_addr_list[i], h->h_length); \
- host->h_addr_list[i] = p; \
- p += h->h_length; \
- } \
- host->h_addr_list[num_addrs] = NULL; \
- } \
-} G_STMT_END
-
-
-#ifdef ENABLE_IPv6
-/* some helpful utils for IPv6 lookups */
-#define IPv6_BUFLEN_MIN (sizeof (char *) * 3)
-
-static int
-ai_to_herr (int error)
-{
- switch (error) {
- case EAI_NONAME:
- case EAI_FAIL:
- return HOST_NOT_FOUND;
- break;
- case EAI_SERVICE:
- return NO_DATA;
- break;
- case EAI_ADDRFAMILY:
- return NO_ADDRESS;
- break;
- case EAI_NODATA:
- return NO_DATA;
- break;
- case EAI_MEMORY:
- return ENOMEM;
- break;
- case EAI_AGAIN:
- return TRY_AGAIN;
- break;
- case EAI_SYSTEM:
- return errno;
- break;
- default:
- return NO_RECOVERY;
- break;
- }
-}
-
-#endif /* ENABLE_IPv6 */
-
-/**
- * e_gethostbyname_r:
- * @name: the host to resolve
- * @host: a buffer pointing to a struct hostent to use for storage
- * @buf: a buffer to use for hostname storage
- * @buflen: the size of @buf
- * @herr: a pointer to a variable to store an error code in
- *
- * Resolves the hostname @name, in a hopefully-reentrant fashion.
- *
- * Return value: 0 on success, ERANGE if @buflen is too small,
- * "something else" otherwise (in which case *@herr will be set to
- * one of the gethostbyname() error codes).
- **/
-int
-e_gethostbyname_r (const char *name, struct hostent *host,
- char *buf, size_t buflen, int *herr)
-{
-#ifdef ENABLE_IPv6
- struct addrinfo hints, *res;
- int retval, len;
- char *addr;
-
- memset (&hints, 0, sizeof (struct addrinfo));
-#ifdef HAVE_AI_ADDRCONFIG
- hints.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;
-#else
- hints.ai_flags = AI_CANONNAME;
-#endif
- hints.ai_family = PF_UNSPEC;
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_protocol = IPPROTO_TCP;
-
- if ((retval = getaddrinfo (name, NULL, &hints, &res)) != 0) {
- *herr = ai_to_herr (retval);
- return -1;
- }
-
- len = ALIGN (strlen (res->ai_canonname) + 1);
- if (buflen < IPv6_BUFLEN_MIN + len + res->ai_addrlen + sizeof (char *))
- return ERANGE;
-
- /* h_name */
- strcpy (buf, res->ai_canonname);
- host->h_name = buf;
- buf += len;
-
- /* h_aliases */
- ((char **) buf)[0] = NULL;
- host->h_aliases = (char **) buf;
- buf += sizeof (char *);
-
- /* h_addrtype and h_length */
- host->h_length = res->ai_addrlen;
- if (res->ai_family == PF_INET6) {
- host->h_addrtype = AF_INET6;
-
- addr = (char *) &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr;
- } else {
- host->h_addrtype = AF_INET;
-
- addr = (char *) &((struct sockaddr_in *) res->ai_addr)->sin_addr;
- }
-
- memcpy (buf, addr, host->h_length);
- addr = buf;
- buf += ALIGN (host->h_length);
-
- /* h_addr_list */
- ((char **) buf)[0] = addr;
- ((char **) buf)[1] = NULL;
- host->h_addr_list = (char **) buf;
-
- freeaddrinfo (res);
-
- return 0;
-#else /* No support for IPv6 addresses */
-#ifdef HAVE_GETHOSTBYNAME_R
-#ifdef GETHOSTBYNAME_R_FIVE_ARGS
- if (gethostbyname_r (name, host, buf, buflen, herr))
- return 0;
- else
- return errno;
-#else
- struct hostent *hp;
- int retval;
-
- retval = gethostbyname_r (name, host, buf, buflen, &hp, herr);
- if (hp != NULL)
- *herr = 0;
- return retval;
-#endif
-#else /* No support for gethostbyname_r */
- struct hostent *h;
-
- G_LOCK (gethost_mutex);
-
- h = gethostbyname (name);
-
- if (!h) {
- *herr = h_errno;
- G_UNLOCK (gethost_mutex);
- return -1;
- }
-
- GETHOST_PROCESS (h, host, buf, buflen, herr);
-
- G_UNLOCK (gethost_mutex);
-
- return 0;
-#endif /* HAVE_GETHOSTBYNAME_R */
-#endif /* ENABLE_IPv6 */
-}
-
-
-/**
- * e_gethostbyaddr_r:
- * @addr: the addr to resolve
- * @addrlen: address length
- * @type: AF type
- * @host: a buffer pointing to a struct hostent to use for storage
- * @buf: a buffer to use for hostname storage
- * @buflen: the size of @buf
- * @herr: a pointer to a variable to store an error code in
- *
- * Resolves the address @addr, in a hopefully-reentrant fashion.
- *
- * Return value: 0 on success, ERANGE if @buflen is too small,
- * "something else" otherwise (in which case *@herr will be set to
- * one of the gethostbyaddr() error codes).
- **/
-int
-e_gethostbyaddr_r (const char *addr, int addrlen, int type, struct hostent *host,
- char *buf, size_t buflen, int *herr)
-{
-#ifdef ENABLE_IPv6
- int retval, len;
-
- if ((retval = getnameinfo (addr, addrlen, buf, buflen, NULL, 0, NI_NAMEREQD)) != 0) {
- *herr = ai_to_herr (retval);
- return -1;
- }
-
- len = ALIGN (strlen (buf) + 1);
- if (buflen < IPv6_BUFLEN_MIN + len + addrlen + sizeof (char *))
- return ERANGE;
-
- /* h_name */
- host->h_name = buf;
- buf += len;
-
- /* h_aliases */
- ((char **) buf)[0] = NULL;
- host->h_aliases = (char **) buf;
- buf += sizeof (char *);
-
- /* h_addrtype and h_length */
- host->h_length = addrlen;
- host->h_addrtype = type;
-
- memcpy (buf, addr, host->h_length);
- addr = buf;
- buf += ALIGN (host->h_length);
-
- /* h_addr_list */
- ((char **) buf)[0] = addr;
- ((char **) buf)[1] = NULL;
- host->h_addr_list = (char **) buf;
-
- return 0;
-#else /* No support for IPv6 addresses */
-#ifdef HAVE_GETHOSTBYADDR_R
-#ifdef GETHOSTBYADDR_R_SEVEN_ARGS
- if (gethostbyaddr_r (addr, addrlen, type, host, buf, buflen, herr))
- return 0;
- else
- return errno;
-#else
- struct hostent *hp;
- int retval;
-
- retval = gethostbyaddr_r (addr, addrlen, type, host, buf, buflen, &hp, herr);
- if (hp != NULL) {
- *herr = 0;
- retval = 0;
- } else if (retval == 0) {
- /* glibc 2.3.2 workaround - it seems that
- * gethostbyaddr_r will sometimes return 0 on fail and
- * fill @host with garbage strings from /etc/hosts
- * (failure to parse the file? who knows). Luckily, it
- * seems that we can rely on @hp being NULL on
- * fail.
- */
- retval = -1;
- }
-
- return retval;
-#endif
-#else /* No support for gethostbyaddr_r */
- struct hostent *h;
-
- G_LOCK (gethost_mutex);
-
- h = gethostbyaddr (addr, addrlen, type);
-
- if (!h) {
- *herr = h_errno;
- G_UNLOCK (gethost_mutex);
- return -1;
- }
-
- GETHOST_PROCESS (h, host, buf, buflen, herr);
-
- G_UNLOCK (gethost_mutex);
-
- return 0;
-#endif /* HAVE_GETHOSTBYADDR_R */
-#endif /* ENABLE_IPv6 */
-}
diff --git a/e-util/e-host-utils.h b/e-util/e-host-utils.h
deleted file mode 100644
index 543a9d3cc2..0000000000
--- a/e-util/e-host-utils.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-host-utils.h
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- *
- * Authors: Chris Toshok, Jeffrey Stedfast
- */
-
-#ifndef E_HOST_UTILS_H
-#define E_HOST_UTILS_H
-
-#include <sys/types.h>
-#include <netdb.h>
-
-/* gethostbyname_r implementation that works for systems without a
- native gethostbyname_r. if you use this, you must make sure to
- *only* use this - it can't even coexist with naked calls to
- gethostbyname (even if they exist in libraries.) yes, this loses
- in many ways. blame your local OS developer. */
-int e_gethostbyname_r (const char *name, struct hostent *host, char *buf, size_t buflen, int *herr);
-
-int e_gethostbyaddr_r (const char *addr, int len, int type, struct hostent *host, char *buf, size_t buflen, int *herr);
-
-#endif /* E_HOST_UTILS_H */
diff --git a/e-util/e-html-utils.c b/e-util/e-html-utils.c
deleted file mode 100644
index 762627b259..0000000000
--- a/e-util/e-html-utils.c
+++ /dev/null
@@ -1,521 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-html-utils.c
- * Copyright (C) 2000-2003 Ximian, Inc.
- * Author: Dan Winship <danw@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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 <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-
-#include "e-html-utils.h"
-
-static char *
-check_size (char **buffer, int *buffer_size, char *out, int len)
-{
- if (out + len + 1> *buffer + *buffer_size) {
- int index = out - *buffer;
-
- *buffer_size = MAX (index + len + 1, *buffer_size * 2);
- *buffer = g_realloc (*buffer, *buffer_size);
- out = *buffer + index;
- }
- return out;
-}
-
-/* auto-urlification hints: the goal is not to be strictly RFC-compliant,
- * but rather to accurately distinguish urls/addresses from non-urls/
- * addresses in real-world email.
- *
- * 1 = non-email-address chars: ()<>@,;:\"[]`'{}|
- * 2 = trailing url garbage: ,.!?;:>)]}`'-_
- * 4 = allowed dns chars
- * 8 = non-url chars: "|
- */
-static int special_chars[] = {
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* nul - 0x0f */
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* 0x10 - 0x1f */
- 9, 2, 9, 0, 0, 0, 0, 3, 1, 3, 0, 0, 3, 6, 6, 0, /* sp - / */
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 1, 0, 3, 2, /* 0 - ? */
- 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* @ - O */
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 3, 0, 2, /* P - _ */
- 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* ` - o */
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 9, 3, 0, 3 /* p - del */
-};
-
-#define is_addr_char(c) (c < 128 && !(special_chars[c] & 1))
-#define is_url_char(c) (c < 128 && !(special_chars[c] & 8))
-#define is_trailing_garbage(c) (c > 127 || (special_chars[c] & 2))
-#define is_domain_name_char(c) (c < 128 && (special_chars[c] & 4))
-
-/* (http|https|ftp|nntp)://[^ "|/]+\.([^ "|]*[^ ,.!?;:>)\]}`'"|_-])+ */
-/* www\.[A-Za-z0-9.-]+(/([^ "|]*[^ ,.!?;:>)\]}`'"|_-])+) */
-
-static char *
-url_extract (const unsigned char **text, gboolean full_url)
-{
- const unsigned char *end = *text, *p;
- char *out;
-
- while (*end && is_url_char (*end))
- end++;
-
- /* Back up if we probably went too far. */
- while (end > *text && is_trailing_garbage (*(end - 1)))
- end--;
-
- if (full_url) {
- /* Make sure this really looks like a URL. */
- p = memchr (*text, ':', end - *text);
- if (!p || end - p < 4)
- return NULL;
- } else {
- /* Make sure this really looks like a hostname. */
- p = memchr (*text, '.', end - *text);
- if (!p || p >= end - 2)
- return NULL;
- p = memchr (p + 2, '.', end - (p + 2));
- if (!p || p >= end - 2)
- return NULL;
- }
-
- out = g_strndup (*text, end - *text);
- *text = end;
- return out;
-}
-
-static char *
-email_address_extract (const unsigned char **cur, char **out, const unsigned char *linestart)
-{
- const unsigned char *start, *end, *dot;
- char *addr;
-
- /* *cur points to the '@'. Look backward for a valid local-part */
- for (start = *cur; start - 1 >= linestart && is_addr_char (*(start - 1)); start--)
- ;
- if (start == *cur)
- return NULL;
- if (start > linestart + 2 &&
- start[-1] == ':' && start[0] == '/' && start[1] == '/')
- return NULL;
-
- /* Now look forward for a valid domain part */
- for (end = *cur + 1, dot = NULL; is_domain_name_char (*end); end++) {
- if (*end == '.' && !dot)
- dot = end;
- }
- if (!dot)
- return NULL;
-
- /* Remove trailing garbage */
- while (is_trailing_garbage (*(end - 1)))
- end--;
- if (dot > end)
- return NULL;
-
- addr = g_strndup (start, end - start);
- *out -= *cur - start;
- *cur = end;
-
- return addr;
-}
-
-static gboolean
-is_citation (const unsigned char *c, gboolean saw_citation)
-{
- const unsigned char *p;
-
- if (*c != '>')
- return FALSE;
-
- /* A line that starts with a ">" is a citation, unless it's
- * just mbox From-mangling...
- */
- if (strncmp (c, ">From ", 6) != 0)
- return TRUE;
-
- /* If the previous line was a citation, then say this
- * one is too.
- */
- if (saw_citation)
- return TRUE;
-
- /* Same if the next line is */
- p = (const unsigned char *)strchr ((const char *)c, '\n');
- if (p && *++p == '>')
- return TRUE;
-
- /* Otherwise, it was just an isolated ">From" line. */
- return FALSE;
-}
-
-/**
- * e_text_to_html_full:
- * @input: a NUL-terminated input buffer
- * @flags: some combination of the E_TEXT_TO_HTML_* flags defined
- * in e-html-utils.h
- * @color: color for citation highlighting
- *
- * 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.
- *
- * - E_TEXT_TO_HTML_CONVERT_ADDRESSES: wrap <a href="mailto:..."> </a> around
- * strings that look like mail addresses.
- *
- * - E_TEXT_TO_HTML_MARK_CITATION: wrap <font color="..."> </font> around
- * citations (lines beginning with "> ", etc).
- *
- * - E_TEXT_TO_HTML_ESCAPE_8BIT: flatten everything to US-ASCII
- *
- * - E_TEXT_TO_HTML_CITE: quote the text with "> " at the start of each
- * line.
- **/
-char *
-e_text_to_html_full (const char *input, unsigned int flags, guint32 color)
-{
- const unsigned char *cur, *next, *linestart;
- char *buffer = NULL;
- char *out = NULL;
- int buffer_size = 0, col;
- gboolean colored = FALSE, saw_citation = FALSE;
-
- /* 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>");
-
- col = 0;
-
- for (cur = linestart = input; cur && *cur; cur = next) {
- gunichar u;
-
- if (flags & E_TEXT_TO_HTML_MARK_CITATION && col == 0) {
- saw_citation = is_citation (cur, saw_citation);
- if (saw_citation) {
- if (!colored) {
- gchar font [25];
-
- g_snprintf (font, 25, "<FONT COLOR=\"#%06x\">", color);
-
- out = check_size (&buffer, &buffer_size, out, 25);
- out += sprintf (out, "%s", font);
- colored = TRUE;
- }
- } else if (colored) {
- gchar *no_font = "</FONT>";
-
- out = check_size (&buffer, &buffer_size, out, 9);
- out += sprintf (out, "%s", no_font);
- colored = FALSE;
- }
-
- /* Display mbox-mangled ">From" as "From" */
- if (*cur == '>' && !saw_citation)
- cur++;
- } else if (flags & E_TEXT_TO_HTML_CITE && col == 0) {
- out = check_size (&buffer, &buffer_size, out, 5);
- out += sprintf (out, "&gt; ");
- }
-
- u = g_utf8_get_char (cur);
- if (g_unichar_isalpha (u) &&
- (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) ||
- !strncasecmp (cur, "file:", 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) &&
- is_url_char (*(cur + 4))) {
- tmpurl = url_extract (&cur, FALSE);
- if (tmpurl) {
- 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);
- }
-
- if (!*cur)
- break;
- u = g_utf8_get_char (cur);
- }
-
- if (u == '@' && (flags & E_TEXT_TO_HTML_CONVERT_ADDRESSES)) {
- char *addr, *dispaddr, *outaddr;
-
- addr = email_address_extract (&cur, &out, linestart);
- if (addr) {
- dispaddr = e_text_to_html (addr, 0);
- outaddr = g_strdup_printf ("<a href=\"mailto:%s\">%s</a>",
- addr, dispaddr);
- out = check_size (&buffer, &buffer_size, out, strlen (outaddr));
- out += sprintf (out, "%s", outaddr);
- col += strlen (addr);
- g_free (addr);
- g_free (dispaddr);
- g_free (outaddr);
-
- if (!*cur)
- break;
- u = g_utf8_get_char (cur);
- }
- }
-
- if (!g_unichar_validate (u)) {
- /* Sigh. Someone sent undeclared 8-bit data.
- * Assume it's iso-8859-1.
- */
- u = *cur;
- next = cur + 1;
- } else
- next = g_utf8_next_char (cur);
-
- out = check_size (&buffer, &buffer_size, out, 10);
-
- switch (u) {
- 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;
- linestart = 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, 7);
- 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' ||
- *(cur - 1) == '\n') {
- strcpy (out, "&nbsp;");
- out += 6;
- col++;
- break;
- }
- }
- /* otherwise, FALL THROUGH */
-
- default:
- if ((u >= 0x20 && u < 0x80) ||
- (u == '\r' || u == '\t')) {
- /* Default case, just copy. */
- *out++ = u;
- } else {
- if (flags & E_TEXT_TO_HTML_ESCAPE_8BIT)
- *out++ = '?';
- else
- out += g_snprintf(out, 9, "&#%d;", u);
- }
- col++;
- break;
- }
- }
-
- out = check_size (&buffer, &buffer_size, out, 7);
- if (flags & E_TEXT_TO_HTML_PRE)
- strcpy (out, "</PRE>");
- else
- *out = '\0';
-
- return buffer;
-}
-
-char *
-e_text_to_html (const char *input, unsigned int flags)
-{
- return e_text_to_html_full (input, flags, 0);
-}
-
-
-#ifdef E_HTML_UTILS_TEST
-
-struct {
- char *text, *url;
-} url_tests[] = {
- { "bob@foo.com", "mailto:bob@foo.com" },
- { "Ends with bob@foo.com", "mailto:bob@foo.com" },
- { "bob@foo.com at start", "mailto:bob@foo.com" },
- { "bob@foo.com.", "mailto:bob@foo.com" },
- { "\"bob@foo.com\"", "mailto:bob@foo.com" },
- { "<bob@foo.com>", "mailto:bob@foo.com" },
- { "(bob@foo.com)", "mailto:bob@foo.com" },
- { "bob@foo.com, 555-9999", "mailto:bob@foo.com" },
- { "|bob@foo.com|555-9999|", "mailto:bob@foo.com" },
- { "bob@ no match bob@", NULL },
- { "@foo.com no match @foo.com", NULL },
- { "\"bob\"@foo.com", NULL },
- { "M@ke money fast!", NULL },
- { "ASCII art @_@ @>->-", NULL },
-
- { "http://www.foo.com", "http://www.foo.com" },
- { "Ends with http://www.foo.com", "http://www.foo.com" },
- { "http://www.foo.com at start", "http://www.foo.com" },
- { "http://www.foo.com.", "http://www.foo.com" },
- { "http://www.foo.com/.", "http://www.foo.com/" },
- { "<http://www.foo.com>", "http://www.foo.com" },
- { "(http://www.foo.com)", "http://www.foo.com" },
- { "http://www.foo.com, 555-9999", "http://www.foo.com" },
- { "|http://www.foo.com|555-9999|", "http://www.foo.com" },
- { "foo http://www.foo.com/ bar", "http://www.foo.com/" },
- { "foo http://www.foo.com/index.html bar", "http://www.foo.com/index.html" },
- { "foo http://www.foo.com/q?99 bar", "http://www.foo.com/q?99" },
- { "foo http://www.foo.com/;foo=bar&baz=quux bar", "http://www.foo.com/;foo=bar&baz=quux" },
- { "foo http://www.foo.com/index.html#anchor bar", "http://www.foo.com/index.html#anchor" },
- { "http://www.foo.com/index.html; foo", "http://www.foo.com/index.html" },
- { "http://www.foo.com/index.html: foo", "http://www.foo.com/index.html" },
- { "http://www.foo.com/index.html-- foo", "http://www.foo.com/index.html" },
- { "http://www.foo.com/index.html?", "http://www.foo.com/index.html" },
- { "http://www.foo.com/index.html!", "http://www.foo.com/index.html" },
- { "\"http://www.foo.com/index.html\"", "http://www.foo.com/index.html" },
- { "'http://www.foo.com/index.html'", "http://www.foo.com/index.html" },
- { "http://bob@www.foo.com/bar/baz/", "http://bob@www.foo.com/bar/baz/" },
- { "http no match http", NULL },
- { "http: no match http:", NULL },
- { "http:// no match http://", NULL },
- { "unrecognized://bob@foo.com/path", NULL },
-
- { "src/www.c", NULL },
- { "Ewwwwww.Gross.", NULL },
-
-};
-int num_url_tests = G_N_ELEMENTS (url_tests);
-
-int
-main (int argc, char **argv)
-{
- int i, errors = 0;
- char *html, *url, *p;
-
- for (i = 0; i < num_url_tests; i++) {
- html = e_text_to_html (url_tests[i].text, E_TEXT_TO_HTML_CONVERT_URLS | E_TEXT_TO_HTML_CONVERT_ADDRESSES);
-
- url = strstr (html, "href=\"");
- if (url) {
- url += 6;
- p = strchr (url, '"');
- if (p)
- *p = '\0';
-
- while ((p = strstr (url, "&amp;")))
- memmove (p + 1, p + 5, strlen (p + 5) + 1);
- }
-
- if ((url && (!url_tests[i].url || strcmp (url, url_tests[i].url) != 0)) ||
- (!url && url_tests[i].url)) {
- printf ("FAILED on \"%s\" -> %s\n (got %s)\n\n",
- url_tests[i].text,
- url_tests[i].url ? url_tests[i].url : "(nothing)",
- url ? url : "(nothing)");
- errors++;
- }
-
- g_free (html);
- }
-
- printf ("\n%d errors\n", errors);
- return errors;
-}
-#endif
diff --git a/e-util/e-html-utils.h b/e-util/e-html-utils.h
deleted file mode 100644
index 551996e089..0000000000
--- a/e-util/e-html-utils.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-html-utils.c */
-/*
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Dan Winship <danw@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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__
-
-#include <glib.h>
-
-#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)
-#define E_TEXT_TO_HTML_MARK_CITATION (1 << 4)
-#define E_TEXT_TO_HTML_CONVERT_ADDRESSES (1 << 5)
-#define E_TEXT_TO_HTML_ESCAPE_8BIT (1 << 6)
-#define E_TEXT_TO_HTML_CITE (1 << 7)
-
-char *e_text_to_html_full (const char *input, unsigned int flags, guint32 color);
-char *e_text_to_html (const char *input, unsigned int flags);
-
-#endif /* __E_HTML_UTILS__ */
diff --git a/e-util/e-i18n.h b/e-util/e-i18n.h
deleted file mode 100644
index 829b2480aa..0000000000
--- a/e-util/e-i18n.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-i18n.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * Copied from gnome-i18nP.h, because this header is typically not installed
- *
- * This file has to be included before any file from the GNOME libraries
- * to have this override the definitions that are pulled from the gnome-i18n.h
- *
- * the difference is that gnome-i18n.h is used for applications, and this is
- * used by libraries (because libraries have to use dcgettext instead of
- * gettext and they need to provide the translation domain, unlike apps).
- *
- * So you can just put this after you include config.h
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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_I18N_H__
-#define __E_I18N_H__
-
-#include <libgnome/gnome-i18n.h>
-
-G_BEGIN_DECLS
-
-#ifdef ENABLE_NLS
- /* this function is defined in e-util.c */
- extern char *e_gettext (const char *msgid);
-# undef _
-# ifdef GNOME_EXPLICIT_TRANSLATION_DOMAIN
-/* No parentheses allowed here since that breaks string concatenation. */
-# define E_I18N_DOMAIN GNOME_EXPLICIT_TRANSLATION_DOMAIN
-# else
-/* No parentheses allowed here since that breaks string concatenation. */
-# define E_I18N_DOMAIN PACKAGE
-# endif
-# define _(String) e_gettext (String)
-# ifdef gettext_noop
-# define N_(String) gettext_noop (String)
-# else
-# define N_(String) (String)
-# endif
-#else
-/* Stubs that do something close enough. */
-# define textdomain(String) (String)
-# define gettext(String) (String)
-# define dgettext(Domain,Message) (Message)
-# define dcgettext(Domain,Message,Type) (Message)
-# define bindtextdomain(Domain,Directory) (Domain)
-# define _(String) (String)
-# define N_(String) (String)
-/* No parentheses allowed here since that breaks string concatenation. */
-# define E_I18N_DOMAIN ""
-#endif
-
-G_END_DECLS
-
-#endif /* __E_I18N_H__ */
diff --git a/e-util/e-iconv.c b/e-util/e-iconv.c
deleted file mode 100644
index 3236521438..0000000000
--- a/e-util/e-iconv.c
+++ /dev/null
@@ -1,614 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-iconv.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- * Jeffery Stedfast <fejj@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include <glib.h>
-#include "e-iconv.h"
-
-#include <locale.h>
-
-#ifdef HAVE_CODESET
-#include <langinfo.h>
-#endif
-
-#include "iconv-detect.h"
-
-#define cd(x)
-
-#ifdef G_THREADS_ENABLED
-static GStaticMutex lock = G_STATIC_MUTEX_INIT;
-#define LOCK() g_static_mutex_lock(&lock)
-#define UNLOCK() g_static_mutex_unlock(&lock)
-#else
-#define LOCK()
-#define UNLOCK()
-#endif
-
-typedef struct _EDListNode {
- struct _EDListNode *next;
- struct _EDListNode *prev;
-} EDListNode;
-
-typedef struct _EDList {
- struct _EDListNode *head;
- struct _EDListNode *tail;
- struct _EDListNode *tailpred;
-} EDList;
-
-#define E_DLIST_INITIALISER(l) { (EDListNode *)&l.tail, 0, (EDListNode *)&l.head }
-
-struct _iconv_cache_node {
- struct _iconv_cache_node *next;
- struct _iconv_cache_node *prev;
-
- struct _iconv_cache *parent;
-
- int busy;
- iconv_t ip;
-};
-
-struct _iconv_cache {
- struct _iconv_cache *next;
- struct _iconv_cache *prev;
-
- char *conv;
-
- EDList open; /* stores iconv_cache_nodes, busy ones up front */
-};
-
-#define E_ICONV_CACHE_SIZE (16)
-
-static EDList iconv_cache_list;
-static GHashTable *iconv_cache;
-static GHashTable *iconv_cache_open;
-static unsigned int iconv_cache_size = 0;
-
-static GHashTable *iconv_charsets = NULL;
-static char *locale_charset = NULL;
-static char *locale_lang = NULL;
-
-struct {
- char *charset;
- char *iconv_name;
-} known_iconv_charsets[] = {
-#if 0
- /* charset name, iconv-friendly charset name */
- { "iso-8859-1", "iso-8859-1" },
- { "iso8859-1", "iso-8859-1" },
- /* the above mostly serves as an example for iso-style charsets,
- but we have code that will populate the iso-*'s if/when they
- show up in e_iconv_charset_name() so I'm
- not going to bother putting them all in here... */
- { "windows-cp1251", "cp1251" },
- { "windows-1251", "cp1251" },
- { "cp1251", "cp1251" },
- /* the above mostly serves as an example for windows-style
- charsets, but we have code that will parse and convert them
- to their cp#### equivalents if/when they show up in
- e_iconv_charset_name() so I'm not going to bother
- putting them all in here either... */
-#endif
- /* charset name (lowercase!), iconv-friendly name (sometimes case sensitive) */
- { "utf-8", "UTF-8" },
-
- /* 10646 is a special case, its usually UCS-2 big endian */
- /* This might need some checking but should be ok for solaris/linux */
- { "iso-10646-1", "UCS-2BE" },
- { "iso_10646-1", "UCS-2BE" },
- { "iso10646-1", "UCS-2BE" },
- { "iso-10646", "UCS-2BE" },
- { "iso_10646", "UCS-2BE" },
- { "iso10646", "UCS-2BE" },
-
- { "ks_c_5601-1987", "EUC-KR" },
-
- /* FIXME: Japanese/Korean/Chinese stuff needs checking */
- { "euckr-0", "EUC-KR" },
- { "5601", "EUC-KR" },
- { "zh_TW-euc", "EUC-TW" },
- { "zh_CN.euc", "gb2312" },
- { "zh_TW-big5", "BIG5" },
- { "euc-cn", "gb2312" },
- { "big5-0", "BIG5" },
- { "big5.eten-0", "BIG5" },
- { "big5hkscs-0", "BIG5HKSCS" },
- { "gb2312-0", "gb2312" },
- { "gb2312.1980-0", "gb2312" },
- { "gb-2312", "gb2312" },
- { "gb18030-0", "gb18030" },
- { "gbk-0", "GBK" },
-
- { "eucjp-0", "eucJP" },
- { "ujis-0", "ujis" },
- { "jisx0208.1983-0","SJIS" },
- { "jisx0212.1990-0","SJIS" },
- { "pck", "SJIS" },
- { NULL, NULL }
-};
-
-
-
-/* Another copy of this trivial list implementation
- Why? This stuff gets called a lot (potentially), should run fast,
- and g_list's are f@@#$ed up to make this a hassle */
-static void e_dlist_init(EDList *v)
-{
- v->head = (EDListNode *)&v->tail;
- v->tail = 0;
- v->tailpred = (EDListNode *)&v->head;
-}
-
-static EDListNode *e_dlist_addhead(EDList *l, EDListNode *n)
-{
- n->next = l->head;
- n->prev = (EDListNode *)&l->head;
- l->head->prev = n;
- l->head = n;
- return n;
-}
-
-static EDListNode *e_dlist_addtail(EDList *l, EDListNode *n)
-{
- n->next = (EDListNode *)&l->tail;
- n->prev = l->tailpred;
- l->tailpred->next = n;
- l->tailpred = n;
- return n;
-}
-
-static EDListNode *e_dlist_remove(EDListNode *n)
-{
- n->next->prev = n->prev;
- n->prev->next = n->next;
- return n;
-}
-
-
-/* fucking glib... */
-static const char *
-e_strdown (char *str)
-{
- register char *s = str;
-
- while (*s) {
- if (*s >= 'A' && *s <= 'Z')
- *s += 0x20;
- s++;
- }
-
- return str;
-}
-
-static const char *
-e_strup (char *str)
-{
- register char *s = str;
-
- while (*s) {
- if (*s >= 'a' && *s <= 'z')
- *s -= 0x20;
- s++;
- }
-
- return str;
-}
-
-
-static void
-locale_parse_lang (const char *locale)
-{
- char *codeset, *lang;
-
- if ((codeset = strchr (locale, '.')))
- lang = g_strndup (locale, codeset - locale);
- else
- lang = g_strdup (locale);
-
- /* validate the language */
- if (strlen (lang) >= 2) {
- if (lang[2] == '-' || lang[2] == '_') {
- /* canonicalise the lang */
- e_strdown (lang);
-
- /* validate the country code */
- if (strlen (lang + 3) > 2) {
- /* invalid country code */
- lang[2] = '\0';
- } else {
- lang[2] = '-';
- e_strup (lang + 3);
- }
- } else if (lang[2] != '\0') {
- /* invalid language */
- g_free (lang);
- lang = NULL;
- }
-
- locale_lang = lang;
- } else {
- /* invalid language */
- locale_lang = NULL;
- g_free (lang);
- }
-}
-
-/* NOTE: Owns the lock on return if keep is TRUE ! */
-static void
-e_iconv_init(int keep)
-{
- char *from, *to, *locale;
- int i;
-
- LOCK();
-
- if (iconv_charsets != NULL) {
- if (!keep)
- UNLOCK();
- return;
- }
-
- iconv_charsets = g_hash_table_new(g_str_hash, g_str_equal);
-
- for (i = 0; known_iconv_charsets[i].charset != NULL; i++) {
- from = g_strdup(known_iconv_charsets[i].charset);
- to = g_strdup(known_iconv_charsets[i].iconv_name);
- e_strdown (from);
- g_hash_table_insert(iconv_charsets, from, to);
- }
-
- e_dlist_init(&iconv_cache_list);
- iconv_cache = g_hash_table_new(g_str_hash, g_str_equal);
- iconv_cache_open = g_hash_table_new(NULL, NULL);
-
- locale = setlocale (LC_ALL, NULL);
-
- if (!locale || !strcmp (locale, "C") || !strcmp (locale, "POSIX")) {
- /* The locale "C" or "POSIX" is a portable locale; its
- * LC_CTYPE part corresponds to the 7-bit ASCII character
- * set.
- */
-
- locale_charset = NULL;
- locale_lang = NULL;
- } else {
-#ifdef HAVE_CODESET
- locale_charset = g_strdup (nl_langinfo (CODESET));
- e_strdown (locale_charset);
-#else
- /* A locale name is typically of the form language[_terri-
- * tory][.codeset][@modifier], where language is an ISO 639
- * language code, territory is an ISO 3166 country code, and
- * codeset is a character set or encoding identifier like
- * ISO-8859-1 or UTF-8.
- */
- char *codeset, *p;
-
- codeset = strchr (locale, '.');
- if (codeset) {
- codeset++;
-
- /* ; is a hack for debian systems and / is a hack for Solaris systems */
- for (p = codeset; *p && !strchr ("@;/", *p); p++);
- locale_charset = g_strndup (codeset, p - codeset);
- e_strdown (locale_charset);
- } else {
- /* charset unknown */
- locale_charset = NULL;
- }
-#endif
-
- /* parse the locale lang */
- locale_parse_lang (locale);
-
- }
-
- if (!keep)
- UNLOCK();
-}
-
-const char *e_iconv_charset_name(const char *charset)
-{
- char *name, *ret, *tmp;
-
- if (charset == NULL)
- return NULL;
-
- name = g_alloca (strlen (charset) + 1);
- strcpy (name, charset);
- e_strdown (name);
-
- e_iconv_init(TRUE);
- ret = g_hash_table_lookup(iconv_charsets, name);
- if (ret != NULL) {
- UNLOCK();
- return ret;
- }
-
- /* Unknown, try canonicalise some basic charset types to something that should work */
- if (strncmp(name, "iso", 3) == 0) {
- /* Convert iso-nnnn-n or isonnnn-n or iso_nnnn-n to iso-nnnn-n or isonnnn-n */
- int iso, codepage;
- char *p;
-
- tmp = name + 3;
- if (*tmp == '-' || *tmp == '_')
- tmp++;
-
- iso = strtoul (tmp, &p, 10);
-
- if (iso == 10646) {
- /* they all become ICONV_10646 */
- ret = g_strdup (ICONV_10646);
- } else {
- tmp = p;
- if (*tmp == '-' || *tmp == '_')
- tmp++;
-
- codepage = strtoul (tmp, &p, 10);
-
- if (p > tmp) {
- /* codepage is numeric */
-#ifdef __aix__
- if (codepage == 13)
- ret = g_strdup ("IBM-921");
- else
-#endif /* __aix__ */
- ret = g_strdup_printf (ICONV_ISO_D_FORMAT, iso, codepage);
- } else {
- /* codepage is a string - probably iso-2022-jp or something */
- ret = g_strdup_printf (ICONV_ISO_S_FORMAT, iso, p);
- }
- }
- } else if (strncmp(name, "windows-", 8) == 0) {
- /* Convert windows-nnnnn or windows-cpnnnnn to cpnnnn */
- tmp = name+8;
- if (!strncmp(tmp, "cp", 2))
- tmp+=2;
- ret = g_strdup_printf("CP%s", tmp);
- } else if (strncmp(name, "microsoft-", 10) == 0) {
- /* Convert microsoft-nnnnn or microsoft-cpnnnnn to cpnnnn */
- tmp = name+10;
- if (!strncmp(tmp, "cp", 2))
- tmp+=2;
- ret = g_strdup_printf("CP%s", tmp);
- } else {
- /* Just assume its ok enough as is, case and all */
- ret = g_strdup(charset);
- }
-
- g_hash_table_insert(iconv_charsets, g_strdup(name), ret);
- UNLOCK();
-
- return ret;
-}
-
-static void
-flush_entry(struct _iconv_cache *ic)
-{
- struct _iconv_cache_node *in, *nn;
-
- in = (struct _iconv_cache_node *)ic->open.head;
- nn = in->next;
- while (nn) {
- if (in->ip != (iconv_t)-1) {
- g_hash_table_remove(iconv_cache_open, in->ip);
- iconv_close(in->ip);
- }
- g_free(in);
- in = nn;
- nn = in->next;
- }
- g_free(ic->conv);
- g_free(ic);
-}
-
-/* This should run pretty quick, its called a lot */
-iconv_t e_iconv_open(const char *oto, const char *ofrom)
-{
- const char *to, *from;
- char *tofrom;
- struct _iconv_cache *ic;
- struct _iconv_cache_node *in;
- int errnosav;
- iconv_t ip;
-
- if (oto == NULL || ofrom == NULL) {
- errno = EINVAL;
- return (iconv_t) -1;
- }
-
- to = e_iconv_charset_name (oto);
- from = e_iconv_charset_name (ofrom);
- tofrom = g_alloca (strlen (to) + strlen (from) + 2);
- sprintf(tofrom, "%s%%%s", to, from);
-
- LOCK();
-
- ic = g_hash_table_lookup(iconv_cache, tofrom);
- if (ic) {
- e_dlist_remove((EDListNode *)ic);
- } else {
- struct _iconv_cache *last = (struct _iconv_cache *)iconv_cache_list.tailpred;
- struct _iconv_cache *prev;
-
- prev = last->prev;
- while (prev && iconv_cache_size > E_ICONV_CACHE_SIZE) {
- in = (struct _iconv_cache_node *)last->open.head;
- if (in->next && !in->busy) {
- cd(printf("Flushing iconv converter '%s'\n", last->conv));
- e_dlist_remove((EDListNode *)last);
- g_hash_table_remove(iconv_cache, last->conv);
- flush_entry(last);
- iconv_cache_size--;
- }
- last = prev;
- prev = last->prev;
- }
-
- iconv_cache_size++;
-
- ic = g_malloc(sizeof(*ic));
- e_dlist_init(&ic->open);
- ic->conv = g_strdup(tofrom);
- g_hash_table_insert(iconv_cache, ic->conv, ic);
-
- cd(printf("Creating iconv converter '%s'\n", ic->conv));
- }
- e_dlist_addhead(&iconv_cache_list, (EDListNode *)ic);
-
- /* If we have a free iconv, use it */
- in = (struct _iconv_cache_node *)ic->open.tailpred;
- if (in->prev && !in->busy) {
- cd(printf("using existing iconv converter '%s'\n", ic->conv));
- ip = in->ip;
- if (ip != (iconv_t)-1) {
- /* work around some broken iconv implementations
- * that die if the length arguments are NULL
- */
- size_t buggy_iconv_len = 0;
- char *buggy_iconv_buf = NULL;
-
- /* resets the converter */
- iconv(ip, &buggy_iconv_buf, &buggy_iconv_len, &buggy_iconv_buf, &buggy_iconv_len);
- in->busy = TRUE;
- e_dlist_remove((EDListNode *)in);
- e_dlist_addhead(&ic->open, (EDListNode *)in);
- }
- } else {
- cd(printf("creating new iconv converter '%s'\n", ic->conv));
- ip = iconv_open(to, from);
- in = g_malloc(sizeof(*in));
- in->ip = ip;
- in->parent = ic;
- e_dlist_addhead(&ic->open, (EDListNode *)in);
- if (ip != (iconv_t)-1) {
- g_hash_table_insert(iconv_cache_open, ip, in);
- in->busy = TRUE;
- } else {
- errnosav = errno;
- g_warning("Could not open converter for '%s' to '%s' charset", from, to);
- in->busy = FALSE;
- errno = errnosav;
- }
- }
-
- UNLOCK();
-
- return ip;
-}
-
-size_t e_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char ** outbuf, size_t *outbytesleft)
-{
- return iconv(cd, (char **) inbuf, inbytesleft, outbuf, outbytesleft);
-}
-
-void
-e_iconv_close(iconv_t ip)
-{
- struct _iconv_cache_node *in;
-
- if (ip == (iconv_t)-1)
- return;
-
- LOCK();
- in = g_hash_table_lookup(iconv_cache_open, ip);
- if (in) {
- cd(printf("closing iconv converter '%s'\n", in->parent->conv));
- e_dlist_remove((EDListNode *)in);
- in->busy = FALSE;
- e_dlist_addtail(&in->parent->open, (EDListNode *)in);
- } else {
- g_warning("trying to close iconv i dont know about: %p", ip);
- iconv_close(ip);
- }
- UNLOCK();
-
-}
-
-const char *e_iconv_locale_charset(void)
-{
- e_iconv_init(FALSE);
-
- return locale_charset;
-}
-
-
-const char *
-e_iconv_locale_language (void)
-{
- e_iconv_init (FALSE);
-
- return locale_lang;
-}
-
-/* map CJKR charsets to their language code */
-/* NOTE: only support charset names that will be returned by
- * e_iconv_charset_name() so that we don't have to keep track of all
- * the aliases too. */
-static struct {
- char *charset;
- char *lang;
-} cjkr_lang_map[] = {
- { "Big5", "zh" },
- { "BIG5HKSCS", "zh" },
- { "gb2312", "zh" },
- { "gb18030", "zh" },
- { "gbk", "zh" },
- { "euc-tw", "zh" },
- { "iso-2022-jp", "ja" },
- { "sjis", "ja" },
- { "ujis", "ja" },
- { "eucJP", "ja" },
- { "euc-jp", "ja" },
- { "euc-kr", "ko" },
- { "koi8-r", "ru" },
- { "koi8-u", "uk" }
-};
-
-#define NUM_CJKR_LANGS (sizeof (cjkr_lang_map) / sizeof (cjkr_lang_map[0]))
-
-const char *
-e_iconv_charset_language (const char *charset)
-{
- int i;
-
- if (!charset)
- return NULL;
-
- charset = e_iconv_charset_name (charset);
- for (i = 0; i < NUM_CJKR_LANGS; i++) {
- if (!strcasecmp (cjkr_lang_map[i].charset, charset))
- return cjkr_lang_map[i].lang;
- }
-
- return NULL;
-}
diff --git a/e-util/e-iconv.h b/e-util/e-iconv.h
deleted file mode 100644
index 14b93853d5..0000000000
--- a/e-util/e-iconv.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-iconv.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- * Jeffrey Stedfast <fejj@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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_ICONV_H_
-#define _E_ICONV_H_
-
-#include <iconv.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-const char *e_iconv_charset_name(const char *charset);
-iconv_t e_iconv_open(const char *oto, const char *ofrom);
-size_t e_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char ** outbuf, size_t *outbytesleft);
-void e_iconv_close(iconv_t ip);
-const char *e_iconv_locale_charset(void);
-
-/* languages */
-const char *e_iconv_locale_language (void);
-const char *e_iconv_charset_language (const char *charset);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* !_E_ICONV_H_ */
diff --git a/e-util/e-iterator.c b/e-util/e-iterator.c
deleted file mode 100644
index d3575a0645..0000000000
--- a/e-util/e-iterator.c
+++ /dev/null
@@ -1,183 +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 Ximian, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#include <config.h>
-
-#include "e-iterator.h"
-#include "e-util-marshal.h"
-
-static void e_iterator_init (EIterator *card);
-static void e_iterator_class_init (EIteratorClass *klass);
-
-#define PARENT_TYPE G_TYPE_OBJECT
-
-static GObjectClass *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.
- **/
-GType
-e_iterator_get_type (void)
-{
- static GType type = 0;
-
- if (! type) {
- GTypeInfo info = {
- sizeof (EIteratorClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) e_iterator_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EIterator),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_iterator_init
- };
-
- type = g_type_register_static (PARENT_TYPE, "EIterator", &info, 0);
- }
-
- return type;
-}
-
-static void
-e_iterator_class_init (EIteratorClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS(klass);
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- e_iterator_signals [INVALIDATE] =
- g_signal_new ("invalidate",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EIteratorClass, invalidate),
- NULL, NULL,
- e_util_marshal_NONE__NONE, /* XXX need a new marshaller here */
- G_TYPE_NONE, 0);
-
- 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 (E_ITERATOR_GET_CLASS(iterator)->get)
- return E_ITERATOR_GET_CLASS(iterator)->get(iterator);
- else
- return NULL;
-}
-
-void
-e_iterator_reset (EIterator *iterator)
-{
- if (E_ITERATOR_GET_CLASS(iterator)->reset)
- E_ITERATOR_GET_CLASS(iterator)->reset(iterator);
-}
-
-void
-e_iterator_last (EIterator *iterator)
-{
- if (E_ITERATOR_GET_CLASS(iterator)->last)
- E_ITERATOR_GET_CLASS(iterator)->last(iterator);
-}
-
-gboolean
-e_iterator_next (EIterator *iterator)
-{
- if (E_ITERATOR_GET_CLASS(iterator)->next)
- return E_ITERATOR_GET_CLASS(iterator)->next(iterator);
- else
- return FALSE;
-}
-
-gboolean
-e_iterator_prev (EIterator *iterator)
-{
- if (E_ITERATOR_GET_CLASS(iterator)->prev)
- return E_ITERATOR_GET_CLASS(iterator)->prev(iterator);
- else
- return FALSE;
-}
-
-void
-e_iterator_delete (EIterator *iterator)
-{
- if (E_ITERATOR_GET_CLASS(iterator)->delete)
- E_ITERATOR_GET_CLASS(iterator)->delete(iterator);
-}
-
-void e_iterator_insert (EIterator *iterator,
- const void *object,
- gboolean before)
-{
- if (E_ITERATOR_GET_CLASS(iterator)->insert)
- E_ITERATOR_GET_CLASS(iterator)->insert(iterator, object, before);
-}
-
-void
-e_iterator_set (EIterator *iterator,
- const void *object)
-{
- if (E_ITERATOR_GET_CLASS(iterator)->set)
- E_ITERATOR_GET_CLASS(iterator)->set(iterator, object);
-}
-
-gboolean
-e_iterator_is_valid (EIterator *iterator)
-{
- if (E_ITERATOR_GET_CLASS(iterator)->is_valid)
- return E_ITERATOR_GET_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));
-
- g_signal_emit (iterator, e_iterator_signals [INVALIDATE], 0);
-}
diff --git a/e-util/e-iterator.h b/e-util/e-iterator.h
deleted file mode 100644
index 9dae97cc3a..0000000000
--- a/e-util/e-iterator.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#ifndef __E_ITERATOR_H__
-#define __E_ITERATOR_H__
-
-#include <stdio.h>
-#include <time.h>
-#include <glib.h>
-#include <glib-object.h>
-
-#define E_TYPE_ITERATOR (e_iterator_get_type ())
-#define E_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_ITERATOR, EIterator))
-#define E_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_ITERATOR, EIteratorClass))
-#define E_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_ITERATOR))
-#define E_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_ITERATOR))
-#define E_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_ITERATOR, EIteratorClass))
-
-typedef struct _EIterator EIterator;
-typedef struct _EIteratorClass EIteratorClass;
-
-struct _EIterator {
- GObject object;
-};
-
-struct _EIteratorClass {
- GObjectClass 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 Glib function */
-GType e_iterator_get_type (void);
-
-#endif /* ! __E_ITERATOR_H__ */
diff --git a/e-util/e-lang-utils.c b/e-util/e-lang-utils.c
deleted file mode 100644
index 564b4a353d..0000000000
--- a/e-util/e-lang-utils.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-lang-utils.c - Utility functions for multi-language support.
- *
- * Copyright (C) 2002 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- *
- * Author: Ettore Perazzoli <ettore@ximian.com>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-lang-utils.h"
-
-#include <string.h>
-
-
-GSList *
-e_get_language_list (void)
-{
- GSList *list = NULL;
- const char *env;
- const char *p;
-
- env = g_getenv ("LANGUAGE");
- if (env == NULL) {
- env = g_getenv ("LANG");
- if (env == NULL)
- return NULL;
- }
-
- p = strchr (env, '=');
- if (p != NULL)
- env = p;
-
- list = g_slist_prepend (list, g_strdup (env));
-
- p = strchr (env, '_');
- if (p != NULL)
- list = g_slist_prepend (list, g_strndup (env, p - env));
-
- return list;
-}
-
-void
-e_free_language_list (GSList *list)
-{
- GSList *iter;
-
- for (iter = list; iter; iter = iter->next)
- g_free (iter->data);
-
- g_slist_free (list);
-}
diff --git a/e-util/e-lang-utils.h b/e-util/e-lang-utils.h
deleted file mode 100644
index 135d98db7a..0000000000
--- a/e-util/e-lang-utils.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-lang-utils.h - Utility functions for multi-language support.
- *
- * Copyright (C) 2002 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- *
- * Author: Ettore Perazzoli <ettore@ximian.com>
- */
-
-#ifndef E_LANG_UTILS_H
-#define E_LANG_UTILS_H
-
-#include <glib.h>
-
-GSList *e_get_language_list (void);
-void e_free_language_list (GSList *list);
-
-#endif /* E_LANG_UTILS_H */
diff --git a/e-util/e-list-iterator.c b/e-util/e-list-iterator.c
deleted file mode 100644
index e801c22ef8..0000000000
--- a/e-util/e-list-iterator.c
+++ /dev/null
@@ -1,249 +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 Ximian, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#include <config.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_dispose (GObject *object);
-
-#define PARENT_TYPE E_TYPE_ITERATOR
-
-static EIteratorClass *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.
- **/
-GType
-e_list_iterator_get_type (void)
-{
- static GType type = 0;
-
- if (! type) {
- GTypeInfo info = {
- sizeof (EListIteratorClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) e_list_iterator_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EListIterator),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_list_iterator_init
- };
-
- type = g_type_register_static (PARENT_TYPE, "EListIterator", &info, 0);
- }
-
- return type;
-}
-
-static void
-e_list_iterator_class_init (EListIteratorClass *klass)
-{
- GObjectClass *object_class;
- EIteratorClass *iterator_class;
-
- object_class = G_OBJECT_CLASS(klass);
- iterator_class = E_ITERATOR_CLASS(klass);
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->dispose = e_list_iterator_dispose;
-
- 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 = g_object_new (E_TYPE_LIST_ITERATOR, NULL);
-
- iterator->list = list;
- g_object_ref(list);
- iterator->iterator = list->list;
-
- return E_ITERATOR(iterator);
-}
-
-/*
- * Virtual functions:
- */
-static void
-e_list_iterator_dispose (GObject *object)
-{
- EListIterator *iterator = E_LIST_ITERATOR(object);
- e_list_remove_iterator(iterator->list, E_ITERATOR(iterator));
- g_object_unref(iterator->list);
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-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);
- else
- iterator->iterator = iterator->list->list;
- 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);
- else
- iterator->iterator = g_list_last(iterator->list->list);
- 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) {
- e_list_remove_link (iterator->list, 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 b3a8953d80..0000000000
--- a/e-util/e-list-iterator.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2000 Ximian, 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 <stdio.h>
-#include <time.h>
-#include <glib.h>
-#include <glib-object.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) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_LIST_ITERATOR, EListIterator))
-#define E_LIST_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_LIST_ITERATOR, EListIteratorClass))
-#define E_IS_LIST_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_LIST_ITERATOR))
-#define E_IS_LIST_ITERATOR_CLASS(klass) (G_TYPE_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 Glib function */
-GType 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 f1b190b16a..0000000000
--- a/e-util/e-list.c
+++ /dev/null
@@ -1,191 +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 Ximian, Inc.
- * Copyright (C) 1999 The Free Software Foundation
- */
-
-#include <config.h>
-
-#include "e-list.h"
-#include "e-list-iterator.h"
-
-static void e_list_init (EList *list);
-static void e_list_class_init (EListClass *klass);
-static void e_list_dispose (GObject *object);
-
-static GObjectClass *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.
- **/
-GType
-e_list_get_type (void)
-{
- static GType type = 0;
-
- if (! type) {
- GTypeInfo info = {
- sizeof (EListClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) e_list_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EList),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_list_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT, "EList", &info, 0);
- }
-
- return type;
-}
-
-static void
-e_list_class_init (EListClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS(klass);
-
- parent_class = g_type_class_ref (G_TYPE_OBJECT);
-
- object_class->dispose = e_list_dispose;
-}
-
-/**
- * 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 = g_object_new (E_TYPE_LIST, NULL);
- e_list_construct (list, copy, free, closure);
- return list;
-}
-
-void
-e_list_construct (EList *list, EListCopyFunc copy, EListFreeFunc free, void *closure)
-{
- list->copy = copy;
- list->free = free;
- list->closure = closure;
-}
-
-EList *
-e_list_duplicate (EList *old)
-{
- EList *list = g_object_new (E_TYPE_LIST, NULL);
-
- 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_remove (EList *list, const void *data)
-{
- GList *link;
- link = g_list_find (list->list, data);
- if (link)
- e_list_remove_link(list, link);
-}
-
-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));
- }
- }
-}
-
-/* FIXME: This doesn't work properly if the iterator is the first
- iterator in the list. Well, the iterator doesn't continue on after
- the next time next is called, at least. */
-void
-e_list_remove_link (EList *list, GList *link)
-{
- GList *iterators = list->iterators;
- for (; iterators; iterators = iterators->next) {
- if (((EListIterator *)iterators->data)->iterator == link) {
- e_iterator_prev(iterators->data);
- }
- }
- if (list->free)
- list->free(link->data, list->closure);
- list->list = g_list_remove_link(list->list, link);
- g_list_free_1(link);
-}
-
-void
-e_list_remove_iterator (EList *list, EIterator *iterator)
-{
- list->iterators = g_list_remove(list->iterators, iterator);
-}
-
-/*
- * Virtual functions
- */
-static void
-e_list_dispose (GObject *object)
-{
- EList *list = E_LIST(object);
- if (list->free)
- g_list_foreach(list->list, (GFunc) list->free, list->closure);
- g_list_free(list->list);
-
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
diff --git a/e-util/e-list.h b/e-util/e-list.h
deleted file mode 100644
index d249fcfa4a..0000000000
--- a/e-util/e-list.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2000 Ximian, 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 <stdio.h>
-#include <time.h>
-#include <glib.h>
-#include <glib-object.h>
-#include <e-util/e-list-iterator.h>
-
-#define E_TYPE_LIST (e_list_get_type ())
-#define E_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_LIST, EList))
-#define E_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_LIST, EListClass))
-#define E_IS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_LIST))
-#define E_IS_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_LIST))
-#define E_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_LIST, EListClass))
-
-typedef void *(*EListCopyFunc) (const void *data, void *closure);
-typedef void (*EListFreeFunc) (void *data, void *closure);
-
-struct _EList {
- GObject object;
- GList *list;
- GList *iterators;
- EListCopyFunc copy;
- EListFreeFunc free;
- void *closure;
-};
-
-struct _EListClass {
- GObjectClass parent_class;
-};
-
-EList *e_list_new (EListCopyFunc copy,
- EListFreeFunc free,
- void *closure);
-void e_list_construct (EList *list,
- 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);
-void e_list_remove (EList *list,
- const void *data);
-int e_list_length (EList *list);
-
-/* For iterators to call. */
-void e_list_remove_link (EList *list,
- GList *link);
-void e_list_remove_iterator (EList *list,
- EIterator *iterator);
-void e_list_invalidate_iterators (EList *list,
- EIterator *skip);
-
-/* Standard Glib function */
-GType e_list_get_type (void);
-
-#endif /* ! __E_LIST_H__ */
diff --git a/e-util/e-marshal.list b/e-util/e-marshal.list
deleted file mode 100644
index 92496dbd7b..0000000000
--- a/e-util/e-marshal.list
+++ /dev/null
@@ -1,51 +0,0 @@
-BOOLEAN:INT,INT,OBJECT,INT,INT,UINT
-BOOLEAN:INT,POINTER,INT,OBJECT,INT,INT,UINT
-BOOLEAN:NONE
-BOOLEAN:OBJECT
-BOOLEAN:OBJECT,DOUBLE,DOUBLE,BOOLEAN
-BOOLEAN:POINTER,POINTER,INT,INT,INT
-BOOLEAN:POINTER,POINTER,POINTER,INT,INT,INT
-BOOLEAN:STRING,INT
-DOUBLE:OBJECT,DOUBLE,DOUBLE,BOOLEAN
-INT:BOXED
-INT:INT
-INT:INT,INT,BOXED
-INT:INT,POINTER,INT,BOXED
-INT:OBJECT,BOXED
-INT:POINTER
-NONE:BOXED
-NONE:BOXED,INT
-NONE:BOXED,INT,INT
-NONE:DOUBLE
-NONE:INT
-NONE:INT,INT
-NONE:INT,INT,BOXED
-NONE:INT,INT,OBJECT
-NONE:INT,INT,OBJECT,BOXED,UINT,UINT
-NONE:INT,INT,OBJECT,INT,INT,BOXED,UINT,UINT
-NONE:INT,INT,OBJECT,POINTER,UINT,UINT
-NONE:INT,INT,OBJECT,UINT
-NONE:INT,INT,STRING,STRING
-NONE:INT,INT,STRING,STRING,POINTER
-NONE:INT,POINTER
-NONE:INT,POINTER,INT,BOXED
-NONE:INT,POINTER,INT,OBJECT
-NONE:INT,POINTER,INT,OBJECT,BOXED,UINT,UINT
-NONE:INT,POINTER,INT,OBJECT,INT,INT,BOXED,UINT,UINT
-NONE:INT,POINTER,INT,OBJECT,UINT
-NONE:INT,STRING
-NONE:NONE
-NONE:OBJECT
-NONE:OBJECT,OBJECT
-NONE:OBJECT,DOUBLE,DOUBLE,BOOLEAN
-NONE:POINTER
-NONE:POINTER,BOOLEAN
-NONE:POINTER,BOOLEAN,BOOLEAN,BOOLEAN
-NONE:POINTER,INT
-NONE:POINTER,INT,INT
-NONE:POINTER,INT,INT,INT
-NONE:POINTER,INT,OBJECT
-NONE:POINTER,POINTER
-NONE:POINTER,POINTER,INT
-OBJECT:OBJECT,DOUBLE,DOUBLE,BOOLEAN
-POINTER:NONE
diff --git a/e-util/e-memory.c b/e-util/e-memory.c
deleted file mode 100644
index cf32147d75..0000000000
--- a/e-util/e-memory.c
+++ /dev/null
@@ -1,1306 +0,0 @@
-/*
- * Copyright (c) 2000, 2001 Ximian Inc.
- *
- * Authors: Michael Zucchi <notzed@ximian.com>
- * Jacob Berkman <jacob@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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 "e-memory.h"
-
-#include <string.h> /* memset() */
-#include <stdlib.h> /* alloca() */
-#include <glib.h>
-
-#define s(x) /* strv debug */
-#define p(x) /* poolv debug */
-#define p2(x) /* poolv assertion checking */
-
-/*#define MALLOC_CHECK*/
-
-/*#define PROFILE_POOLV*/
-
-#ifdef PROFILE_POOLV
-#include <time.h>
-#define pp(x) x
-#else
-#define pp(x)
-#endif
-
-/*#define TIMEIT*/
-
-#ifdef TIMEIT
-#include <sys/time.h>
-#include <unistd.h>
-
-struct timeval timeit_start;
-
-static time_start(const char *desc)
-{
- gettimeofday(&timeit_start, NULL);
- printf("starting: %s\n", desc);
-}
-
-static time_end(const char *desc)
-{
- unsigned long diff;
- struct timeval end;
-
- gettimeofday(&end, NULL);
- diff = end.tv_sec * 1000 + end.tv_usec/1000;
- diff -= timeit_start.tv_sec * 1000 + timeit_start.tv_usec/1000;
- printf("%s took %ld.%03ld seconds\n",
- desc, diff / 1000, diff % 1000);
-}
-#else
-#define time_start(x)
-#define time_end(x)
-#endif
-
-#ifdef MALLOC_CHECK
-#include <mcheck.h>
-#include <stdio.h>
-static void
-checkmem(void *p)
-{
- if (p) {
- int status = mprobe(p);
-
- switch (status) {
- case MCHECK_HEAD:
- printf("Memory underrun at %p\n", p);
- abort();
- case MCHECK_TAIL:
- printf("Memory overrun at %p\n", p);
- abort();
- case MCHECK_FREE:
- printf("Double free %p\n", p);
- abort();
- }
- }
-}
-#define MPROBE(x) checkmem((void *)(x))
-#else
-#define MPROBE(x)
-#endif
-
-/* mempool class */
-
-#define STRUCT_ALIGN (4)
-
-typedef struct _MemChunkFreeNode {
- struct _MemChunkFreeNode *next;
- unsigned int atoms;
-} MemChunkFreeNode;
-
-typedef struct _EMemChunk {
- unsigned int blocksize; /* number of atoms in a block */
- unsigned int atomsize; /* size of each atom */
- GPtrArray *blocks; /* blocks of raw memory */
- struct _MemChunkFreeNode *free;
-} MemChunk;
-
-/**
- * e_memchunk_new:
- * @atomcount: The number of atoms stored in a single malloc'd block of memory.
- * @atomsize: The size of each allocation.
- *
- * Create a new memchunk header. Memchunks are an efficient way to allocate
- * and deallocate identical sized blocks of memory quickly, and space efficiently.
- *
- * e_memchunks are effectively the same as gmemchunks, only faster (much), and
- * they use less memory overhead for housekeeping.
- *
- * Return value: The new header.
- **/
-MemChunk *e_memchunk_new(int atomcount, int atomsize)
-{
- MemChunk *m = g_malloc(sizeof(*m));
-
- m->blocksize = atomcount;
- m->atomsize = MAX(atomsize, sizeof(MemChunkFreeNode));
- m->blocks = g_ptr_array_new();
- m->free = NULL;
-
- return m;
-}
-
-/**
- * memchunk_alloc:
- * @m:
- *
- * Allocate a new atom size block of memory from a memchunk.
- **/
-void *e_memchunk_alloc(MemChunk *m)
-{
- char *b;
- MemChunkFreeNode *f;
- void *mem;
-
- f = m->free;
- if (f) {
- f->atoms--;
- if (f->atoms > 0) {
- mem = ((char *)f) + (f->atoms*m->atomsize);
- } else {
- mem = f;
- m->free = m->free->next;
- }
- return mem;
- } else {
- b = g_malloc(m->blocksize * m->atomsize);
- g_ptr_array_add(m->blocks, b);
- f = (MemChunkFreeNode *)&b[m->atomsize];
- f->atoms = m->blocksize-1;
- f->next = NULL;
- m->free = f;
- return b;
- }
-}
-
-void *e_memchunk_alloc0(EMemChunk *m)
-{
- void *mem;
-
- mem = e_memchunk_alloc(m);
- memset(mem, 0, m->atomsize);
-
- return mem;
-}
-
-/**
- * e_memchunk_free:
- * @m:
- * @mem: Address of atom to free.
- *
- * Free a single atom back to the free pool of atoms in the given
- * memchunk.
- **/
-void
-e_memchunk_free(MemChunk *m, void *mem)
-{
- MemChunkFreeNode *f;
-
- /* put the location back in the free list. If we knew if the preceeding or following
- cells were free, we could merge the free nodes, but it doesn't really add much */
- f = mem;
- f->next = m->free;
- m->free = f;
- f->atoms = 1;
-
- /* we could store the free list sorted - we could then do the above, and also
- probably improve the locality of reference properties for the allocator */
- /* and it would simplify some other algorithms at that, but slow this one down
- significantly */
-}
-
-/**
- * e_memchunk_empty:
- * @m:
- *
- * Clean out the memchunk buffers. Marks all allocated memory as free blocks,
- * but does not give it back to the system. Can be used if the memchunk
- * is to be used repeatedly.
- **/
-void
-e_memchunk_empty(MemChunk *m)
-{
- int i;
- MemChunkFreeNode *f, *h = NULL;
-
- for (i=0;i<m->blocks->len;i++) {
- f = (MemChunkFreeNode *)m->blocks->pdata[i];
- f->atoms = m->blocksize;
- f->next = h;
- h = f;
- }
- m->free = h;
-}
-
-struct _cleaninfo {
- struct _cleaninfo *next;
- char *base;
- int count;
- int size; /* just so tree_search has it, sigh */
-};
-
-static int tree_compare(struct _cleaninfo *a, struct _cleaninfo *b)
-{
- if (a->base < b->base)
- return -1;
- else if (a->base > b->base)
- return 1;
- return 0;
-}
-
-static int tree_search(struct _cleaninfo *a, char *mem)
-{
- if (a->base <= mem) {
- if (mem < &a->base[a->size])
- return 0;
- return 1;
- }
- return -1;
-}
-
-/**
- * e_memchunk_clean:
- * @m:
- *
- * Scan all empty blocks and check for blocks which can be free'd
- * back to the system.
- *
- * This routine may take a while to run if there are many allocated
- * memory blocks (if the total number of allocations is many times
- * greater than atomcount).
- **/
-void
-e_memchunk_clean(MemChunk *m)
-{
- GTree *tree;
- int i;
- MemChunkFreeNode *f;
- struct _cleaninfo *ci, *hi = NULL;
-
- f = m->free;
- if (m->blocks->len == 0 || f == NULL)
- return;
-
- /* first, setup the tree/list so we can map free block addresses to block addresses */
- tree = g_tree_new((GCompareFunc)tree_compare);
- for (i=0;i<m->blocks->len;i++) {
- ci = alloca(sizeof(*ci));
- ci->count = 0;
- ci->base = m->blocks->pdata[i];
- ci->size = m->blocksize * m->atomsize;
- g_tree_insert(tree, ci, ci);
- ci->next = hi;
- hi = ci;
- }
-
- /* now, scan all free nodes, and count them in their tree node */
- while (f) {
- ci = g_tree_search(tree, (GCompareFunc) tree_search, f);
- if (ci) {
- ci->count += f->atoms;
- } else {
- g_warning("error, can't find free node in memory block\n");
- }
- f = f->next;
- }
-
- /* if any nodes are all free, free & unlink them */
- ci = hi;
- while (ci) {
- if (ci->count == m->blocksize) {
- MemChunkFreeNode *prev = NULL;
-
- f = m->free;
- while (f) {
- if (tree_search (ci, (void *) f) == 0) {
- /* prune this node from our free-node list */
- if (prev)
- prev->next = f->next;
- else
- m->free = f->next;
- } else {
- prev = f;
- }
-
- f = f->next;
- }
-
- g_ptr_array_remove_fast(m->blocks, ci->base);
- g_free(ci->base);
- }
- ci = ci->next;
- }
-
- g_tree_destroy(tree);
-}
-
-/**
- * e_memchunk_destroy:
- * @m:
- *
- * Free the memchunk header, and all associated memory.
- **/
-void
-e_memchunk_destroy(MemChunk *m)
-{
- int i;
-
- if (m == NULL)
- return;
-
- for (i=0;i<m->blocks->len;i++)
- g_free(m->blocks->pdata[i]);
- g_ptr_array_free(m->blocks, TRUE);
- g_free(m);
-}
-
-typedef struct _MemPoolNode {
- struct _MemPoolNode *next;
-
- int free;
- char data[1];
-} MemPoolNode;
-
-typedef struct _MemPoolThresholdNode {
- struct _MemPoolThresholdNode *next;
- char data[1];
-} MemPoolThresholdNode;
-
-typedef struct _EMemPool {
- int blocksize;
- int threshold;
- unsigned int align;
- struct _MemPoolNode *blocks;
- struct _MemPoolThresholdNode *threshold_blocks;
-} MemPool;
-
-/* a pool of mempool header blocks */
-static MemChunk *mempool_memchunk;
-#ifdef G_THREADS_ENABLED
-static GStaticMutex mempool_mutex = G_STATIC_MUTEX_INIT;
-#endif
-
-/**
- * e_mempool_new:
- * @blocksize: The base blocksize to use for all system alocations.
- * @threshold: If the allocation exceeds the threshold, then it is
- * allocated separately and stored in a separate list.
- * @flags: Alignment options: E_MEMPOOL_ALIGN_STRUCT uses native
- * struct alignment, E_MEMPOOL_ALIGN_WORD aligns to 16 bits (2 bytes),
- * and E_MEMPOOL_ALIGN_BYTE aligns to the nearest byte. The default
- * is to align to native structures.
- *
- * Create a new mempool header. Mempools can be used to efficiently
- * allocate data which can then be freed as a whole.
- *
- * Mempools can also be used to efficiently allocate arbitrarily
- * aligned data (such as strings) without incurring the space overhead
- * of aligning each allocation (which is not required for strings).
- *
- * However, each allocation cannot be freed individually, only all
- * or nothing.
- *
- * Return value:
- **/
-MemPool *e_mempool_new(int blocksize, int threshold, EMemPoolFlags flags)
-{
- MemPool *pool;
-
-#ifdef G_THREADS_ENABLED
- g_static_mutex_lock(&mempool_mutex);
-#endif
- if (mempool_memchunk == NULL) {
- mempool_memchunk = e_memchunk_new(8, sizeof(MemPool));
- }
- pool = e_memchunk_alloc(mempool_memchunk);
-#ifdef G_THREADS_ENABLED
- g_static_mutex_unlock(&mempool_mutex);
-#endif
- if (threshold >= blocksize)
- threshold = blocksize * 2 / 3;
- pool->blocksize = blocksize;
- pool->threshold = threshold;
- pool->blocks = NULL;
- pool->threshold_blocks = NULL;
-
- switch (flags & E_MEMPOOL_ALIGN_MASK) {
- case E_MEMPOOL_ALIGN_STRUCT:
- default:
- pool->align = STRUCT_ALIGN-1;
- break;
- case E_MEMPOOL_ALIGN_WORD:
- pool->align = 2-1;
- break;
- case E_MEMPOOL_ALIGN_BYTE:
- pool->align = 1-1;
- }
- return pool;
-}
-
-/**
- * e_mempool_alloc:
- * @pool:
- * @size:
- *
- * Allocate a new data block in the mempool. Size will
- * be rounded up to the mempool's alignment restrictions
- * before being used.
- **/
-void *e_mempool_alloc(MemPool *pool, register int size)
-{
- size = (size + pool->align) & (~(pool->align));
- if (size>=pool->threshold) {
- MemPoolThresholdNode *n;
-
- n = g_malloc(sizeof(*n) - sizeof(char) + size);
- n->next = pool->threshold_blocks;
- pool->threshold_blocks = n;
- return &n->data[0];
- } else {
- register MemPoolNode *n;
-
- n = pool->blocks;
- if (n && n->free >= size) {
- n->free -= size;
- return &n->data[n->free];
- }
-
- /* maybe we could do some sort of the free blocks based on size, but
- it doubt its worth it at all */
-
- n = g_malloc(sizeof(*n) - sizeof(char) + pool->blocksize);
- n->next = pool->blocks;
- pool->blocks = n;
- n->free = pool->blocksize - size;
- return &n->data[n->free];
- }
-}
-
-char *e_mempool_strdup(EMemPool *pool, const char *str)
-{
- char *out;
-
- out = e_mempool_alloc(pool, strlen(str)+1);
- strcpy(out, str);
-
- return out;
-}
-
-/**
- * e_mempool_flush:
- * @pool:
- * @freeall: Free all system allocated blocks as well.
- *
- * Flush used memory and mark allocated blocks as free.
- *
- * If @freeall is #TRUE, then all allocated blocks are free'd
- * as well. Otherwise only blocks above the threshold are
- * actually freed, and the others are simply marked as empty.
- **/
-void e_mempool_flush(MemPool *pool, int freeall)
-{
- MemPoolThresholdNode *tn, *tw;
- MemPoolNode *pw, *pn;
-
- tw = pool->threshold_blocks;
- while (tw) {
- tn = tw->next;
- g_free(tw);
- tw = tn;
- }
- pool->threshold_blocks = NULL;
-
- if (freeall) {
- pw = pool->blocks;
- while (pw) {
- pn = pw->next;
- g_free(pw);
- pw = pn;
- }
- pool->blocks = NULL;
- } else {
- pw = pool->blocks;
- while (pw) {
- pw->free = pool->blocksize;
- pw = pw->next;
- }
- }
-}
-
-/**
- * e_mempool_destroy:
- * @pool:
- *
- * Free all memory associated with a mempool.
- **/
-void e_mempool_destroy(MemPool *pool)
-{
- if (pool) {
- e_mempool_flush(pool, 1);
- e_memchunk_free(mempool_memchunk, pool);
- }
-}
-
-
-/*
- string array classes
-*/
-
-#define STRV_UNPACKED ((unsigned char)(~0))
-
-struct _EStrv {
- unsigned char length; /* how many entries we have (or the token STRV_UNPACKED) */
- char data[1]; /* data follows */
-};
-
-struct _s_strv_string {
- char *string; /* the string to output */
- char *free; /* a string to free, if we referenced it */
-};
-
-struct _e_strvunpacked {
- unsigned char type; /* we overload last to indicate this is unpacked */
- MemPool *pool; /* pool of memory for strings */
- struct _EStrv *source; /* if we were converted from a packed one, keep the source around for a while */
- unsigned int length;
- struct _s_strv_string strings[1]; /* the string array data follows */
-};
-
-/**
- * e_strv_new:
- * @size: The number of elements in the strv. Currently this is limited
- * to 254 elements.
- *
- * Create a new strv (string array) header. strv's can be used to
- * create and work with arrays of strings that can then be compressed
- * into a space-efficient static structure. This is useful
- * where a number of strings are to be stored for lookup, and not
- * generally edited afterwards.
- *
- * The size limit is currently 254 elements. This will probably not
- * change as arrays of this size suffer significant performance
- * penalties when looking up strings with high indices.
- *
- * Return value:
- **/
-struct _EStrv *
-e_strv_new(int size)
-{
- struct _e_strvunpacked *s;
-
- g_assert(size<255);
-
- s = g_malloc(sizeof(*s) + (size-1)*sizeof(s->strings[0]));
- s(printf("new strv=%p, size = %d bytes\n", s, sizeof(*s) + (size-1)*sizeof(char *)));
- s->type = STRV_UNPACKED;
- s->pool = NULL;
- s->length = size;
- s->source = NULL;
- memset(s->strings, 0, size*sizeof(s->strings[0]));
-
- return (struct _EStrv *)s;
-}
-
-static struct _e_strvunpacked *
-strv_unpack(struct _EStrv *strv)
-{
- struct _e_strvunpacked *s;
- register char *p;
- int i;
-
- s(printf("unpacking\n"));
-
- s = (struct _e_strvunpacked *)e_strv_new(strv->length);
- p = strv->data;
- for (i=0;i<s->length;i++) {
- if (i>0)
- while (*p++)
- ;
- s->strings[i].string = p;
- }
- s->source = strv;
- s->type = STRV_UNPACKED;
-
- return s;
-}
-
-/**
- * e_strv_set_ref:
- * @strv:
- * @index:
- * @str:
- *
- * Set a string array element by reference. The string
- * is not copied until the array is packed.
- *
- * If @strv has been packed, then it is unpacked ready
- * for more inserts, and should be packed again once finished with.
- * The memory used by the original @strv is not freed until
- * the new strv is packed, or freed itself.
- *
- * Return value: A new EStrv if the strv has already
- * been packed, otherwise @strv.
- **/
-struct _EStrv *
-e_strv_set_ref(struct _EStrv *strv, int index, char *str)
-{
- struct _e_strvunpacked *s;
-
- s(printf("set ref %d '%s'\nawkmeharder: %s\n ", index, str, str));
-
- if (strv->length != STRV_UNPACKED)
- s = strv_unpack(strv);
- else
- s = (struct _e_strvunpacked *)strv;
-
- g_assert(index>=0 && index < s->length);
-
- s->strings[index].string = str;
-
- return (struct _EStrv *)s;
-}
-
-/**
- * e_strv_set_ref_free:
- * @strv:
- * @index:
- * @str:
- *
- * Set a string by reference, similar to set_ref, but also
- * free the string when finished with it. The string
- * is not copied until the strv is packed, and not at
- * all if the index is overwritten.
- *
- * Return value: @strv if already unpacked, otherwise an packed
- * EStrv.
- **/
-struct _EStrv *
-e_strv_set_ref_free(struct _EStrv *strv, int index, char *str)
-{
- struct _e_strvunpacked *s;
-
- s(printf("set ref %d '%s'\nawkmeevenharder: %s\n ", index, str, str));
-
- if (strv->length != STRV_UNPACKED)
- s = strv_unpack(strv);
- else
- s = (struct _e_strvunpacked *)strv;
-
- g_assert(index>=0 && index < s->length);
-
- s->strings[index].string = str;
- if (s->strings[index].free)
- g_free(s->strings[index].free);
- s->strings[index].free = str;
-
- return (struct _EStrv *)s;
-}
-
-/**
- * e_strv_set:
- * @strv:
- * @index:
- * @str:
- *
- * Set a string array reference. The string @str is copied
- * into the string array at location @index.
- *
- * If @strv has been packed, then it is unpacked ready
- * for more inserts, and should be packed again once finished with.
- *
- * Return value: A new EStrv if the strv has already
- * been packed, otherwise @strv.
- **/
-struct _EStrv *
-e_strv_set(struct _EStrv *strv, int index, const char *str)
-{
- struct _e_strvunpacked *s;
-
- s(printf("set %d '%s'\n", index, str));
-
- if (strv->length != STRV_UNPACKED)
- s = strv_unpack(strv);
- else
- s = (struct _e_strvunpacked *)strv;
-
- g_assert(index>=0 && index < s->length);
-
- if (s->pool == NULL)
- s->pool = e_mempool_new(1024, 512, E_MEMPOOL_ALIGN_BYTE);
-
- s->strings[index].string = e_mempool_alloc(s->pool, strlen(str)+1);
- strcpy(s->strings[index].string, str);
-
- return (struct _EStrv *)s;
-}
-
-/**
- * e_strv_pack:
- * @strv:
- *
- * Pack the @strv into a space efficient structure for later lookup.
- *
- * All strings are packed into a single allocated block, separated
- * by single \0 characters, together with a count byte.
- *
- * Return value:
- **/
-struct _EStrv *
-e_strv_pack(struct _EStrv *strv)
-{
- struct _e_strvunpacked *s;
- int len, i;
- register char *src, *dst;
-
- if (strv->length == STRV_UNPACKED) {
- s = (struct _e_strvunpacked *)strv;
-
- s(printf("packing string\n"));
-
- len = 0;
- for (i=0;i<s->length;i++)
- len += s->strings[i].string?strlen(s->strings[i].string)+1:1;
-
- strv = g_malloc(sizeof(*strv) + len);
- s(printf("allocating strv=%p, size = %d\n", strv, sizeof(*strv)+len));
- strv->length = s->length;
- dst = strv->data;
- for (i=0;i<s->length;i++) {
- if ((src = s->strings[i].string)) {
- while ((*dst++ = *src++))
- ;
- } else {
- *dst++ = 0;
- }
- }
- e_strv_destroy((struct _EStrv *)s);
- }
- return strv;
-}
-
-/**
- * e_strv_get:
- * @strv:
- * @index:
- *
- * Retrieve a string by index. This function works
- * identically on both packed and unpacked strv's, although
- * may be much slower on a packed strv.
- *
- * Return value:
- **/
-char *
-e_strv_get(struct _EStrv *strv, int index)
-{
- struct _e_strvunpacked *s;
- char *p;
-
- if (strv->length != STRV_UNPACKED) {
- g_assert(index>=0 && index < strv->length);
- p = strv->data;
- while (index > 0) {
- while (*p++ != 0)
- ;
- index--;
- }
- return p;
- } else {
- s = (struct _e_strvunpacked *)strv;
- g_assert(index>=0 && index < s->length);
- return s->strings[index].string?s->strings[index].string:"";
- }
-}
-
-/**
- * e_strv_destroy:
- * @strv:
- *
- * Free a strv and all associated memory. Works on packed
- * or unpacked strv's.
- **/
-void
-e_strv_destroy(struct _EStrv *strv)
-{
- struct _e_strvunpacked *s;
- int i;
-
- s(printf("freeing strv\n"));
-
- if (strv->length == STRV_UNPACKED) {
- s = (struct _e_strvunpacked *)strv;
- if (s->pool)
- e_mempool_destroy(s->pool);
- if (s->source)
- e_strv_destroy(s->source);
- for (i=0;i<s->length;i++) {
- if (s->strings[i].free)
- g_free(s->strings[i].free);
- }
- }
-
- s(printf("freeing strv=%p\n", strv));
-
- g_free(strv);
-}
-
-
-
-/* string pool stuff */
-
-/* TODO:
- garbage collection, using the following technique:
- Create a memchunk for each possible size of poolv, and allocate every poolv from those
- To garbage collect, scan all memchunk internally, ignoring any free areas (or mark each
- poolv when freeing it - set length 0?), and find out which strings are not anywhere,
- then free them.
-
- OR:
- Just keep a refcount in the hashtable, instead of duplicating the key pointer.
-
- either would also require a free for the mempool, so ignore it for now */
-
-/*#define POOLV_REFCNT*/ /* Define to enable refcounting code that does
- automatic garbage collection of unused strings */
-
-static GHashTable *poolv_pool = NULL;
-static EMemPool *poolv_mempool = NULL;
-
-#ifdef MALLOC_CHECK
-static GPtrArray *poolv_table = NULL;
-#endif
-
-#ifdef PROFILE_POOLV
-static gulong poolv_hits = 0;
-static gulong poolv_misses = 0;
-static unsigned long poolv_mem, poolv_count;
-#endif
-
-#ifdef G_THREADS_ENABLED
-static GStaticMutex poolv_mutex = G_STATIC_MUTEX_INIT;
-#endif
-
-struct _EPoolv {
- unsigned char length;
- char *s[1];
-};
-
-/**
- * e_poolv_new: @size: The number of elements in the poolv, maximum of 254 elements.
- *
- * create a new poolv (string vector which shares a global string
- * pool). poolv's can be used to work with arrays of strings which
- * save memory by eliminating duplicated allocations of the same
- * string.
- *
- * this is useful when you have a log of read-only strings that do not
- * go away and are duplicated a lot (such as email headers).
- *
- * we should probably in the future ref count the strings contained in
- * the hash table, but for now let's not.
- *
- * Return value: new pooled string vector
- **/
-EPoolv *
-e_poolv_new(unsigned int size)
-{
- EPoolv *poolv;
-
- g_assert(size < 255);
-
- poolv = g_malloc0(sizeof (*poolv) + (size - 1) * sizeof (char *));
- poolv->length = size;
-
-#ifdef G_THREADS_ENABLED
- g_static_mutex_lock(&poolv_mutex);
-#endif
- if (!poolv_pool)
- poolv_pool = g_hash_table_new(g_str_hash, g_str_equal);
-
- if (!poolv_mempool)
- poolv_mempool = e_mempool_new(32 * 1024, 512, E_MEMPOOL_ALIGN_BYTE);
-
-#ifdef MALLOC_CHECK
- {
- int i;
-
- if (poolv_table == NULL)
- poolv_table = g_ptr_array_new();
-
- for (i=0;i<poolv_table->len;i++)
- MPROBE(poolv_table->pdata[i]);
-
- g_ptr_array_add(poolv_table, poolv);
- }
-#endif
-
-#ifdef G_THREADS_ENABLED
- g_static_mutex_unlock(&poolv_mutex);
-#endif
-
- p(printf("new poolv=%p\tsize=%d\n", poolv, sizeof(*poolv) + (size-1)*sizeof(char *)));
-
-#ifdef PROFILE_POOLV
- poolv_count++;
-#endif
- return poolv;
-}
-
-/**
- * e_poolv_cpy:
- * @dest: destination pooled string vector
- * @src: source pooled string vector
- *
- * Copy the contents of a pooled string vector
- *
- * Return value: @dest, which may be re-allocated if the strings
- * are different lengths.
- **/
-EPoolv *
-e_poolv_cpy(EPoolv *dest, const EPoolv *src)
-{
-#ifdef POOLV_REFCNT
- int i;
- unsigned int ref;
- char *key;
-#endif
-
- p2(g_return_val_if_fail (dest != NULL, NULL));
- p2(g_return_val_if_fail (src != NULL, NULL));
-
- MPROBE(dest);
- MPROBE(src);
-
- if (dest->length != src->length) {
- e_poolv_destroy(dest);
- dest = e_poolv_new(src->length);
- }
-
-#ifdef POOLV_REFCNT
-#ifdef G_THREADS_ENABLED
- g_static_mutex_lock(&poolv_mutex);
-#endif
- /* ref new copies */
- for (i=0;i<src->length;i++) {
- if (src->s[i]) {
- if (g_hash_table_lookup_extended(poolv_pool, src->s[i], (void **)&key, (void **)&ref)) {
- g_hash_table_insert(poolv_pool, key, (void *)(ref+1));
- } else {
- g_assert_not_reached();
- }
- }
- }
-
- /* unref the old ones */
- for (i=0;i<dest->length;i++) {
- if (dest->s[i]) {
- if (g_hash_table_lookup_extended(poolv_pool, dest->s[i], (void **)&key, (void **)&ref)) {
- /* if ref == 1 free it */
- g_assert(ref > 0);
- g_hash_table_insert(poolv_pool, key, (void *)(ref-1));
- } else {
- g_assert_not_reached();
- }
- }
- }
-#ifdef G_THREADS_ENABLED
- g_static_mutex_unlock(&poolv_mutex);
-#endif
-#endif
-
- memcpy(dest->s, src->s, src->length * sizeof (char *));
-
- return dest;
-}
-
-#ifdef PROFILE_POOLV
-static void
-poolv_profile_update (void)
-{
- static time_t last_time = 0;
- time_t new_time;
-
- new_time = time (NULL);
- if (new_time - last_time < 5)
- return;
-
- printf("poolv profile: %lu hits, %lu misses: %d%% hit rate, memory: %lu, instances: %lu\n",
- poolv_hits, poolv_misses,
- (int)(100.0 * ((double) poolv_hits / (double) (poolv_hits + poolv_misses))),
- poolv_mem, poolv_count);
-
- last_time = new_time;
-}
-#endif
-
-/**
- * e_poolv_set:
- * @poolv: pooled string vector
- * @index: index in vector of string
- * @str: string to set
- * @freeit: whether the caller is releasing its reference to the
- * string
- *
- * Set a string vector reference. If the caller will no longer be
- * referencing the string, freeit should be TRUE. Otherwise, this
- * will duplicate the string if it is not found in the pool.
- *
- * Return value: @poolv
- **/
-EPoolv *
-e_poolv_set (EPoolv *poolv, int index, char *str, int freeit)
-{
-#ifdef POOLV_REFCNT
- unsigned int ref;
- char *key;
-#endif
-
- p2(g_return_val_if_fail (poolv != NULL, NULL));
-
- g_assert(index >=0 && index < poolv->length);
-
- MPROBE(poolv);
-
- p(printf("setting %d `%s'\n", index, str));
-
- if (!str) {
-#ifdef POOLV_REFCNT
- if (poolv->s[index]) {
- if (g_hash_table_lookup_extended(poolv_pool, poolv->s[index], (void **)&key, (void **)&ref)) {
- g_assert(ref > 0);
- g_hash_table_insert(poolv_pool, key, (void *)(ref-1));
- } else {
- g_assert_not_reached();
- }
- }
-#endif
- poolv->s[index] = NULL;
- return poolv;
- }
-
-#ifdef G_THREADS_ENABLED
- g_static_mutex_lock(&poolv_mutex);
-#endif
-
-#ifdef POOLV_REFCNT
- if (g_hash_table_lookup_extended(poolv_pool, str, (void **)&key, (void **)&ref)) {
- g_hash_table_insert(poolv_pool, key, (void *)(ref+1));
- poolv->s[index] = key;
-# ifdef PROFILE_POOLV
- poolv_hits++;
- poolv_profile_update ();
-# endif
- } else {
-# ifdef PROFILE_POOLV
- poolv_misses++;
- poolv_mem += strlen(str);
- poolv_profile_update ();
-# endif
- poolv->s[index] = e_mempool_strdup(poolv_mempool, str);
- g_hash_table_insert(poolv_pool, poolv->s[index], (void *)1);
- }
-
-#else /* !POOLV_REFCNT */
- if ((poolv->s[index] = g_hash_table_lookup(poolv_pool, str)) != NULL) {
-# ifdef PROFILE_POOLV
- poolv_hits++;
- poolv_profile_update ();
-# endif
- } else {
-# ifdef PROFILE_POOLV
- poolv_misses++;
- poolv_mem += strlen(str);
- poolv_profile_update ();
-# endif
- poolv->s[index] = e_mempool_strdup(poolv_mempool, str);
- g_hash_table_insert(poolv_pool, poolv->s[index], poolv->s[index]);
- }
-#endif /* !POOLV_REFCNT */
-
-#ifdef G_THREADS_ENABLED
- g_static_mutex_unlock(&poolv_mutex);
-#endif
-
- if (freeit)
- g_free(str);
-
- return poolv;
-}
-
-/**
- * e_poolv_get:
- * @poolv: pooled string vector
- * @index: index in vector of string
- *
- * Retrieve a string by index. This could possibly just be a macro.
- *
- * Since the pool is never freed, this string does not need to be
- * duplicated, but should not be modified.
- *
- * Return value: string at that index.
- **/
-const char *
-e_poolv_get(EPoolv *poolv, int index)
-{
- g_assert(poolv != NULL);
- g_assert(index>= 0 && index < poolv->length);
-
- MPROBE(poolv);
-
- p(printf("get %d = `%s'\n", index, poolv->s[index]));
-
- return poolv->s[index]?poolv->s[index]:"";
-}
-
-/**
- * e_poolv_destroy:
- * @poolv: pooled string vector to free
- *
- * Free a pooled string vector. This doesn't free the strings from
- * the vector, however.
- **/
-void
-e_poolv_destroy(EPoolv *poolv)
-{
-#ifdef POOLV_REFCNT
- int i;
- unsigned int ref;
- char *key;
-
- MPROBE(poolv);
-
-#ifdef G_THREADS_ENABLED
- g_static_mutex_lock(&poolv_mutex);
-#endif
-
-#ifdef MALLOC_CHECK
- for (i=0;i<poolv_table->len;i++)
- MPROBE(poolv_table->pdata[i]);
-
- g_ptr_array_remove_fast(poolv_table, poolv);
-#endif
-
- for (i=0;i<poolv->length;i++) {
- if (poolv->s[i]) {
- if (g_hash_table_lookup_extended(poolv_pool, poolv->s[i], (void **)&key, (void **)&ref)) {
- /* if ref == 1 free it */
- g_assert(ref > 0);
- g_hash_table_insert(poolv_pool, key, (void *)(ref-1));
- } else {
- g_assert_not_reached();
- }
- }
- }
-#ifdef G_THREADS_ENABLED
- g_static_mutex_unlock(&poolv_mutex);
-#endif
-#endif
-
-#ifdef PROFILE_POOLV
- poolv_count++;
-#endif
- g_free(poolv);
-}
-
-#if 0
-
-#define CHUNK_SIZE (20)
-#define CHUNK_COUNT (32)
-
-#define s(x)
-
-main()
-{
- int i;
- MemChunk *mc;
- void *mem, *last;
- GMemChunk *gmc;
- struct _EStrv *s;
-
- s = strv_new(8);
- s = strv_set(s, 1, "Testing 1");
- s = strv_set(s, 2, "Testing 2");
- s = strv_set(s, 3, "Testing 3");
- s = strv_set(s, 4, "Testing 4");
- s = strv_set(s, 5, "Testing 5");
- s = strv_set(s, 6, "Testing 7");
-
- for (i=0;i<8;i++) {
- printf("s[%d] = %s\n", i, strv_get(s, i));
- }
-
- s(sleep(5));
-
- printf("packing ...\n");
- s = strv_pack(s);
-
- for (i=0;i<8;i++) {
- printf("s[%d] = %s\n", i, strv_get(s, i));
- }
-
- printf("setting ...\n");
-
- s = strv_set_ref(s, 1, "Testing 1 x");
-
- for (i=0;i<8;i++) {
- printf("s[%d] = %s\n", i, strv_get(s, i));
- }
-
- printf("packing ...\n");
- s = strv_pack(s);
-
- for (i=0;i<8;i++) {
- printf("s[%d] = %s\n", i, strv_get(s, i));
- }
-
- strv_free(s);
-
-#if 0
- time_start("Using memchunks");
- mc = memchunk_new(CHUNK_COUNT, CHUNK_SIZE);
- for (i=0;i<1000000;i++) {
- mem = memchunk_alloc(mc);
- if ((i & 1) == 0)
- memchunk_free(mc, mem);
- }
- s(sleep(10));
- memchunk_destroy(mc);
- time_end("allocating 1000000 memchunks, freeing 500k");
-
- time_start("Using gmemchunks");
- gmc = g_mem_chunk_new("memchunk", CHUNK_SIZE, CHUNK_SIZE*CHUNK_COUNT, G_ALLOC_AND_FREE);
- for (i=0;i<1000000;i++) {
- mem = g_mem_chunk_alloc(gmc);
- if ((i & 1) == 0)
- g_mem_chunk_free(gmc, mem);
- }
- s(sleep(10));
- g_mem_chunk_destroy(gmc);
- time_end("allocating 1000000 gmemchunks, freeing 500k");
-
- time_start("Using memchunks");
- mc = memchunk_new(CHUNK_COUNT, CHUNK_SIZE);
- for (i=0;i<1000000;i++) {
- mem = memchunk_alloc(mc);
- }
- s(sleep(10));
- memchunk_destroy(mc);
- time_end("allocating 1000000 memchunks");
-
- time_start("Using gmemchunks");
- gmc = g_mem_chunk_new("memchunk", CHUNK_SIZE, CHUNK_COUNT*CHUNK_SIZE, G_ALLOC_ONLY);
- for (i=0;i<1000000;i++) {
- mem = g_mem_chunk_alloc(gmc);
- }
- s(sleep(10));
- g_mem_chunk_destroy(gmc);
- time_end("allocating 1000000 gmemchunks");
-
- time_start("Using malloc");
- for (i=0;i<1000000;i++) {
- malloc(CHUNK_SIZE);
- }
- time_end("allocating 1000000 malloc");
-#endif
-
-}
-
-#endif
diff --git a/e-util/e-memory.h b/e-util/e-memory.h
deleted file mode 100644
index 9cc89f2f23..0000000000
--- a/e-util/e-memory.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2001, Ximian Inc.
- *
- * Authors: Michael Zucchi <notzed@ximian.com>
- * Jacob Berkman <jacob@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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_MEMORY_H
-#define _E_MEMORY_H
-
-/* memchunks - allocate/free fixed-size blocks of memory */
-/* this is like gmemchunk, only faster and less overhead (only 4 bytes for every atomcount allocations) */
-typedef struct _EMemChunk EMemChunk;
-
-EMemChunk *e_memchunk_new(int atomcount, int atomsize);
-void *e_memchunk_alloc(EMemChunk *m);
-void *e_memchunk_alloc0(EMemChunk *m);
-void e_memchunk_free(EMemChunk *m, void *mem);
-void e_memchunk_empty(EMemChunk *m);
-void e_memchunk_clean(EMemChunk *m);
-void e_memchunk_destroy(EMemChunk *m);
-
-/* mempools - allocate variable sized blocks of memory, and free as one */
-/* allocation is very fast, but cannot be freed individually */
-typedef struct _EMemPool EMemPool;
-typedef enum {
- E_MEMPOOL_ALIGN_STRUCT = 0, /* allocate to native structure alignment */
- E_MEMPOOL_ALIGN_WORD = 1, /* allocate to words - 16 bit alignment */
- E_MEMPOOL_ALIGN_BYTE = 2, /* allocate to bytes - 8 bit alignment */
- E_MEMPOOL_ALIGN_MASK = 3, /* which bits determine the alignment information */
-} EMemPoolFlags;
-
-EMemPool *e_mempool_new(int blocksize, int threshold, EMemPoolFlags flags);
-void *e_mempool_alloc(EMemPool *pool, int size);
-char *e_mempool_strdup(EMemPool *pool, const char *str);
-void e_mempool_flush(EMemPool *pool, int freeall);
-void e_mempool_destroy(EMemPool *pool);
-
-/* strv's string arrays that can be efficiently modified and then compressed mainly for retrival */
-/* building is relatively fast, once compressed it takes the minimum amount of memory possible to store */
-typedef struct _EStrv EStrv;
-
-EStrv *e_strv_new(int size);
-EStrv *e_strv_set_ref(EStrv *strv, int index, char *str);
-EStrv *e_strv_set_ref_free(EStrv *strv, int index, char *str);
-EStrv *e_strv_set(EStrv *strv, int index, const char *str);
-EStrv *e_strv_pack(EStrv *strv);
-char *e_strv_get(EStrv *strv, int index);
-void e_strv_destroy(EStrv *strv);
-
-/* poolv's are similar to strv's, but they store common strings */
-typedef struct _EPoolv EPoolv;
-
-EPoolv *e_poolv_new(unsigned int size);
-EPoolv *e_poolv_cpy(EPoolv *dest, const EPoolv *src);
-EPoolv *e_poolv_set(EPoolv *poolv, int index, char *str, int freeit);
-const char *e_poolv_get(EPoolv *poolv, int index);
-void e_poolv_destroy(EPoolv *poolv);
-
-#endif /* ! _E_MEMORY_H */
diff --git a/e-util/e-meta.c b/e-util/e-meta.c
deleted file mode 100644
index a4c0ad562b..0000000000
--- a/e-util/e-meta.c
+++ /dev/null
@@ -1,521 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Michael Zucchi <notzed@ximian.com>
- *
- * Copyright 2003 Ximian, Inc. (www.ximian.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-#include <glib.h>
-
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-#include <libxml/xmlmemory.h>
-
-#include <sys/stat.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-
-#include <gal/util/e-xml-utils.h>
-#include <gal/util/e-util.h>
-#include "e-meta.h"
-
-static GObjectClass *e_meta_parent_class;
-
-struct _meta_data {
- struct _meta_data *next;
-
- char *md_key;
- char *md_value;
-};
-
-struct _EMetaPrivate {
- char *path;
- struct _meta_data *data;
- gulong sync_id;
- /* if set, we wont try and save/etc */
- unsigned int deleted:1;
-};
-
-static int meta_save(EMeta *em)
-{
- struct _EMetaPrivate *p = em->priv;
- xmlDocPtr doc;
- xmlNodePtr root, work;
- struct _meta_data *md;
- int res;
- char *dir;
- struct stat st;
-
- if (p->deleted)
- return 0;
-
- /* since we can, build the full path if we need to */
- dir = g_path_get_dirname(p->path);
- if (stat(dir, &st) == -1) {
- e_mkdir_hier(dir, 0777);
- g_free(dir);
- }
-
- /* of course, saving in xml is overkill, but everyone loves this shit ... */
-
- doc = xmlNewDoc("1.0");
- root = xmlNewDocNode(doc, NULL, "e-meta-data", NULL);
- xmlDocSetRootElement(doc, root);
-
- md = p->data;
- while (md) {
- work = xmlNewChild(root, NULL, "item", NULL);
- xmlSetProp(work, "name", md->md_key);
- xmlSetProp(work, "value", md->md_value);
- md = md->next;
- }
-
- res = e_xml_save_file(p->path, doc);
- if (res != 0)
- g_warning("Could not save folder meta-data `%s': %s", p->path, g_strerror(errno));
-
- xmlFreeDoc(doc);
-
- return res;
-}
-
-static int meta_load(EMeta *em)
-{
- struct _EMetaPrivate *p = em->priv;
- struct _meta_data *tail, *md;
- xmlDocPtr doc = NULL;
- xmlNodePtr root, work;
- char *name, *val;
- struct stat st;
-
- if (stat (p->path, &st) == -1 || !S_ISREG (st.st_mode))
- return -1;
-
- doc = xmlParseFile(p->path);
- if (doc == NULL)
- return -1;
-
- root = xmlDocGetRootElement(doc);
- if (root == NULL || strcmp(root->name, "e-meta-data")) {
- xmlFreeDoc(doc);
- errno = EINVAL;
- return -1;
- }
-
- work = root->children;
- tail = (struct _meta_data *)&p->data;
- while (work) {
- if (strcmp(work->name, "item") == 0) {
- name = xmlGetProp(work, "name");
- val = xmlGetProp(work, "value");
- if (name && val) {
- md = g_malloc(sizeof(*md));
- md->md_key = g_strdup(name);
- md->md_value = g_strdup(val);
- md->next = NULL;
- tail->next = md;
- tail = md;
- }
- if (name)
- xmlFree(name);
- if (val)
- xmlFree(val);
- }
- work = work->next;
- }
-
- xmlFreeDoc(doc);
-
- return 0;
-}
-
-static struct _meta_data *meta_find(EMeta *em, const char *key, struct _meta_data **mpp)
-{
- struct _meta_data *mp = (struct _meta_data *)&em->priv->data;
- struct _meta_data *md = mp->next;
-
- while (md && strcmp(md->md_key, key) != 0) {
- mp = md;
- md = md->next;
- }
-
- *mpp = mp;
-
- return md;
-}
-
-static void meta_free(struct _meta_data *md)
-{
- g_free(md->md_key);
- g_free(md->md_value);
- g_free(md);
-}
-
-static void
-e_meta_init (EMeta *em)
-{
- em->priv = g_malloc0(sizeof(*em->priv));
-}
-
-static void
-e_meta_finalise(GObject *crap)
-{
- EMeta *em = (EMeta *)crap;
- struct _EMetaPrivate *p = em->priv;
- struct _meta_data *md, *mn;
-
- if (p->sync_id != 0)
- e_meta_sync(em);
-
- md = p->data;
- while (md) {
- mn = md->next;
- meta_free(md);
- md = mn;
- }
-
- g_free(p->path);
- g_free(p);
- e_meta_parent_class->finalize((GObject *)em);
-}
-
-static void
-e_meta_class_init (EMetaClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS(klass);
-
- e_meta_parent_class = g_type_class_ref (G_TYPE_OBJECT);
-
- ((GObjectClass *)klass)->finalize = e_meta_finalise;
-}
-
-static GTypeInfo e_meta_type_info = {
- sizeof (EMetaClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) e_meta_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EMeta),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_meta_init
-};
-
-static GType e_meta_type;
-
-GType
-e_meta_get_type (void)
-{
- return e_meta_type?e_meta_type:(e_meta_type = g_type_register_static (G_TYPE_OBJECT, "EMeta", &e_meta_type_info, 0));
-}
-
-/**
- * e_meta_new:
- * @path: full path to meta-data storage object.
- *
- * Create a new meta-data storage object. Any existing meta-data stored for
- * this key will be loaded.
- *
- * Return value:
- **/
-EMeta *
-e_meta_new(const char *path)
-{
- EMeta *em;
-
- em = g_object_new(e_meta_get_type(), NULL);
- em->priv->path = g_strdup(path);
- meta_load(em);
-
- return em;
-}
-
-static gboolean
-meta_flush(EMeta *em)
-{
- em->priv->sync_id = 0;
- meta_save(em);
-
- return FALSE;
-}
-
-/* returns TRUE if the value changed */
-static int meta_set(EMeta *em, const char *key, const char *val)
-{
- struct _EMetaPrivate *p = em->priv;
- struct _meta_data *md, *mp;
-
- md = meta_find(em, key, &mp);
- if (md == NULL) {
- /* already unset / or new case */
- if (val == NULL)
- return FALSE;
- md = g_malloc0(sizeof(*md));
- md->md_key = g_strdup(key);
- md->next = p->data;
- p->data = md;
- } else if (val == NULL) {
- /* unset case */
- mp->next = md->next;
- meta_free(md);
- return TRUE;
- } else if (strcmp(md->md_value, val) == 0) {
- /* unchanged value */
- return FALSE;
- } else {
- /* changed value */
- g_free(md->md_value);
- }
- md->md_value = g_strdup(val);
-
- return TRUE;
-}
-
-/* get a value, returns NULL if it doesn't exist */
-static const char *meta_get(EMeta *em, const char *key)
-{
- struct _meta_data *md, *mp;
-
- md = meta_find(em, key, &mp);
-
- return md?md->md_value:NULL;
-}
-
-/**
- * e_meta_set:
- * @em:
- * @key:
- * @...: value, key, value, ..., NULL.
- *
- * Set any number of meta-data key-value pairs.
- * Unset a key by passing a value of NULL.
- *
- * If the meta-data set changes as a result of this
- * call, then a sync will be implicitly queued for
- * a later time.
- **/
-void
-e_meta_set(EMeta *em, const char *key, ...)
-{
- struct _EMetaPrivate *p = em->priv;
- const char *val;
- va_list ap;
- int changed = FALSE;
-
- va_start(ap, key);
- while (key != NULL) {
- val = va_arg(ap, const char *);
- changed = meta_set(em, key, val);
- key = va_arg(ap, const char *);
- }
- va_end(ap);
-
- /* todo: could do changed events ? */
-
- if (changed && p->sync_id == 0)
- p->sync_id = g_timeout_add(2000, (GSourceFunc)meta_flush, em);
-}
-
-/**
- * e_meta_get:
- * @em:
- * @key:
- * @...: value, key, value, ..., NULL.
- *
- * Get any number of meta-data key-value pairs.
- **/
-void
-e_meta_get(EMeta *em, const char *key, ...)
-{
- const char **valp;
- va_list ap;
-
- va_start(ap, key);
- while (key) {
- valp = va_arg(ap, const char **);
- *valp = meta_get(em, key);
- key = va_arg(ap, const char *);
- }
- va_end(ap);
-}
-
-/**
- * e_meta_get_bool:
- * @em:
- * @key:
- * @def:
- *
- * Get a boolean value at @key, with a default fallback @def.
- *
- * If the default value is used, then it will become the persistent
- * new value for the key.
- *
- * Return value: The value of the key, or if the key was not
- * previously set, then the new value of the key, @def.
- **/
-gboolean
-e_meta_get_bool(EMeta *em, const char *key, gboolean def)
-{
- const char *v;
-
- v = meta_get(em, key);
- /* this forces the value to become 'static' from first use */
- if (v == NULL) {
- e_meta_set_bool(em, key, def);
- return def;
- }
-
- return atoi(v);
-}
-
-/**
- * e_meta_set_bool:
- * @em:
- * @key:
- * @val:
- *
- * Helper to set a boolean value. Boolean TRUE is mapped to
- * the string "1", FALSE to "0".
- **/
-void
-e_meta_set_bool(EMeta *em, const char *key, gboolean val)
-{
- e_meta_set(em, key, val?"1":"0", NULL);
-}
-
-/**
- * e_meta_sync:
- * @em:
- *
- * Force an explicit and immediate sync of the meta-data to disk.
- *
- * This is not normally required unless part of transactional
- * processing, as updates will always be flushed to disk automatically.
- *
- * Return value: 0 on success.
- **/
-int
-e_meta_sync(EMeta *em)
-{
- struct _EMetaPrivate *p = em->priv;
-
- if (p->sync_id != 0) {
- g_source_remove(p->sync_id);
- p->sync_id = 0;
- }
-
- return meta_save(em);
-}
-
-static GHashTable *e_meta_table;
-
-static char *meta_filename(const char *base, const char *key)
-{
- const char *p;
- char *keyp, *o, c;
-
- p = key;
- o = keyp = alloca(strlen(key)+8);
-
- while ( (c = *p++) ) {
- if (c == '/')
- c = '_';
- *o++ = c;
- }
- strcpy(o, ".emeta");
- o = g_build_filename(base, keyp, NULL);
-
- return o;
-}
-
-static void
-meta_weak_notify(char *path, void *o)
-{
- g_hash_table_remove(e_meta_table, path);
- g_free(path);
-}
-
-/**
- * e_meta_data_lookup:
- * @base: Base storage directory.
- * @key: key for file.
- *
- * Lookup a meta-data object from a storage directory.
- *
- * Return value: The metadata object.
- **/
-EMeta *e_meta_data_find(const char *base, const char *key)
-{
- EMeta *em;
- char *path;
-
- if (e_meta_table == NULL)
- e_meta_table = g_hash_table_new(g_str_hash, g_str_equal);
-
- path = meta_filename(base, key);
- em = g_hash_table_lookup(e_meta_table, path);
- if (em) {
- g_free(path);
- g_object_ref(em);
- return em;
- }
-
- em = e_meta_new(path);
- g_hash_table_insert(e_meta_table, path, em);
- g_object_weak_ref((GObject *)em, (GWeakNotify)meta_weak_notify, path);
-
- return em;
-}
-
-/**
- * e_meta_data_delete:
- * @base:
- * @key:
- *
- * Delete a key from storage. If the key is still cached, it will be
- * marked as deleted, and will not be saved from then on.
- **/
-void e_meta_data_delete(const char *base, const char *key)
-{
- EMeta *em;
- char *path;
-
- path = meta_filename(base, key);
-
- if (e_meta_table && (em = g_hash_table_lookup(e_meta_table, path))) {
- if (em->priv->sync_id) {
- g_source_remove(em->priv->sync_id);
- em->priv->sync_id = 0;
- }
- em->priv->deleted = TRUE;
- }
-
- unlink(path);
- g_free(path);
-}
diff --git a/e-util/e-meta.h b/e-util/e-meta.h
deleted file mode 100644
index 19c23e3a06..0000000000
--- a/e-util/e-meta.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- *
- *
- * A simple persistent meta-data api.
- *
- * Authors: Michael Zucchi <notzed@ximian.com>
- *
- * Copyright 2003 Ximian, Inc. (www.ximian.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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_META_H
-#define _E_META_H 1
-
-#include <glib.h>
-#include <glib-object.h>
-
-typedef struct _EMeta EMeta;
-typedef struct _EMetaClass EMetaClass;
-
-struct _EMeta {
- GObject object;
-
- struct _EMetaPrivate *priv;
-};
-
-struct _EMetaClass {
- GObjectClass object;
-};
-
-GType e_meta_get_type (void);
-
-/* 'trivial' meta-data api */
-EMeta *e_meta_new(const char *path);
-void e_meta_set(EMeta *em, const char *key, ...);
-void e_meta_get(EMeta *em, const char *key, ...);
-int e_meta_sync(EMeta *em);
-
-/* helpers */
-gboolean e_meta_get_bool(EMeta *, const char *key, gboolean def);
-void e_meta_set_bool(EMeta *, const char *key, gboolean val);
-
-/* 'class' methods */
-EMeta *e_meta_data_find(const char *base, const char *key);
-void e_meta_data_delete(const char *base, const char *key);
-
-#endif /* ! _E_META_H */
diff --git a/e-util/e-mktemp.c b/e-util/e-mktemp.c
deleted file mode 100644
index 10ac4e1bf6..0000000000
--- a/e-util/e-mktemp.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <errno.h>
-
-#ifdef ENABLE_THREADS
-#include <pthread.h>
-#endif
-
-#include "e-mktemp.h"
-
-
-static gboolean initialized = FALSE;
-static GSList *temp_files = NULL;
-static GSList *temp_dirs = NULL;
-#ifdef ENABLE_THREADS
-static pthread_mutex_t temp_files_lock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t temp_dirs_lock = PTHREAD_MUTEX_INITIALIZER;
-#define TEMP_FILES_LOCK() pthread_mutex_lock (&temp_files_lock)
-#define TEMP_FILES_UNLOCK() pthread_mutex_unlock (&temp_files_lock)
-#define TEMP_DIRS_LOCK() pthread_mutex_lock (&temp_dirs_lock)
-#define TEMP_DIRS_UNLOCK() pthread_mutex_unlock (&temp_dirs_lock)
-#else
-#define TEMP_FILES_LOCK()
-#define TEMP_FILES_UNLOCK()
-#define TEMP_DIRS_LOCK()
-#define TEMP_DIRS_UNLOCK()
-#endif /* ENABLE_THREADS */
-
-
-static GString *
-get_path (gboolean make)
-{
- GString *path;
-
- path = g_string_new ("/tmp/evolution-");
- g_string_append_printf (path, "%d-%d", (int) getuid (), (int) getpid ());
-
- if (make) {
- int ret;
-
- /* shoot now, ask questions later */
- ret = mkdir (path->str, S_IRWXU);
- if (ret == -1) {
- if (errno == EEXIST) {
- struct stat st;
-
- if (stat (path->str, &st) == -1) {
- /* reset errno */
- errno = EEXIST;
- g_string_free (path, TRUE);
- return NULL;
- }
-
- /* make sure this is a directory and belongs to us... */
- if (!S_ISDIR (st.st_mode) || st.st_uid != getuid ()) {
- /* eek! this is bad... */
- g_string_free (path, TRUE);
- return NULL;
- }
- } else {
- /* some other error...do not pass go, do not collect $200 */
- g_string_free (path, TRUE);
- return NULL;
- }
- }
- }
-
- return path;
-}
-
-static void
-e_mktemp_cleanup (void)
-{
- GString *path;
- GSList *node;
-
- TEMP_FILES_LOCK ();
- if (temp_files) {
- node = temp_files;
- while (node) {
- unlink (node->data);
- g_free (node->data);
- node = node->next;
- }
- g_slist_free (temp_files);
- temp_files = NULL;
- }
- TEMP_FILES_UNLOCK ();
-
- TEMP_DIRS_LOCK ();
- if (temp_dirs) {
- node = temp_dirs;
- while (node) {
- /* perform the equivalent of a rm -rf */
- struct dirent *dent;
- DIR *dir;
-
- /* first empty out this directory of it's files... */
- dir = opendir (node->data);
- if (dir) {
- while ((dent = readdir (dir)) != NULL) {
- char *full_path;
-
- if (!strcmp (dent->d_name, ".") || !strcmp (dent->d_name, ".."))
- continue;
-
- full_path = g_strdup_printf ("%s/%s", node->data, dent->d_name);
- unlink (full_path);
- g_free (full_path);
- }
- closedir (dir);
- }
-
- /* ...then rmdir the directory */
- rmdir (node->data);
- g_free (node->data);
- node = node->next;
- }
- g_slist_free (temp_dirs);
- temp_dirs = NULL;
- }
- TEMP_DIRS_UNLOCK ();
-
- path = get_path (FALSE);
- rmdir (path->str);
-
- g_string_free (path, TRUE);
-}
-
-
-const char *
-e_mktemp (const char *template)
-{
- GString *path;
- char *ret;
-
- path = get_path (TRUE);
- if (!path)
- return NULL;
-
- g_string_append_c (path, '/');
- if (template)
- g_string_append (path, template);
- else
- g_string_append (path, "unknown-XXXXXX");
-
- ret = mktemp (path->str);
- if (ret) {
- TEMP_FILES_LOCK ();
- if (!initialized) {
- g_atexit (e_mktemp_cleanup);
- initialized = TRUE;
- }
- temp_files = g_slist_prepend (temp_files, ret);
- g_string_free (path, FALSE);
- TEMP_FILES_UNLOCK ();
- } else {
- g_string_free (path, TRUE);
- }
-
- return ret;
-}
-
-
-int
-e_mkstemp (const char *template)
-{
- GString *path;
- int fd;
-
- path = get_path (TRUE);
- if (!path)
- return -1;
-
- g_string_append_c (path, '/');
- if (template)
- g_string_append (path, template);
- else
- g_string_append (path, "unknown-XXXXXX");
-
- fd = mkstemp (path->str);
- if (fd != -1) {
- TEMP_FILES_LOCK ();
- if (!initialized) {
- g_atexit (e_mktemp_cleanup);
- initialized = TRUE;
- }
- temp_files = g_slist_prepend (temp_files, path->str);
- g_string_free (path, FALSE);
- TEMP_FILES_UNLOCK ();
- } else {
- g_string_free (path, TRUE);
- }
-
- return fd;
-}
-
-
-const char *
-e_mkdtemp (const char *template)
-{
- GString *path;
- char *tmpdir;
-
- path = get_path (TRUE);
- if (!path)
- return NULL;
-
- g_string_append_c (path, '/');
- if (template)
- g_string_append (path, template);
- else
- g_string_append (path, "unknown-XXXXXX");
-
-#ifdef HAVE_MKDTEMP
- tmpdir = mkdtemp (path->str);
-#else
- tmpdir = mktemp (path->str);
- if (tmpdir) {
- if (mkdir (tmpdir, S_IRWXU) == -1)
- tmpdir = NULL;
- }
-#endif
-
- if (tmpdir) {
- TEMP_DIRS_LOCK ();
- if (!initialized) {
- g_atexit (e_mktemp_cleanup);
- initialized = TRUE;
- }
- temp_dirs = g_slist_prepend (temp_dirs, tmpdir);
- g_string_free (path, FALSE);
- TEMP_DIRS_UNLOCK ();
- } else {
- g_string_free (path, TRUE);
- }
-
- return tmpdir;
-}
diff --git a/e-util/e-mktemp.h b/e-util/e-mktemp.h
deleted file mode 100644
index b5eb587d86..0000000000
--- a/e-util/e-mktemp.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2001 Ximian, Inc. (www.ximian.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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_MKTEMP_H__
-#define __E_MKTEMP_H__
-
-const char *e_mktemp (const char *template);
-
-int e_mkstemp (const char *template);
-
-const char *e_mkdtemp (const char *template);
-
-#endif /* __E_MKTEMP_H__ */
diff --git a/e-util/e-msgport.c b/e-util/e-msgport.c
deleted file mode 100644
index 36ea6cfe8d..0000000000
--- a/e-util/e-msgport.c
+++ /dev/null
@@ -1,1041 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Michael Zucchi <notzed@ximian.com>
- *
- * Copyright 2002 Ximian, Inc. (www.ximian.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <pthread.h>
-
-#include <glib.h>
-
-#ifdef HAVE_NSS
-#include <nspr.h>
-#endif
-
-#include "e-msgport.h"
-
-#define m(x) /* msgport debug */
-#define t(x) /* thread debug */
-
-void e_dlist_init(EDList *v)
-{
- v->head = (EDListNode *)&v->tail;
- v->tail = 0;
- v->tailpred = (EDListNode *)&v->head;
-}
-
-EDListNode *e_dlist_addhead(EDList *l, EDListNode *n)
-{
- n->next = l->head;
- n->prev = (EDListNode *)&l->head;
- l->head->prev = n;
- l->head = n;
- return n;
-}
-
-EDListNode *e_dlist_addtail(EDList *l, EDListNode *n)
-{
- n->next = (EDListNode *)&l->tail;
- n->prev = l->tailpred;
- l->tailpred->next = n;
- l->tailpred = n;
- return n;
-}
-
-EDListNode *e_dlist_remove(EDListNode *n)
-{
- n->next->prev = n->prev;
- n->prev->next = n->next;
- return n;
-}
-
-EDListNode *e_dlist_remhead(EDList *l)
-{
- EDListNode *n, *nn;
-
- n = l->head;
- nn = n->next;
- if (nn) {
- nn->prev = n->prev;
- l->head = nn;
- return n;
- }
- return NULL;
-}
-
-EDListNode *e_dlist_remtail(EDList *l)
-{
- EDListNode *n, *np;
-
- n = l->tailpred;
- np = n->prev;
- if (np) {
- np->next = n->next;
- l->tailpred = np;
- return n;
- }
- return NULL;
-}
-
-int e_dlist_empty(EDList *l)
-{
- return (l->head == (EDListNode *)&l->tail);
-}
-
-int e_dlist_length(EDList *l)
-{
- EDListNode *n, *nn;
- int count = 0;
-
- n = l->head;
- nn = n->next;
- while (nn) {
- count++;
- n = nn;
- nn = n->next;
- }
-
- return count;
-}
-
-struct _EMsgPort {
- EDList queue;
- int condwait; /* how many waiting in condwait */
- union {
- int pipe[2];
- struct {
- int read;
- int write;
- } fd;
- } pipe;
-#ifdef HAVE_NSS
- struct {
- PRFileDesc *read;
- PRFileDesc *write;
- } prpipe;
-#endif
- /* @#@$#$ glib stuff */
- GCond *cond;
- GMutex *lock;
-};
-
-EMsgPort *e_msgport_new(void)
-{
- EMsgPort *mp;
-
- mp = g_malloc(sizeof(*mp));
- e_dlist_init(&mp->queue);
- mp->lock = g_mutex_new();
- mp->cond = g_cond_new();
- mp->pipe.fd.read = -1;
- mp->pipe.fd.write = -1;
-#ifdef HAVE_NSS
- mp->prpipe.read = NULL;
- mp->prpipe.write = NULL;
-#endif
- mp->condwait = 0;
-
- return mp;
-}
-
-void e_msgport_destroy(EMsgPort *mp)
-{
- g_mutex_free(mp->lock);
- g_cond_free(mp->cond);
- if (mp->pipe.fd.read != -1) {
- close(mp->pipe.fd.read);
- close(mp->pipe.fd.write);
- }
-#ifdef HAVE_NSS
- if (mp->prpipe.read) {
- PR_Close(mp->prpipe.read);
- PR_Close(mp->prpipe.write);
- }
-#endif
- g_free(mp);
-}
-
-/* get a fd that can be used to wait on the port asynchronously */
-int e_msgport_fd(EMsgPort *mp)
-{
- int fd;
-
- g_mutex_lock(mp->lock);
- fd = mp->pipe.fd.read;
- if (fd == -1) {
- pipe(mp->pipe.pipe);
- fd = mp->pipe.fd.read;
- }
- g_mutex_unlock(mp->lock);
-
- return fd;
-}
-
-#ifdef HAVE_NSS
-PRFileDesc *e_msgport_prfd(EMsgPort *mp)
-{
- PRFileDesc *fd;
-
- g_mutex_lock(mp->lock);
- fd = mp->prpipe.read;
- if (fd == NULL) {
- PR_CreatePipe(&mp->prpipe.read, &mp->prpipe.write);
- fd = mp->prpipe.read;
- }
- g_mutex_unlock(mp->lock);
-
- return fd;
-}
-#endif
-
-void e_msgport_put(EMsgPort *mp, EMsg *msg)
-{
- int fd;
-#ifdef HAVE_NSS
- PRFileDesc *prfd;
-#endif
-
- m(printf("put:\n"));
- g_mutex_lock(mp->lock);
- e_dlist_addtail(&mp->queue, &msg->ln);
- if (mp->condwait > 0) {
- m(printf("put: condwait > 0, waking up\n"));
- g_cond_signal(mp->cond);
- }
- fd = mp->pipe.fd.write;
-#ifdef HAVE_NSS
- prfd = mp->prpipe.write;
-#endif
- g_mutex_unlock(mp->lock);
-
- if (fd != -1) {
- m(printf("put: have pipe, writing notification to it\n"));
- write(fd, "", 1);
- }
-
-#ifdef HAVE_NSS
- if (prfd != NULL) {
- m(printf("put: have pr pipe, writing notification to it\n"));
- PR_Write(prfd, "", 1);
- }
-#endif
- m(printf("put: done\n"));
-}
-
-static void
-msgport_cleanlock(void *data)
-{
- EMsgPort *mp = data;
-
- g_mutex_unlock(mp->lock);
-}
-
-EMsg *e_msgport_wait(EMsgPort *mp)
-{
- EMsg *msg;
-
- m(printf("wait:\n"));
- g_mutex_lock(mp->lock);
- while (e_dlist_empty(&mp->queue)) {
- if (mp->pipe.fd.read != -1) {
- fd_set rfds;
- int retry;
-
- m(printf("wait: waitng on pipe\n"));
- g_mutex_unlock(mp->lock);
- do {
- FD_ZERO(&rfds);
- FD_SET(mp->pipe.fd.read, &rfds);
- retry = select(mp->pipe.fd.read+1, &rfds, NULL, NULL, NULL) == -1 && errno == EINTR;
- pthread_testcancel();
- } while (retry);
- g_mutex_lock(mp->lock);
- m(printf("wait: got pipe\n"));
-#ifdef HAVE_NSS
- } else if (mp->prpipe.read != NULL) {
- PRPollDesc polltable[1];
- int retry;
-
- m(printf("wait: waitng on pr pipe\n"));
- g_mutex_unlock(mp->lock);
- do {
- polltable[0].fd = mp->prpipe.read;
- polltable[0].in_flags = PR_POLL_READ|PR_POLL_ERR;
- retry = PR_Poll(polltable, 1, PR_INTERVAL_NO_TIMEOUT) == -1 && PR_GetError() == PR_PENDING_INTERRUPT_ERROR;
- pthread_testcancel();
- } while (retry);
- g_mutex_lock(mp->lock);
- m(printf("wait: got pr pipe\n"));
-#endif /* HAVE_NSS */
- } else {
- m(printf("wait: waiting on condition\n"));
- mp->condwait++;
- /* if we are cancelled in the cond-wait, then we need to unlock our lock when we cleanup */
- pthread_cleanup_push(msgport_cleanlock, mp);
- g_cond_wait(mp->cond, mp->lock);
- pthread_cleanup_pop(0);
- m(printf("wait: got condition\n"));
- mp->condwait--;
- }
- }
- msg = (EMsg *)mp->queue.head;
- m(printf("wait: message = %p\n", msg));
- g_mutex_unlock(mp->lock);
- m(printf("wait: done\n"));
- return msg;
-}
-
-EMsg *e_msgport_get(EMsgPort *mp)
-{
- EMsg *msg;
- char dummy[1];
-
- g_mutex_lock(mp->lock);
- msg = (EMsg *)e_dlist_remhead(&mp->queue);
- if (msg) {
- if (mp->pipe.fd.read != -1)
- read(mp->pipe.fd.read, dummy, 1);
-#ifdef HAVE_NSS
- if (mp->prpipe.read != NULL) {
- int c;
- c = PR_Read(mp->prpipe.read, dummy, 1);
- g_assert(c == 1);
- }
-#endif
- }
- m(printf("get: message = %p\n", msg));
- g_mutex_unlock(mp->lock);
-
- return msg;
-}
-
-void e_msgport_reply(EMsg *msg)
-{
- if (msg->reply_port) {
- e_msgport_put(msg->reply_port, msg);
- }
- /* else lost? */
-}
-
-struct _thread_info {
- pthread_t id;
- int busy;
-};
-
-struct _EThread {
- struct _EThread *next;
- struct _EThread *prev;
-
- EMsgPort *server_port;
- EMsgPort *reply_port;
- pthread_mutex_t mutex;
- e_thread_t type;
- int queue_limit;
-
- int waiting; /* if we are waiting for a new message, count of waiting processes */
- pthread_t id; /* id of our running child thread */
- GList *id_list; /* if THREAD_NEW, then a list of our child threads in thread_info structs */
-
- EThreadFunc destroy;
- void *destroy_data;
-
- EThreadFunc received;
- void *received_data;
-
- EThreadFunc lost;
- void *lost_data;
-};
-
-/* All active threads */
-static EDList ethread_list = E_DLIST_INITIALISER(ethread_list);
-static pthread_mutex_t ethread_lock = PTHREAD_MUTEX_INITIALIZER;
-
-#define E_THREAD_NONE ((pthread_t)~0)
-#define E_THREAD_QUIT_REPLYPORT ((struct _EMsgPort *)~0)
-
-static void thread_destroy_msg(EThread *e, EMsg *m);
-
-static struct _thread_info *thread_find(EThread *e, pthread_t id)
-{
- GList *node;
- struct _thread_info *info;
-
- node = e->id_list;
- while (node) {
- info = node->data;
- if (info->id == id)
- return info;
- node = node->next;
- }
- return NULL;
-}
-
-#if 0
-static void thread_remove(EThread *e, pthread_t id)
-{
- GList *node;
- struct _thread_info *info;
-
- node = e->id_list;
- while (node) {
- info = node->data;
- if (info->id == id) {
- e->id_list = g_list_remove(e->id_list, info);
- g_free(info);
- }
- node = node->next;
- }
-}
-#endif
-
-EThread *e_thread_new(e_thread_t type)
-{
- EThread *e;
-
- e = g_malloc0(sizeof(*e));
- pthread_mutex_init(&e->mutex, 0);
- e->type = type;
- e->server_port = e_msgport_new();
- e->id = E_THREAD_NONE;
- e->queue_limit = INT_MAX;
-
- pthread_mutex_lock(&ethread_lock);
- e_dlist_addtail(&ethread_list, (EDListNode *)e);
- pthread_mutex_unlock(&ethread_lock);
-
- return e;
-}
-
-/* close down the threads & resources etc */
-void e_thread_destroy(EThread *e)
-{
- int busy = FALSE;
- EMsg *msg;
- struct _thread_info *info;
- GList *l;
-
- /* make sure we soak up all the messages first */
- while ( (msg = e_msgport_get(e->server_port)) ) {
- thread_destroy_msg(e, msg);
- }
-
- pthread_mutex_lock(&e->mutex);
-
- switch(e->type) {
- case E_THREAD_QUEUE:
- case E_THREAD_DROP:
- /* if we have a thread, 'kill' it */
- if (e->id != E_THREAD_NONE) {
- pthread_t id = e->id;
-
- t(printf("Sending thread '%d' quit message\n", id));
-
- e->id = E_THREAD_NONE;
-
- msg = g_malloc0(sizeof(*msg));
- msg->reply_port = E_THREAD_QUIT_REPLYPORT;
- e_msgport_put(e->server_port, msg);
-
- pthread_mutex_unlock(&e->mutex);
- t(printf("Joining thread '%d'\n", id));
- pthread_join(id, 0);
- t(printf("Joined thread '%d'!\n", id));
- pthread_mutex_lock(&e->mutex);
- }
- busy = e->id != E_THREAD_NONE;
- break;
- case E_THREAD_NEW:
- /* first, send everyone a quit message */
- l = e->id_list;
- while (l) {
- info = l->data;
- t(printf("Sending thread '%d' quit message\n", info->id));
- msg = g_malloc0(sizeof(*msg));
- msg->reply_port = E_THREAD_QUIT_REPLYPORT;
- e_msgport_put(e->server_port, msg);
- l = l->next;
- }
-
- /* then, wait for everyone to quit */
- while (e->id_list) {
- info = e->id_list->data;
- e->id_list = g_list_remove(e->id_list, info);
- pthread_mutex_unlock(&e->mutex);
- t(printf("Joining thread '%d'\n", info->id));
- pthread_join(info->id, 0);
- t(printf("Joined thread '%d'!\n", info->id));
- pthread_mutex_lock(&e->mutex);
- g_free(info);
- }
- busy = g_list_length(e->id_list) != 0;
- break;
- }
-
- pthread_mutex_unlock(&e->mutex);
-
- /* and clean up, if we can */
- if (busy) {
- g_warning("threads were busy, leaked EThread");
- return;
- }
-
- pthread_mutex_lock(&ethread_lock);
- e_dlist_remove((EDListNode *)e);
- pthread_mutex_unlock(&ethread_lock);
-
- pthread_mutex_destroy(&e->mutex);
- e_msgport_destroy(e->server_port);
- g_free(e);
-}
-
-/* set the queue maximum depth, what happens when the queue
- fills up depends on the queue type */
-void e_thread_set_queue_limit(EThread *e, int limit)
-{
- e->queue_limit = limit;
-}
-
-/* set a msg destroy callback, this can not call any e_thread functions on @e */
-void e_thread_set_msg_destroy(EThread *e, EThreadFunc destroy, void *data)
-{
- pthread_mutex_lock(&e->mutex);
- e->destroy = destroy;
- e->destroy_data = data;
- pthread_mutex_unlock(&e->mutex);
-}
-
-/* set a message lost callback, called if any message is discarded */
-void e_thread_set_msg_lost(EThread *e, EThreadFunc lost, void *data)
-{
- pthread_mutex_lock(&e->mutex);
- e->lost = lost;
- e->lost_data = lost;
- pthread_mutex_unlock(&e->mutex);
-}
-
-/* set a reply port, if set, then send messages back once finished */
-void e_thread_set_reply_port(EThread *e, EMsgPort *reply_port)
-{
- e->reply_port = reply_port;
-}
-
-/* set a received data callback */
-void e_thread_set_msg_received(EThread *e, EThreadFunc received, void *data)
-{
- pthread_mutex_lock(&e->mutex);
- e->received = received;
- e->received_data = data;
- pthread_mutex_unlock(&e->mutex);
-}
-
-/* find out if we're busy doing any work, e==NULL, check for all work */
-int e_thread_busy(EThread *e)
-{
- int busy = FALSE;
-
- if (e == NULL) {
- pthread_mutex_lock(&ethread_lock);
- e = (EThread *)ethread_list.head;
- while (e->next && !busy) {
- busy = e_thread_busy(e);
- e = e->next;
- }
- pthread_mutex_unlock(&ethread_lock);
- } else {
- pthread_mutex_lock(&e->mutex);
- switch (e->type) {
- case E_THREAD_QUEUE:
- case E_THREAD_DROP:
- busy = e->waiting != 1 && e->id != E_THREAD_NONE;
- break;
- case E_THREAD_NEW:
- busy = e->waiting != g_list_length(e->id_list);
- break;
- }
- pthread_mutex_unlock(&e->mutex);
- }
-
- return busy;
-}
-
-static void
-thread_destroy_msg(EThread *e, EMsg *m)
-{
- EThreadFunc func;
- void *func_data;
-
- /* we do this so we never get an incomplete/unmatched callback + data */
- pthread_mutex_lock(&e->mutex);
- func = e->destroy;
- func_data = e->destroy_data;
- pthread_mutex_unlock(&e->mutex);
-
- if (func)
- func(e, m, func_data);
-}
-
-static void
-thread_received_msg(EThread *e, EMsg *m)
-{
- EThreadFunc func;
- void *func_data;
-
- /* we do this so we never get an incomplete/unmatched callback + data */
- pthread_mutex_lock(&e->mutex);
- func = e->received;
- func_data = e->received_data;
- pthread_mutex_unlock(&e->mutex);
-
- if (func)
- func(e, m, func_data);
- else
- g_warning("No processing callback for EThread, message unprocessed");
-}
-
-static void
-thread_lost_msg(EThread *e, EMsg *m)
-{
- EThreadFunc func;
- void *func_data;
-
- /* we do this so we never get an incomplete/unmatched callback + data */
- pthread_mutex_lock(&e->mutex);
- func = e->lost;
- func_data = e->lost_data;
- pthread_mutex_unlock(&e->mutex);
-
- if (func)
- func(e, m, func_data);
-}
-
-/* the actual thread dispatcher */
-static void *
-thread_dispatch(void *din)
-{
- EThread *e = din;
- EMsg *m;
- struct _thread_info *info;
- pthread_t self = pthread_self();
-
- t(printf("dispatch thread started: %ld\n", pthread_self()));
-
- while (1) {
- pthread_mutex_lock(&e->mutex);
- m = e_msgport_get(e->server_port);
- if (m == NULL) {
- /* nothing to do? If we are a 'new' type thread, just quit.
- Otherwise, go into waiting (can be cancelled here) */
- info = NULL;
- switch (e->type) {
- case E_THREAD_NEW:
- case E_THREAD_QUEUE:
- case E_THREAD_DROP:
- info = thread_find(e, self);
- if (info)
- info->busy = FALSE;
- e->waiting++;
- pthread_mutex_unlock(&e->mutex);
- e_msgport_wait(e->server_port);
- pthread_mutex_lock(&e->mutex);
- e->waiting--;
- pthread_mutex_unlock(&e->mutex);
- break;
-#if 0
- case E_THREAD_NEW:
- e->id_list = g_list_remove(e->id_list, (void *)pthread_self());
- pthread_mutex_unlock(&e->mutex);
- return 0;
-#endif
- }
-
- continue;
- } else if (m->reply_port == E_THREAD_QUIT_REPLYPORT) {
- t(printf("Thread %d got quit message\n", self));
- /* Handle a quit message, say we're quitting, free the message, and break out of the loop */
- info = thread_find(e, self);
- if (info)
- info->busy = 2;
- pthread_mutex_unlock(&e->mutex);
- g_free(m);
- break;
- } else {
- info = thread_find(e, self);
- if (info)
- info->busy = TRUE;
- }
- pthread_mutex_unlock(&e->mutex);
-
- t(printf("got message in dispatch thread\n"));
-
- /* process it */
- thread_received_msg(e, m);
-
- /* if we have a reply port, send it back, otherwise, lose it */
- if (m->reply_port) {
- e_msgport_reply(m);
- } else {
- thread_destroy_msg(e, m);
- }
- }
-
- return NULL;
-}
-
-/* send a message to the thread, start thread if necessary */
-void e_thread_put(EThread *e, EMsg *msg)
-{
- pthread_t id;
- EMsg *dmsg = NULL;
-
- pthread_mutex_lock(&e->mutex);
-
- /* the caller forgot to tell us what to do, well, we can't do anything can we */
- if (e->received == NULL) {
- pthread_mutex_unlock(&e->mutex);
- g_warning("EThread called with no receiver function, no work to do!");
- thread_destroy_msg(e, msg);
- return;
- }
-
- msg->reply_port = e->reply_port;
-
- switch(e->type) {
- case E_THREAD_QUEUE:
- /* if the queue is full, lose this new addition */
- if (e_dlist_length(&e->server_port->queue) < e->queue_limit) {
- e_msgport_put(e->server_port, msg);
- } else {
- printf("queue limit reached, dropping new message\n");
- dmsg = msg;
- }
- break;
- case E_THREAD_DROP:
- /* if the queue is full, lose the oldest (unprocessed) message */
- if (e_dlist_length(&e->server_port->queue) < e->queue_limit) {
- e_msgport_put(e->server_port, msg);
- } else {
- printf("queue limit reached, dropping old message\n");
- e_msgport_put(e->server_port, msg);
- dmsg = e_msgport_get(e->server_port);
- }
- break;
- case E_THREAD_NEW:
- /* it is possible that an existing thread can catch this message, so
- we might create a thread with no work to do.
- but that doesn't matter, the other alternative that it be lost is worse */
- e_msgport_put(e->server_port, msg);
- if (e->waiting == 0
- && g_list_length(e->id_list) < e->queue_limit
- && pthread_create(&id, NULL, thread_dispatch, e) == 0) {
- struct _thread_info *info = g_malloc0(sizeof(*info));
- t(printf("created NEW thread %ld\n", id));
- info->id = id;
- info->busy = TRUE;
- e->id_list = g_list_append(e->id_list, info);
- }
- pthread_mutex_unlock(&e->mutex);
- return;
- }
-
- /* create the thread, if there is none to receive it yet */
- if (e->id == E_THREAD_NONE) {
- int err;
-
- if ((err = pthread_create(&e->id, NULL, thread_dispatch, e)) != 0) {
- g_warning("Could not create dispatcher thread, message queued?: %s", strerror(err));
- e->id = E_THREAD_NONE;
- }
- }
-
- pthread_mutex_unlock(&e->mutex);
-
- if (dmsg) {
- thread_lost_msg(e, dmsg);
- thread_destroy_msg(e, dmsg);
- }
-}
-
-/* yet-another-mutex interface */
-struct _EMutex {
- int type;
- pthread_t owner;
- short waiters;
- short depth;
- pthread_mutex_t mutex;
- pthread_cond_t cond;
-};
-
-/* sigh, this is just painful to have to need, but recursive
- read/write, etc mutexes just aren't very common in thread
- implementations */
-/* TODO: Just make it use recursive mutexes if they are available */
-EMutex *e_mutex_new(e_mutex_t type)
-{
- struct _EMutex *m;
-
- m = g_malloc(sizeof(*m));
- m->type = type;
- m->waiters = 0;
- m->depth = 0;
- m->owner = E_THREAD_NONE;
-
- switch (type) {
- case E_MUTEX_SIMPLE:
- pthread_mutex_init(&m->mutex, 0);
- break;
- case E_MUTEX_REC:
- pthread_mutex_init(&m->mutex, 0);
- pthread_cond_init(&m->cond, 0);
- break;
- /* read / write ? flags for same? */
- }
-
- return m;
-}
-
-int e_mutex_destroy(EMutex *m)
-{
- int ret = 0;
-
- switch (m->type) {
- case E_MUTEX_SIMPLE:
- ret = pthread_mutex_destroy(&m->mutex);
- if (ret == -1)
- g_warning("EMutex destroy failed: %s", strerror(errno));
- g_free(m);
- break;
- case E_MUTEX_REC:
- ret = pthread_mutex_destroy(&m->mutex);
- if (ret == -1)
- g_warning("EMutex destroy failed: %s", strerror(errno));
- ret = pthread_cond_destroy(&m->cond);
- if (ret == -1)
- g_warning("EMutex destroy failed: %s", strerror(errno));
- g_free(m);
-
- }
- return ret;
-}
-
-int e_mutex_lock(EMutex *m)
-{
- pthread_t id;
- int err;
-
- switch (m->type) {
- case E_MUTEX_SIMPLE:
- return pthread_mutex_lock(&m->mutex);
- case E_MUTEX_REC:
- id = pthread_self();
- if ((err = pthread_mutex_lock(&m->mutex)) != 0)
- return err;
- while (1) {
- if (m->owner == E_THREAD_NONE) {
- m->owner = id;
- m->depth = 1;
- break;
- } else if (id == m->owner) {
- m->depth++;
- break;
- } else {
- m->waiters++;
- if ((err = pthread_cond_wait(&m->cond, &m->mutex)) != 0)
- return err;
- m->waiters--;
- }
- }
- return pthread_mutex_unlock(&m->mutex);
- }
-
- return EINVAL;
-}
-
-int e_mutex_unlock(EMutex *m)
-{
- int err;
-
- switch (m->type) {
- case E_MUTEX_SIMPLE:
- return pthread_mutex_unlock(&m->mutex);
- case E_MUTEX_REC:
- if ((err = pthread_mutex_lock(&m->mutex)) != 0)
- return err;
- g_assert(m->owner == pthread_self());
-
- m->depth--;
- if (m->depth == 0) {
- m->owner = E_THREAD_NONE;
- if (m->waiters > 0)
- pthread_cond_signal(&m->cond);
- }
- return pthread_mutex_unlock(&m->mutex);
- }
-
- errno = EINVAL;
- return -1;
-}
-
-void e_mutex_assert_locked(EMutex *m)
-{
- g_return_if_fail (m->type == E_MUTEX_REC);
- pthread_mutex_lock(&m->mutex);
- g_assert(m->owner == pthread_self());
- pthread_mutex_unlock(&m->mutex);
-}
-
-int e_mutex_cond_wait(void *vcond, EMutex *m)
-{
- int ret;
- pthread_cond_t *cond = vcond;
-
- switch(m->type) {
- case E_MUTEX_SIMPLE:
- return pthread_cond_wait(cond, &m->mutex);
- case E_MUTEX_REC:
- if ((ret = pthread_mutex_lock(&m->mutex)) != 0)
- return ret;
- g_assert(m->owner == pthread_self());
- ret = pthread_cond_wait(cond, &m->mutex);
- g_assert(m->owner == pthread_self());
- pthread_mutex_unlock(&m->mutex);
- return ret;
- default:
- g_return_val_if_reached(-1);
- }
-}
-
-#ifdef STANDALONE
-EMsgPort *server_port;
-
-
-void *fdserver(void *data)
-{
- int fd;
- EMsg *msg;
- int id = (int)data;
- fd_set rfds;
-
- fd = e_msgport_fd(server_port);
-
- while (1) {
- int count = 0;
-
- printf("server %d: waiting on fd %d\n", id, fd);
- FD_ZERO(&rfds);
- FD_SET(fd, &rfds);
- select(fd+1, &rfds, NULL, NULL, NULL);
- printf("server %d: Got async notification, checking for messages\n", id);
- while ((msg = e_msgport_get(server_port))) {
- printf("server %d: got message\n", id);
- sleep(1);
- printf("server %d: replying\n", id);
- e_msgport_reply(msg);
- count++;
- }
- printf("server %d: got %d messages\n", id, count);
- }
-}
-
-void *server(void *data)
-{
- EMsg *msg;
- int id = (int)data;
-
- while (1) {
- printf("server %d: waiting\n", id);
- msg = e_msgport_wait(server_port);
- msg = e_msgport_get(server_port);
- if (msg) {
- printf("server %d: got message\n", id);
- sleep(1);
- printf("server %d: replying\n", id);
- e_msgport_reply(msg);
- } else {
- printf("server %d: didn't get message\n", id);
- }
- }
-}
-
-void *client(void *data)
-{
- EMsg *msg;
- EMsgPort *replyport;
- int i;
-
- replyport = e_msgport_new();
- msg = g_malloc0(sizeof(*msg));
- msg->reply_port = replyport;
- for (i=0;i<10;i++) {
- /* synchronous operation */
- printf("client: sending\n");
- e_msgport_put(server_port, msg);
- printf("client: waiting for reply\n");
- e_msgport_wait(replyport);
- e_msgport_get(replyport);
- printf("client: got reply\n");
- }
-
- printf("client: sleeping ...\n");
- sleep(2);
- printf("client: sending multiple\n");
-
- for (i=0;i<10;i++) {
- msg = g_malloc0(sizeof(*msg));
- msg->reply_port = replyport;
- e_msgport_put(server_port, msg);
- }
-
- printf("client: receiving multiple\n");
- for (i=0;i<10;i++) {
- e_msgport_wait(replyport);
- msg = e_msgport_get(replyport);
- g_free(msg);
- }
-
- printf("client: done\n");
-}
-
-int main(int argc, char **argv)
-{
- pthread_t serverid, clientid;
-
- g_thread_init(NULL);
-
- server_port = e_msgport_new();
-
- /*pthread_create(&serverid, NULL, server, (void *)1);*/
- pthread_create(&serverid, NULL, fdserver, (void *)1);
- pthread_create(&clientid, NULL, client, NULL);
-
- sleep(60);
-
- return 0;
-}
-#endif
diff --git a/e-util/e-msgport.h b/e-util/e-msgport.h
deleted file mode 100644
index 8d4e0c20f7..0000000000
--- a/e-util/e-msgport.h
+++ /dev/null
@@ -1,88 +0,0 @@
-
-#ifndef _E_MSGPORT_H
-#define _E_MSGPORT_H
-
-/* double-linked list yeah another one, deal */
-typedef struct _EDListNode {
- struct _EDListNode *next;
- struct _EDListNode *prev;
-} EDListNode;
-
-typedef struct _EDList {
- struct _EDListNode *head;
- struct _EDListNode *tail;
- struct _EDListNode *tailpred;
-} EDList;
-
-#define E_DLIST_INITIALISER(l) { (EDListNode *)&l.tail, 0, (EDListNode *)&l.head }
-
-void e_dlist_init(EDList *v);
-EDListNode *e_dlist_addhead(EDList *l, EDListNode *n);
-EDListNode *e_dlist_addtail(EDList *l, EDListNode *n);
-EDListNode *e_dlist_remove(EDListNode *n);
-EDListNode *e_dlist_remhead(EDList *l);
-EDListNode *e_dlist_remtail(EDList *l);
-int e_dlist_empty(EDList *l);
-int e_dlist_length(EDList *l);
-
-/* message ports - a simple inter-thread 'ipc' primitive */
-/* opaque handle */
-typedef struct _EMsgPort EMsgPort;
-
-/* header for any message */
-typedef struct _EMsg {
- EDListNode ln;
- EMsgPort *reply_port;
-} EMsg;
-
-EMsgPort *e_msgport_new(void);
-void e_msgport_destroy(EMsgPort *mp);
-/* get a fd that can be used to wait on the port asynchronously */
-int e_msgport_fd(EMsgPort *mp);
-void e_msgport_put(EMsgPort *mp, EMsg *msg);
-EMsg *e_msgport_wait(EMsgPort *mp);
-EMsg *e_msgport_get(EMsgPort *mp);
-void e_msgport_reply(EMsg *msg);
-#ifdef HAVE_NSS
-struct PRFileDesc *e_msgport_prfd(EMsgPort *mp);
-#endif
-
-/* e threads, a server thread with a message based request-response, and flexible queuing */
-typedef struct _EThread EThread;
-
-typedef enum {
- E_THREAD_QUEUE = 0, /* run one by one, until done, if the queue_limit is reached, discard new request */
- E_THREAD_DROP, /* run one by one, until done, if the queue_limit is reached, discard oldest requests */
- E_THREAD_NEW, /* always run in a new thread, if the queue limit is reached, new requests are
- stored in the queue until a thread becomes available for it, creating a thread pool */
-} e_thread_t;
-
-typedef void (*EThreadFunc)(EThread *, EMsg *, void *data);
-
-EThread *e_thread_new(e_thread_t type);
-void e_thread_destroy(EThread *e);
-void e_thread_set_queue_limit(EThread *e, int limit);
-void e_thread_set_msg_lost(EThread *e, EThreadFunc destroy, void *data);
-void e_thread_set_msg_destroy(EThread *e, EThreadFunc destroy, void *data);
-void e_thread_set_reply_port(EThread *e, EMsgPort *reply_port);
-void e_thread_set_msg_received(EThread *e, EThreadFunc received, void *data);
-void e_thread_put(EThread *e, EMsg *msg);
-int e_thread_busy(EThread *e);
-
-/* sigh, another mutex interface, this one allows different mutex types, portably */
-typedef struct _EMutex EMutex;
-
-typedef enum _e_mutex_t {
- E_MUTEX_SIMPLE, /* == pthread_mutex */
- E_MUTEX_REC, /* recursive mutex */
-} e_mutex_t;
-
-EMutex *e_mutex_new(e_mutex_t type);
-int e_mutex_destroy(EMutex *m);
-int e_mutex_lock(EMutex *m);
-int e_mutex_unlock(EMutex *m);
-void e_mutex_assert_locked(EMutex *m);
-/* this uses pthread cond's */
-int e_mutex_cond_wait(void *cond, EMutex *m);
-
-#endif
diff --git a/e-util/e-passwords.c b/e-util/e-passwords.c
deleted file mode 100644
index 5405e76245..0000000000
--- a/e-util/e-passwords.c
+++ /dev/null
@@ -1,594 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * e-passwords.c
- *
- * Copyright (C) 2001 Ximian, Inc.
- */
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "e-passwords.h"
-#include <string.h>
-#include <libgnome/gnome-config.h>
-#include <libgnome/gnome-i18n.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkbox.h>
-#include <gtk/gtkcheckbutton.h>
-#include <gtk/gtkmessagedialog.h>
-
-static char *decode_base64 (char *base64);
-
-static GHashTable *passwords = NULL;
-
-static int base64_encode_close(unsigned char *in, int inlen, gboolean break_lines, unsigned char *out, int *state, int *save);
-static int base64_encode_step(unsigned char *in, int len, gboolean break_lines, unsigned char *out, int *state, int *save);
-
-/**
- * e_passwords_init:
- *
- * Initializes the e_passwords routines. Must be called before any other
- * e_passwords_* function.
- **/
-static void
-e_passwords_init ()
-{
- if (passwords)
- return;
-
- /* create the per-session hash table */
- passwords = g_hash_table_new (g_str_hash, g_str_equal);
-}
-
-static gboolean
-free_entry (gpointer key, gpointer value, gpointer user_data)
-{
- g_free (key);
- memset (value, 0, strlen (value));
- g_free (value);
- return TRUE;
-}
-
-/**
- * e_passwords_shutdown:
- *
- * Cleanup routine to call before exiting.
- **/
-void
-e_passwords_shutdown ()
-{
- /* shouldn't need this really - everything is synchronous */
- gnome_config_private_sync_file ("/Evolution");
-
- if (passwords) {
- /* and destroy our per session hash */
- g_hash_table_foreach_remove (passwords, free_entry, NULL);
- g_hash_table_destroy (passwords);
- passwords = NULL;
- }
-}
-
-
-/**
- * e_passwords_forget_passwords:
- *
- * Forgets all cached passwords, in memory and on disk.
- **/
-void
-e_passwords_forget_passwords ()
-{
- void *it;
- char *key;
-
- e_passwords_init ();
-
- it = gnome_config_private_init_iterator_sections("/Evolution");
- while ( (it = gnome_config_iterator_next(it, &key, NULL)) ) {
- if (0 == strncmp(key, "Passwords-", 10)) {
- char *section = g_strdup_printf("/Evolution/%s", key);
-
- gnome_config_private_clean_section (section);
- g_free(section);
- }
- g_free(key);
- }
-
- /*gnome_config_private_clean_section ("/Evolution/Passwords-Mail");*/
- gnome_config_private_sync_file ("/Evolution");
-
- /* free up the session passwords */
- g_hash_table_foreach_remove (passwords, free_entry, NULL);
-}
-
-/**
- * e_passwords_clear_component_passwords:
- *
- * Forgets all disk cached passwords.
- **/
-void
-e_passwords_clear_component_passwords (const char *component_name)
-{
- char *path;
-
- e_passwords_init ();
-
- path = g_strdup_printf ("/Evolution/Passwords-%s", component_name);
-
- gnome_config_private_clean_section (path);
- gnome_config_private_sync_file ("/Evolution");
-
- g_free (path);
-}
-
-static char *
-password_path (const char *component_name, const char *key)
-{
- char *keycopy, *path;
- int i;
- keycopy = g_strdup (key);
-
- for (i = 0; i < strlen (keycopy); i ++)
- if (keycopy[i] == '/' || keycopy[i] =='=')
- keycopy[i] = '_';
-
- path = g_strdup_printf ("/Evolution/Passwords-%s/%s", component_name, keycopy);
-
- g_free (keycopy);
-
- return path;
-}
-
-/**
- * e_passwords_remember_password:
- * @key: the key
- *
- * Saves the password associated with @key to disk.
- **/
-void
-e_passwords_remember_password (const char *component_name, const char *key)
-{
- gpointer okey, value;
- char *path, *pass64;
- int len, state, save;
-
- e_passwords_init ();
-
- if (!g_hash_table_lookup_extended (passwords, key, &okey, &value))
- return;
-
- /* add it to the on-disk cache of passwords */
- path = password_path (component_name, okey);
-
- len = strlen (value);
- pass64 = g_malloc0 ((len + 2) * 4 / 3 + 1);
- state = save = 0;
- base64_encode_close (value, len, FALSE, pass64, &state, &save);
-
- gnome_config_private_set_string (path, pass64);
- g_free (path);
- g_free (pass64);
-
- /* now remove it from our session hash */
- g_hash_table_remove (passwords, key);
- g_free (okey);
- g_free (value);
-
- gnome_config_private_sync_file ("/Evolution");
-}
-
-/**
- * e_passwords_forget_password:
- * @key: the key
- *
- * Forgets the password associated with @key, in memory and on disk.
- **/
-void
-e_passwords_forget_password (const char *component_name, const char *key)
-{
- gpointer okey, value;
- char *path;
-
- e_passwords_init ();
-
- if (g_hash_table_lookup_extended (passwords, key, &okey, &value)) {
- g_hash_table_remove (passwords, key);
- memset (value, 0, strlen (value));
- g_free (okey);
- g_free (value);
- }
-
- /* clear it in the on disk db */
- path = password_path (component_name, key);
- gnome_config_private_clean_key (path);
- gnome_config_private_sync_file ("/Evolution");
- g_free (path);
-}
-
-/**
- * e_passwords_get_password:
- * @key: the key
- *
- * Return value: the password associated with @key, or %NULL. Caller
- * must free the returned password.
- **/
-char *
-e_passwords_get_password (const char *component_name, const char *key)
-{
- char *path, *passwd;
- char *encoded = NULL;
-
- e_passwords_init ();
-
- passwd = g_hash_table_lookup (passwords, key);
- if (passwd)
- return g_strdup (passwd);
-
- /* not part of the session hash, look it up in the on disk db */
- path = password_path (component_name, key);
-
- encoded = gnome_config_private_get_string_with_default (path, NULL);
-
- g_free (path);
-
- if (!encoded)
- return NULL;
-
- passwd = decode_base64 (encoded);
- g_free (encoded);
-
- return passwd;
-}
-
-/**
- * e_passwords_add_password:
- * @key: a key
- * @passwd: the password for @key
- *
- * This stores the @key/@passwd pair in the current session's password
- * hash.
- **/
-void
-e_passwords_add_password (const char *key, const char *passwd)
-{
- gpointer okey, value;
-
- e_passwords_init ();
-
- /* FIXME: shouldn't this be g_return_if_fail? */
- if (!key || !passwd)
- return;
-
- if (g_hash_table_lookup_extended (passwords, key, &okey, &value)) {
- g_hash_table_remove (passwords, key);
- g_free (okey);
- g_free (value);
- }
-
- g_hash_table_insert (passwords, g_strdup (key), g_strdup (passwd));
-}
-
-
-static void
-entry_activate (GtkEntry *entry, GtkDialog *dialog)
-{
- gtk_dialog_response (dialog, GTK_RESPONSE_OK);
-}
-
-/**
- * e_passwords_ask_password:
- * @title: title for the password dialog
- * @component_name: the name of the component for which we're storing
- * the password (e.g. Mail, Addressbook, etc.)
- * @key: key to store the password under
- * @prompt: prompt string
- * @secret: whether or not the password text should be ***ed out
- * @remember_type: whether or not to offer to remember the password,
- * and for how long.
- * @remember: on input, the default state of the remember checkbox.
- * on output, the state of the checkbox when the dialog was closed.
- * @parent: parent window of the dialog, or %NULL
- *
- * Asks the user for a password.
- *
- * Return value: the password, which the caller must free, or %NULL if
- * the user cancelled the operation. *@remember will be set if the
- * return value is non-%NULL and @remember_type is not
- * E_PASSWORDS_DO_NOT_REMEMBER.
- **/
-char *
-e_passwords_ask_password (const char *title, const char *component_name,
- const char *key,
- const char *prompt, gboolean secret,
- EPasswordsRememberType remember_type,
- gboolean *remember,
- GtkWindow *parent)
-{
- GtkWidget *dialog;
- GtkWidget *check = NULL, *entry;
- char *password;
- int response;
-
- dialog = gtk_message_dialog_new (parent,
- 0,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_OK_CANCEL,
- prompt);
-
- gtk_window_set_title (GTK_WINDOW (dialog), title);
-
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
-
- /* Password entry */
- entry = gtk_entry_new();
- if (secret)
- gtk_entry_set_visibility (GTK_ENTRY(entry), FALSE);
-
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
- entry, FALSE, FALSE, 4);
- gtk_widget_show (entry);
- gtk_widget_grab_focus (entry);
-
- g_signal_connect (entry, "activate",
- G_CALLBACK (entry_activate), dialog);
-
- /* Remember the password? */
- if (remember_type != E_PASSWORDS_DO_NOT_REMEMBER) {
- const char *label;
-
- if (remember_type == E_PASSWORDS_REMEMBER_FOREVER)
- label = _("Remember this password");
- else
- label = _("Remember this password for the remainder of this session");
- check = gtk_check_button_new_with_label (label);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check),
- *remember);
-
- gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->vbox),
- check, TRUE, FALSE, 4);
- gtk_widget_show (check);
- }
-
- response = gtk_dialog_run (GTK_DIALOG (dialog));
-
- if (response == GTK_RESPONSE_OK) {
- password = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
- if (remember_type != E_PASSWORDS_DO_NOT_REMEMBER) {
- *remember = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check));
-
- if (*remember || remember_type == E_PASSWORDS_REMEMBER_FOREVER)
- e_passwords_add_password (key, password);
- if (*remember && remember_type == E_PASSWORDS_REMEMBER_FOREVER)
- e_passwords_remember_password (component_name, key);
- }
- } else
- password = NULL;
-
- gtk_widget_destroy (dialog);
-
- return password;
-}
-
-
-
-static char *base64_alphabet =
-"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-static unsigned char camel_mime_base64_rank[256] = {
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255, 62,255,255,255, 63,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,255,255,255, 0,255,255,
- 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,255,255,255,255,255,
- 255, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-};
-
-/* call this when finished encoding everything, to
- flush off the last little bit */
-static int
-base64_encode_close(unsigned char *in, int inlen, gboolean break_lines, unsigned char *out, int *state, int *save)
-{
- int c1, c2;
- unsigned char *outptr = out;
-
- if (inlen>0)
- outptr += base64_encode_step(in, inlen, break_lines, outptr, state, save);
-
- c1 = ((unsigned char *)save)[1];
- c2 = ((unsigned char *)save)[2];
-
- switch (((char *)save)[0]) {
- case 2:
- outptr[2] = base64_alphabet[ ( (c2 &0x0f) << 2 ) ];
- g_assert(outptr[2] != 0);
- goto skip;
- case 1:
- outptr[2] = '=';
- skip:
- outptr[0] = base64_alphabet[ c1 >> 2 ];
- outptr[1] = base64_alphabet[ c2 >> 4 | ( (c1&0x3) << 4 )];
- outptr[3] = '=';
- outptr += 4;
- break;
- }
- if (break_lines)
- *outptr++ = '\n';
-
- *save = 0;
- *state = 0;
-
- return outptr-out;
-}
-
-/*
- performs an 'encode step', only encodes blocks of 3 characters to the
- output at a time, saves left-over state in state and save (initialise to
- 0 on first invocation).
-*/
-static int
-base64_encode_step(unsigned char *in, int len, gboolean break_lines, unsigned char *out, int *state, int *save)
-{
- register unsigned char *inptr, *outptr;
-
- if (len<=0)
- return 0;
-
- inptr = in;
- outptr = out;
-
- if (len + ((char *)save)[0] > 2) {
- unsigned char *inend = in+len-2;
- register int c1, c2, c3;
- register int already;
-
- already = *state;
-
- switch (((char *)save)[0]) {
- case 1: c1 = ((unsigned char *)save)[1]; goto skip1;
- case 2: c1 = ((unsigned char *)save)[1];
- c2 = ((unsigned char *)save)[2]; goto skip2;
- }
-
- /* yes, we jump into the loop, no i'm not going to change it, it's beautiful! */
- while (inptr < inend) {
- c1 = *inptr++;
- skip1:
- c2 = *inptr++;
- skip2:
- c3 = *inptr++;
- *outptr++ = base64_alphabet[ c1 >> 2 ];
- *outptr++ = base64_alphabet[ c2 >> 4 | ( (c1&0x3) << 4 ) ];
- *outptr++ = base64_alphabet[ ( (c2 &0x0f) << 2 ) | (c3 >> 6) ];
- *outptr++ = base64_alphabet[ c3 & 0x3f ];
- /* this is a bit ugly ... */
- if (break_lines && (++already)>=19) {
- *outptr++='\n';
- already = 0;
- }
- }
-
- ((char *)save)[0] = 0;
- len = 2-(inptr-inend);
- *state = already;
- }
-
- if (len>0) {
- register char *saveout;
-
- /* points to the slot for the next char to save */
- saveout = & (((char *)save)[1]) + ((char *)save)[0];
-
- /* len can only be 0 1 or 2 */
- switch(len) {
- case 2: *saveout++ = *inptr++;
- case 1: *saveout++ = *inptr++;
- }
- ((char *)save)[0]+=len;
- }
-
- return outptr-out;
-}
-
-
-/**
- * base64_decode_step: decode a chunk of base64 encoded data
- * @in: input stream
- * @len: max length of data to decode
- * @out: output stream
- * @state: holds the number of bits that are stored in @save
- * @save: leftover bits that have not yet been decoded
- *
- * Decodes a chunk of base64 encoded data
- **/
-static int
-base64_decode_step(unsigned char *in, int len, unsigned char *out, int *state, unsigned int *save)
-{
- register unsigned char *inptr, *outptr;
- unsigned char *inend, c;
- register unsigned int v;
- int i;
-
- inend = in+len;
- outptr = out;
-
- /* convert 4 base64 bytes to 3 normal bytes */
- v=*save;
- i=*state;
- inptr = in;
- while (inptr<inend) {
- c = camel_mime_base64_rank[*inptr++];
- if (c != 0xff) {
- v = (v<<6) | c;
- i++;
- if (i==4) {
- *outptr++ = v>>16;
- *outptr++ = v>>8;
- *outptr++ = v;
- i=0;
- }
- }
- }
-
- *save = v;
- *state = i;
-
- /* quick scan back for '=' on the end somewhere */
- /* fortunately we can drop 1 output char for each trailing = (upto 2) */
- i=2;
- while (inptr>in && i) {
- inptr--;
- if (camel_mime_base64_rank[*inptr] != 0xff) {
- if (*inptr == '=')
- outptr--;
- i--;
- }
- }
-
- /* if i!= 0 then there is a truncation error! */
- return outptr-out;
-}
-
-static char *
-decode_base64 (char *base64)
-{
- char *plain, *pad = "==";
- int len, out, state, save;
-
- len = strlen (base64);
- plain = g_malloc0 (len);
- state = save = 0;
- out = base64_decode_step (base64, len, plain, &state, &save);
- if (len % 4) {
- base64_decode_step (pad, 4 - len % 4, plain + out,
- &state, &save);
- }
-
- return plain;
-}
diff --git a/e-util/e-passwords.h b/e-util/e-passwords.h
deleted file mode 100644
index 7a2b2aa17f..0000000000
--- a/e-util/e-passwords.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * e-passwords.h
- *
- * Copyright (C) 2001 Ximian, Inc.
- */
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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_PASSWORD_H_
-#define _E_PASSWORD_H_
-
-#include <glib.h>
-#include <gtk/gtkwindow.h>
-
-G_BEGIN_DECLS
-
-/* initialization is now implicit when you call any of the functions
- below (except _shutdown.). e_passwords_shutdown should be called
- at exit time to synch the password on-disk storage, and to free up
- in-memory storage. */
-void e_passwords_shutdown (void);
-
-void e_passwords_remember_password (const char *component, const char *key);
-void e_passwords_add_password (const char *key, const char *passwd);
-char *e_passwords_get_password (const char *component, const char *key);
-void e_passwords_forget_password (const char *component, const char *key);
-void e_passwords_forget_passwords (void);
-void e_passwords_clear_component_passwords (const char *component);
-
-typedef enum {
- E_PASSWORDS_DO_NOT_REMEMBER,
- E_PASSWORDS_REMEMBER_FOR_SESSION,
- E_PASSWORDS_REMEMBER_FOREVER
-} EPasswordsRememberType;
-
-char * e_passwords_ask_password (const char *title,
- const char*component_name, const char *key,
- const char *prompt, gboolean secret,
- EPasswordsRememberType remember_type,
- gboolean *remember,
- GtkWindow *parent);
-
-G_END_DECLS
-
-#endif /* _E_PASSWORD_H_ */
diff --git a/e-util/e-path.c b/e-util/e-path.c
deleted file mode 100644
index 089ee03842..0000000000
--- a/e-util/e-path.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-path.c
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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 <sys/types.h>
-#include <dirent.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <glib.h>
-
-#include "e-path.h"
-
-#define SUBFOLDER_DIR_NAME "subfolders"
-#define SUBFOLDER_DIR_NAME_LEN 10
-
-/**
- * e_path_to_physical:
- * @prefix: a prefix to prepend to the path, or %NULL
- * @path: the virtual path to convert to a filesystem path.
- *
- * This converts the "virtual" path @path into an expanded form that
- * allows a given name to refer to both a file and a directory. The
- * expanded path will have a "subfolders" directory inserted between
- * each path component. If the path ends with "/", the returned
- * physical path will end with "/subfolders"
- *
- * If @prefix is non-%NULL, it will be prepended to the returned path.
- *
- * Return value: the expanded path
- **/
-char *
-e_path_to_physical (const char *prefix, const char *vpath)
-{
- const char *p, *newp;
- char *dp;
- char *ppath;
- int ppath_len;
- int prefix_len;
-
- while (*vpath == '/')
- vpath++;
- if (!prefix)
- prefix = "";
-
- /* Calculate the length of the real path. */
- ppath_len = strlen (vpath);
- ppath_len++; /* For the ending zero. */
-
- prefix_len = strlen (prefix);
- ppath_len += prefix_len;
- ppath_len++; /* For the separating slash. */
-
- /* Take account of the fact that we need to translate every
- * separator into `subfolders/'.
- */
- p = vpath;
- while (1) {
- newp = strchr (p, '/');
- if (newp == NULL)
- break;
-
- ppath_len += SUBFOLDER_DIR_NAME_LEN;
- ppath_len++; /* For the separating slash. */
-
- /* Skip consecutive slashes. */
- while (*newp == '/')
- newp++;
-
- p = newp;
- };
-
- ppath = g_malloc (ppath_len);
- dp = ppath;
-
- memcpy (dp, prefix, prefix_len);
- dp += prefix_len;
- *(dp++) = '/';
-
- /* Copy the mangled path. */
- p = vpath;
- while (1) {
- newp = strchr (p, '/');
- if (newp == NULL) {
- strcpy (dp, p);
- break;
- }
-
- memcpy (dp, p, newp - p + 1); /* `+ 1' to copy the slash too. */
- dp += newp - p + 1;
-
- memcpy (dp, SUBFOLDER_DIR_NAME, SUBFOLDER_DIR_NAME_LEN);
- dp += SUBFOLDER_DIR_NAME_LEN;
-
- *(dp++) = '/';
-
- /* Skip consecutive slashes. */
- while (*newp == '/')
- newp++;
-
- p = newp;
- }
-
- return ppath;
-}
-
-
-static gboolean
-find_folders_recursive (const char *physical_path, const char *path,
- EPathFindFoldersCallback callback, gpointer data)
-{
- DIR *dir;
- char *subfolder_directory_path;
- gboolean ok;
-
- if (*path) {
- if (!callback (physical_path, path, data))
- return FALSE;
-
- subfolder_directory_path = g_strdup_printf ("%s/%s", physical_path, SUBFOLDER_DIR_NAME);
- } else {
- /* On the top level, we have no folders and,
- * consequently, no subfolder directory.
- */
-
- subfolder_directory_path = g_strdup (physical_path);
- }
-
- /* Now scan the subfolders and load them. */
- dir = opendir (subfolder_directory_path);
- if (dir == NULL) {
- g_free (subfolder_directory_path);
- return TRUE;
- }
-
- ok = TRUE;
- while (ok) {
- struct stat file_stat;
- struct dirent *dirent;
- char *file_path;
- char *new_path;
-
- dirent = readdir (dir);
- if (dirent == NULL)
- break;
-
- if (strcmp (dirent->d_name, ".") == 0 || strcmp (dirent->d_name, "..") == 0)
- continue;
-
- file_path = g_strdup_printf ("%s/%s", subfolder_directory_path,
- dirent->d_name);
-
- if (stat (file_path, &file_stat) < 0 ||
- ! S_ISDIR (file_stat.st_mode)) {
- g_free (file_path);
- continue;
- }
-
- new_path = g_strdup_printf ("%s/%s", path, dirent->d_name);
-
- ok = find_folders_recursive (file_path, new_path, callback, data);
-
- g_free (file_path);
- g_free (new_path);
- }
-
- closedir (dir);
- g_free (subfolder_directory_path);
-
- return ok;
-}
-
-/**
- * e_path_find_folders:
- * @prefix: directory to start from
- * @callback: Callback to invoke on each folder
- * @data: Data for @callback
- *
- * Walks the folder tree starting at @prefix and calls @callback
- * on each folder.
- *
- * Return value: %TRUE on success, %FALSE if an error occurs at any point
- **/
-gboolean
-e_path_find_folders (const char *prefix,
- EPathFindFoldersCallback callback,
- gpointer data)
-{
- return find_folders_recursive (prefix, "", callback, data);
-}
-
-
-/**
- * e_path_rmdir:
- * @prefix: a prefix to prepend to the path, or %NULL
- * @path: the virtual path to convert to a filesystem path.
- *
- * This removes the directory pointed to by @prefix and @path
- * and attempts to remove its parent "subfolders" directory too
- * if it's empty.
- *
- * Return value: -1 (with errno set) if it failed to rmdir the
- * specified directory. 0 otherwise, whether or not it removed
- * the parent directory.
- **/
-int
-e_path_rmdir (const char *prefix, const char *vpath)
-{
- char *physical_path, *p;
-
- /* Remove the directory itself */
- physical_path = e_path_to_physical (prefix, vpath);
- if (rmdir (physical_path) == -1) {
- g_free (physical_path);
- return -1;
- }
-
- /* Attempt to remove its parent "subfolders" directory,
- * ignoring errors since it might not be empty.
- */
-
- p = strrchr (physical_path, '/');
- if (p[1] == '\0') {
- g_free (physical_path);
- return 0;
- }
- *p = '\0';
- p = strrchr (physical_path, '/');
- if (!p || strcmp (p + 1, SUBFOLDER_DIR_NAME) != 0) {
- g_free (physical_path);
- return 0;
- }
-
- rmdir (physical_path);
- g_free (physical_path);
- return 0;
-}
diff --git a/e-util/e-path.h b/e-util/e-path.h
deleted file mode 100644
index 2295889778..0000000000
--- a/e-util/e-path.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2001 Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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_PATH__
-#define __E_PATH__
-
-#include <glib.h>
-
-typedef gboolean (*EPathFindFoldersCallback) (const char *physical_path,
- const char *path,
- gpointer user_data);
-
-char * e_path_to_physical (const char *prefix, const char *vpath);
-
-gboolean e_path_find_folders (const char *prefix,
- EPathFindFoldersCallback callback,
- gpointer data);
-
-int e_path_rmdir (const char *prefix, const char *vpath);
-#endif /* __E_PATH__ */
diff --git a/e-util/e-pilot-map.c b/e-util/e-pilot-map.c
deleted file mode 100644
index e155657732..0000000000
--- a/e-util/e-pilot-map.c
+++ /dev/null
@@ -1,448 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Evolution Conduits - Pilot Map routines
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Authors: JP Rosevear <jpr@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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 "e-pilot-map.h"
-
-#include <string.h> /* memset(), strcmp() */
-#include <stdlib.h>
-#include <glib.h>
-#include <libxml/parser.h>
-
-typedef struct
-{
- char *uid;
- gboolean archived;
- gboolean touched;
-} EPilotMapPidNode;
-
-typedef struct
-{
- guint32 pid;
- gboolean archived;
- gboolean touched;
-} EPilotMapUidNode;
-
-typedef struct
-{
- gboolean touched_only;
- xmlNodePtr root;
-} EPilotMapWriteData;
-
-static void
-real_e_pilot_map_insert (EPilotMap *map, guint32 pid, const char *uid, gboolean archived, gboolean touch)
-{
- char *new_uid;
- guint32 *new_pid;
- EPilotMapPidNode *pnode;
- EPilotMapUidNode *unode;
-
- g_return_if_fail (map != NULL);
- g_return_if_fail (uid != NULL);
-
- /* Keys */
- if (pid != 0) {
- new_pid = g_new (guint32, 1);
- *new_pid = pid;
- }
- new_uid = g_strdup (uid);
-
- /* Values */
- if (pid != 0) {
- pnode = g_new0 (EPilotMapPidNode, 1);
- pnode->uid = new_uid;
- pnode->archived = archived;
- if (touch)
- pnode->touched = TRUE;
- }
-
- unode = g_new0 (EPilotMapUidNode, 1);
- unode->pid = pid;
- unode->archived = archived;
- if (touch)
- unode->touched = TRUE;
-
- /* Insertion */
- if (pid != 0)
- g_hash_table_insert (map->pid_map, new_pid, pnode);
- g_hash_table_insert (map->uid_map, new_uid, unode);
-}
-
-static void
-map_set_node_timet (xmlNodePtr node, const char *name, time_t t)
-{
- char *tstring;
-
- tstring = g_strdup_printf ("%ld", t);
- xmlSetProp (node, name, tstring);
- g_free (tstring);
-}
-
-static void
-map_sax_start_element (void *data, const xmlChar *name,
- const xmlChar **attrs)
-{
- EPilotMap *map = (EPilotMap *)data;
-
- if (!strcmp (name, "PilotMap")) {
- while (attrs && *attrs != NULL) {
- const xmlChar **val = attrs;
-
- val++;
- if (!strcmp (*attrs, "timestamp"))
- map->since = (time_t)strtoul (*val, NULL, 0);
-
- attrs = ++val;
- }
- }
-
- if (!strcmp (name, "map")) {
- const char *uid = NULL;
- guint32 pid = 0;
- gboolean archived = FALSE;
-
- while (attrs && *attrs != NULL) {
- const xmlChar **val = attrs;
-
- val++;
- if (!strcmp (*attrs, "uid"))
- uid = *val;
-
- if (!strcmp (*attrs, "pilot_id"))
- pid = strtoul (*val, NULL, 0);
-
- if (!strcmp (*attrs, "archived"))
- archived = strtoul (*val, NULL, 0)== 1 ? TRUE : FALSE;
-
- attrs = ++val;
- }
-
- g_assert (uid != NULL);
- g_assert (pid != 0 || archived);
-
- real_e_pilot_map_insert (map, pid, uid, archived, FALSE);
- }
-}
-
-static void
-map_write_foreach (gpointer key, gpointer value, gpointer data)
-{
- EPilotMapWriteData *wd = data;
- xmlNodePtr root = wd->root;
- char *uid = key;
- EPilotMapUidNode *unode = value;
- xmlNodePtr mnode;
-
- if (wd->touched_only && !unode->touched)
- return;
-
- mnode = xmlNewChild (root, NULL, "map", NULL);
- xmlSetProp (mnode, "uid", uid);
-
- if (unode->archived) {
- xmlSetProp (mnode, "archived", "1");
- } else {
- char *pidstr;
-
- pidstr = g_strdup_printf ("%d", unode->pid);
- xmlSetProp (mnode, "pilot_id", pidstr);
- g_free (pidstr);
- xmlSetProp (mnode, "archived", "0");
- }
-}
-
-gboolean
-e_pilot_map_pid_is_archived (EPilotMap *map, guint32 pid)
-{
- EPilotMapPidNode *pnode;
-
- g_return_val_if_fail (map != NULL, FALSE);
-
- pnode = g_hash_table_lookup (map->pid_map, &pid);
-
- if (pnode == NULL)
- return FALSE;
-
- return pnode->archived;
-}
-
-gboolean
-e_pilot_map_uid_is_archived (EPilotMap *map, const char *uid)
-{
- EPilotMapUidNode *unode;
-
- g_return_val_if_fail (map != NULL, FALSE);
- g_return_val_if_fail (uid != NULL, FALSE);
-
- unode = g_hash_table_lookup (map->uid_map, uid);
-
- if (unode == NULL)
- return FALSE;
-
- return unode->archived;
-}
-
-void
-e_pilot_map_insert (EPilotMap *map, guint32 pid, const char *uid, gboolean archived)
-{
- gpointer key, value;
-
- if (g_hash_table_lookup_extended (map->pid_map, &pid, &key, &value)) {
- EPilotMapPidNode *pnode = value;
- gpointer other_key, other_value;
-
- g_hash_table_remove (map->pid_map, &pid);
-
- /* In case the pid<->uid mapping is not the same anymore */
- if (g_hash_table_lookup_extended (map->uid_map, pnode->uid, &other_key, &other_value)) {
- g_hash_table_remove (map->uid_map, pnode->uid);
- g_free (other_key);
- g_free (other_value);
- }
-
- g_free (key);
- g_free (value);
- }
- if (g_hash_table_lookup_extended (map->uid_map, uid, &key, &value)) {
- EPilotMapUidNode *unode = value;
- gpointer other_key, other_value;
-
- g_hash_table_remove (map->uid_map, uid);
-
- /* In case the pid<->uid mapping is not the same anymore */
- if (g_hash_table_lookup_extended (map->pid_map, &unode->pid, &other_key, &other_value)) {
- g_hash_table_remove (map->pid_map, &unode->pid);
- g_free (other_key);
- g_free (other_value);
- }
-
- g_free (key);
- g_free (value);
- }
-
- real_e_pilot_map_insert (map, pid, uid, archived, TRUE);
-}
-
-void
-e_pilot_map_remove_by_pid (EPilotMap *map, guint32 pid)
-{
- EPilotMapPidNode *pnode = NULL;
- EPilotMapUidNode *unode = NULL;
- gpointer pkey, ukey;
-
- g_return_if_fail (map != NULL);
-
- if (!g_hash_table_lookup_extended (map->pid_map, &pid,
- &pkey, (gpointer *)&pnode))
- return;
-
- g_hash_table_lookup_extended (map->uid_map, pnode->uid, &ukey,
- (gpointer *)&unode);
- g_assert (unode != NULL);
-
- g_hash_table_remove (map->pid_map, &pid);
- g_hash_table_remove (map->uid_map, pnode->uid);
-
- g_free (pkey);
- g_free (ukey);
- g_free (pnode);
- g_free (unode);
-}
-
-void
-e_pilot_map_remove_by_uid (EPilotMap *map, const char *uid)
-{
- EPilotMapPidNode *pnode = NULL;
- EPilotMapUidNode *unode = NULL;
- gpointer pkey, ukey;
-
- g_return_if_fail (map != NULL);
- g_return_if_fail (uid != NULL);
-
- if (!g_hash_table_lookup_extended (map->uid_map, uid, &ukey, (gpointer *)&unode))
- return;
-
- g_hash_table_lookup_extended (map->pid_map, &unode->pid, &pkey, (gpointer *)&pnode);
-
- g_hash_table_remove (map->uid_map, uid);
- g_hash_table_remove (map->pid_map, &unode->pid);
-
- if (unode->pid != 0)
- g_free (pkey);
- g_free (ukey);
-
- if (unode->pid != 0)
- g_free (pnode);
- g_free (unode);
-}
-
-
-guint32
-e_pilot_map_lookup_pid (EPilotMap *map, const char *uid, gboolean touch)
-{
- EPilotMapUidNode *unode = NULL;
-
- g_return_val_if_fail (map != NULL, 0);
- g_return_val_if_fail (uid != NULL, 0);
-
- unode = g_hash_table_lookup (map->uid_map, uid);
-
- if (unode == NULL)
- return 0;
-
- if (touch) {
- EPilotMapPidNode *pnode = NULL;
-
- pnode = g_hash_table_lookup (map->pid_map, &unode->pid);
- if (pnode != NULL)
- pnode->touched = TRUE;
- unode->touched = TRUE;
- }
-
- return unode->pid;
-}
-
-const char *
-e_pilot_map_lookup_uid (EPilotMap *map, guint32 pid, gboolean touch)
-{
- EPilotMapPidNode *pnode = NULL;
-
- g_return_val_if_fail (map != NULL, NULL);
-
- pnode = g_hash_table_lookup (map->pid_map, &pid);
-
- if (pnode == NULL)
- return NULL;
-
- if (touch) {
- EPilotMapUidNode *unode = NULL;
-
- unode = g_hash_table_lookup (map->uid_map, pnode->uid);
- g_assert (unode != NULL);
-
- unode->touched = TRUE;
- pnode->touched = TRUE;
- }
-
- return pnode->uid;
-}
-
-int
-e_pilot_map_read (const char *filename, EPilotMap **map)
-{
- xmlSAXHandler handler;
- EPilotMap *new_map;
-
- g_return_val_if_fail (filename != NULL, -1);
- g_return_val_if_fail (map != NULL, -1);
-
- *map = NULL;
- new_map = g_new0 (EPilotMap, 1);
-
- memset (&handler, 0, sizeof (xmlSAXHandler));
- handler.startElement = map_sax_start_element;
-
- new_map->pid_map = g_hash_table_new (g_int_hash, g_int_equal);
- new_map->uid_map = g_hash_table_new (g_str_hash, g_str_equal);
-
- if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
- if (xmlSAXUserParseFile (&handler, new_map, filename) < 0) {
- g_free (new_map);
- return -1;
- }
- }
-
- new_map->write_touched_only = FALSE;
-
- *map = new_map;
-
- return 0;
-}
-
-int
-e_pilot_map_write (const char *filename, EPilotMap *map)
-{
- EPilotMapWriteData wd;
- xmlDocPtr doc;
- int ret;
-
- g_return_val_if_fail (filename != NULL, -1);
- g_return_val_if_fail (map != NULL, -1);
-
- doc = xmlNewDoc ("1.0");
- if (doc == NULL) {
- g_warning ("Pilot map file could not be created\n");
- return -1;
- }
- xmlDocSetRootElement (doc, xmlNewDocNode(doc, NULL, "PilotMap", NULL));
- map->since = time (NULL);
- map_set_node_timet (xmlDocGetRootElement (doc), "timestamp", map->since);
-
- wd.touched_only = map->write_touched_only;
- wd.root = xmlDocGetRootElement(doc);
- g_hash_table_foreach (map->uid_map, map_write_foreach, &wd);
-
- /* Write the file */
- xmlSetDocCompressMode (doc, 0);
- ret = xmlSaveFile (filename, doc);
- if (ret < 0) {
- g_warning ("Pilot map file '%s' could not be saved\n", filename);
- return -1;
- }
-
- xmlFreeDoc (doc);
-
- return 0;
-}
-
-static gboolean
-foreach_remove (gpointer key, gpointer value, gpointer data)
-{
- g_free (key);
- g_free (value);
-
- return TRUE;
-}
-
-void
-e_pilot_map_clear (EPilotMap *map)
-{
- g_return_if_fail (map != NULL);
-
- g_hash_table_foreach_remove (map->pid_map, foreach_remove, NULL);
- g_hash_table_foreach_remove (map->uid_map, foreach_remove, NULL);
-
- map->since = 0;
- map->write_touched_only = FALSE;
-}
-
-void
-e_pilot_map_destroy (EPilotMap *map)
-{
- g_return_if_fail (map != NULL);
-
- g_hash_table_foreach_remove (map->pid_map, foreach_remove, NULL);
- g_hash_table_foreach_remove (map->uid_map, foreach_remove, NULL);
-
- g_hash_table_destroy (map->pid_map);
- g_hash_table_destroy (map->uid_map);
- g_free (map);
-}
diff --git a/e-util/e-pilot-map.h b/e-util/e-pilot-map.h
deleted file mode 100644
index ff02994645..0000000000
--- a/e-util/e-pilot-map.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Evolution Conduits - Pilot Map routines
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Authors: JP Rosevear <jpr@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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_PILOT_MAP_H
-#define E_PILOT_MAP_H
-
-#include <glib.h>
-#include <time.h>
-
-typedef struct _EPilotMap EPilotMap;
-
-struct _EPilotMap
-{
- GHashTable *pid_map;
- GHashTable *uid_map;
-
- time_t since;
-
- gboolean write_touched_only;
-};
-
-gboolean e_pilot_map_pid_is_archived (EPilotMap *map, guint32 pid);
-gboolean e_pilot_map_uid_is_archived (EPilotMap *map, const char *uid);
-
-void e_pilot_map_insert (EPilotMap *map, guint32 pid, const char *uid, gboolean archived);
-void e_pilot_map_remove_by_pid (EPilotMap *map, guint32 pid);
-void e_pilot_map_remove_by_uid (EPilotMap *map, const char *uid);
-
-guint32 e_pilot_map_lookup_pid (EPilotMap *map, const char *uid, gboolean touch);
-const char * e_pilot_map_lookup_uid (EPilotMap *map, guint32 pid, gboolean touch);
-
-int e_pilot_map_read (const char *filename, EPilotMap **map);
-int e_pilot_map_write (const char *filename, EPilotMap *map);
-
-void e_pilot_map_clear (EPilotMap *map);
-
-void e_pilot_map_destroy (EPilotMap *map);
-
-#endif /* E_PILOT_MAP_H */
diff --git a/e-util/e-pilot-settings.c b/e-util/e-pilot-settings.c
deleted file mode 100644
index 7649f60287..0000000000
--- a/e-util/e-pilot-settings.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-pilot-settings.c
- *
- * Copyright (C) 2001 JP Rosevear
- *
- * 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.
- *
- * Author: JP Rosevear
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-#include <libgnome/gnome-i18n.h>
-#include "e-pilot-settings.h"
-
-struct _EPilotSettingsPrivate
-{
- GtkWidget *secret;
- GtkWidget *cat;
- GtkWidget *cat_btn;
-};
-
-
-static void class_init (EPilotSettingsClass *klass);
-static void init (EPilotSettings *ps);
-
-static GObjectClass *parent_class = NULL;
-
-
-GType
-e_pilot_settings_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static GTypeInfo info = {
- sizeof (EPilotSettingsClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) class_init,
- NULL, NULL,
- sizeof (EPilotSettings),
- 0,
- (GInstanceInitFunc) init
- };
- type = g_type_register_static (GTK_TYPE_TABLE, "EPilotSettings", &info, 0);
- }
-
- return type;
-}
-
-static void
-class_init (EPilotSettingsClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref (GTK_TYPE_TABLE);
-}
-
-
-static void
-init (EPilotSettings *ps)
-{
- EPilotSettingsPrivate *priv;
- GtkWidget *lbl;
-
- priv = g_new0 (EPilotSettingsPrivate, 1);
-
- ps->priv = priv;
-
- gtk_table_resize (GTK_TABLE (ps), 2, 2);
- gtk_container_set_border_width (GTK_CONTAINER (ps), 4);
- gtk_table_set_col_spacings (GTK_TABLE (ps), 4);
-
- lbl = gtk_label_new (_("Sync Private Records:"));
- gtk_misc_set_alignment (GTK_MISC (lbl), 0.0, 0.5);
- priv->secret = gtk_check_button_new ();
- gtk_table_attach_defaults (GTK_TABLE (ps), lbl, 0, 1, 0, 1);
- gtk_table_attach_defaults (GTK_TABLE (ps), priv->secret, 1, 2, 0, 1);
- gtk_widget_show (lbl);
- gtk_widget_show (priv->secret);
-
-#if 0
- lbl = gtk_label_new (_("Sync Categories:"));
- gtk_misc_set_alignment (GTK_MISC (lbl), 0.0, 0.5);
- priv->cat = gtk_check_button_new ();
- gtk_table_attach_defaults (GTK_TABLE (ps), lbl, 0, 1, 1, 2);
- gtk_table_attach_defaults (GTK_TABLE (ps), priv->cat, 1, 2, 1, 2);
- gtk_widget_show (lbl);
- gtk_widget_show (priv->cat);
-#endif
-}
-
-
-
-GtkWidget *
-e_pilot_settings_new (void)
-{
- GtkWidget *w = g_object_new (E_TYPE_PILOT_SETTINGS, NULL);
- g_object_ref (w);
- gtk_object_sink (GTK_OBJECT (w));
-
- return w;
-}
-
-gboolean
-e_pilot_settings_get_secret (EPilotSettings *ps)
-{
- EPilotSettingsPrivate *priv;
-
- g_return_val_if_fail (ps != NULL, FALSE);
- g_return_val_if_fail (E_IS_PILOT_SETTINGS (ps), FALSE);
-
- priv = ps->priv;
-
- return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->secret));
-}
-
-void
-e_pilot_settings_set_secret (EPilotSettings *ps, gboolean secret)
-{
- EPilotSettingsPrivate *priv;
-
- g_return_if_fail (ps != NULL);
- g_return_if_fail (E_IS_PILOT_SETTINGS (ps));
-
- priv = ps->priv;
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->secret),
- secret);
-}
-
diff --git a/e-util/e-pilot-settings.h b/e-util/e-pilot-settings.h
deleted file mode 100644
index 908f9e1836..0000000000
--- a/e-util/e-pilot-settings.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-pilot-settings.h
- *
- * Copyright (C) 2001 JP Rosevear
- *
- * 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.
- *
- * Author: JP Rosevear
- */
-
-#ifndef _E_PILOT_SETTINGS_H_
-#define _E_PILOT_SETTINGS_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_PILOT_SETTINGS (e_pilot_settings_get_type ())
-#define E_PILOT_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_PILOT_SETTINGS, EPilotSettings))
-#define E_PILOT_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_PILOT_SETTINGS, EPilotSettingsClass))
-#define E_IS_PILOT_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_PILOT_SETTINGS))
-#define E_IS_PILOT_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_PILOT_SETTINGS))
-
-
-typedef struct _EPilotSettings EPilotSettings;
-typedef struct _EPilotSettingsPrivate EPilotSettingsPrivate;
-typedef struct _EPilotSettingsClass EPilotSettingsClass;
-
-#define E_PILOT_SETTINGS_TABLE_ROWS 2
-#define E_PILOT_SETTINGS_TABLE_COLS 2
-
-struct _EPilotSettings {
- GtkTable parent;
-
- EPilotSettingsPrivate *priv;
-};
-
-struct _EPilotSettingsClass {
- GtkTableClass parent_class;
-};
-
-
-GType e_pilot_settings_get_type (void);
-GtkWidget *e_pilot_settings_new (void);
-
-gboolean e_pilot_settings_get_secret (EPilotSettings *ps);
-void e_pilot_settings_set_secret (EPilotSettings *ps, gboolean secret);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_PILOT_SETTINGS_H_ */
diff --git a/e-util/e-pilot-util.c b/e-util/e-pilot-util.c
deleted file mode 100644
index 9e9c13d2c0..0000000000
--- a/e-util/e-pilot-util.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Evolution Conduits - Pilot Map routines
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Authors: JP Rosevear <jpr@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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 <stdlib.h>
-#include <time.h>
-#include <libxml/parser.h>
-#include <pi-util.h>
-
-#include "e-pilot-util.h"
-
-char *
-e_pilot_utf8_to_pchar (const char *string)
-{
- char *pstring = NULL;
- int res;
-
- if (!string)
- return NULL;
-
- res = convert_ToPilotChar ("UTF-8", string, strlen (string), &pstring);
-
- if (res != 0)
- pstring = strdup (string);
-
- return pstring;
-}
-
-char *
-e_pilot_utf8_from_pchar (const char *string)
-{
- char *ustring = NULL;
- int res;
-
- if (!string)
- return NULL;
-
- res = convert_FromPilotChar ("UTF-8", string, strlen (string), &ustring);
-
- if (res != 0)
- ustring = strdup (string);
-
- return ustring;
-}
diff --git a/e-util/e-pilot-util.h b/e-util/e-pilot-util.h
deleted file mode 100644
index 059b113694..0000000000
--- a/e-util/e-pilot-util.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Evolution Conduits - Pilot Map routines
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * Authors: JP Rosevear <jpr@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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_PILOT_UTIL_H
-#define E_PILOT_UTIL_H
-
-char *e_pilot_utf8_to_pchar (const char *string);
-char *e_pilot_utf8_from_pchar (const char *string);
-
-#endif /* E_PILOT_UTIL_H */
diff --git a/e-util/e-request.c b/e-util/e-request.c
deleted file mode 100644
index 65c6a8e84b..0000000000
--- a/e-util/e-request.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-request.c
- *
- * Copyright (C) 2000, 2001 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-request.h"
-
-#include <gtk/gtkbox.h>
-#include <gtk/gtkdialog.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkstock.h>
-
-
-/**
- * e_request_string:
- * @parent: parent window, or %NULL
- * @title: the dialog title (in the locale character set)
- * @prompt: the prompt (in the locale character set)
- * @default: default value (in UTF8)
- *
- * Request a string from the user.
- *
- * Return value: %NULL if the user cancelled the dialog, the inserted
- * string (in UTF8) otherwise. The string must be freed by the caller.
- **/
-char *
-e_request_string (GtkWindow *parent,
- const char *title,
- const char *prompt,
- const char *default_string)
-{
- GtkWidget *prompt_label;
- char *text;
- GtkWidget *dialog;
- GtkWidget *entry;
- GtkWidget *vbox;
-
- g_return_val_if_fail (title != NULL, NULL);
- g_return_val_if_fail (prompt != NULL, NULL);
-
- dialog = gtk_dialog_new_with_buttons (title, parent,
- GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
- gtk_window_set_default_size (GTK_WINDOW (dialog), 275, -1);
- gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
-
- vbox = GTK_DIALOG (dialog)->vbox;
-
- prompt_label = gtk_label_new (prompt);
- gtk_box_pack_start (GTK_BOX (vbox), prompt_label, TRUE, TRUE, 6);
- gtk_box_set_spacing (GTK_BOX (vbox), 6);
-
- entry = gtk_entry_new ();
- gtk_entry_set_text (GTK_ENTRY (entry), default_string);
- gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
- gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
- gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 3);
-
- gtk_widget_grab_focus (entry);
-
- gtk_widget_show (prompt_label);
- gtk_widget_show (entry);
- gtk_widget_show (dialog);
-
- switch (gtk_dialog_run (GTK_DIALOG (dialog))) {
- case GTK_RESPONSE_OK:
- text = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
- break;
- default:
- text = NULL;
- break;
- }
-
- gtk_widget_destroy (dialog);
-
- return text;
-}
diff --git a/e-util/e-request.h b/e-util/e-request.h
deleted file mode 100644
index 7ebb70c43f..0000000000
--- a/e-util/e-request.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-request.c
- *
- * Copyright (C) 2000, 2001 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef E_REQUEST_H
-#define E_REQUEST_H
-
-#include <gtk/gtkwindow.h>
-
-char *e_request_string (GtkWindow *parent,
- const char *title,
- const char *prompt,
- const char *default_string);
-
-#endif
diff --git a/e-util/e-sexp.c b/e-util/e-sexp.c
deleted file mode 100644
index a7619c59f2..0000000000
--- a/e-util/e-sexp.c
+++ /dev/null
@@ -1,1379 +0,0 @@
-/*
- * Copyright 2000 Ximian (www.ximian.com).
- *
- * A simple, extensible s-exp evaluation engine.
- *
- * Author :
- * Michael Zucchi <notzed@ximian.com>
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
-
- time_t = (+ time_t*)
- Add time_t values.
-
- int = (- int int*)
- Subtract integers from the first.
-
- time_t = (- time_t*)
- Subtract time_t values from the first.
-
- int = (cast-int string|int|bool)
- Cast to an integer value.
-
- string = (cast-string string|int|bool)
- Cast to an string value.
-
- Comparison operators:
-
- bool = (< int int)
- bool = (> int int)
- bool = (= int int)
-
- bool = (< string string)
- bool = (> string string)
- bool = (= string string)
-
- bool = (< time_t time_t)
- bool = (> time_t time_t)
- bool = (= time_t time_t)
- Perform a comparision of 2 integers, 2 string values, or 2 time 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.
-*/
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-
-#include "e-sexp.h"
-#include "e-memory.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);
-
-#ifdef E_SEXP_IS_G_OBJECT
-static GObjectClass *parent_class;
-#endif
-
-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 */,
-};
-
-/* jumps back to the caller of f->failenv, only to be called from inside a callback */
-void
-e_sexp_fatal_error(struct _ESExp *f, char *why, ...)
-{
- va_list args;
-
- if (f->error)
- g_free(f->error);
-
- va_start(args, why);
- f->error = g_strdup_vprintf(why, args);
- va_end(args);
-
- longjmp(f->failenv, 1);
-}
-
-const char *
-e_sexp_error(struct _ESExp *f)
-{
- return f->error;
-}
-
-struct _ESExpResult *
-e_sexp_result_new(struct _ESExp *f, int type)
-{
- struct _ESExpResult *r = e_memchunk_alloc0(f->result_chunks);
- r->type = type;
- return r;
-}
-
-void
-e_sexp_result_free(struct _ESExp *f, 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:
- case ESEXP_RES_TIME:
- break;
- case ESEXP_RES_STRING:
- g_free(t->value.string);
- break;
- case ESEXP_RES_UNDEFINED:
- break;
- default:
- g_assert_not_reached();
- }
- e_memchunk_free(f->result_chunks, t);
-}
-
-/* used in normal functions if they have to abort, and free their arguments */
-void
-e_sexp_resultv_free(struct _ESExp *f, int argc, struct _ESExpResult **argv)
-{
- int i;
-
- for (i=0;i<argc;i++) {
- e_sexp_result_free(f, argv[i]);
- }
-}
-
-/* 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(f, 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) {
- e_sexp_result_free(f, r);
- e_sexp_result_free(f, r1);
- g_hash_table_destroy(ht);
- e_sexp_fatal_error(f, "Invalid types in AND");
- } 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++) {
- gpointer ptr;
- int n;
- ptr = g_hash_table_lookup(ht, a1[j]);
- n = GPOINTER_TO_INT(ptr);
- g_hash_table_insert(ht, a1[j], GINT_TO_POINTER(n+1));
- }
- } else if (r1->type == ESEXP_RES_BOOL) {
- bool = bool && r1->value.bool;
- }
- e_sexp_result_free(f, 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(f, 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) {
- e_sexp_result_free(f, r);
- e_sexp_result_free(f, r1);
- g_hash_table_destroy(ht);
- e_sexp_fatal_error(f, "Invalid types in OR");
- } 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(f, 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(f, 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(f, 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) {
- e_sexp_result_free(f, r1);
- e_sexp_result_free(f, r2);
- e_sexp_result_free(f, r);
- e_sexp_fatal_error(f, "Incompatible types in compare <");
- } 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_TIME) {
- r->type = ESEXP_RES_BOOL;
- r->value.bool = r1->value.time < r2->value.time;
- } else if (r1->type == ESEXP_RES_STRING) {
- r->type = ESEXP_RES_BOOL;
- r->value.bool = strcmp(r1->value.string, r2->value.string) < 0;
- }
- e_sexp_result_free(f, r1);
- e_sexp_result_free(f, r2);
- }
- 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(f, 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) {
- e_sexp_result_free(f, r1);
- e_sexp_result_free(f, r2);
- e_sexp_result_free(f, r);
- e_sexp_fatal_error(f, "Incompatible types in compare >");
- } 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_TIME) {
- r->type = ESEXP_RES_BOOL;
- r->value.bool = r1->value.time > r2->value.time;
- } else if (r1->type == ESEXP_RES_STRING) {
- r->type = ESEXP_RES_BOOL;
- r->value.bool = strcmp(r1->value.string, r2->value.string) > 0;
- }
- e_sexp_result_free(f, r1);
- e_sexp_result_free(f, r2);
- }
- 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(f, 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_TIME) {
- r->value.bool = r1->value.time == r2->value.time;
- } else if (r1->type == ESEXP_RES_STRING) {
- r->value.bool = strcmp(r1->value.string, r2->value.string) == 0;
- }
- e_sexp_result_free(f, r1);
- e_sexp_result_free(f, r2);
- }
- 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) {
- e_sexp_resultv_free(f, argc, argv);
- e_sexp_fatal_error(f, "Invalid types in (+ ints)");
- }
- r = e_sexp_result_new(f, 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) {
- e_sexp_resultv_free(f, argc, argv);
- e_sexp_fatal_error(f, "Invalid types in (+ strings)");
- }
- r = e_sexp_result_new(f, ESEXP_RES_STRING);
- r->value.string = s->str;
- g_string_free(s, FALSE);
- break; }
- case ESEXP_RES_TIME: {
- time_t total;
-
- total = argv[0]->value.time;
-
- for (i = 1; i < argc && argv[i]->type == ESEXP_RES_TIME; i++)
- total += argv[i]->value.time;
-
- if (i < argc) {
- e_sexp_resultv_free (f, argc, argv);
- e_sexp_fatal_error (f, "Invalid types in (+ time_t)");
- }
-
- r = e_sexp_result_new (f, ESEXP_RES_TIME);
- r->value.time = total;
- break; }
- }
- }
-
- if (!r) {
- r = e_sexp_result_new(f, 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) {
- e_sexp_resultv_free(f, argc, argv);
- e_sexp_fatal_error(f, "Invalid types in -");
- }
- r = e_sexp_result_new(f, ESEXP_RES_INT);
- r->value.number = total;
- break; }
- case ESEXP_RES_TIME: {
- time_t total;
-
- total = argv[0]->value.time;
-
- for (i = 1; i < argc && argv[i]->type == ESEXP_RES_TIME; i++)
- total -= argv[i]->value.time;
-
- if (i < argc) {
- e_sexp_resultv_free (f, argc, argv);
- e_sexp_fatal_error (f, "Invalid types in (- time_t)");
- }
-
- r = e_sexp_result_new (f, ESEXP_RES_TIME);
- r->value.time = total;
- break; }
- }
- }
-
- if (!r) {
- r = e_sexp_result_new(f, ESEXP_RES_INT);
- r->value.number = 0;
- }
- return r;
-}
-
-/* cast to int */
-static ESExpResult *
-term_eval_castint(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- struct _ESExpResult *r;
-
- if (argc != 1)
- e_sexp_fatal_error(f, "Incorrect argument count to (int )");
-
- r = e_sexp_result_new(f, ESEXP_RES_INT);
- switch (argv[0]->type) {
- case ESEXP_RES_INT:
- r->value.number = argv[0]->value.number;
- break;
- case ESEXP_RES_BOOL:
- r->value.number = argv[0]->value.bool != 0;
- break;
- case ESEXP_RES_STRING:
- r->value.number = strtoul(argv[0]->value.string, 0, 10);
- break;
- default:
- e_sexp_result_free(f, r);
- e_sexp_fatal_error(f, "Invalid type in (cast-int )");
- }
-
- return r;
-}
-
-/* cast to string */
-static ESExpResult *
-term_eval_caststring(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data)
-{
- struct _ESExpResult *r;
-
- if (argc != 1)
- e_sexp_fatal_error(f, "Incorrect argument count to (cast-string )");
-
- r = e_sexp_result_new(f, ESEXP_RES_STRING);
- switch (argv[0]->type) {
- case ESEXP_RES_INT:
- r->value.string = g_strdup_printf("%d", argv[0]->value.number);
- break;
- case ESEXP_RES_BOOL:
- r->value.string = g_strdup_printf("%d", argv[0]->value.bool != 0);
- break;
- case ESEXP_RES_STRING:
- r->value.string = g_strdup(argv[0]->value.string);
- break;
- default:
- e_sexp_result_free(f, r);
- e_sexp_fatal_error(f, "Invalid type in (int )");
- }
-
- 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(f, 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(f, 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(f, r);
- r = e_sexp_term_eval(f, argv[i]);
- }
- if (r)
- return r;
- else
- return e_sexp_result_new(f, ESEXP_RES_UNDEFINED);
-}
-
-
-/* this must only be called from inside term evaluation callbacks! */
-struct _ESExpResult *
-e_sexp_term_eval(struct _ESExp *f, struct _ESExpTerm *t)
-{
- struct _ESExpResult *r = NULL;
- int i;
- struct _ESExpResult **argv;
-
- g_return_val_if_fail(t != NULL, NULL);
-
- r(printf("eval term :\n"));
- r(parse_dump_term(t, 0));
-
- switch (t->type) {
- case ESEXP_TERM_STRING:
- r(printf(" (string \"%s\")\n", t->value.string));
- r = e_sexp_result_new(f, 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 = e_sexp_result_new(f, ESEXP_RES_INT);
- r->value.number = t->value.number;
- break;
- case ESEXP_TERM_BOOL:
- r(printf(" (int %d)\n", t->value.number));
- r = e_sexp_result_new(f, ESEXP_RES_BOOL);
- r->value.bool = t->value.bool;
- break;
- case ESEXP_TERM_TIME:
- r(printf(" (time_t %d)\n", t->value.time));
- r = e_sexp_result_new (f, ESEXP_RES_TIME);
- r->value.time = t->value.time;
- break;
- case ESEXP_TERM_IFUNC:
- if (t->value.func.sym->f.ifunc)
- r = t->value.func.sym->f.ifunc(f, t->value.func.termcount, t->value.func.terms, t->value.func.sym->data);
- break;
- case ESEXP_TERM_FUNC:
- /* 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)
- r = t->value.func.sym->f.func(f, t->value.func.termcount, argv, t->value.func.sym->data);
-
- e_sexp_resultv_free(f, t->value.func.termcount, argv);
- break;
- default:
- e_sexp_fatal_error(f, "Unknown type in parse tree: %d", t->type);
- }
-
- if (r==NULL)
- r = e_sexp_result_new(f, ESEXP_RES_UNDEFINED);
-
- return r;
-}
-
-#ifdef TESTER
-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_TIME:
- printf("time_t: %ld\n", (long) r->value.time);
- 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_TIME:
- printf(" %ld", (long) t->value.time);
- 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_term_new(struct _ESExp *f, int type)
-{
- struct _ESExpTerm *s = e_memchunk_alloc0(f->term_chunks);
- s->type = type;
- return s;
-}
-
-static void
-parse_term_free(struct _ESExp *f, struct _ESExpTerm *t)
-{
- int i;
-
- if (t==NULL) {
- return;
- }
-
- switch (t->type) {
- case ESEXP_TERM_INT:
- case ESEXP_TERM_BOOL:
- case ESEXP_TERM_TIME:
- case ESEXP_TERM_VAR:
- break;
-
- case ESEXP_TERM_STRING:
- g_free(t->value.string);
- break;
-
- case ESEXP_TERM_FUNC:
- case ESEXP_TERM_IFUNC:
- for (i=0;i<t->value.func.termcount;i++) {
- parse_term_free(f, t->value.func.terms[i]);
- }
- g_free(t->value.func.terms);
- break;
-
- default:
- printf("parse_term_free: unknown type: %d\n", t->type);
- }
- e_memchunk_free(f->term_chunks, t);
-}
-
-static struct _ESExpTerm **
-parse_values(ESExp *f, int *len)
-{
- int token;
- struct _ESExpTerm **terms;
- int i, size = 0;
- GScanner *gs = f->scanner;
- GSList *list = NULL, *l;
-
- p(printf("parsing values\n"));
-
- while ( (token = g_scanner_peek_next_token(gs)) != G_TOKEN_EOF
- && token != ')') {
- list = g_slist_prepend(list, parse_value(f));
- size++;
- }
-
- /* go over the list, and put them backwards into the term array */
- terms = g_malloc(size * sizeof(*terms));
- l = list;
- for (i=size-1;i>=0;i--) {
- g_assert(l);
- g_assert(l->data);
- terms[i] = l->data;
- l = g_slist_next(l);
- }
- g_slist_free(list);
-
- p(printf("found %d subterms\n", size));
- *len = size;
-
- p(printf("done parsing values\n"));
- return terms;
-}
-
-static struct _ESExpTerm *
-parse_value(ESExp *f)
-{
- int token, negative = FALSE;
- 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_term_new(f, ESEXP_TERM_STRING);
- t->value.string = g_strdup(g_scanner_cur_value(gs).v_string);
- break;
- case '-':
- p(printf ("got negative int?\n"));
- token = g_scanner_get_next_token (gs);
- if (token != G_TOKEN_INT) {
- e_sexp_fatal_error (f, "Invalid format for a integer value");
- return NULL;
- }
-
- negative = TRUE;
- /* fall through... */
- case G_TOKEN_INT:
- t = parse_term_new(f, ESEXP_TERM_INT);
- t->value.number = g_scanner_cur_value(gs).v_int;
- if (negative)
- t->value.number = -t->value.number;
- p(printf("got int\n"));
- break;
- case '#': {
- char *str;
-
- p(printf("got bool?\n"));
- token = g_scanner_get_next_token(gs);
- if (token != G_TOKEN_IDENTIFIER) {
- e_sexp_fatal_error (f, "Invalid format for a boolean value");
- return NULL;
- }
-
- str = g_scanner_cur_value (gs).v_identifier;
-
- g_assert (str != NULL);
- if (!(strlen (str) == 1 && (str[0] == 't' || str[0] == 'f'))) {
- e_sexp_fatal_error (f, "Invalid format for a boolean value");
- return NULL;
- }
-
- t = parse_term_new(f, ESEXP_TERM_BOOL);
- t->value.bool = (str[0] == '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_term_new(f, 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_term_new(f, s->type);
- t->value.var = s;
- break;
- default:
- e_sexp_fatal_error(f, "Invalid symbol type: %s: %d", s->name, s->type);
- }
- break;
- case G_TOKEN_IDENTIFIER:
- e_sexp_fatal_error(f, "Unknown identifier: %s", g_scanner_cur_value(gs).v_identifier);
- break;
- default:
- e_sexp_fatal_error(f, "Unexpected token encountered: %d", token);
- }
- 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_term_new(f, 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 {
- parse_term_free(f, t);
- e_sexp_fatal_error(f, "Trying to call variable as function: %s", s->name);
- }
- break; }
- case G_TOKEN_IDENTIFIER:
- e_sexp_fatal_error(f, "Unknown identifier: %s", g_scanner_cur_value(gs).v_identifier);
- break;
- default:
- e_sexp_fatal_error(f, "Unexpected token encountered: %d", token);
- }
- token = g_scanner_get_next_token(gs);
- if (token != ')') {
- e_sexp_fatal_error(f, "Missing ')'");
- }
- } else {
- e_sexp_fatal_error(f, "Missing '('");
- }
-
- p(printf("returning list %p\n", t));
- return t;
-}
-
-static void e_sexp_finalise(void *);
-
-#ifdef E_SEXP_IS_G_OBJECT
-static void
-e_sexp_class_init (ESExpClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = e_sexp_finalise;
-
- parent_class = g_type_class_ref (g_object_get_type ());
-}
-#endif
-
-/* '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 },
- { "cast-int", (ESExpFunc *)term_eval_castint, 0 },
- { "cast-string", (ESExpFunc *)term_eval_caststring, 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(void *o)
-{
- ESExp *s = (ESExp *)o;
-
- if (s->tree) {
- parse_term_free(s, s->tree);
- s->tree = NULL;
- }
-
- e_memchunk_destroy(s->term_chunks);
- e_memchunk_destroy(s->result_chunks);
-
- g_scanner_scope_foreach_symbol(s->scanner, 0, free_symbol, 0);
- g_scanner_destroy(s->scanner);
-
-#ifdef E_SEXP_IS_G_OBJECT
- G_OBJECT_CLASS (parent_class)->finalize (o);
-#endif
-}
-
-static void
-e_sexp_init (ESExp *s)
-{
- int i;
-
- s->scanner = g_scanner_new(&scanner_config);
- s->term_chunks = e_memchunk_new(16, sizeof(struct _ESExpTerm));
- s->result_chunks = e_memchunk_new(16, sizeof(struct _ESExpResult));
-
- /* 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]);
- }
- }
-
-#ifndef E_SEXP_IS_G_OBJECT
- s->refcount = 1;
-#endif
-}
-
-#ifdef E_SEXP_IS_G_OBJECT
-GType
-e_sexp_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (ESExpClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) e_sexp_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (ESExp),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_sexp_init,
- };
-
- type = g_type_register_static (G_TYPE_OBJECT, "ESExp", &info, 0);
- }
-
- return type;
-}
-#endif
-
-ESExp *
-e_sexp_new (void)
-{
-#ifdef E_SEXP_IS_G_OBJECT
- ESExp *f = (ESexp *) g_object_new (E_TYPE_SEXP, NULL);
-#else
- ESExp *f = g_malloc0 (sizeof (ESExp));
- e_sexp_init (f);
-#endif
-
- return f;
-}
-
-#ifndef E_SEXP_IS_G_OBJECT
-void
-e_sexp_ref (ESExp *f)
-{
- f->refcount++;
-}
-
-void
-e_sexp_unref (ESExp *f)
-{
- f->refcount--;
- if (f->refcount == 0) {
- e_sexp_finalise(f);
- g_free(f);
- }
-}
-#endif
-
-void
-e_sexp_add_function(ESExp *f, int scope, char *name, ESExpFunc *func, void *data)
-{
- struct _ESExpSymbol *s;
-
- g_return_if_fail (IS_E_SEXP (f));
- g_return_if_fail (name != NULL);
-
- e_sexp_remove_symbol (f, scope, name);
-
- 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 (IS_E_SEXP (f));
- g_return_if_fail (name != NULL);
-
- e_sexp_remove_symbol (f, scope, name);
-
- 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 (IS_E_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 (IS_E_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 (IS_E_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 (IS_E_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 (IS_E_SEXP (f));
-
- g_scanner_input_file(f->scanner, fd);
-}
-
-/* returns -1 on error */
-int
-e_sexp_parse(ESExp *f)
-{
- g_return_val_if_fail (IS_E_SEXP (f), -1);
-
- if (setjmp(f->failenv)) {
- g_warning("Error in parsing: %s", f->error);
- return -1;
- }
-
- if (f->tree)
- parse_term_free(f, f->tree);
-
- f->tree = parse_value (f);
-
- return 0;
-}
-
-/* returns NULL on error */
-struct _ESExpResult *
-e_sexp_eval(ESExp *f)
-{
- g_return_val_if_fail (IS_E_SEXP (f), NULL);
- g_return_val_if_fail (f->tree != NULL, NULL);
-
- if (setjmp(f->failenv)) {
- g_warning("Error in execution: %s", f->error);
- return 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;
-
- if (string == NULL)
- p = "";
- else
- 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 5f41c97dcc..0000000000
--- a/e-util/e-sexp.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- generic s-exp evaluator class
-*/
-#ifndef _E_SEXP_H
-#define _E_SEXP_H
-
-#include <setjmp.h>
-#include <time.h>
-#include <glib.h>
-
-#ifdef E_SEXP_IS_G_OBJECT
-#include <glib-object.h>
-#endif
-
-#ifdef E_SEXP_IS_G_OBJECT
-#define E_TYPE_SEXP (e_sexp_get_type ())
-#define E_SEXP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SEXP, ESExp))
-#define E_SEXP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SEXP, ESExpClass))
-#define IS_E_SEXP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SEXP))
-#define IS_E_SEXP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_SEXP))
-#define E_SEXP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_SEXP, ESExpClass))
-#else
-#define E_TYPE_SEXP (0)
-#define E_SEXP(obj) ((struct _ESExp *) (obj))
-#define E_SEXP_CLASS(klass) ((struct _ESExpClass *) (klass))
-#define IS_E_SEXP(obj) (1)
-#define IS_E_SEXP_CLASS(obj) (1)
-#define E_SEXP_GET_CLASS(obj) (NULL)
-#endif
-
-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_TIME, /* time_t type */
- ESEXP_RES_UNDEFINED /* unknown type */
-};
-
-struct _ESExpResult {
- enum _ESExpResultType type;
- union {
- GPtrArray *ptrarray;
- int number;
- char *string;
- int bool;
- time_t time;
- } value;
-};
-
-enum _ESExpTermType {
- ESEXP_TERM_INT = 0, /* integer literal */
- ESEXP_TERM_BOOL, /* boolean literal */
- ESEXP_TERM_STRING, /* string literal */
- ESEXP_TERM_TIME, /* time_t literal (number of seconds past the epoch) */
- 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;
- time_t time;
- struct {
- struct _ESExpSymbol *sym;
- struct _ESExpTerm **terms;
- int termcount;
- } func;
- struct _ESExpSymbol *var;
- } value;
-};
-
-
-
-struct _ESExp {
-#ifdef E_SEXP_IS_G_OBJECT
- GObject parent_object;
-#else
- int refcount;
-#endif
- GScanner *scanner; /* for parsing text version */
- ESExpTerm *tree; /* root of expression tree */
-
- /* private stuff */
- jmp_buf failenv;
- char *error;
-
- /* TODO: may also need a pool allocator for term strings, so we dont lose them
- in error conditions? */
- struct _EMemChunk *term_chunks;
- struct _EMemChunk *result_chunks;
-};
-
-struct _ESExpClass {
-#ifdef E_SEXP_IS_G_OBJECT
- GObjectClass parent_class;
-#else
- int dummy;
-#endif
-};
-
-#ifdef E_SEXP_IS_G_OBJECT
-GType e_sexp_get_type (void);
-#endif
-ESExp *e_sexp_new (void);
-#ifdef E_SEXP_IS_G_OBJECT
-#define e_sexp_ref(f) g_object_ref (f)
-#define e_sexp_unref(f) g_object_unref (f)
-#else
-void e_sexp_ref (ESExp *f);
-void e_sexp_unref (ESExp *f);
-#endif
-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);
-
-
-int 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 (struct _ESExp *f, int type);
-void e_sexp_result_free (struct _ESExp *f, struct _ESExpResult *t);
-
-/* used in normal functions if they have to abort, to free their arguments */
-void e_sexp_resultv_free (struct _ESExp *f, int argc, struct _ESExpResult **argv);
-
-/* 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);
-
-/* only to be called from inside a callback to signal a fatal execution error */
-void e_sexp_fatal_error (struct _ESExp *f, char *why, ...);
-
-/* return the error string */
-const char *e_sexp_error (struct _ESExp *f);
-
-#endif /* _E_SEXP_H */
diff --git a/e-util/e-sorter-array.c b/e-util/e-sorter-array.c
deleted file mode 100644
index ab1e748d9a..0000000000
--- a/e-util/e-sorter-array.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-sorter-array.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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 <stdlib.h>
-#include <string.h>
-#include "gal/util/e-util.h"
-#include "e-sorter-array.h"
-
-#define d(x)
-
-#define PARENT_TYPE E_SORTER_TYPE
-
-#define INCREMENT_AMOUNT 100
-
-static ESorterClass *parent_class;
-
-static void esa_sort (ESorterArray *esa);
-static void esa_backsort (ESorterArray *esa);
-
-static gint esa_model_to_sorted (ESorter *sorter, int row);
-static gint esa_sorted_to_model (ESorter *sorter, int row);
-static void esa_get_model_to_sorted_array (ESorter *sorter, int **array, int *count);
-static void esa_get_sorted_to_model_array (ESorter *sorter, int **array, int *count);
-static gboolean esa_needs_sorting (ESorter *esa);
-
-#define ESA_NEEDS_SORTING(esa) (((ESorterArray *) (esa))->compare != NULL)
-
-static int
-esort_callback(const void *data1, const void *data2, gpointer user_data)
-{
- ESorterArray *esa = user_data;
- int ret_val;
- int int1, int2;
-
- int1 = *(int *)data1;
- int2 = *(int *)data2;
-
- ret_val = esa->compare (int1, int2, esa->closure);
- if (ret_val != 0)
- return ret_val;
-
- if (int1 < int2)
- return -1;
- if (int1 > int2)
- return 1;
- return 0;
-}
-
-static void
-esa_sort(ESorterArray *esa)
-{
- int rows;
- int i;
-
- if (esa->sorted)
- return;
-
- rows = esa->rows;
-
- esa->sorted = g_new(int, rows);
- for (i = 0; i < rows; i++)
- esa->sorted[i] = i;
-
- if (esa->compare)
- e_sort (esa->sorted, rows, sizeof(int), esort_callback, esa);
-}
-
-static void
-esa_backsort(ESorterArray *esa)
-{
- int i, rows;
-
- if (esa->backsorted)
- return;
-
- esa_sort(esa);
-
- rows = esa->rows;
-
- esa->backsorted = g_new0(int, rows);
-
- for (i = 0; i < rows; i++) {
- esa->backsorted[esa->sorted[i]] = i;
- }
-}
-
-
-static gint
-esa_model_to_sorted (ESorter *es, int row)
-{
- ESorterArray *esa = E_SORTER_ARRAY(es);
-
- g_return_val_if_fail(row >= 0, -1);
- g_return_val_if_fail(row < esa->rows, -1);
-
- if (ESA_NEEDS_SORTING(es))
- esa_backsort(esa);
-
- if (esa->backsorted)
- return esa->backsorted[row];
- else
- return row;
-}
-
-static gint
-esa_sorted_to_model (ESorter *es, int row)
-{
- ESorterArray *esa = (ESorterArray *) es;
-
- g_return_val_if_fail(row >= 0, -1);
- g_return_val_if_fail(row < esa->rows, -1);
-
- if (ESA_NEEDS_SORTING(es))
- esa_sort(esa);
-
- if (esa->sorted)
- return esa->sorted[row];
- else
- return row;
-}
-
-static void
-esa_get_model_to_sorted_array (ESorter *es, int **array, int *count)
-{
- ESorterArray *esa = E_SORTER_ARRAY(es);
- if (array || count) {
- esa_backsort(esa);
-
- if (array)
- *array = esa->backsorted;
- if (count)
- *count = esa->rows;
- }
-}
-
-static void
-esa_get_sorted_to_model_array (ESorter *es, int **array, int *count)
-{
- ESorterArray *esa = E_SORTER_ARRAY(es);
- if (array || count) {
- esa_sort(esa);
-
- if (array)
- *array = esa->sorted;
- if (count)
- *count = esa->rows;
- }
-}
-
-static gboolean
-esa_needs_sorting(ESorter *es)
-{
- ESorterArray *esa = E_SORTER_ARRAY(es);
- return esa->compare != NULL;
-}
-
-void
-e_sorter_array_clean(ESorterArray *esa)
-{
- g_free(esa->sorted);
- esa->sorted = NULL;
-
- g_free(esa->backsorted);
- esa->backsorted = NULL;
-}
-
-void
-e_sorter_array_set_count (ESorterArray *esa, int count)
-{
- e_sorter_array_clean (esa);
- esa->rows = count;
-}
-
-void
-e_sorter_array_append (ESorterArray *esa, int count)
-{
- int i;
- g_free(esa->backsorted);
- esa->backsorted = NULL;
-
- if (esa->sorted) {
- esa->sorted = g_renew(int, esa->sorted, esa->rows + count);
- for (i = 0; i < count; i++) {
- int value = esa->rows;
- size_t pos;
- e_bsearch (&value, esa->sorted, esa->rows, sizeof (int), esort_callback, esa, &pos, NULL);
- memmove (esa->sorted + pos + 1, esa->sorted + pos, sizeof (int) * (esa->rows - pos));
- esa->sorted[pos] = value;
- esa->rows ++;
- }
- } else {
- esa->rows += count;
- }
-}
-
-ESorterArray *
-e_sorter_array_construct (ESorterArray *esa,
- ECompareRowsFunc compare,
- gpointer closure)
-{
- esa->compare = compare;
- esa->closure = closure;
- return esa;
-}
-
-ESorterArray *
-e_sorter_array_new (ECompareRowsFunc compare, gpointer closure)
-{
- ESorterArray *esa = g_object_new (E_SORTER_ARRAY_TYPE, NULL);
-
- return e_sorter_array_construct (esa, compare, closure);
-}
-
-static void
-esa_class_init (ESorterArrayClass *klass)
-{
- ESorterClass *sorter_class = E_SORTER_CLASS(klass);
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- sorter_class->model_to_sorted = esa_model_to_sorted ;
- sorter_class->sorted_to_model = esa_sorted_to_model ;
- sorter_class->get_model_to_sorted_array = esa_get_model_to_sorted_array ;
- sorter_class->get_sorted_to_model_array = esa_get_sorted_to_model_array ;
- sorter_class->needs_sorting = esa_needs_sorting ;
-}
-
-static void
-esa_init (ESorterArray *esa)
-{
- esa->rows = 0;
- esa->compare = NULL;
- esa->closure = NULL;
- esa->sorted = NULL;
- esa->backsorted = NULL;
-}
-
-E_MAKE_TYPE(e_sorter_array, "ESorterArray", ESorterArray, esa_class_init, esa_init, PARENT_TYPE)
diff --git a/e-util/e-sorter-array.h b/e-util/e-sorter-array.h
deleted file mode 100644
index 227e437443..0000000000
--- a/e-util/e-sorter-array.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-sorter-array.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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_SORTER_ARRAY_H_
-#define _E_SORTER_ARRAY_H_
-
-#include <glib.h>
-#include <glib-object.h>
-#include <gal/util/e-sorter.h>
-
-G_BEGIN_DECLS
-
-#define E_SORTER_ARRAY_TYPE (e_sorter_array_get_type ())
-#define E_SORTER_ARRAY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_SORTER_ARRAY_TYPE, ESorterArray))
-#define E_SORTER_ARRAY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_SORTER_ARRAY_TYPE, ESorterArrayClass))
-#define E_IS_SORTER_ARRAY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_SORTER_ARRAY_TYPE))
-#define E_IS_SORTER_ARRAY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_SORTER_ARRAY_TYPE))
-
-#ifndef _E_COMPARE_ROWS_FUNC_H_
-#define _E_COMPARE_ROWS_FUNC_H_
-typedef int (*ECompareRowsFunc) (int row1,
- int row2,
- gpointer closure);
-#endif
-
-typedef struct {
- ESorter base;
-
- ECompareRowsFunc compare;
- gpointer closure;
-
- /* If needs_sorting is 0, then model_to_sorted and sorted_to_model are no-ops. */
- int *sorted;
- int *backsorted;
-
- int rows;
-} ESorterArray;
-
-typedef struct {
- ESorterClass parent_class;
-} ESorterArrayClass;
-
-GType e_sorter_array_get_type (void);
-ESorterArray *e_sorter_array_construct (ESorterArray *sorter,
- ECompareRowsFunc compare,
- gpointer closure);
-ESorterArray *e_sorter_array_new (ECompareRowsFunc compare,
- gpointer closure);
-void e_sorter_array_clean (ESorterArray *esa);
-void e_sorter_array_set_count (ESorterArray *esa,
- int count);
-void e_sorter_array_append (ESorterArray *esa,
- int count);
-
-G_END_DECLS
-
-#endif /* _E_SORTER_ARRAY_H_ */
diff --git a/e-util/e-sorter.c b/e-util/e-sorter.c
deleted file mode 100644
index adee6d0d98..0000000000
--- a/e-util/e-sorter.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-sorter.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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 <stdlib.h>
-#include <string.h>
-#include "gal/util/e-util.h"
-#include "e-sorter.h"
-
-#define d(x)
-
-#define PARENT_TYPE G_TYPE_OBJECT
-
-static GObjectClass *parent_class;
-
-static gint es_model_to_sorted (ESorter *es, int row);
-static gint es_sorted_to_model (ESorter *es, int row);
-static void es_get_model_to_sorted_array (ESorter *es, int **array, int *count);
-static void es_get_sorted_to_model_array (ESorter *es, int **array, int *count);
-static gboolean es_needs_sorting(ESorter *es);
-
-static void
-es_class_init (ESorterClass *klass)
-{
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- klass->model_to_sorted = es_model_to_sorted;
- klass->sorted_to_model = es_sorted_to_model;
- klass->get_model_to_sorted_array = es_get_model_to_sorted_array;
- klass->get_sorted_to_model_array = es_get_sorted_to_model_array;
- klass->needs_sorting = es_needs_sorting;
-}
-
-static void
-es_init (ESorter *es)
-{
-}
-
-E_MAKE_TYPE(e_sorter, "ESorter", ESorter, es_class_init, es_init, PARENT_TYPE)
-
-ESorter *
-e_sorter_new (void)
-{
- ESorter *es = g_object_new (E_SORTER_TYPE, NULL);
-
- return es;
-}
-
-
-static gint
-es_model_to_sorted (ESorter *es, int row)
-{
- return row;
-}
-
-static gint
-es_sorted_to_model (ESorter *es, int row)
-{
- return row;
-}
-
-
-static void
-es_get_model_to_sorted_array (ESorter *es, int **array, int *count)
-{
-}
-
-static void
-es_get_sorted_to_model_array (ESorter *es, int **array, int *count)
-{
-}
-
-
-static gboolean
-es_needs_sorting(ESorter *es)
-{
- return FALSE;
-}
-
-gint
-e_sorter_model_to_sorted (ESorter *es, int row)
-{
- g_return_val_if_fail(es != NULL, -1);
- g_return_val_if_fail(row >= 0, -1);
-
- if (E_SORTER_GET_CLASS(es)->model_to_sorted)
- return E_SORTER_GET_CLASS(es)->model_to_sorted (es, row);
- else
- return -1;
-}
-
-gint
-e_sorter_sorted_to_model (ESorter *es, int row)
-{
- g_return_val_if_fail(es != NULL, -1);
- g_return_val_if_fail(row >= 0, -1);
-
- if (E_SORTER_GET_CLASS(es)->sorted_to_model)
- return E_SORTER_GET_CLASS(es)->sorted_to_model (es, row);
- else
- return -1;
-}
-
-
-void
-e_sorter_get_model_to_sorted_array (ESorter *es, int **array, int *count)
-{
- g_return_if_fail(es != NULL);
-
- if (E_SORTER_GET_CLASS(es)->get_model_to_sorted_array)
- E_SORTER_GET_CLASS(es)->get_model_to_sorted_array (es, array, count);
-}
-
-void
-e_sorter_get_sorted_to_model_array (ESorter *es, int **array, int *count)
-{
- g_return_if_fail(es != NULL);
-
- if (E_SORTER_GET_CLASS(es)->get_sorted_to_model_array)
- E_SORTER_GET_CLASS(es)->get_sorted_to_model_array (es, array, count);
-}
-
-
-gboolean
-e_sorter_needs_sorting(ESorter *es)
-{
- g_return_val_if_fail (es != NULL, FALSE);
-
- if (E_SORTER_GET_CLASS(es)->needs_sorting)
- return E_SORTER_GET_CLASS(es)->needs_sorting (es);
- else
- return FALSE;
-}
diff --git a/e-util/e-sorter.h b/e-util/e-sorter.h
deleted file mode 100644
index a70c2bd2d7..0000000000
--- a/e-util/e-sorter.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-sorter.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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_SORTER_H_
-#define _E_SORTER_H_
-
-#include <glib-object.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_SORTER_TYPE (e_sorter_get_type ())
-#define E_SORTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_SORTER_TYPE, ESorter))
-#define E_SORTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_SORTER_TYPE, ESorterClass))
-#define E_IS_SORTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_SORTER_TYPE))
-#define E_IS_SORTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_SORTER_TYPE))
-#define E_SORTER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_SORTER_TYPE, ESorterClass))
-
-typedef struct {
- GObject base;
-} ESorter;
-
-typedef struct {
- GObjectClass parent_class;
- gint (*model_to_sorted) (ESorter *sorter,
- int row);
- gint (*sorted_to_model) (ESorter *sorter,
- int row);
-
- void (*get_model_to_sorted_array) (ESorter *sorter,
- int **array,
- int *count);
- void (*get_sorted_to_model_array) (ESorter *sorter,
- int **array,
- int *count);
-
- gboolean (*needs_sorting) (ESorter *sorter);
-} ESorterClass;
-
-GType e_sorter_get_type (void);
-ESorter *e_sorter_new (void);
-
-gint e_sorter_model_to_sorted (ESorter *sorter,
- int row);
-gint e_sorter_sorted_to_model (ESorter *sorter,
- int row);
-
-void e_sorter_get_model_to_sorted_array (ESorter *sorter,
- int **array,
- int *count);
-void e_sorter_get_sorted_to_model_array (ESorter *sorter,
- int **array,
- int *count);
-
-gboolean e_sorter_needs_sorting (ESorter *sorter);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_SORTER_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 478dc2d68b..0000000000
--- a/e-util/e-text-event-processor-emacs-like.c
+++ /dev/null
@@ -1,495 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text-event-processor-emacs-like.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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 <string.h>
-#include <gdk/gdkkeysyms.h>
-#include <gal/util/e-util.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);
-
-#define PARENT_TYPE E_TEXT_EVENT_PROCESSOR_TYPE
-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_NOP, 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_CAPS, E_TEP_CAPS_TITLE, "" },/* 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_CAPS, E_TEP_CAPS_LOWER, "" }, /* 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_CAPS, E_TEP_CAPS_UPPER, "" }, /* 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 */
-
-};
-
-E_MAKE_TYPE (e_text_event_processor_emacs_like,
- "ETextEventProcessorEmacsLike",
- ETextEventProcessorEmacsLike,
- e_text_event_processor_emacs_like_class_init,
- e_text_event_processor_emacs_like_init,
- PARENT_TYPE)
-
-static void
-e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass *klass)
-{
- ETextEventProcessorClass *processor_class;
-
- processor_class = (ETextEventProcessorClass*) klass;
-
- parent_class = g_type_class_ref (PARENT_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;
- g_signal_emit_by_name (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;
- tep_el->mouse_down = FALSE;
- } 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;
- g_signal_emit_by_name (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 if (key.state & GDK_MOD1_MASK)
- command.action = E_TEP_NOP;
- else
- command.action = E_TEP_MOVE;
- switch(key.keyval) {
- case GDK_Home:
- case GDK_KP_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:
- case GDK_KP_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:
- case GDK_KP_Page_Up: command.position = E_TEP_BACKWARD_PAGE; break;
-
- case GDK_Page_Down:
- case GDK_KP_Page_Down: command.position = E_TEP_FORWARD_PAGE; break;
- /* CUA has Ctrl-Up/Ctrl-Down as paragraph up down */
- case GDK_Up:
- case GDK_KP_Up: command.position = E_TEP_BACKWARD_LINE; break;
-
- case GDK_Down:
- case GDK_KP_Down: command.position = E_TEP_FORWARD_LINE; break;
-
- case GDK_Left:
- case GDK_KP_Left:
- if (key.state & GDK_CONTROL_MASK)
- command.position = E_TEP_BACKWARD_WORD;
- else
- command.position = E_TEP_BACKWARD_CHARACTER;
- break;
- case GDK_Right:
- case GDK_KP_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:
- case GDK_KP_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 -- FIXME */
- }
- break;
- case GDK_Delete:
- case GDK_KP_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;
- g_signal_emit_by_name (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:
- case GDK_KP_Tab:
- case GDK_ISO_Left_Tab:
- case GDK_3270_BackTab:
- /* Don't insert literally */
- command.action = E_TEP_NOP;
- command.position = E_TEP_SELECTION;
- break;
- case GDK_Return:
- case GDK_KP_Enter:
- if (tep->allow_newlines) {
- 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";
- }
- } else {
- if (key.state & GDK_CONTROL_MASK) {
- command.action = E_TEP_NOP;
- command.position = E_TEP_SELECTION;
- } else {
- command.action = E_TEP_ACTIVATE;
- command.position = E_TEP_SELECTION;
- }
- }
- break;
- case GDK_Escape:
- /* Don't insert literally */
- command.action = E_TEP_NOP;
- command.position = E_TEP_SELECTION;
- break;
-
- case GDK_KP_Space:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = " ";
- break;
- case GDK_KP_Equal:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "=";
- break;
- case GDK_KP_Multiply:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "*";
- break;
- case GDK_KP_Add:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "+";
- break;
- case GDK_KP_Subtract:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "-";
- break;
- case GDK_KP_Decimal:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = ".";
- break;
- case GDK_KP_Divide:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "/";
- break;
- case GDK_KP_0:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "0";
- break;
- case GDK_KP_1:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "1";
- break;
- case GDK_KP_2:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "2";
- break;
- case GDK_KP_3:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "3";
- break;
- case GDK_KP_4:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "4";
- break;
- case GDK_KP_5:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "5";
- break;
- case GDK_KP_6:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "6";
- break;
- case GDK_KP_7:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "7";
- break;
- case GDK_KP_8:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "8";
- break;
- case GDK_KP_9:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "9";
- break;
-
- default:
- if ((key.state & GDK_CONTROL_MASK) && !(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 = 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 == ' ') {
- command.action = E_TEP_NOP;
- }
-
- if (key.keyval == 'x') {
- command.action = E_TEP_COPY;
- command.position = E_TEP_SELECTION;
- g_signal_emit_by_name (tep, "command", &command);
-
- command.action = E_TEP_DELETE;
- command.position = E_TEP_SELECTION;
- }
-
- break;
- } else if ((key.state & GDK_MOD1_MASK) && !(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 = 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.state & GDK_MOD1_MASK) && !(key.state & GDK_CONTROL_MASK) && key.length > 0) {
- if (key.keyval >= GDK_KP_0 && key.keyval <= GDK_KP_9) {
- key.keyval = '0';
- key.string = "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) {
- g_signal_emit_by_name (tep, "command", &command);
- return 1;
- }
- else
- return 0;
-}
-
-ETextEventProcessor *
-e_text_event_processor_emacs_like_new (void)
-{
- ETextEventProcessorEmacsLike *retval = g_object_new (E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, NULL);
- 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 1fd74dacfe..0000000000
--- a/e-util/e-text-event-processor-emacs-like.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text-event-processor-emacs-like.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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 <gal/util/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) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, ETextEventProcessorEmacsLike))
-#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, ETextEventProcessorEmacsLikeClass))
-#define E_IS_TEXT_EVENT_PROCESSOR_EMACS_LIKE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE))
-#define E_IS_TEXT_EVENT_PROCESSOR_EMACS_LIKE_CLASS(klass) (G_TYPE_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 */
- guint mouse_down : 1;
-};
-
-struct _ETextEventProcessorEmacsLikeClass
-{
- ETextEventProcessorClass parent_class;
-};
-
-
-GType 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 5cb3f198d7..0000000000
--- a/e-util/e-text-event-processor-types.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text-event-processor-types.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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_TYPES_H__
-#define __E_TEXT_EVENT_PROCESSOR_TYPES_H__
-
-#include <glib/gmacros.h>
-
-G_BEGIN_DECLS
-
-#include <gdk/gdkevents.h>
-
-typedef union _ETextEventProcessorEvent ETextEventProcessorEvent;
-
-typedef enum {
- 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
-
-} ETextEventProcessorCommandPosition;
-
-typedef enum {
- E_TEP_MOVE,
- E_TEP_SELECT,
- E_TEP_DELETE,
- E_TEP_INSERT,
-
- E_TEP_CAPS,
-
- 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
-} ETextEventProcessorCommandAction;
-
-typedef struct {
- ETextEventProcessorCommandPosition position;
- ETextEventProcessorCommandAction action;
- int value;
- char *string;
- guint32 time;
-} ETextEventProcessorCommand;
-
-typedef struct {
- GdkEventType type;
- guint32 time;
- guint state;
- guint button;
- gint position;
-} ETextEventProcessorEventButton;
-
-typedef struct {
- GdkEventType type;
- guint32 time;
- guint state;
- guint keyval;
- gint length;
- gchar *string;
-} ETextEventProcessorEventKey;
-
-typedef struct {
- GdkEventType type;
- guint32 time;
- guint state;
- gint position;
-} ETextEventProcessorEventMotion;
-
-union _ETextEventProcessorEvent {
- GdkEventType type;
- ETextEventProcessorEventButton button;
- ETextEventProcessorEventKey key;
- ETextEventProcessorEventMotion motion;
-};
-
-typedef enum _ETextEventProcessorCaps {
- E_TEP_CAPS_UPPER,
- E_TEP_CAPS_LOWER,
- E_TEP_CAPS_TITLE
-} ETextEventProcessorCaps;
-
-G_END_DECLS
-
-#endif /* __E_TEXT_EVENT_PROCESSOR_TYPES_H__ */
diff --git a/e-util/e-text-event-processor.c b/e-util/e-text-event-processor.c
deleted file mode 100644
index 6b974d894e..0000000000
--- a/e-util/e-text-event-processor.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text-event-processor.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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-text-event-processor.h"
-#include <gal/util/e-util.h>
-#include <gal/util/e-i18n.h>
-#include "gal/util/e-marshal.h"
-
-static void e_text_event_processor_init (ETextEventProcessor *card);
-static void e_text_event_processor_class_init (ETextEventProcessorClass *klass);
-
-static void e_text_event_processor_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void e_text_event_processor_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-#define PARENT_TYPE G_TYPE_OBJECT
-static GObjectClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- PROP_0,
- PROP_ALLOW_NEWLINES
-};
-
-enum {
- E_TEP_EVENT,
- E_TEP_LAST_SIGNAL
-};
-
-static guint e_tep_signals[E_TEP_LAST_SIGNAL] = { 0 };
-
-E_MAKE_TYPE (e_text_event_processor,
- "ETextEventProcessor",
- ETextEventProcessor,
- e_text_event_processor_class_init,
- e_text_event_processor_init,
- PARENT_TYPE)
-
-static void
-e_text_event_processor_class_init (ETextEventProcessorClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass*) klass;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->set_property = e_text_event_processor_set_property;
- object_class->get_property = e_text_event_processor_get_property;
-
- e_tep_signals[E_TEP_EVENT] =
- g_signal_new ("command",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETextEventProcessorClass, command),
- NULL, NULL,
- e_marshal_NONE__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
-
- g_object_class_install_property (object_class, PROP_ALLOW_NEWLINES,
- g_param_spec_boolean ("allow_newlines",
- _( "Allow newlines" ),
- _( "Allow newlines" ),
- FALSE,
- G_PARAM_READWRITE));
-
- klass->event = NULL;
- klass->command = NULL;
-
-}
-
-static void
-e_text_event_processor_init (ETextEventProcessor *tep)
-{
- tep->allow_newlines = TRUE;
-}
-
-gint
-e_text_event_processor_handle_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event)
-{
- if (E_TEXT_EVENT_PROCESSOR_GET_CLASS(tep)->event)
- return E_TEXT_EVENT_PROCESSOR_GET_CLASS(tep)->event(tep, event);
- else
- return 0;
-}
-
-/* Set_arg handler for the text item */
-static void
-e_text_event_processor_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ETextEventProcessor *tep = E_TEXT_EVENT_PROCESSOR (object);
-
- switch (prop_id) {
- case PROP_ALLOW_NEWLINES:
- tep->allow_newlines = g_value_get_boolean (value);
- break;
- default:
- return;
- }
-}
-
-/* Get_arg handler for the text item */
-static void
-e_text_event_processor_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ETextEventProcessor *tep = E_TEXT_EVENT_PROCESSOR (object);
-
- switch (prop_id) {
- case PROP_ALLOW_NEWLINES:
- g_value_set_boolean (value, tep->allow_newlines);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
diff --git a/e-util/e-text-event-processor.h b/e-util/e-text-event-processor.h
deleted file mode 100644
index 21f2550fde..0000000000
--- a/e-util/e-text-event-processor.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text-event-processor.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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 <glib.h>
-#include <gtk/gtkobject.h>
-#include <gal/util/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) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessor))
-#define E_TEXT_EVENT_PROCESSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessorClass))
-#define E_IS_TEXT_EVENT_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_TYPE))
-#define E_IS_TEXT_EVENT_PROCESSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_TYPE))
-#define E_TEXT_EVENT_PROCESSOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessorClass))
-typedef struct _ETextEventProcessor ETextEventProcessor;
-typedef struct _ETextEventProcessorClass ETextEventProcessorClass;
-
-struct _ETextEventProcessor
-{
- GObject parent;
-
- /* object specific fields */
- guint allow_newlines : 1;
-};
-
-struct _ETextEventProcessorClass
-{
- GtkObjectClass parent_class;
-
- /* signals */
- void (* command) (ETextEventProcessor *tep, ETextEventProcessorCommand *command);
-
- /* virtual functions */
- gint (* event) (ETextEventProcessor *tep, ETextEventProcessorEvent *event);
-};
-
-
-GType 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-time-utils.c b/e-util/e-time-utils.c
deleted file mode 100644
index 8f05427a81..0000000000
--- a/e-util/e-time-utils.c
+++ /dev/null
@@ -1,492 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Time utility functions
- *
- * Author:
- * Damon Chaplin (damon@ximian.com)
- *
- * (C) 2001 Ximian, Inc.
- */
-
-#include <config.h>
-
-#ifdef __linux__
-/* We need this to get a prototype for strptime. */
-#define _GNU_SOURCE
-#endif /* __linux__ */
-
-#include <time.h>
-#include <sys/time.h>
-#include <gal/widgets/e-unicode.h>
-
-#ifdef __linux__
-#undef _GNU_SOURCE
-#endif /* __linux__ */
-
-#include <string.h>
-#include <ctype.h>
-#include <glib.h>
-#include <libgnome/gnome-i18n.h>
-#include <gal/util/e-util.h>
-#include "e-time-utils.h"
-
-
-/* Returns whether a string is NULL, empty, or full of whitespace */
-static gboolean
-string_is_empty (const char *value)
-{
- const char *p;
- gboolean empty = TRUE;
-
- if (value) {
- p = value;
- while (*p) {
- if (!isspace (*p)) {
- empty = FALSE;
- break;
- }
- p++;
- }
- }
- return empty;
-}
-
-
-/* Takes a number of format strings for strptime() and attempts to parse a
- * string with them.
- */
-static ETimeParseStatus
-parse_with_strptime (const char *value, struct tm *result, const char **formats, int n_formats)
-{
- const char *parse_end = NULL, *pos;
- gchar *locale_str;
- gchar *format_str;
- ETimeParseStatus parse_ret;
- gboolean parsed = FALSE;
- int i;
-
- if (string_is_empty (value)) {
- memset (result, 0, sizeof (*result));
- result->tm_isdst = -1;
- return E_TIME_PARSE_NONE;
- }
-
- locale_str = e_utf8_to_locale_string (value);
-
- pos = (const char *) locale_str;
-
- /* Skip whitespace */
- while (isspace (*pos))
- pos++;
-
- /* Try each of the formats in turn */
-
- for (i = 0; i < n_formats; i++) {
- memset (result, 0, sizeof (*result));
- format_str = e_utf8_to_locale_string (formats[i]);
- parse_end = strptime (pos, format_str, result);
- g_free (format_str);
- if (parse_end) {
- parsed = TRUE;
- break;
- }
- }
-
- result->tm_isdst = -1;
-
- parse_ret = E_TIME_PARSE_INVALID;
-
- /* If we parsed something, make sure we parsed the entire string. */
- if (parsed) {
- /* Skip whitespace */
- while (isspace (*parse_end))
- parse_end++;
-
- if (*parse_end == '\0')
- parse_ret = E_TIME_PARSE_OK;
- }
-
- g_free (locale_str);
-
- return (parse_ret);
-
-}
-
-
-/* Returns TRUE if the locale has 'am' and 'pm' strings defined, in which
- case the user can choose between 12 and 24-hour time formats. */
-static gboolean
-locale_supports_12_hour_format (void)
-{
- struct tm tmp_tm = { 0 };
- char s[16];
-
- e_utf8_strftime (s, sizeof (s), "%p", &tmp_tm);
- return s[0] != '\0';
-}
-
-
-/*
- * Parses a string containing a date and a time. The date is expected to be
- * in a format something like "Wed 3/13/00 14:20:00", though we use gettext
- * to support the appropriate local formats and we try to accept slightly
- * different formats, e.g. the weekday can be skipped and we can accept 12-hour
- * formats with an am/pm string.
- *
- * Returns E_TIME_PARSE_OK if it could not be parsed, E_TIME_PARSE_NONE if it
- * was empty, or E_TIME_PARSE_INVALID if it couldn't be parsed.
- */
-ETimeParseStatus
-e_time_parse_date_and_time (const char *value,
- struct tm *result)
-{
- struct tm *today_tm;
- time_t t;
- const char *format[16];
- int num_formats = 0;
- gboolean use_12_hour_formats = locale_supports_12_hour_format ();
- ETimeParseStatus status;
-
- if (string_is_empty (value)) {
- memset (result, 0, sizeof (*result));
- result->tm_isdst = -1;
- return E_TIME_PARSE_NONE;
- }
-
- /* We'll parse the whole date and time in one go, otherwise we get
- into i18n problems. We attempt to parse with several formats,
- longest first. Note that we only use the '%p' specifier if the
- locale actually has 'am' and 'pm' strings defined, otherwise we
- will get incorrect results. Note also that we try to use exactly
- the same strings as in e_time_format_date_and_time(), to try to
- avoid i18n problems. We also use cut-down versions, so users don't
- have to type in the weekday or the seconds, for example.
- Note that all these formats include the full date, and the time
- will be set to 00:00:00 before parsing, so we don't need to worry
- about filling in any missing fields after parsing. */
-
- /*
- * Try the full times, with the weekday. Then try without seconds,
- * and without minutes, and finally with no time at all.
- */
- if (use_12_hour_formats) {
- /* strptime format of a weekday, a date and a time,
- in 12-hour format. */
- format[num_formats++] = _("%a %m/%d/%Y %I:%M:%S %p");
- }
-
- /* strptime format of a weekday, a date and a time,
- in 24-hour format. */
- format[num_formats++] = _("%a %m/%d/%Y %H:%M:%S");
-
- if (use_12_hour_formats) {
- /* strptime format of a weekday, a date and a time,
- in 12-hour format, without seconds. */
- format[num_formats++] = _("%a %m/%d/%Y %I:%M %p");
- }
-
- /* strptime format of a weekday, a date and a time,
- in 24-hour format, without seconds. */
- format[num_formats++] = _("%a %m/%d/%Y %H:%M");
-
- if (use_12_hour_formats) {
- /* strptime format of a weekday, a date and a time,
- in 12-hour format, without minutes or seconds. */
- format[num_formats++] = _("%a %m/%d/%Y %I %p");
- }
-
- /* strptime format of a weekday, a date and a time,
- in 24-hour format, without minutes or seconds. */
- format[num_formats++] = _("%a %m/%d/%Y %H");
-
- /* strptime format of a weekday and a date. */
- format[num_formats++] = _("%a %m/%d/%Y");
-
-
- /*
- * Now try all the above formats again, but without the weekday.
- */
- if (use_12_hour_formats) {
- /* strptime format of a date and a time, in 12-hour format. */
- format[num_formats++] = _("%m/%d/%Y %I:%M:%S %p");
- }
-
- /* strptime format of a date and a time, in 24-hour format. */
- format[num_formats++] = _("%m/%d/%Y %H:%M:%S");
-
- if (use_12_hour_formats) {
- /* strptime format of a date and a time, in 12-hour format,
- without seconds. */
- format[num_formats++] = _("%m/%d/%Y %I:%M %p");
- }
-
- /* strptime format of a date and a time, in 24-hour format,
- without seconds. */
- format[num_formats++] = _("%m/%d/%Y %H:%M");
-
- if (use_12_hour_formats) {
- /* strptime format of a date and a time, in 12-hour format,
- without minutes or seconds. */
- format[num_formats++] = _("%m/%d/%Y %I %p");
- }
-
- /* strptime format of a date and a time, in 24-hour format,
- without minutes or seconds. */
- format[num_formats++] = _("%m/%d/%Y %H");
-
- /* strptime format of a weekday and a date. */
- format[num_formats++] = _("%m/%d/%Y");
-
-
- status = parse_with_strptime (value, result, format, num_formats);
- /* Note that we checked if it was empty already, so it is either OK
- or INVALID here. */
- if (status == E_TIME_PARSE_OK) {
- /* If a 2-digit year was used we use the current century. */
- if (result->tm_year < 0) {
- t = time (NULL);
- today_tm = localtime (&t);
-
- /* This should convert it into a value from 0 to 99. */
- result->tm_year += 1900;
-
- /* Now add on the century. */
- result->tm_year += today_tm->tm_year
- - (today_tm->tm_year % 100);
- }
- } else {
- /* Now we try to just parse a time, assuming the current day.*/
- status = e_time_parse_time (value, result);
- if (status == E_TIME_PARSE_OK) {
- /* We fill in the current day. */
- t = time (NULL);
- today_tm = localtime (&t);
- result->tm_mday = today_tm->tm_mday;
- result->tm_mon = today_tm->tm_mon;
- result->tm_year = today_tm->tm_year;
- }
- }
-
- return status;
-}
-
-/**
- * e_time_parse_date:
- * @value: A date string.
- * @result: Return value for the parsed date.
- *
- * Takes in a date string entered by the user and tries to convert it to
- * a struct tm.
- *
- * Return value: Result code indicating whether the @value was an empty
- * string, a valid date, or an invalid date.
- **/
-ETimeParseStatus
-e_time_parse_date (const char *value, struct tm *result)
-{
- const char *format[2];
- struct tm *today_tm;
- time_t t;
- ETimeParseStatus status;
-
- g_return_val_if_fail (value != NULL, E_TIME_PARSE_INVALID);
- g_return_val_if_fail (result != NULL, E_TIME_PARSE_INVALID);
-
- /* strptime format of a weekday and a date. */
- format[0] = _("%a %m/%d/%Y");
-
- /* This is the preferred date format for the locale. */
- format[1] = _("%m/%d/%Y");
-
- status = parse_with_strptime (value, result, format, sizeof (format) / sizeof (format[0]));
- if (status == E_TIME_PARSE_OK) {
- /* If a 2-digit year was used we use the current century. */
- if (result->tm_year < 0) {
- t = time (NULL);
- today_tm = localtime (&t);
-
- /* This should convert it into a value from 0 to 99. */
- result->tm_year += 1900;
-
- /* Now add on the century. */
- result->tm_year += today_tm->tm_year
- - (today_tm->tm_year % 100);
- }
- }
-
- return status;
-}
-
-
-/*
- * Parses a string containing a time. It is expected to be in a format
- * something like "14:20:00", though we use gettext to support the appropriate
- * local formats and we try to accept slightly different formats, e.g. we can
- * accept 12-hour formats with an am/pm string.
- *
- * Returns E_TIME_PARSE_OK if it could not be parsed, E_TIME_PARSE_NONE if it
- * was empty, or E_TIME_PARSE_INVALID if it couldn't be parsed.
- */
-ETimeParseStatus
-e_time_parse_time (const char *value, struct tm *result)
-{
- const char *format[6];
- int num_formats = 0;
- gboolean use_12_hour_formats = locale_supports_12_hour_format ();
-
- if (use_12_hour_formats) {
- /* strptime format for a time of day, in 12-hour format. */
- format[num_formats++] = _("%I:%M:%S %p");
- }
-
- /* strptime format for a time of day, in 24-hour format. */
- format[num_formats++] = _("%H:%M:%S");
-
- if (use_12_hour_formats) {
- /* strptime format for time of day, without seconds,
- in 12-hour format. */
- format[num_formats++] = _("%I:%M %p");
- }
-
- /* strptime format for time of day, without seconds 24-hour format. */
- format[num_formats++] = _("%H:%M");
-
- if (use_12_hour_formats) {
- /* strptime format for hour and AM/PM, 12-hour format. */
- format[num_formats++] = _("%I %p");
- }
-
- /* strptime format for hour, 24-hour format. */
- format[num_formats++] = "%H";
-
- return parse_with_strptime (value, result, format, num_formats);
-}
-
-
-/* Creates a string representation of a time value and stores it in buffer.
- buffer_size should be about 64 to be safe. If show_midnight is FALSE, and
- the time is midnight, then we just show the date. If show_zero_seconds
- is FALSE, then if the time has zero seconds only the hour and minute are
- shown. */
-void
-e_time_format_date_and_time (struct tm *date_tm,
- gboolean use_24_hour_format,
- gboolean show_midnight,
- gboolean show_zero_seconds,
- char *buffer,
- int buffer_size)
-{
- char *format;
-
- if (!show_midnight && date_tm->tm_hour == 0
- && date_tm->tm_min == 0 && date_tm->tm_sec == 0) {
- /* strftime format of a weekday and a date. */
- format = _("%a %m/%d/%Y");
- } else if (use_24_hour_format) {
- if (!show_zero_seconds && date_tm->tm_sec == 0)
- /* strftime format of a weekday, a date and a
- time, in 24-hour format, without seconds. */
- format = _("%a %m/%d/%Y %H:%M");
- else
- /* strftime format of a weekday, a date and a
- time, in 24-hour format. */
- format = _("%a %m/%d/%Y %H:%M:%S");
- } else {
- if (!show_zero_seconds && date_tm->tm_sec == 0)
- /* strftime format of a weekday, a date and a
- time, in 12-hour format, without seconds. */
- format = _("%a %m/%d/%Y %I:%M %p");
- else
- /* strftime format of a weekday, a date and a
- time, in 12-hour format. */
- format = _("%a %m/%d/%Y %I:%M:%S %p");
- }
-
- /* strftime returns 0 if the string doesn't fit, and leaves the buffer
- undefined, so we set it to the empty string in that case. */
- if (e_utf8_strftime (buffer, buffer_size, format, date_tm) == 0)
- buffer[0] = '\0';
-}
-
-
-/* Creates a string representation of a time value and stores it in buffer.
- buffer_size should be about 64 to be safe. */
-void
-e_time_format_time (struct tm *date_tm,
- gboolean use_24_hour_format,
- gboolean show_zero_seconds,
- char *buffer,
- int buffer_size)
-{
- char *format;
-
- if (use_24_hour_format) {
- if (!show_zero_seconds && date_tm->tm_sec == 0)
- /* strftime format of a time in 24-hour format,
- without seconds. */
- format = _("%H:%M");
- else
- /* strftime format of a time in 24-hour format. */
- format = _("%H:%M:%S");
- } else {
- if (!show_zero_seconds && date_tm->tm_sec == 0)
- /* strftime format of a time in 12-hour format,
- without seconds. */
- format = _("%I:%M %p");
- else
- /* strftime format of a time in 12-hour format. */
- format = _("%I:%M:%S %p");
- }
-
- /* strftime returns 0 if the string doesn't fit, and leaves the buffer
- undefined, so we set it to the empty string in that case. */
- if (e_utf8_strftime (buffer, buffer_size, format, date_tm) == 0)
- buffer[0] = '\0';
-}
-
-
-/* Like mktime(3), but assumes UTC instead of local timezone. */
-time_t
-e_mktime_utc (struct tm *tm)
-{
- time_t tt;
-
- tm->tm_isdst = -1;
- tt = mktime (tm);
-
-#if defined (HAVE_TM_GMTOFF)
- tt += tm->tm_gmtoff;
-#elif defined (HAVE_TIMEZONE)
- if (tm->tm_isdst > 0) {
- #if defined (HAVE_ALTZONE)
- tt -= altzone;
- #else /* !defined (HAVE_ALTZONE) */
- tt -= (timezone - 3600);
- #endif
- } else
- tt -= timezone;
-#endif
-
- return tt;
-}
-
-/* Like localtime_r(3), but also returns an offset in seconds after UTC.
- (Calling gmtime with tt + offset would generate the same tm) */
-void
-e_localtime_with_offset (time_t tt, struct tm *tm, int *offset)
-{
- localtime_r (&tt, tm);
-
-#if defined (HAVE_TM_GMTOFF)
- *offset = tm->tm_gmtoff;
-#elif defined (HAVE_TIMEZONE)
- if (tm->tm_isdst > 0) {
- #if defined (HAVE_ALTZONE)
- *offset = -altzone;
- #else /* !defined (HAVE_ALTZONE) */
- *offset = -(timezone - 3600);
- #endif
- } else
- *offset = -timezone;
-#endif
-}
diff --git a/e-util/e-time-utils.h b/e-util/e-time-utils.h
deleted file mode 100644
index 0b081dadd4..0000000000
--- a/e-util/e-time-utils.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Time utility functions
- *
- * Author:
- * Damon Chaplin (damon@ximian.com)
- *
- * (C) 2001 Ximian, Inc.
- */
-
-#ifndef E_TIME_UTILS
-#define E_TIME_UTILS
-
-#include <time.h>
-#include <glib.h>
-
-typedef enum {
- E_TIME_PARSE_OK,
- E_TIME_PARSE_NONE,
- E_TIME_PARSE_INVALID
-} ETimeParseStatus;
-
-/* Tries to parse a string containing a date and time. */
-ETimeParseStatus e_time_parse_date_and_time (const char *value,
- struct tm *result);
-
-/* Tries to parse a string containing a date. */
-ETimeParseStatus e_time_parse_date (const char *value,
- struct tm *result);
-
-/* Tries to parse a string containing a time. */
-ETimeParseStatus e_time_parse_time (const char *value,
- struct tm *result);
-
-/* Turns a struct tm into a string like "Wed 3/12/00 12:00:00 AM". */
-void e_time_format_date_and_time (struct tm *date_tm,
- gboolean use_24_hour_format,
- gboolean show_midnight,
- gboolean show_zero_seconds,
- char *buffer,
- int buffer_size);
-
-/* Formats a time from a struct tm, e.g. "01:59 PM". */
-void e_time_format_time (struct tm *date_tm,
- gboolean use_24_hour_format,
- gboolean show_zero_seconds,
- char *buffer,
- int buffer_size);
-
-
-/* Like mktime(3), but assumes UTC instead of local timezone. */
-time_t e_mktime_utc (struct tm *timeptr);
-
-/* Like localtime_r(3), but also returns an offset in minutes after UTC.
- (Calling gmtime with tt + offset would generate the same tm) */
-void e_localtime_with_offset (time_t tt, struct tm *tm, int *offset);
-
-#endif /* E_TIME_UTILS */
diff --git a/e-util/e-trie.c b/e-util/e-trie.c
deleted file mode 100644
index 2edf94df34..0000000000
--- a/e-util/e-trie.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2002 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <string.h>
-
-#include "e-trie.h"
-#include "e-memory.h"
-
-#define d(x)
-
-struct _trie_state {
- struct _trie_state *next;
- struct _trie_state *fail;
- struct _trie_match *match;
- unsigned int final;
- int id;
-};
-
-struct _trie_match {
- struct _trie_match *next;
- struct _trie_state *state;
- gunichar c;
-};
-
-struct _ETrie {
- struct _trie_state root;
- GPtrArray *fail_states;
- gboolean icase;
-
- EMemChunk *match_chunks;
- EMemChunk *state_chunks;
-};
-
-
-static inline gunichar
-trie_utf8_getc (const unsigned char **in, size_t inlen)
-{
- register const unsigned char *inptr = *in;
- const unsigned char *inend = inptr + inlen;
- register unsigned char c, r;
- register gunichar u, m;
-
- if (inlen == 0)
- return 0;
-
- r = *inptr++;
- if (r < 0x80) {
- *in = inptr;
- u = r;
- } else if (r < 0xfe) { /* valid start char? */
- u = r;
- m = 0x7f80; /* used to mask out the length bits */
- do {
- if (inptr >= inend)
- return 0;
-
- c = *inptr++;
- if ((c & 0xc0) != 0x80)
- goto error;
-
- u = (u << 6) | (c & 0x3f);
- r <<= 1;
- m <<= 5;
- } while (r & 0x40);
-
- *in = inptr;
-
- u &= ~m;
- } else {
- error:
- *in = (*in)+1;
- u = 0xfffe;
- }
-
- return u;
-}
-
-
-ETrie *
-e_trie_new (gboolean icase)
-{
- ETrie *trie;
-
- trie = g_new (ETrie, 1);
- trie->root.next = NULL;
- trie->root.fail = NULL;
- trie->root.match = NULL;
- trie->root.final = 0;
-
- trie->fail_states = g_ptr_array_sized_new (8);
- trie->icase = icase;
-
- trie->match_chunks = e_memchunk_new (8, sizeof (struct _trie_match));
- trie->state_chunks = e_memchunk_new (8, sizeof (struct _trie_state));
-
- return trie;
-}
-
-void
-e_trie_free (ETrie *trie)
-{
- g_ptr_array_free (trie->fail_states, TRUE);
- e_memchunk_destroy (trie->match_chunks);
- e_memchunk_destroy (trie->state_chunks);
- g_free (trie);
-}
-
-
-
-static struct _trie_match *
-g (struct _trie_state *s, gunichar c)
-{
- struct _trie_match *m = s->match;
-
- while (m && m->c != c)
- m = m->next;
-
- return m;
-}
-
-static struct _trie_state *
-trie_insert (ETrie *trie, int depth, struct _trie_state *q, gunichar c)
-{
- struct _trie_match *m;
-
- m = e_memchunk_alloc (trie->match_chunks);
- m->next = q->match;
- m->c = c;
-
- q->match = m;
- q = m->state = e_memchunk_alloc (trie->state_chunks);
- q->match = NULL;
- q->fail = &trie->root;
- q->final = 0;
- q->id = -1;
-
- if (trie->fail_states->len < depth + 1) {
- unsigned int size = trie->fail_states->len;
-
- size = MAX (size + 64, depth + 1);
- g_ptr_array_set_size (trie->fail_states, size);
- }
-
- q->next = trie->fail_states->pdata[depth];
- trie->fail_states->pdata[depth] = q;
-
- return q;
-}
-
-
-#if 1
-static void
-dump_trie (struct _trie_state *s, int depth)
-{
- char *p = g_alloca ((depth * 2) + 1);
- struct _trie_match *m;
-
- memset (p, ' ', depth * 2);
- p[depth * 2] = '\0';
-
- fprintf (stderr, "%s[state] %p: final=%d; pattern-id=%d; fail=%p\n",
- p, s, s->final, s->id, s->fail);
- m = s->match;
- while (m) {
- fprintf (stderr, " %s'%c' -> %p\n", p, m->c, m->state);
- if (m->state)
- dump_trie (m->state, depth + 1);
-
- m = m->next;
- }
-}
-#endif
-
-
-/*
- * final = empty set
- * FOR p = 1 TO #pat
- * q = root
- * FOR j = 1 TO m[p]
- * IF g(q, pat[p][j]) == null
- * insert(q, pat[p][j])
- * ENDIF
- * q = g(q, pat[p][j])
- * ENDFOR
- * final = union(final, q)
- * ENDFOR
-*/
-
-void
-e_trie_add (ETrie *trie, const char *pattern, int pattern_id)
-{
- const unsigned char *inptr = (const unsigned char *) pattern;
- struct _trie_state *q, *q1, *r;
- struct _trie_match *m, *n;
- int i, depth = 0;
- gunichar c;
-
- /* Step 1: add the pattern to the trie */
-
- q = &trie->root;
-
- while ((c = trie_utf8_getc (&inptr, -1))) {
- if (trie->icase)
- c = g_unichar_tolower (c);
-
- m = g (q, c);
- if (m == NULL) {
- q = trie_insert (trie, depth, q, c);
- } else {
- q = m->state;
- }
-
- depth++;
- }
-
- q->final = depth;
- q->id = pattern_id;
-
- /* Step 2: compute failure graph */
-
- for (i = 0; i < trie->fail_states->len; i++) {
- q = trie->fail_states->pdata[i];
- while (q) {
- m = q->match;
- while (m) {
- c = m->c;
- q1 = m->state;
- r = q->fail;
- while (r && (n = g (r, c)) == NULL)
- r = r->fail;
-
- if (r != NULL) {
- q1->fail = n->state;
- if (q1->fail->final > q1->final)
- q1->final = q1->fail->final;
- } else {
- if ((n = g (&trie->root, c)))
- q1->fail = n->state;
- else
- q1->fail = &trie->root;
- }
-
- m = m->next;
- }
-
- q = q->next;
- }
- }
-
- d(fprintf (stderr, "\nafter adding pattern '%s' to trie %p:\n", pattern, trie));
- d(dump_trie (&trie->root, 0));
-}
-
-/*
- * Aho-Corasick
- *
- * q = root
- * FOR i = 1 TO n
- * WHILE q != fail AND g(q, text[i]) == fail
- * q = h(q)
- * ENDWHILE
- * IF q == fail
- * q = root
- * ELSE
- * q = g(q, text[i])
- * ENDIF
- * IF isElement(q, final)
- * RETURN TRUE
- * ENDIF
- * ENDFOR
- * RETURN FALSE
- */
-
-const char *
-e_trie_search (ETrie *trie, const char *buffer, size_t buflen, int *matched_id)
-{
- const unsigned char *inptr, *inend, *prev, *pat;
- register size_t inlen = buflen;
- struct _trie_state *q;
- struct _trie_match *m;
- gunichar c;
-
- inptr = (const unsigned char *) buffer;
- inend = inptr + buflen;
-
- q = &trie->root;
- pat = prev = inptr;
- while ((c = trie_utf8_getc (&inptr, inlen))) {
- inlen = (inend - inptr);
-
- if (c != 0xfffe) {
- if (trie->icase)
- c = g_unichar_tolower (c);
-
- while (q != NULL && (m = g (q, c)) == NULL)
- q = q->fail;
-
- if (q == &trie->root)
- pat = prev;
-
- if (q == NULL) {
- q = &trie->root;
- pat = inptr;
- } else if (m != NULL) {
- q = m->state;
-
- if (q->final) {
- if (matched_id)
- *matched_id = q->id;
-
- return (const char *) pat;
- }
- }
- }
-
- prev = inptr;
- }
-
- return NULL;
-}
diff --git a/e-util/e-trie.h b/e-util/e-trie.h
deleted file mode 100644
index cabf5fc627..0000000000
--- a/e-util/e-trie.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Jeffrey Stedfast <fejj@ximian.com>
- *
- * Copyright 2002 Ximian, Inc. (www.ximian.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 Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-
-#ifndef __E_TRIE_H__
-#define __E_TRIE_H__
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#include <glib.h>
-
-typedef struct _ETrie ETrie;
-
-ETrie *e_trie_new (gboolean icase);
-void e_trie_free (ETrie *trie);
-
-void e_trie_add (ETrie *trie, const char *pattern, int pattern_id);
-
-const char *e_trie_search (ETrie *trie, const char *buffer, size_t buflen, int *matched_id);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __E_TRIE_H__ */
diff --git a/e-util/e-uid.c b/e-util/e-uid.c
deleted file mode 100644
index 90c036e0c1..0000000000
--- a/e-util/e-uid.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-uid.c - Unique ID generator.
- *
- * Copyright (C) 2002 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- *
- * Author: Dan Winship <danw@ximian.com>
- */
-
-#include "e-uid.h"
-
-#include <glib/gstrfuncs.h>
-
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-
-
-/**
- * e_uid_new:
- *
- * Generate a new unique string for use e.g. in account lists.
- *
- * Return value: the newly generated UID. The caller should free the string
- * when it's done with it.
- **/
-char *
-e_uid_new (void)
-{
- static char *hostname;
- static int serial;
-
- if (!hostname) {
- static char buffer [512];
-
- if ((gethostname (buffer, sizeof (buffer) - 1) == 0) &&
- (buffer [0] != 0))
- hostname = buffer;
- else
- hostname = "localhost";
- }
-
- return g_strdup_printf ("%lu.%lu.%d@%s",
- (unsigned long) time (NULL),
- (unsigned long) getpid (),
- serial++,
- hostname);
-}
diff --git a/e-util/e-uid.h b/e-util/e-uid.h
deleted file mode 100644
index 44ec8c0dd9..0000000000
--- a/e-util/e-uid.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-uid.h - Unique ID generator.
- *
- * Copyright (C) 2002 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- *
- * Author: Dan Winship <danw@ximian.com>
- */
-
-#ifndef E_UID_H
-#define E_UID_H
-
-char *e_uid_new (void);
-
-#endif /* E_UID_H */
diff --git a/e-util/e-url.c b/e-util/e-url.c
deleted file mode 100644
index 8dba46b62b..0000000000
--- a/e-util/e-url.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * e-url.c
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Developed by Jon Trowbridge <trow@ximian.com>
- * Rodrigo Moya <rodrigo@ximian.com>
- */
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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 <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include "e-url.h"
-
-char *
-e_url_shroud (const char *url)
-{
- const char *first_colon = NULL;
- const char *last_at = NULL;
- const char *p;
- char *shrouded;
-
- if (url == NULL)
- return NULL;
-
- /* Skip past the moniker */
- for (p = url; *p && *p != ':'; ++p);
- if (*p)
- ++p;
-
- while (*p) {
- if (first_colon == NULL && *p == ':')
- first_colon = p;
- if (*p == '@')
- last_at = p;
- ++p;
- }
-
- if (first_colon && last_at && first_colon < last_at) {
- shrouded = g_strdup_printf ("%.*s%s", first_colon - url, url, last_at);
- } else {
- shrouded = g_strdup (url);
- }
-
- return shrouded;
-}
-
-gboolean
-e_url_equal (const char *url1, const char *url2)
-{
- char *shroud1 = e_url_shroud (url1);
- char *shroud2 = e_url_shroud (url2);
- gint len1, len2;
- gboolean rv;
-
- if (shroud1 == NULL || shroud2 == NULL) {
- rv = (shroud1 == shroud2);
- } else {
- len1 = strlen (shroud1);
- len2 = strlen (shroud2);
-
- rv = !strncmp (shroud1, shroud2, MIN (len1, len2));
- }
-
- g_free (shroud1);
- g_free (shroud2);
-
- return rv;
-}
-
-#define HEXVAL(c) (isdigit (c) ? (c) - '0' : tolower (c) - 'a' + 10)
-
-static void
-uri_decode (char *part)
-{
- guchar *s, *d;
-
- s = d = (guchar *)part;
- while (*s) {
- if (*s == '%') {
- if (isxdigit (s[1]) && isxdigit (s[2])) {
- *d++ = HEXVAL (s[1]) * 16 + HEXVAL (s[2]);
- s += 3;
- } else
- *d++ = *s++;
- } else
- *d++ = *s++;
- }
- *d = '\0';
-}
-
-EUri *
-e_uri_new (const char *uri_string)
-{
- EUri *uri;
- const char *end, *hash, *colon, *semi, *at, *slash, *question;
- const char *p;
-
- if (!uri_string)
- return NULL;
-
- uri = g_new0 (EUri, 1);
-
- /* find fragment */
- end = hash = strchr (uri_string, '#');
- if (hash && hash[1]) {
- uri->fragment = g_strdup (hash + 1);
- uri_decode (uri->fragment);
- }
- else
- end = uri_string + strlen (uri_string);
-
- /* find protocol: initial [a-z+.-]* substring until ":" */
- p = uri_string;
- while (p < end && (isalnum ((unsigned char) *p) ||
- *p == '.' || *p == '+' || *p == '-'))
- p++;
-
- if (p > uri_string && *p == ':') {
- uri->protocol = g_ascii_strdown (uri_string, p - uri_string);
- uri_string = p + 1;
- }
- else
- uri->protocol = g_strdup ("file");
-
- if (!*uri_string)
- return uri;
-
- /* check for authority */
- if (strncmp (uri_string, "//", 2) == 0) {
- uri_string += 2;
-
- slash = uri_string + strcspn (uri_string, "/#");
- at = strchr (uri_string, '@');
- if (at && at < slash) {
- colon = strchr (uri_string, ':');
- if (colon && colon < at) {
- uri->passwd = g_strndup (colon + 1, at - colon - 1);
- uri_decode (uri->passwd);
- }
- else {
- uri->passwd = NULL;
- colon = at;
- }
-
- semi = strchr (uri_string, ';');
- if (semi && semi < colon &&
- !strncasecmp (semi, ";auth=", 6)) {
- uri->authmech = g_strndup (semi + 6, colon - semi - 6);
- uri_decode (uri->authmech);
- }
- else {
- uri->authmech = NULL;
- semi = colon;
- }
-
- uri->user = g_strndup (uri_string, semi - uri_string);
- uri_decode (uri->user);
- uri_string = at + 1;
- }
- else
- uri->user = uri->passwd = uri->authmech = NULL;
-
- /* find host and port */
- colon = strchr (uri_string, ':');
- if (colon && colon < slash) {
- uri->host = g_strndup (uri_string, colon - uri_string);
- uri->port = strtoul (colon + 1, NULL, 10);
- }
- else {
- uri->host = g_strndup (uri_string, slash - uri_string);
- uri_decode (uri->host);
- uri->port = 0;
- }
-
- uri_string = slash;
- }
-
- /* find query */
- question = memchr (uri_string, '?', end - uri_string);
- if (question) {
- if (question[1]) {
- uri->query = g_strndup (question + 1, end - (question + 1));
- uri_decode (uri->query);
- }
- end = question;
- }
-
- /* find parameters */
- semi = memchr (uri_string, ';', end - uri_string);
- if (semi) {
- if (semi[1]) {
- const char *cur, *p, *eq;
- char *name, *value;
-
- for (cur = semi + 1; cur < end; cur = p + 1) {
- p = memchr (cur, ';', end - cur);
- if (!p)
- p = end;
- eq = memchr (cur, '=', p - cur);
- if (eq) {
- name = g_strndup (cur, eq - cur);
- value = g_strndup (eq + 1, p - (eq + 1));
- uri_decode (value);
- } else {
- name = g_strndup (cur, p - cur);
- value = g_strdup ("");
- }
- uri_decode (name);
- g_datalist_set_data_full (&uri->params, name,
- value, g_free);
- g_free (name);
- }
- }
- end = semi;
- }
-
- if (end != uri_string) {
- uri->path = g_strndup (uri_string, end - uri_string);
- uri_decode (uri->path);
- }
-
- return uri;
-}
-
-void
-e_uri_free (EUri *uri)
-{
- if (uri) {
- g_free (uri->protocol);
- g_free (uri->user);
- g_free (uri->authmech);
- g_free (uri->passwd);
- g_free (uri->host);
- g_free (uri->path);
- g_datalist_clear (&uri->params);
- g_free (uri->query);
- g_free (uri->fragment);
-
- g_free (uri);
- }
-}
-
-const char *
-e_uri_get_param (EUri *uri, const char *name)
-{
- return g_datalist_get_data (&uri->params, name);
-}
-
-static void
-copy_param_cb (GQuark key_id, gpointer data, gpointer user_data)
-{
- GData *params = (GData *) user_data;
-
- g_datalist_id_set_data_full (&params, key_id, g_strdup (data), g_free);
-}
-
-EUri *
-e_uri_copy (EUri *uri)
-{
- EUri *uri_copy;
-
- g_return_val_if_fail (uri != NULL, NULL);
-
- uri_copy = g_new0 (EUri, 1);
- uri_copy->protocol = g_strdup (uri->protocol);
- uri_copy->user = g_strdup (uri->user);
- uri_copy->authmech = g_strdup (uri->authmech);
- uri_copy->passwd = g_strdup (uri->passwd);
- uri_copy->host = g_strdup (uri->host);
- uri_copy->port = uri->port;
- uri_copy->path = g_strdup (uri->path);
- uri_copy->query = g_strdup (uri->query);
- uri_copy->fragment = g_strdup (uri->fragment);
-
- /* copy uri->params */
- g_datalist_foreach (&uri->params,
- (GDataForeachFunc) copy_param_cb,
- &uri_copy->params);
-
- return uri_copy;
-}
-
-char *
-e_uri_to_string (EUri *uri, gboolean show_password)
-{
- char *str_uri = NULL;
-
- g_return_val_if_fail (uri != NULL, NULL);
-
- if (uri->port != 0)
- str_uri = g_strdup_printf (
- "%s://%s%s%s%s%s%s%s:%d%s%s%s",
- uri->protocol,
- uri->user ? uri->user : "",
- uri->authmech ? ";auth=" : "",
- uri->authmech ? uri->authmech : "",
- uri->passwd && show_password ? ":" : "",
- uri->passwd && show_password ? uri->passwd : "",
- uri->user ? "@" : "",
- uri->host ? uri->host : "",
- uri->port,
- uri->path ? uri->path : "",
- uri->query ? "?" : "",
- uri->query ? uri->query : "");
- else
- str_uri = g_strdup_printf(
- "%s://%s%s%s%s%s%s%s%s%s%s",
- uri->protocol,
- uri->user ? uri->user : "",
- uri->authmech ? ";auth=" : "",
- uri->authmech ? uri->authmech : "",
- uri->passwd && show_password ? ":" : "",
- uri->passwd && show_password ? uri->passwd : "",
- uri->user ? "@" : "",
- uri->host ? uri->host : "",
- uri->path ? uri->path : "",
- uri->query ? "?" : "",
- uri->query ? uri->query : "");
-
- return str_uri;
-}
diff --git a/e-util/e-url.h b/e-util/e-url.h
deleted file mode 100644
index e37b5d68f3..0000000000
--- a/e-util/e-url.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * e-url.h
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Developed by Jon Trowbridge <trow@ximian.com>
- * Rodrigo Moya <rodrigo@ximian.com>
- */
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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_URL_H__
-#define __E_URL_H__
-
-#include <gtk/gtk.h>
-
-char *e_url_shroud (const char *url);
-gboolean e_url_equal (const char *url1, const char *url2);
-
-typedef struct {
- char *protocol;
- char *user;
- char *authmech;
- char *passwd;
- char *host;
- int port;
- char *path;
- GData *params;
- char *query;
- char *fragment;
-} EUri;
-
-EUri *e_uri_new (const char *uri_string);
-void e_uri_free (EUri *uri);
-const char *e_uri_get_param (EUri *uri, const char *name);
-EUri *e_uri_copy (EUri *uri);
-char *e_uri_to_string (EUri *uri, gboolean show_password);
-
-#endif /* __E_URL_H__ */
-
diff --git a/e-util/e-util-marshal.list b/e-util/e-util-marshal.list
deleted file mode 100644
index 463afd8129..0000000000
--- a/e-util/e-util-marshal.list
+++ /dev/null
@@ -1,2 +0,0 @@
-NONE:NONE
-NONE:OBJECT
diff --git a/e-util/e-util.c b/e-util/e-util.c
deleted file mode 100644
index 2514cfc931..0000000000
--- a/e-util/e-util.c
+++ /dev/null
@@ -1,1230 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-util.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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 "e-util.h"
-#include "e-i18n.h"
-
-#include <glib.h>
-#include <gtk/gtkobject.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <locale.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <libgnome/gnome-util.h>
-#include <math.h>
-
-#if 0
-#include <libgnomevfs/gnome-vfs.h>
-#endif
-
-int
-g_str_compare (const void *x, const void *y)
-{
- if (x == NULL || y == NULL) {
- if (x == y)
- return 0;
- else
- return x ? -1 : 1;
- }
-
- return strcmp (x, y);
-}
-
-int
-g_collate_compare (const void *x, const void *y)
-{
- if (x == NULL || y == NULL) {
- if (x == y)
- return 0;
- else
- return x ? -1 : 1;
- }
-
- return g_utf8_collate (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(const char *string)
-{
- int i;
- int length = 0;
- int initial = 0;
- for ( i = 0; string[i]; i++ ) {
- if (initial == i && isspace((unsigned char) string[i])) {
- initial ++;
- }
- if (!isspace((unsigned char) 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)
- g_object_unref (p->data);
-
- g_list_free (list);
-}
-
-void
-e_free_object_slist (GSList *list)
-{
- GSList *p;
-
- for (p = list; p != NULL; p = p->next)
- g_object_unref (p->data);
-
- g_slist_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);
-}
-
-void
-e_free_string_slist (GSList *list)
-{
- GSList *p;
-
- for (p = list; p != NULL; p = p->next)
- g_free (p->data);
- g_slist_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 | O_WRONLY, 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;
- }
- }
- }
- if (close(fd) != 0) {
- return errno;
- }
- return 0;
-}
-
-gint
-e_write_file_mkstemp(char *filename, const char *data)
-{
- int fd;
- int length = strlen(data);
- int bytes;
- fd = mkstemp (filename);
- 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;
- }
- }
- }
- if (close(fd) != 0) {
- return errno;
- }
- return 0;
-}
-
-/**
- * e_mkdir_hier:
- * @path: a directory path
- * @mode: a mode, as for mkdir(2)
- *
- * This creates the named directory with the given @mode, creating
- * any necessary intermediate directories (with the same @mode).
- *
- * Return value: 0 on success, -1 on error, in which case errno will
- * be set as for mkdir(2).
- **/
-int
-e_mkdir_hier(const char *path, mode_t mode)
-{
- char *copy, *p;
-
- if (path[0] == '/') {
- p = copy = g_strdup (path);
- } else {
- gchar *current_dir = g_get_current_dir();
- p = copy = g_concat_dir_and_file (current_dir, path);
- }
-
- do {
- p = strchr (p + 1, '/');
- if (p)
- *p = '\0';
- if (access (copy, F_OK) == -1) {
- if (mkdir (copy, mode) == -1) {
- g_free (copy);
- return -1;
- }
- }
- if (p)
- *p = '/';
- } while (p);
-
- g_free (copy);
- 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
-
-/* Include build marshalers */
-
-#include "e-marshal.h"
-#include "e-marshal.c"
-
-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;
-}
-
-gchar *
-e_strstrcase (const gchar *haystack, const gchar *needle)
-{
- /* find the needle in the haystack neglecting case */
- const 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 (gchar *) haystack;
-
- for (ptr = haystack; *(ptr + len - 1) != '\0'; ptr++)
- if (!g_strncasecmp (ptr, needle, len))
- return (gchar *) ptr;
-
- return NULL;
-}
-
-/* This only makes a filename safe for usage as a filename. It still may have shell meta-characters in it. */
-void
-e_filename_make_safe (gchar *string)
-{
- gchar *p, *ts;
- gunichar c;
-
- g_return_if_fail (string != NULL);
- p = string;
-
- while(p && *p) {
- c = g_utf8_get_char (p);
- ts = p;
- p = g_utf8_next_char (p);
- if (!g_unichar_isprint(c) || ( c < 0xff && strchr (" /'\"`&();|<>$%{}!", c&0xff ))) {
- while (ts<p)
- *ts++ = '_';
- }
- }
-}
-
-static gint
-epow10 (gint number) {
- gint value;
-
- for (value = 1; number > 0; number --) {
- value *= 10;
- }
- return value;
-}
-
-gchar *
-e_format_number (gint number)
-{
- GList *iterator, *list = NULL;
- struct lconv *locality;
- gint char_length = 0;
- gint group_count = 0;
- guchar *grouping;
- int last_count = 3;
- int divider;
- char *value;
- char *value_iterator;
-
- locality = localeconv();
- grouping = locality->grouping;
- while (number) {
- char *group;
- switch (*grouping) {
- default:
- last_count = *grouping;
- grouping++;
- case 0:
- divider = epow10(last_count);
- if (number >= divider) {
- group = g_strdup_printf("%0*d", last_count, number % divider);
- } else {
- group = g_strdup_printf("%d", number % divider);
- }
- number /= divider;
- break;
- case CHAR_MAX:
- group = g_strdup_printf("%d", number);
- number = 0;
- break;
- }
- char_length += strlen(group);
- list = g_list_prepend(list, group);
- group_count ++;
- }
-
- if (list) {
- value = g_new(char, 1 + char_length + (group_count - 1) * strlen(locality->thousands_sep));
-
- iterator = list;
- value_iterator = value;
-
- strcpy(value_iterator, iterator->data);
- value_iterator += strlen(iterator->data);
- for (iterator = iterator->next; iterator; iterator = iterator->next) {
- strcpy(value_iterator, locality->thousands_sep);
- value_iterator += strlen(locality->thousands_sep);
-
- strcpy(value_iterator, iterator->data);
- value_iterator += strlen(iterator->data);
- }
- e_free_string_list (list);
- return value;
- } else {
- return g_strdup("0");
- }
-}
-
-static gchar *
-do_format_number_as_float (double number)
-{
- GList *iterator, *list = NULL;
- struct lconv *locality;
- gint char_length = 0;
- gint group_count = 0;
- guchar *grouping;
- int last_count = 3;
- int divider;
- char *value;
- char *value_iterator;
- double fractional;
-
- locality = localeconv();
- grouping = locality->grouping;
- while (number >= 1.0) {
- char *group;
- switch (*grouping) {
- default:
- last_count = *grouping;
- grouping++;
- /* Fall through */
- case 0:
- divider = epow10(last_count);
- number /= divider;
- fractional = modf (number, &number);
- fractional *= divider;
- fractional = floor (fractional);
-
- if (number >= 1.0) {
- group = g_strdup_printf("%0*d", last_count, (int) fractional);
- } else {
- group = g_strdup_printf("%d", (int) fractional);
- }
- break;
- case CHAR_MAX:
- divider = epow10(last_count);
- number /= divider;
- fractional = modf (number, &number);
- fractional *= divider;
- fractional = floor (fractional);
-
- while (number >= 1.0) {
- group = g_strdup_printf("%0*d", last_count, (int) fractional);
-
- char_length += strlen(group);
- list = g_list_prepend(list, group);
- group_count ++;
-
- divider = epow10(last_count);
- number /= divider;
- fractional = modf (number, &number);
- fractional *= divider;
- fractional = floor (fractional);
- }
-
- group = g_strdup_printf("%d", (int) fractional);
- break;
- }
- char_length += strlen(group);
- list = g_list_prepend(list, group);
- group_count ++;
- }
-
- if (list) {
- value = g_new(char, 1 + char_length + (group_count - 1) * strlen(locality->thousands_sep));
-
- iterator = list;
- value_iterator = value;
-
- strcpy(value_iterator, iterator->data);
- value_iterator += strlen(iterator->data);
- for (iterator = iterator->next; iterator; iterator = iterator->next) {
- strcpy(value_iterator, locality->thousands_sep);
- value_iterator += strlen(locality->thousands_sep);
-
- strcpy(value_iterator, iterator->data);
- value_iterator += strlen(iterator->data);
- }
- e_free_string_list (list);
- return value;
- } else {
- return g_strdup("0");
- }
-}
-
-gchar *
-e_format_number_float (gfloat number)
-{
- gfloat int_part;
- gint fraction;
- struct lconv *locality;
- gchar *str_intpart;
- gchar *decimal_point;
- gchar *str_fraction;
- gchar *value;
-
- locality = localeconv();
-
- int_part = floor (number);
- str_intpart = do_format_number_as_float ((double) int_part);
-
- if (!strcmp(locality->mon_decimal_point, "")) {
- decimal_point = ".";
- }
- else {
- decimal_point = locality->mon_decimal_point;
- }
-
- fraction = (int) ((number - int_part) * 100);
-
- if (fraction == 0) {
- str_fraction = g_strdup ("00");
- } else {
- str_fraction = g_strdup_printf ("%02d", fraction);
- }
-
- value = g_strconcat (str_intpart, decimal_point, str_fraction, NULL);
-
- g_free (str_intpart);
- g_free (str_fraction);
-
- return value;
-}
-
-gboolean
-e_create_directory (gchar *directory)
-{
- gint ret_val = e_mkdir_hier (directory, 0777);
- if (ret_val == -1)
- return FALSE;
- else
- return TRUE;
-}
-
-
-/* Perform a binary search for key in base which has nmemb elements
- of size bytes each. The comparisons are done by (*compare)(). */
-void e_bsearch (const void *key,
- const void *base,
- size_t nmemb,
- size_t size,
- ESortCompareFunc compare,
- gpointer closure,
- size_t *start,
- size_t *end)
-{
- size_t l, u, idx;
- const void *p;
- int comparison;
- if (!(start || end))
- return;
-
- l = 0;
- u = nmemb;
- while (l < u) {
- idx = (l + u) / 2;
- p = (void *) (((const char *) base) + (idx * size));
- comparison = (*compare) (key, p, closure);
- if (comparison < 0)
- u = idx;
- else if (comparison > 0)
- l = idx + 1;
- else {
- size_t lsave, usave;
- lsave = l;
- usave = u;
- if (start) {
- while (l < u) {
- idx = (l + u) / 2;
- p = (void *) (((const char *) base) + (idx * size));
- comparison = (*compare) (key, p, closure);
- if (comparison <= 0)
- u = idx;
- else
- l = idx + 1;
- }
- *start = l;
-
- l = lsave;
- u = usave;
- }
- if (end) {
- while (l < u) {
- idx = (l + u) / 2;
- p = (void *) (((const char *) base) + (idx * size));
- comparison = (*compare) (key, p, closure);
- if (comparison < 0)
- u = idx;
- else
- l = idx + 1;
- }
- *end = l;
- }
- return;
- }
- }
-
- if (start)
- *start = l;
- if (end)
- *end = l;
-}
-
-static gpointer closure_closure;
-static ESortCompareFunc compare_closure;
-
-static int
-qsort_callback(const void *data1, const void *data2)
-{
- return (*compare_closure) (data1, data2, closure_closure);
-}
-
-/* Forget it. We're just going to use qsort. I lost the need for a stable sort. */
-void
-e_sort (void *base,
- size_t nmemb,
- size_t size,
- ESortCompareFunc compare,
- gpointer closure)
-{
- closure_closure = closure;
- compare_closure = compare;
- qsort(base, nmemb, size, qsort_callback);
-#if 0
- void *base_copy;
- int i;
- base_copy = g_malloc(nmemb * size);
-
- for (i = 0; i < nmemb; i++) {
- int position;
- e_bsearch(base + (i * size), base_copy, i, size, compare, closure, NULL, &position);
- memmove(base_copy + (position + 1) * size, base_copy + position * size, (i - position) * size);
- memcpy(base_copy + position * size, base + i * size, size);
- }
- memcpy(base, base_copy, nmemb * size);
- g_free(base_copy);
-#endif
-}
-
-size_t e_strftime(char *s, size_t max, const char *fmt, const struct tm *tm)
-{
-#ifdef HAVE_LKSTRFTIME
- return strftime(s, max, fmt, tm);
-#else
- char *c, *ffmt, *ff;
- size_t ret;
-
- ffmt = g_strdup(fmt);
- ff = ffmt;
- while ((c = strstr(ff, "%l")) != NULL) {
- c[1] = 'I';
- ff = c;
- }
-
- ff = fmt;
- while ((c = strstr(ff, "%k")) != NULL) {
- c[1] = 'H';
- ff = c;
- }
-
- ret = strftime(s, max, ffmt, tm);
- g_free(ffmt);
- return ret;
-#endif
-}
-
-size_t
-e_utf8_strftime(char *s, size_t max, const char *fmt, const struct tm *tm)
-{
- size_t sz, ret;
- char *locale_fmt, *buf;
-
- locale_fmt = g_locale_from_utf8(fmt, -1, NULL, &sz, NULL);
- if (!locale_fmt)
- return 0;
-
- ret = e_strftime(s, max, locale_fmt, tm);
- if (!ret) {
- g_free (locale_fmt);
- return 0;
- }
-
- buf = g_locale_to_utf8(s, ret, NULL, &sz, NULL);
- if (!buf) {
- g_free (locale_fmt);
- return 0;
- }
-
- if (sz >= max) {
- char *tmp = buf + max - 1;
- tmp = g_utf8_find_prev_char(buf, tmp);
- if (tmp)
- sz = tmp - buf;
- else
- sz = 0;
- }
- memcpy(s, buf, sz);
- s[sz] = '\0';
- g_free(locale_fmt);
- g_free(buf);
- return sz;
-}
-
-/**
- * Function to do a last minute fixup of the AM/PM stuff if the locale
- * and gettext haven't done it right. Most English speaking countries
- * except the USA use the 24 hour clock (UK, Australia etc). However
- * since they are English nobody bothers to write a language
- * translation (gettext) file. So the locale turns off the AM/PM, but
- * gettext does not turn on the 24 hour clock. Leaving a mess.
- *
- * This routine checks if AM/PM are defined in the locale, if not it
- * forces the use of the 24 hour clock.
- *
- * The function itself is a front end on strftime and takes exactly
- * the same arguments.
- *
- * TODO: Actually remove the '%p' from the fixed up string so that
- * there isn't a stray space.
- **/
-
-size_t e_strftime_fix_am_pm(char *s, size_t max, const char *fmt, const struct tm *tm)
-{
- char buf[10];
- char *sp;
- char *ffmt;
- size_t ret;
-
- if (strstr(fmt, "%p")==NULL && strstr(fmt, "%P")==NULL) {
- /* No AM/PM involved - can use the fmt string directly */
- ret=e_strftime(s, max, fmt, tm);
- } else {
- /* Get the AM/PM symbol from the locale */
- e_strftime (buf, 10, "%p", tm);
-
- if (buf[0]) {
- /**
- * AM/PM have been defined in the locale
- * so we can use the fmt string directly
- **/
- ret=e_strftime(s, max, fmt, tm);
- } else {
- /**
- * No AM/PM defined by locale
- * must change to 24 hour clock
- **/
- ffmt=g_strdup(fmt);
- for (sp=ffmt; (sp=strstr(sp, "%l")); sp++) {
- /**
- * Maybe this should be 'k', but I have never
- * seen a 24 clock actually use that format
- **/
- sp[1]='H';
- }
- for (sp=ffmt; (sp=strstr(sp, "%I")); sp++) {
- sp[1]='H';
- }
- ret=e_strftime(s, max, ffmt, tm);
- g_free(ffmt);
- }
- }
- return(ret);
-}
-
-size_t
-e_utf8_strftime_fix_am_pm(char *s, size_t max, const char *fmt, const struct tm *tm)
-{
- size_t sz, ret;
- char *locale_fmt, *buf;
-
- locale_fmt = g_locale_from_utf8(fmt, -1, NULL, &sz, NULL);
- if (!locale_fmt)
- return 0;
-
- ret = e_strftime_fix_am_pm(s, max, locale_fmt, tm);
- if (!ret) {
- g_free (locale_fmt);
- return 0;
- }
-
- buf = g_locale_to_utf8(s, ret, NULL, &sz, NULL);
- if (!buf) {
- g_free (locale_fmt);
- return 0;
- }
-
- if (sz >= max) {
- char *tmp = buf + max - 1;
- tmp = g_utf8_find_prev_char(buf, tmp);
- if (tmp)
- sz = tmp - buf;
- else
- sz = 0;
- }
- memcpy(s, buf, sz);
- s[sz] = '\0';
- g_free(locale_fmt);
- g_free(buf);
- return sz;
-}
-
-/**
- * e_flexible_strtod:
- * @nptr: the string to convert to a numeric value.
- * @endptr: if non-NULL, it returns the character after
- * the last character used in the conversion.
- *
- * Converts a string to a gdouble value. This function detects
- * strings either in the standard C locale or in the current locale.
- *
- * This function is typically used when reading configuration files or
- * other non-user input that should not be locale dependent, but may
- * have been in the past. To handle input from the user you should
- * normally use the locale-sensitive system strtod function.
- *
- * To convert from a double to a string in a locale-insensitive way, use
- * @g_ascii_dtostr.
- *
- * Return value: the gdouble value.
- **/
-gdouble
-e_flexible_strtod (const gchar *nptr,
- gchar **endptr)
-{
- gchar *fail_pos;
- gdouble val;
- struct lconv *locale_data;
- const char *decimal_point;
- int decimal_point_len;
- const char *p, *decimal_point_pos;
- const char *end = NULL; /* Silence gcc */
- char *copy, *c;
-
- g_return_val_if_fail (nptr != NULL, 0);
-
- fail_pos = NULL;
-
- locale_data = localeconv ();
- decimal_point = locale_data->decimal_point;
- decimal_point_len = strlen (decimal_point);
-
- g_assert (decimal_point_len != 0);
-
- decimal_point_pos = NULL;
- if (!strcmp (decimal_point, "."))
- return strtod (nptr, endptr);
-
- p = nptr;
-
- /* Skip leading space */
- while (isspace ((guchar)*p))
- p++;
-
- /* Skip leading optional sign */
- if (*p == '+' || *p == '-')
- p++;
-
- if (p[0] == '0' &&
- (p[1] == 'x' || p[1] == 'X')) {
- p += 2;
- /* HEX - find the (optional) decimal point */
-
- while (isxdigit ((guchar)*p))
- p++;
-
- if (*p == '.') {
- decimal_point_pos = p++;
-
- while (isxdigit ((guchar)*p))
- p++;
-
- if (*p == 'p' || *p == 'P')
- p++;
- if (*p == '+' || *p == '-')
- p++;
- while (isdigit ((guchar)*p))
- p++;
- end = p;
- } else if (strncmp (p, decimal_point, decimal_point_len) == 0) {
- return strtod (nptr, endptr);
- }
- } else {
- while (isdigit ((guchar)*p))
- p++;
-
- if (*p == '.') {
- decimal_point_pos = p++;
-
- while (isdigit ((guchar)*p))
- p++;
-
- if (*p == 'e' || *p == 'E')
- p++;
- if (*p == '+' || *p == '-')
- p++;
- while (isdigit ((guchar)*p))
- p++;
- end = p;
- } else if (strncmp (p, decimal_point, decimal_point_len) == 0) {
- return strtod (nptr, endptr);
- }
- }
- /* For the other cases, we need not convert the decimal point */
-
- if (!decimal_point_pos)
- return strtod (nptr, endptr);
-
- /* We need to convert the '.' to the locale specific decimal point */
- copy = g_malloc (end - nptr + 1 + decimal_point_len);
-
- c = copy;
- memcpy (c, nptr, decimal_point_pos - nptr);
- c += decimal_point_pos - nptr;
- memcpy (c, decimal_point, decimal_point_len);
- c += decimal_point_len;
- memcpy (c, decimal_point_pos + 1, end - (decimal_point_pos + 1));
- c += end - (decimal_point_pos + 1);
- *c = 0;
-
- val = strtod (copy, &fail_pos);
-
- if (fail_pos) {
- if (fail_pos > decimal_point_pos)
- fail_pos = (char *)nptr + (fail_pos - copy) - (decimal_point_len - 1);
- else
- fail_pos = (char *)nptr + (fail_pos - copy);
- }
-
- g_free (copy);
-
- if (endptr)
- *endptr = fail_pos;
-
- return val;
-}
-
-/**
- * e_ascii_dtostr:
- * @buffer: A buffer to place the resulting string in
- * @buf_len: The length of the buffer.
- * @format: The printf-style format to use for the
- * code to use for converting.
- * @d: The double to convert
- *
- * Converts a double to a string, using the '.' as
- * decimal_point. To format the number you pass in
- * a printf-style formating string. Allowed conversion
- * specifiers are eEfFgG.
- *
- * If you want to generates enough precision that converting
- * the string back using @g_strtod gives the same machine-number
- * (on machines with IEEE compatible 64bit doubles) use the format
- * string "%.17g". If you do this it is guaranteed that the size
- * of the resulting string will never be larger than
- * @G_ASCII_DTOSTR_BUF_SIZE bytes.
- *
- * Return value: The pointer to the buffer with the converted string.
- **/
-gchar *
-e_ascii_dtostr (gchar *buffer,
- gint buf_len,
- const gchar *format,
- gdouble d)
-{
- struct lconv *locale_data;
- const char *decimal_point;
- int decimal_point_len;
- gchar *p;
- int rest_len;
- gchar format_char;
-
- g_return_val_if_fail (buffer != NULL, NULL);
- g_return_val_if_fail (format[0] == '%', NULL);
- g_return_val_if_fail (strpbrk (format + 1, "'l%") == NULL, NULL);
-
- format_char = format[strlen (format) - 1];
-
- g_return_val_if_fail (format_char == 'e' || format_char == 'E' ||
- format_char == 'f' || format_char == 'F' ||
- format_char == 'g' || format_char == 'G',
- NULL);
-
- if (format[0] != '%')
- return NULL;
-
- if (strpbrk (format + 1, "'l%"))
- return NULL;
-
- if (!(format_char == 'e' || format_char == 'E' ||
- format_char == 'f' || format_char == 'F' ||
- format_char == 'g' || format_char == 'G'))
- return NULL;
-
-
- g_snprintf (buffer, buf_len, format, d);
-
- locale_data = localeconv ();
- decimal_point = locale_data->decimal_point;
- decimal_point_len = strlen (decimal_point);
-
- g_assert (decimal_point_len != 0);
-
- if (strcmp (decimal_point, ".")) {
- p = buffer;
-
- if (*p == '+' || *p == '-')
- p++;
-
- while (isdigit ((guchar)*p))
- p++;
-
- if (strncmp (p, decimal_point, decimal_point_len) == 0) {
- *p = '.';
- p++;
- if (decimal_point_len > 1) {
- rest_len = strlen (p + (decimal_point_len-1));
- memmove (p, p + (decimal_point_len-1),
- rest_len);
- p[rest_len] = 0;
- }
- }
- }
-
- return buffer;
-}
-
-gchar *
-e_strdup_append_strings (gchar *first_string, ...)
-{
- gchar *buffer;
- gchar *current;
- gint length;
- va_list args1;
- va_list args2;
- char *v_string;
- int v_int;
-
- va_start (args1, first_string);
- G_VA_COPY (args2, args1);
-
- length = 0;
-
- v_string = first_string;
- while (v_string) {
- v_int = va_arg (args1, int);
- if (v_int >= 0)
- length += v_int;
- else
- length += strlen (v_string);
- v_string = va_arg (args1, char *);
- }
-
- buffer = g_new (char, length + 1);
- current = buffer;
-
- v_string = first_string;
- while (v_string) {
- v_int = va_arg (args2, int);
- if (v_int < 0) {
- int i;
- for (i = 0; v_string[i]; i++) {
- *(current++) = v_string[i];
- }
- } else {
- int i;
- for (i = 0; v_string[i] && i < v_int; i++) {
- *(current++) = v_string[i];
- }
- }
- v_string = va_arg (args2, char *);
- }
- *(current++) = 0;
-
- va_end (args1);
- va_end (args2);
-
- return buffer;
-}
-
-gchar **
-e_strdupv (const gchar **str_array)
-{
- if (str_array) {
- gint i;
- gchar **retval;
-
- i = 0;
- while (str_array[i])
- i++;
-
- retval = g_new (gchar*, i + 1);
-
- i = 0;
- while (str_array[i]) {
- retval[i] = g_strdup (str_array[i]);
- i++;
- }
- retval[i] = NULL;
-
- return retval;
- } else {
- return NULL;
- }
-}
-
-char *
-e_gettext (const char *msgid)
-{
- static gboolean initialized = FALSE;
-
- if (!initialized) {
- bindtextdomain (E_I18N_DOMAIN, GNOMELOCALEDIR);
- bind_textdomain_codeset (E_I18N_DOMAIN, "UTF-8");
- initialized = TRUE;
- }
-
- return dgettext (E_I18N_DOMAIN, msgid);
-}
-
diff --git a/e-util/e-util.h b/e-util/e-util.h
deleted file mode 100644
index d9d51967d1..0000000000
--- a/e-util/e-util.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-util.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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_UTIL_H_
-#define _E_UTIL_H_
-
-#include <sys/types.h>
-#include <glib-object.h>
-#include <limits.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#include <gal/util/e-marshal.h>
-
-#define E_MAKE_TYPE(l,str,t,ci,i,parent) \
-GType l##_get_type(void)\
-{\
- static GType type = 0; \
- if (!type){ \
- static GTypeInfo const object_info = { \
- sizeof (t##Class), \
- \
- (GBaseInitFunc) NULL, \
- (GBaseFinalizeFunc) NULL, \
- \
- (GClassInitFunc) ci, \
- (GClassFinalizeFunc) NULL, \
- NULL, /* class_data */ \
- \
- sizeof (t), \
- 0, /* n_preallocs */ \
- (GInstanceInitFunc) i, \
- }; \
- type = g_type_register_static (parent, str, &object_info, 0); \
- } \
- return type; \
-}
-
-
-#define E_MAKE_X_TYPE(l,str,t,ci,i,parent,poa_init,offset) \
-GtkType l##_get_type(void) \
-{ \
- static GtkType type = 0; \
- if (!type){ \
- GTypeInfo info = { \
- sizeof (t##Class), \
- \
- (GBaseInitFunc) NULL, \
- (GBaseFinalizeFunc) NULL, \
- \
- (GClassInitFunc) ci, \
- (GClassFinalizeFunc) NULL, \
- \
- NULL, /* class_data */ \
- \
- sizeof (t), \
- 0, /* n_preallocs */ \
- (GInstanceInitFunc) i, \
- }; \
- type = bonobo_x_type_unique ( \
- parent, poa_init, NULL, \
- offset, &info, str); \
- } \
- return type; \
-}
-
-#define GET_STRING_ARRAY_FROM_ELLIPSIS(labels, first_string) \
- { \
- va_list args; \
- int i; \
- char *s; \
- \
- va_start (args, (first_string)); \
- \
- i = 0; \
- for (s = (first_string); s; s = va_arg (args, char *)) \
- i++; \
- va_end (args); \
- \
- (labels) = g_new (char *, i + 1); \
- \
- va_start (args, (first_string)); \
- i = 0; \
- for (s = (first_string); s; s = va_arg (args, char *)) \
- (labels)[i++] = s; \
- \
- va_end (args); \
- (labels)[i] = NULL; \
- }
-
-
-#define GET_DUPLICATED_STRING_ARRAY_FROM_ELLIPSIS(labels, first_string) \
- { \
- int i; \
- GET_STRING_ARRAY_FROM_ELLIPSIS ((labels), (first_string)); \
- for (i = 0; labels[i]; i++) \
- labels[i] = g_strdup (labels[i]); \
- }
-
-
-#if 0
-# define E_OBJECT_CLASS_ADD_SIGNALS(oc,sigs,last) \
- gtk_object_class_add_signals (oc, sigs, last)
-# define E_OBJECT_CLASS_TYPE(oc) (oc)->type
-#else
-# define E_OBJECT_CLASS_ADD_SIGNALS(oc,sigs,last)
-# define E_OBJECT_CLASS_TYPE(oc) G_TYPE_FROM_CLASS (oc)
-#endif
-
-
-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_collate_compare (const void *x,
- const void *y);
-int g_int_compare (const void *x,
- const void *y);
-char *e_strdup_strip (const char *string);
-void e_free_object_list (GList *list);
-void e_free_object_slist (GSList *list);
-void e_free_string_list (GList *list);
-void e_free_string_slist (GSList *list);
-char *e_read_file (const char *filename);
-int e_write_file (const char *filename,
- const char *data,
- int flags);
-int e_write_file_mkstemp (char *filename,
- const char *data);
-int e_mkdir_hier (const char *path,
- mode_t mode);
-
-gchar **e_strsplit (const gchar *string,
- const gchar *delimiter,
- gint max_tokens);
-gchar *e_strstrcase (const gchar *haystack,
- const gchar *needle);
-/* This only makes a filename safe for usage as a filename. It still may have shell meta-characters in it. */
-void e_filename_make_safe (gchar *string);
-gchar *e_format_number (gint number);
-gchar *e_format_number_float (gfloat number);
-gboolean e_create_directory (gchar *directory);
-gchar **e_strdupv (const gchar **str_array);
-
-
-typedef int (*ESortCompareFunc) (const void *first,
- const void *second,
- gpointer closure);
-void e_sort (void *base,
- size_t nmemb,
- size_t size,
- ESortCompareFunc compare,
- gpointer closure);
-void e_bsearch (const void *key,
- const void *base,
- size_t nmemb,
- size_t size,
- ESortCompareFunc compare,
- gpointer closure,
- size_t *start,
- size_t *end);
-size_t e_strftime_fix_am_pm (char *s,
- size_t max,
- const char *fmt,
- const struct tm *tm);
-
-size_t e_strftime (char *s,
- size_t max,
- const char *fmt,
- const struct tm *tm);
-
-size_t e_utf8_strftime_fix_am_pm (char *s,
- size_t max,
- const char *fmt,
- const struct tm *tm);
-
-size_t e_utf8_strftime (char *s,
- size_t max,
- const char *fmt,
- const struct tm *tm);
-
-/* String to/from double conversion functions */
-gdouble e_flexible_strtod (const gchar *nptr,
- gchar **endptr);
-
-/* 29 bytes should enough for all possible values that
- * g_ascii_dtostr can produce with the %.17g format.
- * Then add 10 for good measure */
-#define E_ASCII_DTOSTR_BUF_SIZE (DBL_DIG + 12 + 10)
-gchar *e_ascii_dtostr (gchar *buffer,
- gint buf_len,
- const gchar *format,
- gdouble d);
-
-/* Alternating char * and int arguments with a NULL char * to end.
- Less than 0 for the int means copy the whole string. */
-gchar *e_strdup_append_strings (gchar *first_string,
- ...);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_UTIL_H_ */
diff --git a/e-util/e-xml-hash-utils.c b/e-util/e-xml-hash-utils.c
deleted file mode 100644
index ba72321afe..0000000000
--- a/e-util/e-xml-hash-utils.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2001-2003 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "e-xml-hash-utils.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/entities.h>
-
-GHashTable *
-e_xml_to_hash (xmlDoc *doc, EXmlHashType type)
-{
- xmlNode *root, *node;
- const char *key;
- xmlChar *value;
- GHashTable *hash;
-
- hash = g_hash_table_new (g_str_hash, g_str_equal);
-
- root = xmlDocGetRootElement (doc);
- for (node = root->xmlChildrenNode; node; node = node->next) {
- if (node->name == NULL || node->type != XML_ELEMENT_NODE)
- continue;
-
- if (type == E_XML_HASH_TYPE_OBJECT_UID &&
- !strcmp (node->name, "object"))
- key = xmlGetProp (node, "uid");
- else
- key = node->name;
-
- value = xmlNodeListGetString (doc, node->xmlChildrenNode, 1);
- if (!key || !value) {
- g_warning ("Found an entry with missing properties!!");
- continue;
- }
-
- g_hash_table_insert (hash, g_strdup (key), g_strdup (value));
- xmlFree (value);
- }
-
- return hash;
-}
-
-
-struct save_data {
- EXmlHashType type;
- xmlDoc *doc;
- xmlNode *root;
-};
-
-static void
-foreach_save_func (gpointer key, gpointer value, gpointer user_data)
-{
- struct save_data *sd = user_data;
- xmlNodePtr new_node;
- xmlChar *enc;
-
- if (sd->type == E_XML_HASH_TYPE_OBJECT_UID) {
- new_node = xmlNewNode (NULL, "object");
- xmlNewProp (new_node, "uid", (const char *) key);
- } else
- new_node = xmlNewNode (NULL, (const char *) key);
-
- enc = xmlEncodeSpecialChars (sd->doc, value);
- xmlNodeSetContent (new_node, enc);
- xmlFree (enc);
-
- xmlAddChild (sd->root, new_node);
-}
-
-xmlDoc *
-e_xml_from_hash (GHashTable *hash, EXmlHashType type, const char *root_name)
-{
- xmlDoc *doc;
- struct save_data sd;
-
- doc = xmlNewDoc ("1.0");
- sd.type = type;
- sd.doc = doc;
- sd.root = xmlNewDocNode (doc, NULL, root_name, NULL);
- xmlDocSetRootElement (doc, sd.root);
-
- g_hash_table_foreach (hash, foreach_save_func, &sd);
- return doc;
-}
-
-static void
-free_values (gpointer key, gpointer value, gpointer data)
-{
- g_free (key);
- g_free (value);
-}
-
-void
-e_xml_destroy_hash (GHashTable *hash)
-{
- g_hash_table_foreach (hash, free_values, NULL);
- g_hash_table_destroy (hash);
-}
-
-
-
-struct EXmlHash {
- char *filename;
- GHashTable *objects;
-};
-
-EXmlHash *
-e_xmlhash_new (const char *filename)
-{
- EXmlHash *hash;
- xmlDoc *doc = NULL;
-
- g_return_val_if_fail (filename != NULL, NULL);
-
- hash = g_new0 (EXmlHash, 1);
- hash->filename = g_strdup (filename);
-
- if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
- doc = xmlParseFile (filename);
- if (!doc) {
- e_xmlhash_destroy (hash);
-
- return NULL;
- }
- hash->objects = e_xml_to_hash (doc, E_XML_HASH_TYPE_OBJECT_UID);
- xmlFreeDoc (doc);
- } else {
- hash->objects = g_hash_table_new (g_str_hash, g_str_equal);
- }
-
- return hash;
-}
-
-void
-e_xmlhash_add (EXmlHash *hash, const char *key, const char *data)
-{
- g_return_if_fail (hash != NULL);
- g_return_if_fail (key != NULL);
- g_return_if_fail (data != NULL);
-
- e_xmlhash_remove (hash, key);
- g_hash_table_insert (hash->objects, g_strdup (key), g_strdup (data));
-}
-
-void
-e_xmlhash_remove (EXmlHash *hash, const char *key)
-{
- gpointer orig_key;
- gpointer orig_value;
-
- g_return_if_fail (hash != NULL);
- g_return_if_fail (key != NULL);
-
- if (g_hash_table_lookup_extended (hash->objects, key, &orig_key, &orig_value)) {
- g_hash_table_remove (hash->objects, key);
- g_free (orig_key);
- g_free (orig_value);
- }
-}
-
-EXmlHashStatus
-e_xmlhash_compare (EXmlHash *hash, const char *key, const char *compare_data)
-{
- char *data;
- int rc;
-
- g_return_val_if_fail (hash != NULL, E_XMLHASH_STATUS_NOT_FOUND);
- g_return_val_if_fail (key != NULL, E_XMLHASH_STATUS_NOT_FOUND);
- g_return_val_if_fail (compare_data != NULL, E_XMLHASH_STATUS_NOT_FOUND);
-
- data = g_hash_table_lookup (hash->objects, key);
- if (!data)
- return E_XMLHASH_STATUS_NOT_FOUND;
-
- rc = strcmp (data, compare_data);
- if (rc == 0)
- return E_XMLHASH_STATUS_SAME;
-
- return E_XMLHASH_STATUS_DIFFERENT;
-}
-
-typedef struct {
- EXmlHashFunc func;
- gpointer user_data;
-} foreach_data_t;
-
-static void
-foreach_hash_func (gpointer key, gpointer value, gpointer user_data)
-{
- foreach_data_t *data = (foreach_data_t *) user_data;
-
- data->func (key, data->user_data);
-}
-
-void
-e_xmlhash_foreach_key (EXmlHash *hash, EXmlHashFunc func, gpointer user_data)
-{
- foreach_data_t data;
-
- g_return_if_fail (hash != NULL);
- g_return_if_fail (func != NULL);
-
- data.func = func;
- data.user_data = user_data;
- g_hash_table_foreach (hash->objects, foreach_hash_func, &data);
-}
-
-void
-e_xmlhash_write (EXmlHash *hash)
-{
- xmlDoc *doc;
-
- g_return_if_fail (hash != NULL);
-
- doc = e_xml_from_hash (hash->objects, E_XML_HASH_TYPE_OBJECT_UID, "xmlhash");
- xmlSaveFile (hash->filename, doc);
- xmlFreeDoc (doc);
-}
-
-void
-e_xmlhash_destroy (EXmlHash *hash)
-{
- g_return_if_fail (hash != NULL);
-
- g_free (hash->filename);
- if (hash->objects)
- e_xml_destroy_hash (hash->objects);
-
- g_free (hash);
-}
diff --git a/e-util/e-xml-hash-utils.h b/e-util/e-xml-hash-utils.h
deleted file mode 100644
index b972aa4b1a..0000000000
--- a/e-util/e-xml-hash-utils.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2001-2003 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * 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_XML_HASH_UTILS_H__
-#define __E_XML_HASH_UTILS_H__
-
-#include <glib.h>
-#include <libxml/parser.h>
-
-typedef enum {
- E_XML_HASH_TYPE_OBJECT_UID,
- E_XML_HASH_TYPE_PROPERTY
-} EXmlHashType;
-
-GHashTable *e_xml_to_hash (xmlDoc *doc,
- EXmlHashType type);
-xmlDoc *e_xml_from_hash (GHashTable *hash,
- EXmlHashType type,
- const char *root_node);
-
-void e_xml_destroy_hash (GHashTable *hash);
-
-
-
-typedef enum {
- E_XMLHASH_STATUS_SAME,
- E_XMLHASH_STATUS_DIFFERENT,
- E_XMLHASH_STATUS_NOT_FOUND
-} EXmlHashStatus;
-
-typedef void (* EXmlHashFunc) (const char *key, gpointer user_data);
-
-typedef struct EXmlHash EXmlHash;
-
-EXmlHash *e_xmlhash_new (const char *filename);
-
-void e_xmlhash_add (EXmlHash *hash,
- const char *key,
- const char *data);
-void e_xmlhash_remove (EXmlHash *hash,
- const char *key);
-
-EXmlHashStatus e_xmlhash_compare (EXmlHash *hash,
- const char *key,
- const char *compare_data);
-void e_xmlhash_foreach_key (EXmlHash *hash,
- EXmlHashFunc func,
- gpointer user_data);
-
-void e_xmlhash_write (EXmlHash *hash);
-void e_xmlhash_destroy (EXmlHash *hash);
-
-#endif
diff --git a/e-util/e-xml-utils.c b/e-util/e-xml-utils.c
deleted file mode 100644
index 437934be65..0000000000
--- a/e-util/e-xml-utils.c
+++ /dev/null
@@ -1,502 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-xml-utils.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-xml-utils.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <locale.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <math.h>
-#include <string.h>
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-
-#include "gal/util/e-i18n.h"
-#include "gal/util/e-util.h"
-
-xmlNode *
-e_xml_get_child_by_name (const 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->xmlChildrenNode; child != NULL; child = child->next) {
- if (xmlStrcmp (child->name, child_name) == 0) {
- 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 (const xmlNode *parent,
- const xmlChar *child_name,
- const gchar *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) {
-#ifdef HAVE_LC_MESSAGES
- lang = setlocale (LC_MESSAGES, NULL);
-#else
- lang = setlocale (LC_CTYPE, NULL);
-#endif
- }
- for (child = parent->xmlChildrenNode; child != NULL; child = child->next) {
- if (xmlStrcmp (child->name, child_name) == 0) {
- xmlChar *this_lang = xmlGetProp (child, "lang");
- if (this_lang == NULL) {
- C = child;
- } else if (xmlStrcmp(this_lang, "lang") == 0) {
- return child;
- }
- }
- }
- return C;
-}
-
-static xmlNode *
-e_xml_get_child_by_name_by_lang_list_with_score (const xmlNode *parent,
- const gchar *name,
- const GList *lang_list,
- gint *best_lang_score)
-{
- xmlNodePtr best_node = NULL, node;
-
- for (node = parent->xmlChildrenNode; node != NULL; node = node->next) {
- xmlChar *lang;
-
- if (node->name == NULL || strcmp (node->name, name) != 0) {
- continue;
- }
- lang = xmlGetProp (node, "xml:lang");
- if (lang != NULL) {
- const GList *l;
- gint i;
-
- for (l = lang_list, i = 0;
- l != NULL && i < *best_lang_score;
- l = l->next, i++) {
- if (strcmp ((gchar *) l->data, lang) == 0) {
- best_node = node;
- *best_lang_score = i;
- }
- }
- } else {
- if (best_node == NULL) {
- best_node = node;
- }
- }
- xmlFree (lang);
- if (*best_lang_score == 0) {
- return best_node;
- }
- }
-
- return best_node;
-}
-
-/*
- * e_xml_get_child_by_name_by_lang_list:
- *
- */
-xmlNode *
-e_xml_get_child_by_name_by_lang_list (const xmlNode *parent,
- const gchar *name,
- const GList *lang_list)
-{
- gint best_lang_score = INT_MAX;
-
- g_return_val_if_fail (parent != NULL, NULL);
- g_return_val_if_fail (name != NULL, NULL);
-
- if (lang_list == NULL) {
- lang_list = gnome_i18n_get_language_list ("LC_MESSAGES");
- }
- return e_xml_get_child_by_name_by_lang_list_with_score
- (parent,name,
- lang_list,
- &best_lang_score);
-}
-
-/*
- * e_xml_get_child_by_name_no_lang
- *
- */
-xmlNode *
-e_xml_get_child_by_name_no_lang (const xmlNode *parent, const gchar *name)
-{
- xmlNodePtr node;
-
- g_return_val_if_fail (parent != NULL, NULL);
- g_return_val_if_fail (name != NULL, NULL);
-
- for (node = parent->xmlChildrenNode; node != NULL; node = node->next) {
- xmlChar *lang;
-
- if (node->name == NULL || strcmp (node->name, name) != 0) {
- continue;
- }
- lang = xmlGetProp (node, "xml:lang");
- if (lang == NULL) {
- return node;
- }
- xmlFree (lang);
- }
-
- return NULL;
-}
-
-gint
-e_xml_get_integer_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
-{
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- return e_xml_get_integer_prop_by_name_with_default (parent, prop_name, 0);
-}
-
-gint
-e_xml_get_integer_prop_by_name_with_default (const xmlNode *parent,
- const xmlChar *prop_name,
- gint def)
-{
- xmlChar *prop;
- gint ret_val = def;
-
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- prop = xmlGetProp ((xmlNode *) parent, prop_name);
- if (prop != NULL) {
- (void) sscanf (prop, "%d", &ret_val);
- xmlFree (prop);
- }
- return ret_val;
-}
-
-void
-e_xml_set_integer_prop_by_name (xmlNode *parent,
- const xmlChar *prop_name,
- gint value)
-{
- gchar *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);
-}
-
-guint
-e_xml_get_uint_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
-{
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- return e_xml_get_uint_prop_by_name_with_default (parent, prop_name, 0);
-}
-
-guint
-e_xml_get_uint_prop_by_name_with_default (const xmlNode *parent,
- const xmlChar *prop_name,
- guint def)
-{
- xmlChar *prop;
- guint ret_val = def;
-
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- prop = xmlGetProp ((xmlNode *) parent, prop_name);
- if (prop != NULL) {
- (void) sscanf (prop, "%u", &ret_val);
- xmlFree (prop);
- }
- return ret_val;
-}
-
-void
-e_xml_set_uint_prop_by_name (xmlNode *parent,
- const xmlChar *prop_name,
- guint value)
-{
- gchar *valuestr;
-
- g_return_if_fail (parent != NULL);
- g_return_if_fail (prop_name != NULL);
-
- valuestr = g_strdup_printf ("%u", value);
- xmlSetProp (parent, prop_name, valuestr);
- g_free (valuestr);
-}
-
-gboolean
-e_xml_get_bool_prop_by_name (const xmlNode *parent,
- const xmlChar *prop_name)
-{
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- return e_xml_get_bool_prop_by_name_with_default (parent,
- prop_name,
- FALSE);
-}
-
-gboolean
-e_xml_get_bool_prop_by_name_with_default(const xmlNode *parent,
- const xmlChar *prop_name,
- gboolean def)
-{
- xmlChar *prop;
- gboolean ret_val = def;
-
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- prop = xmlGetProp ((xmlNode *) parent, prop_name);
- if (prop != NULL) {
- if (g_strcasecmp (prop, "true") == 0) {
- ret_val = TRUE;
- } else if (g_strcasecmp (prop, "false") == 0) {
- ret_val = FALSE;
- }
- xmlFree(prop);
- }
- return ret_val;
-}
-
-void
-e_xml_set_bool_prop_by_name (xmlNode *parent, const xmlChar *prop_name, gboolean value)
-{
- g_return_if_fail (parent != NULL);
- g_return_if_fail (prop_name != NULL);
-
- if (value) {
- xmlSetProp (parent, prop_name, "true");
- } else {
- xmlSetProp (parent, prop_name, "false");
- }
-}
-
-gdouble
-e_xml_get_double_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
-{
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- return e_xml_get_double_prop_by_name_with_default (parent, prop_name, 0.0);
-}
-
-gdouble
-e_xml_get_double_prop_by_name_with_default (const xmlNode *parent, const xmlChar *prop_name, gdouble def)
-{
- xmlChar *prop;
- gdouble ret_val = def;
-
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- prop = xmlGetProp ((xmlNode *) parent, prop_name);
- if (prop != NULL) {
- ret_val = e_flexible_strtod (prop, NULL);
- xmlFree (prop);
- }
- return ret_val;
-}
-
-void
-e_xml_set_double_prop_by_name(xmlNode *parent, const xmlChar *prop_name, gdouble value)
-{
- char buffer[E_ASCII_DTOSTR_BUF_SIZE];
- char *format;
-
- g_return_if_fail (parent != NULL);
- g_return_if_fail (prop_name != NULL);
-
- if (fabs (value) < 1e9 && fabs (value) > 1e-5) {
- format = g_strdup_printf ("%%.%df", DBL_DIG);
- } else {
- format = g_strdup_printf ("%%.%dg", DBL_DIG);
- }
- e_ascii_dtostr (buffer, sizeof (buffer), format, value);
- g_free (format);
-
- xmlSetProp (parent, prop_name, buffer);
-}
-
-gchar *
-e_xml_get_string_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
-{
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- return e_xml_get_string_prop_by_name_with_default (parent, prop_name, NULL);
-}
-
-gchar *
-e_xml_get_string_prop_by_name_with_default (const xmlNode *parent, const xmlChar *prop_name, const gchar *def)
-{
- xmlChar *prop;
- gchar *ret_val;
-
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- prop = xmlGetProp ((xmlNode *) parent, prop_name);
- if (prop != NULL) {
- ret_val = g_strdup (prop);
- xmlFree (prop);
- } else {
- ret_val = g_strdup (def);
- }
- return ret_val;
-}
-
-void
-e_xml_set_string_prop_by_name (xmlNode *parent, const xmlChar *prop_name, const gchar *value)
-{
- g_return_if_fail (parent != NULL);
- g_return_if_fail (prop_name != NULL);
-
- if (value != NULL) {
- xmlSetProp (parent, prop_name, value);
- }
-}
-
-gchar *
-e_xml_get_translated_string_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
-{
- xmlChar *prop;
- gchar *ret_val = NULL;
- gchar *combined_name;
-
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- prop = xmlGetProp ((xmlNode *) parent, prop_name);
- if (prop != NULL) {
- ret_val = g_strdup (prop);
- xmlFree (prop);
- return ret_val;
- }
-
- combined_name = g_strdup_printf("_%s", prop_name);
- prop = xmlGetProp ((xmlNode *) parent, combined_name);
- if (prop != NULL) {
- ret_val = g_strdup (gettext(prop));
- xmlFree (prop);
- }
- g_free(combined_name);
-
- return ret_val;
-}
-
-
-int
-e_xml_save_file (const char *filename, xmlDocPtr doc)
-{
- char *filesave, *slash, *xmlbuf;
- size_t n, written = 0;
- int ret, fd, size;
- int errnosave;
- ssize_t w;
-
- filesave = alloca (strlen (filename) + 5);
- slash = strrchr (filename, '/');
- if (slash)
- sprintf (filesave, "%.*s.#%s", slash - filename + 1, filename, slash + 1);
- else
- sprintf (filesave, ".#%s", filename);
-
- fd = open (filesave, O_WRONLY | O_CREAT | O_TRUNC, 0600);
- if (fd == -1)
- return -1;
-
- xmlDocDumpFormatMemory (doc, (xmlChar **) &xmlbuf, &size, TRUE);
- if (size <= 0) {
- close (fd);
- unlink (filesave);
- errno = ENOMEM;
- return -1;
- }
-
- n = (size_t) size;
- do {
- do {
- w = write (fd, xmlbuf + written, n - written);
- } while (w == -1 && errno == EINTR);
-
- if (w > 0)
- written += w;
- } while (w != -1 && written < n);
-
- xmlFree (xmlbuf);
-
- if (written < n || fsync (fd) == -1) {
- errnosave = errno;
- close (fd);
- unlink (filesave);
- errno = errnosave;
- return -1;
- }
-
- while ((ret = close (fd)) == -1 && errno == EINTR)
- ;
-
- if (ret == -1)
- return -1;
-
- if (rename (filesave, filename) == -1) {
- errnosave = errno;
- unlink (filesave);
- errno = errnosave;
- return -1;
- }
-
- return 0;
-}
diff --git a/e-util/e-xml-utils.h b/e-util/e-xml-utils.h
deleted file mode 100644
index 6c39ee6f79..0000000000
--- a/e-util/e-xml-utils.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-xml-utils.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library 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 <glib.h>
-#include <libxml/tree.h>
-
-G_BEGIN_DECLS
-
-xmlNode *e_xml_get_child_by_name (const xmlNode *parent,
- const xmlChar *child_name);
-/* lang set to NULL means use the current locale. */
-xmlNode *e_xml_get_child_by_name_by_lang (const xmlNode *parent,
- const xmlChar *child_name,
- const gchar *lang);
-/* lang_list set to NULL means use the current locale. */
-xmlNode *e_xml_get_child_by_name_by_lang_list (const xmlNode *parent,
- const gchar *name,
- const GList *lang_list);
-xmlNode *e_xml_get_child_by_name_no_lang (const xmlNode *parent,
- const gchar *name);
-
-
-gint e_xml_get_integer_prop_by_name (const xmlNode *parent,
- const xmlChar *prop_name);
-gint e_xml_get_integer_prop_by_name_with_default (const xmlNode *parent,
- const xmlChar *prop_name,
- gint def);
-void e_xml_set_integer_prop_by_name (xmlNode *parent,
- const xmlChar *prop_name,
- gint value);
-
-
-guint e_xml_get_uint_prop_by_name (const xmlNode *parent,
- const xmlChar *prop_name);
-guint e_xml_get_uint_prop_by_name_with_default (const xmlNode *parent,
- const xmlChar *prop_name,
- guint def);
-void e_xml_set_uint_prop_by_name (xmlNode *parent,
- const xmlChar *prop_name,
- guint value);
-
-
-gboolean e_xml_get_bool_prop_by_name (const xmlNode *parent,
- const xmlChar *prop_name);
-gboolean e_xml_get_bool_prop_by_name_with_default (const xmlNode *parent,
- const xmlChar *prop_name,
- gboolean def);
-void e_xml_set_bool_prop_by_name (xmlNode *parent,
- const xmlChar *prop_name,
- gboolean value);
-
-gdouble e_xml_get_double_prop_by_name (const xmlNode *parent,
- const xmlChar *prop_name);
-gdouble e_xml_get_double_prop_by_name_with_default (const xmlNode *parent,
- const xmlChar *prop_name,
- gdouble def);
-void e_xml_set_double_prop_by_name ( xmlNode *parent,
- const xmlChar *prop_name,
- gdouble value);
-
-
-gchar *e_xml_get_string_prop_by_name (const xmlNode *parent,
- const xmlChar *prop_name);
-gchar *e_xml_get_string_prop_by_name_with_default (const xmlNode *parent,
- const xmlChar *prop_name,
- const gchar *def);
-void e_xml_set_string_prop_by_name (xmlNode *parent,
- const xmlChar *prop_name,
- const gchar *value);
-
-gchar *e_xml_get_translated_string_prop_by_name (const xmlNode *parent,
- const xmlChar *prop_name);
-
-int e_xml_save_file (const char *filename, xmlDocPtr doc);
-
-G_END_DECLS
-
-#endif /* __E_XML_UTILS__ */
diff --git a/e-util/eggtrayicon.c b/e-util/eggtrayicon.c
deleted file mode 100644
index 0fb53f0eda..0000000000
--- a/e-util/eggtrayicon.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* eggtrayicon.c
- * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <string.h>
-#include <gdk/gdkx.h>
-#include "eggtrayicon.h"
-
-#define SYSTEM_TRAY_REQUEST_DOCK 0
-#define SYSTEM_TRAY_BEGIN_MESSAGE 1
-#define SYSTEM_TRAY_CANCEL_MESSAGE 2
-
-static GtkPlugClass *parent_class = NULL;
-
-static void egg_tray_icon_init (EggTrayIcon *icon);
-static void egg_tray_icon_class_init (EggTrayIconClass *klass);
-
-static void egg_tray_icon_update_manager_window (EggTrayIcon *icon);
-
-GType
-egg_tray_icon_get_type (void)
-{
- static GType our_type = 0;
-
- if (our_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (EggTrayIconClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) egg_tray_icon_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EggTrayIcon),
- 0, /* n_preallocs */
- (GInstanceInitFunc) egg_tray_icon_init
- };
-
- our_type = g_type_register_static (GTK_TYPE_PLUG, "EggTrayIcon", &our_info, 0);
- }
-
- return our_type;
-}
-
-static void
-egg_tray_icon_init (EggTrayIcon *icon)
-{
- icon->stamp = 1;
-
- gtk_widget_add_events (GTK_WIDGET (icon), GDK_PROPERTY_CHANGE_MASK);
-}
-
-static void
-egg_tray_icon_class_init (EggTrayIconClass *klass)
-{
- parent_class = g_type_class_peek_parent (klass);
-}
-
-static GdkFilterReturn
-egg_tray_icon_manager_filter (GdkXEvent *xevent, GdkEvent *event, gpointer user_data)
-{
- EggTrayIcon *icon = user_data;
- XEvent *xev = (XEvent *)xevent;
-
- if (xev->xany.type == ClientMessage &&
- xev->xclient.message_type == icon->manager_atom &&
- xev->xclient.data.l[1] == icon->selection_atom)
- {
- egg_tray_icon_update_manager_window (icon);
- }
- else if (xev->xany.window == icon->manager_window)
- {
- if (xev->xany.type == DestroyNotify)
- {
- egg_tray_icon_update_manager_window (icon);
- }
- }
-
- return GDK_FILTER_CONTINUE;
-}
-
-static void
-egg_tray_icon_send_manager_message (EggTrayIcon *icon,
- long message,
- Window window,
- long data1,
- long data2,
- long data3)
-{
- XClientMessageEvent ev;
- Display *display;
-
- ev.type = ClientMessage;
- ev.window = window;
- ev.message_type = icon->system_tray_opcode_atom;
- ev.format = 32;
- ev.data.l[0] = gdk_x11_get_server_time (GTK_WIDGET (icon)->window);
- ev.data.l[1] = message;
- ev.data.l[2] = data1;
- ev.data.l[3] = data2;
- ev.data.l[4] = data3;
-
-#if HAVE_GTK_MULTIHEAD
- display = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
-#else
- display = gdk_display;
-#endif
-
- gdk_error_trap_push ();
- XSendEvent (display,
- icon->manager_window, False, NoEventMask, (XEvent *)&ev);
- XSync (display, False);
- gdk_error_trap_pop ();
-}
-
-static void
-egg_tray_icon_send_dock_request (EggTrayIcon *icon)
-{
- egg_tray_icon_send_manager_message (icon,
- SYSTEM_TRAY_REQUEST_DOCK,
- icon->manager_window,
- gtk_plug_get_id (GTK_PLUG (icon)),
- 0, 0);
-}
-
-static void
-egg_tray_icon_update_manager_window (EggTrayIcon *icon)
-{
- Display *xdisplay;
-
-#if HAVE_GTK_MULTIHEAD
- xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
-#else
- xdisplay = gdk_display;
-#endif
-
- if (icon->manager_window != None)
- {
- GdkWindow *gdkwin;
-
-#if HAVE_GTK_MULTIHEAD
- gdkwin = gdk_window_lookup_for_display (display,
- icon->manager_window);
-#else
- gdkwin = gdk_window_lookup (icon->manager_window);
-#endif
-
- gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon);
- }
-
- XGrabServer (xdisplay);
-
- icon->manager_window = XGetSelectionOwner (xdisplay,
- icon->selection_atom);
-
- if (icon->manager_window != None)
- XSelectInput (xdisplay,
- icon->manager_window, StructureNotifyMask);
-
- XUngrabServer (xdisplay);
- XFlush (xdisplay);
-
- if (icon->manager_window != None)
- {
- GdkWindow *gdkwin;
-
-#if HAVE_GTK_MULTIHEAD
- gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)),
- icon->manager_window);
-#else
- gdkwin = gdk_window_lookup (icon->manager_window);
-#endif
-
- gdk_window_add_filter (gdkwin, egg_tray_icon_manager_filter, icon);
-
- /* Send a request that we'd like to dock */
- egg_tray_icon_send_dock_request (icon);
- }
-}
-
-static EggTrayIcon *
-egg_tray_icon_new_for_xscreen (Screen *xscreen, const char *name)
-{
- EggTrayIcon *icon;
- char buffer[256];
- GdkWindow *root_window;
-
- g_return_val_if_fail (xscreen != NULL, NULL);
-
- icon = g_object_new (EGG_TYPE_TRAY_ICON, NULL);
- gtk_window_set_title (GTK_WINDOW (icon), name);
-
-#if HAVE_GTK_MULTIHEAD
- gtk_plug_construct_for_display (GTK_PLUG (icon),
- gdk_screen_get_display (screen), 0);
-#else
- gtk_plug_construct (GTK_PLUG (icon), 0);
-#endif
-
- gtk_widget_realize (GTK_WIDGET (icon));
-
- /* Now see if there's a manager window around */
- g_snprintf (buffer, sizeof (buffer),
- "_NET_SYSTEM_TRAY_S%d",
- XScreenNumberOfScreen (xscreen));
-
- icon->selection_atom = XInternAtom (DisplayOfScreen (xscreen),
- buffer, False);
-
- icon->manager_atom = XInternAtom (DisplayOfScreen (xscreen),
- "MANAGER", False);
-
- icon->system_tray_opcode_atom = XInternAtom (DisplayOfScreen (xscreen),
- "_NET_SYSTEM_TRAY_OPCODE", False);
-
- egg_tray_icon_update_manager_window (icon);
-
-#if HAVE_GTK_MULTIHEAD
- root_window = gdk_screen_get_root_window (screen);
-#else
- root_window = gdk_window_lookup (gdk_x11_get_default_root_xwindow ());
-#endif
-
- /* Add a root window filter so that we get changes on MANAGER */
- gdk_window_add_filter (root_window,
- egg_tray_icon_manager_filter, icon);
-
- return icon;
-}
-
-#if HAVE_GTK_MULTIHEAD
-EggTrayIcon *
-egg_tray_icon_new_for_screen (GdkScreen *screen, const char *name)
-{
- EggTrayIcon *icon;
- char buffer[256];
-
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
- return egg_tray_icon_new_for_xscreen (GDK_SCREEN_XSCREEN (screen), name);
-}
-#endif
-
-EggTrayIcon*
-egg_tray_icon_new (const gchar *name)
-{
- return egg_tray_icon_new_for_xscreen (DefaultScreenOfDisplay (gdk_display), name);
-}
-
-guint
-egg_tray_icon_send_message (EggTrayIcon *icon,
- gint timeout,
- const gchar *message,
- gint len)
-{
- guint stamp;
-
- g_return_val_if_fail (EGG_IS_TRAY_ICON (icon), 0);
- g_return_val_if_fail (timeout >= 0, 0);
- g_return_val_if_fail (message != NULL, 0);
-
- if (icon->manager_window == None)
- return 0;
-
- if (len < 0)
- len = strlen (message);
-
- stamp = icon->stamp++;
-
- /* Get ready to send the message */
- egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_BEGIN_MESSAGE,
- (Window)gtk_plug_get_id (GTK_PLUG (icon)),
- timeout, len, stamp);
-
- /* Now to send the actual message */
- gdk_error_trap_push ();
- while (len > 0)
- {
- XClientMessageEvent ev;
- Display *xdisplay;
-
-#if HAVE_GTK_MULTIHEAD
- xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
-#else
- xdisplay = gdk_display;
-#endif
-
- ev.type = ClientMessage;
- ev.window = (Window)gtk_plug_get_id (GTK_PLUG (icon));
- ev.format = 8;
- ev.message_type = XInternAtom (xdisplay,
- "_NET_SYSTEM_TRAY_MESSAGE_DATA", False);
- if (len > 20)
- {
- memcpy (&ev.data, message, 20);
- len -= 20;
- message += 20;
- }
- else
- {
- memcpy (&ev.data, message, len);
- len = 0;
- }
-
- XSendEvent (xdisplay,
- icon->manager_window, False, StructureNotifyMask, (XEvent *)&ev);
- XSync (xdisplay, False);
- }
- gdk_error_trap_pop ();
-
- return stamp;
-}
-
-void
-egg_tray_icon_cancel_message (EggTrayIcon *icon,
- guint id)
-{
- g_return_if_fail (EGG_IS_TRAY_ICON (icon));
- g_return_if_fail (id > 0);
-
- egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_CANCEL_MESSAGE,
- (Window)gtk_plug_get_id (GTK_PLUG (icon)),
- id, 0, 0);
-}
diff --git a/e-util/eggtrayicon.h b/e-util/eggtrayicon.h
deleted file mode 100644
index 724bc3da8b..0000000000
--- a/e-util/eggtrayicon.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* eggtrayicon.h
- * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 __EGG_TRAY_ICON_H__
-#define __EGG_TRAY_ICON_H__
-
-#include <gtk/gtkplug.h>
-#include <gdk/gdkx.h>
-
-G_BEGIN_DECLS
-
-#define EGG_TYPE_TRAY_ICON (egg_tray_icon_get_type ())
-#define EGG_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TRAY_ICON, EggTrayIcon))
-#define EGG_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_TRAY_ICON, EggTrayIconClass))
-#define EGG_IS_TRAY_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TRAY_ICON))
-#define EGG_IS_TRAY_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_TRAY_ICON))
-#define EGG_TRAY_ICON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_TRAY_ICON, EggTrayIconClass))
-
-typedef struct _EggTrayIcon EggTrayIcon;
-typedef struct _EggTrayIconClass EggTrayIconClass;
-
-struct _EggTrayIcon
-{
- GtkPlug parent_instance;
-
- guint stamp;
-
- Atom selection_atom;
- Atom manager_atom;
- Atom system_tray_opcode_atom;
- Window manager_window;
-};
-
-struct _EggTrayIconClass
-{
- GtkPlugClass parent_class;
-};
-
-GType egg_tray_icon_get_type (void);
-
-#if EGG_TRAY_ENABLE_MULTIHEAD
-EggTrayIcon *egg_tray_icon_new_for_screen (GdkScreen *screen,
- const gchar *name);
-#endif
-
-EggTrayIcon *egg_tray_icon_new (const gchar *name);
-
-guint egg_tray_icon_send_message (EggTrayIcon *icon,
- gint timeout,
- const char *message,
- gint len);
-void egg_tray_icon_cancel_message (EggTrayIcon *icon,
- guint id);
-
-
-
-G_END_DECLS
-
-#endif /* __EGG_TRAY_ICON_H__ */
diff --git a/e-util/md5-utils.c b/e-util/md5-utils.c
deleted file mode 100644
index 6f7e06f48d..0000000000
--- a/e-util/md5-utils.c
+++ /dev/null
@@ -1,363 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest. This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
- * Equivalent code is available from RSA Data Security, Inc.
- * This code has been tested against that, and is equivalent,
- * except that you don't need to include two pages of legalese
- * with every copy.
- *
- * To compute the message digest of a chunk of bytes, declare an
- * MD5Context structure, pass it to md5_init, call md5_update as
- * needed on buffers full of bytes, and then call md5_Final, which
- * will fill a supplied 16-byte array with the digest.
- */
-
-/* parts of this file are :
- * Written March 1993 by Branko Lankester
- * Modified June 1993 by Colin Plumb for altered md5.c.
- * Modified October 1995 by Erik Troan for RPM
- */
-
-
-#include <stdio.h>
-#include <string.h>
-#include "md5-utils.h"
-
-
-static void md5_transform (guint32 buf[4], const guint32 in[16]);
-
-static gint _ie = 0x44332211;
-static union _endian { gint i; gchar b[4]; } *_endian = (union _endian *)&_ie;
-#define IS_BIG_ENDIAN() (_endian->b[0] == '\x44')
-#define IS_LITTLE_ENDIAN() (_endian->b[0] == '\x11')
-
-
-/*
- * Note: this code is harmless on little-endian machines.
- */
-static void
-_byte_reverse (guchar *buf, guint32 longs)
-{
- guint32 t;
- do {
- t = (guint32) ((guint32) buf[3] << 8 | buf[2]) << 16 |
- ((guint32) buf[1] << 8 | buf[0]);
- *(guint32 *) buf = t;
- buf += 4;
- } while (--longs);
-}
-
-/**
- * md5_init: Initialise an md5 context object
- * @ctx: md5 context
- *
- * Initialise an md5 buffer.
- *
- **/
-void
-md5_init (MD5Context *ctx)
-{
- ctx->buf[0] = 0x67452301;
- ctx->buf[1] = 0xefcdab89;
- ctx->buf[2] = 0x98badcfe;
- ctx->buf[3] = 0x10325476;
-
- ctx->bits[0] = 0;
- ctx->bits[1] = 0;
-
- if (IS_BIG_ENDIAN())
- ctx->doByteReverse = 1;
- else
- ctx->doByteReverse = 0;
-}
-
-
-
-/**
- * md5_update: add a buffer to md5 hash computation
- * @ctx: conetxt object used for md5 computaion
- * @buf: buffer to add
- * @len: buffer length
- *
- * Update context to reflect the concatenation of another buffer full
- * of bytes. Use this to progressively construct an md5 hash.
- **/
-void
-md5_update (MD5Context *ctx, const guchar *buf, guint32 len)
-{
- guint32 t;
-
- /* Update bitcount */
-
- t = ctx->bits[0];
- if ((ctx->bits[0] = t + ((guint32) len << 3)) < t)
- ctx->bits[1]++; /* Carry from low to high */
- ctx->bits[1] += len >> 29;
-
- t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
-
- /* Handle any leading odd-sized chunks */
-
- if (t) {
- guchar *p = (guchar *) ctx->in + t;
-
- t = 64 - t;
- if (len < t) {
- memcpy (p, buf, len);
- return;
- }
- memcpy (p, buf, t);
- if (ctx->doByteReverse)
- _byte_reverse (ctx->in, 16);
- md5_transform (ctx->buf, (guint32 *) ctx->in);
- buf += t;
- len -= t;
- }
- /* Process data in 64-byte chunks */
-
- while (len >= 64) {
- memcpy (ctx->in, buf, 64);
- if (ctx->doByteReverse)
- _byte_reverse (ctx->in, 16);
- md5_transform (ctx->buf, (guint32 *) ctx->in);
- buf += 64;
- len -= 64;
- }
-
- /* Handle any remaining bytes of data. */
-
- memcpy (ctx->in, buf, len);
-}
-
-
-
-
-
-/*
- * Final wrapup - pad to 64-byte boundary with the bit pattern
- * 1 0* (64-bit count of bits processed, MSB-first)
- */
-/**
- * md5_final: copy the final md5 hash to a bufer
- * @digest: 16 bytes buffer
- * @ctx: context containing the calculated md5
- *
- * copy the final md5 hash to a bufer
- **/
-void
-md5_final (MD5Context *ctx, guchar digest[16])
-{
- guint32 count;
- guchar *p;
-
- /* Compute number of bytes mod 64 */
- count = (ctx->bits[0] >> 3) & 0x3F;
-
- /* Set the first char of padding to 0x80. This is safe since there is
- always at least one byte free */
- p = ctx->in + count;
- *p++ = 0x80;
-
- /* Bytes of padding needed to make 64 bytes */
- count = 64 - 1 - count;
-
- /* Pad out to 56 mod 64 */
- if (count < 8) {
- /* Two lots of padding: Pad the first block to 64 bytes */
- memset (p, 0, count);
- if (ctx->doByteReverse)
- _byte_reverse (ctx->in, 16);
- md5_transform (ctx->buf, (guint32 *) ctx->in);
-
- /* Now fill the next block with 56 bytes */
- memset (ctx->in, 0, 56);
- } else {
- /* Pad block to 56 bytes */
- memset (p, 0, count - 8);
- }
- if (ctx->doByteReverse)
- _byte_reverse (ctx->in, 14);
-
- /* Append length in bits and transform */
- ((guint32 *) ctx->in)[14] = ctx->bits[0];
- ((guint32 *) ctx->in)[15] = ctx->bits[1];
-
- md5_transform (ctx->buf, (guint32 *) ctx->in);
- if (ctx->doByteReverse)
- _byte_reverse ((guchar *) ctx->buf, 4);
- memcpy (digest, ctx->buf, 16);
-}
-
-
-
-
-/* The four core functions - F1 is optimized somewhat */
-
-/* #define F1(x, y, z) (x & y | ~x & z) */
-#define F1(x, y, z) (z ^ (x & (y ^ z)))
-#define F2(x, y, z) F1(z, x, y)
-#define F3(x, y, z) (x ^ y ^ z)
-#define F4(x, y, z) (y ^ (x | ~z))
-
-/* This is the central step in the MD5 algorithm. */
-#define MD5STEP(f, w, x, y, z, data, s) \
- ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
-
-/*
- * The core of the MD5 algorithm, this alters an existing MD5 hash to
- * reflect the addition of 16 longwords of new data. md5_Update blocks
- * the data and converts bytes into longwords for this routine.
- */
-static void
-md5_transform (guint32 buf[4], const guint32 in[16])
-{
- register guint32 a, b, c, d;
-
- a = buf[0];
- b = buf[1];
- c = buf[2];
- d = buf[3];
-
- MD5STEP (F1, a, b, c, d, in[0] + 0xd76aa478, 7);
- MD5STEP (F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
- MD5STEP (F1, c, d, a, b, in[2] + 0x242070db, 17);
- MD5STEP (F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
- MD5STEP (F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
- MD5STEP (F1, d, a, b, c, in[5] + 0x4787c62a, 12);
- MD5STEP (F1, c, d, a, b, in[6] + 0xa8304613, 17);
- MD5STEP (F1, b, c, d, a, in[7] + 0xfd469501, 22);
- MD5STEP (F1, a, b, c, d, in[8] + 0x698098d8, 7);
- MD5STEP (F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
- MD5STEP (F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
- MD5STEP (F1, b, c, d, a, in[11] + 0x895cd7be, 22);
- MD5STEP (F1, a, b, c, d, in[12] + 0x6b901122, 7);
- MD5STEP (F1, d, a, b, c, in[13] + 0xfd987193, 12);
- MD5STEP (F1, c, d, a, b, in[14] + 0xa679438e, 17);
- MD5STEP (F1, b, c, d, a, in[15] + 0x49b40821, 22);
-
- MD5STEP (F2, a, b, c, d, in[1] + 0xf61e2562, 5);
- MD5STEP (F2, d, a, b, c, in[6] + 0xc040b340, 9);
- MD5STEP (F2, c, d, a, b, in[11] + 0x265e5a51, 14);
- MD5STEP (F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
- MD5STEP (F2, a, b, c, d, in[5] + 0xd62f105d, 5);
- MD5STEP (F2, d, a, b, c, in[10] + 0x02441453, 9);
- MD5STEP (F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
- MD5STEP (F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
- MD5STEP (F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
- MD5STEP (F2, d, a, b, c, in[14] + 0xc33707d6, 9);
- MD5STEP (F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
- MD5STEP (F2, b, c, d, a, in[8] + 0x455a14ed, 20);
- MD5STEP (F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
- MD5STEP (F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
- MD5STEP (F2, c, d, a, b, in[7] + 0x676f02d9, 14);
- MD5STEP (F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
-
- MD5STEP (F3, a, b, c, d, in[5] + 0xfffa3942, 4);
- MD5STEP (F3, d, a, b, c, in[8] + 0x8771f681, 11);
- MD5STEP (F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
- MD5STEP (F3, b, c, d, a, in[14] + 0xfde5380c, 23);
- MD5STEP (F3, a, b, c, d, in[1] + 0xa4beea44, 4);
- MD5STEP (F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
- MD5STEP (F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
- MD5STEP (F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
- MD5STEP (F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
- MD5STEP (F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
- MD5STEP (F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
- MD5STEP (F3, b, c, d, a, in[6] + 0x04881d05, 23);
- MD5STEP (F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
- MD5STEP (F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
- MD5STEP (F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
- MD5STEP (F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
-
- MD5STEP (F4, a, b, c, d, in[0] + 0xf4292244, 6);
- MD5STEP (F4, d, a, b, c, in[7] + 0x432aff97, 10);
- MD5STEP (F4, c, d, a, b, in[14] + 0xab9423a7, 15);
- MD5STEP (F4, b, c, d, a, in[5] + 0xfc93a039, 21);
- MD5STEP (F4, a, b, c, d, in[12] + 0x655b59c3, 6);
- MD5STEP (F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
- MD5STEP (F4, c, d, a, b, in[10] + 0xffeff47d, 15);
- MD5STEP (F4, b, c, d, a, in[1] + 0x85845dd1, 21);
- MD5STEP (F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
- MD5STEP (F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
- MD5STEP (F4, c, d, a, b, in[6] + 0xa3014314, 15);
- MD5STEP (F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
- MD5STEP (F4, a, b, c, d, in[4] + 0xf7537e82, 6);
- MD5STEP (F4, d, a, b, c, in[11] + 0xbd3af235, 10);
- MD5STEP (F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
- MD5STEP (F4, b, c, d, a, in[9] + 0xeb86d391, 21);
-
- buf[0] += a;
- buf[1] += b;
- buf[2] += c;
- buf[3] += d;
-}
-
-
-
-
-/**
- * md5_get_digest: get the md5 hash of a buffer
- * @buffer: byte buffer
- * @buffer_size: buffer size (in bytes)
- * @digest: 16 bytes buffer receiving the hash code.
- *
- * Get the md5 hash of a buffer. The result is put in
- * the 16 bytes buffer @digest .
- **/
-void
-md5_get_digest (const gchar *buffer, gint buffer_size, guchar digest[16])
-{
- MD5Context ctx;
-
- md5_init (&ctx);
- md5_update (&ctx, buffer, buffer_size);
- md5_final (&ctx, digest);
-
-}
-
-
-/**
- * md5_get_digest_from_file: get the md5 hash of a file
- * @filename: file name
- * @digest: 16 bytes buffer receiving the hash code.
- *
- * Get the md5 hash of a file. The result is put in
- * the 16 bytes buffer @digest .
- **/
-void
-md5_get_digest_from_file (const gchar *filename, guchar digest[16])
-{
- MD5Context ctx;
- guchar tmp_buf[1024];
- gint nb_bytes_read;
- FILE *fp;
-
- printf("generating checksum\n");
-
- md5_init (&ctx);
- fp = fopen(filename, "r");
- if (!fp) {
- return;
- }
-
- while ((nb_bytes_read = fread (tmp_buf, sizeof (guchar), 1024, fp)) > 0)
- md5_update (&ctx, tmp_buf, nb_bytes_read);
-
- if (ferror(fp)) {
- fclose(fp);
- return;
- }
-
-
- md5_final (&ctx, digest);
-
- printf("checksum done\n");
-}
-
-
-
-
diff --git a/e-util/md5-utils.h b/e-util/md5-utils.h
deleted file mode 100644
index 607471a752..0000000000
--- a/e-util/md5-utils.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest. This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
- * Equivalent code is available from RSA Data Security, Inc.
- * This code has been tested against that, and is equivalent,
- * except that you don't need to include two pages of legalese
- * with every copy.
- *
- * To compute the message digest of a chunk of bytes, declare an
- * MD5Context structure, pass it to rpmMD5Init, call rpmMD5Update as
- * needed on buffers full of bytes, and then call rpmMD5Final, which
- * will fill a supplied 16-byte array with the digest.
- */
-
-/* parts of this file are :
- * Written March 1993 by Branko Lankester
- * Modified June 1993 by Colin Plumb for altered md5.c.
- * Modified October 1995 by Erik Troan for RPM
- */
-
-
-#ifndef MD5_UTILS_H
-#define MD5_UTILS_H
-
-#include <glib.h>
-
-
-typedef struct _MD5Context {
- guint32 buf[4];
- guint32 bits[2];
- guchar in[64];
- gint doByteReverse;
-} MD5Context;
-
-
-void md5_get_digest (const gchar *buffer, gint buffer_size, guchar digest[16]);
-
-/* use this one when speed is needed */
-/* for use in provider code only */
-void md5_get_digest_from_file (const gchar *filename, guchar digest[16]);
-
-/* raw routines */
-void md5_init (MD5Context *ctx);
-void md5_update (MD5Context *ctx, const guchar *buf, guint32 len);
-void md5_final (MD5Context *ctx, guchar digest[16]);
-
-
-#endif /* MD5_UTILS_H */