--- /dev/null
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/mail-client/evolution/evolution-2.8.0.ebuild,v 1.1 2006/09/07 03:49:51 dang Exp $
+
+inherit eutils flag-o-matic alternatives gnome2 autotools
+
+DESCRIPTION="Integrated mail, addressbook and calendaring functionality"
+HOMEPAGE="http://www.gnome.org/projects/evolution/"
+SRC_URI="${SRC_URI}
+ bogofilter? ( mirror://gentoo/${PN}-2.5.5.1-bf-junk.tar.bz2 )"
+
+LICENSE="GPL-2 FDL-1.1"
+SLOT="2.0"
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+IUSE="bogofilter crypt dbus debug doc gstreamer hal ipv6 kerberos krb4 ldap mono nntp pda profile spell ssl"
+
+# Pango dependency required to avoid font rendering problems
+# evolution-data-server dep is 1.5 because in the e-utils directories,
+# the includes reference locations only present in eds > 1.5
+RDEPEND=">=x11-themes/gnome-icon-theme-1.2
+ dev-libs/atk
+ >=gnome-extra/gtkhtml-3.9.90
+ >=dev-libs/glib-2
+ >=gnome-base/orbit-2.9.8
+ >=gnome-base/libbonobo-2
+ >=gnome-extra/evolution-data-server-1.7.90
+ >=gnome-base/libbonoboui-2.4.2
+ >=gnome-base/gnome-vfs-2.4
+ >=gnome-base/libgnomeui-2
+ >=gnome-base/libglade-2
+ >=gnome-base/libgnomecanvas-2
+ >=dev-libs/libxml2-2
+ >=gnome-base/gconf-2
+ >=gnome-base/libgnomeprint-2.2
+ >=gnome-base/libgnomeprintui-2.2.1
+ >=x11-libs/gtk+-2
+ >=gnome-base/libgnome-2
+ >=net-libs/libsoup-2.2.96
+ >=x11-libs/pango-1.8.1
+ x11-libs/libnotify
+ hal? ( >=sys-apps/hal-0.5.4 )
+ pda? (
+ >=app-pda/gnome-pilot-2
+ >=app-pda/gnome-pilot-conduits-2 )
+ spell? ( >=app-text/gnome-spell-1.0.5 )
+ crypt? ( >=app-crypt/gnupg-1.2.2 )
+ ssl? ( >=dev-libs/nspr-4.6.1
+ >=dev-libs/nss-3.11 )
+ ldap? ( >=net-nds/openldap-2 )
+ kerberos? ( virtual/krb5 )
+ krb4? ( virtual/krb5 )
+ gstreamer? (
+ >=media-libs/gstreamer-0.10
+ >=media-libs/gst-plugins-base-0.10 )
+ dbus? ( sys-apps/dbus )
+ mono? ( >=dev-lang/mono-1 )
+ bogofilter? ( mail-filter/bogofilter )
+ !bogofilter? ( mail-filter/spamassassin )"
+
+DEPEND="${RDEPEND}
+ >=dev-util/pkgconfig-0.9
+ >=dev-util/intltool-0.35
+ sys-devel/gettext
+ sys-devel/bison
+ app-text/scrollkeeper
+ >=gnome-base/gnome-common-2.12.0
+ doc? ( >=dev-util/gtk-doc-0.6 )"
+
+DOCS="AUTHORS ChangeLog* HACKING MAINTAINERS NEWS* README"
+ELTCONF="--reverse-deps"
+
+
+pkg_setup() {
+ G2CONF="--disable-default-binary \
+ --without-kde-applnk-path \
+ $(use_enable ssl nss) \
+ $(use_enable ssl smime) \
+ $(use_enable ipv6) \
+ $(use_enable mono) \
+ $(use_enable nntp) \
+ $(use_enable pda pilot-conduits) \
+ $(use_enable profile profiling) \
+ $(use_with ldap openldap) \
+ $(use_with kerberos krb5 /usr)"
+
+ if use krb4 && ! built_with_use virtual/krb5 krb4; then
+ ewarn
+ ewarn "In order to add kerberos 4 support, you have to emerge"
+ ewarn "virtual/krb5 with the 'krb4' USE flag enabled as well."
+ ewarn
+ ewarn "Skipping for now."
+ ewarn
+ G2CONF="${G2CONF} --without-krb4"
+ else
+ G2CONF="${G2CONF} $(use_with krb4 krb4 /usr)"
+ fi
+
+ # Plug-ins to install. Normally we would want something similar to
+ # --enable-plugins=all (plugins_base + plugins_standard), except for some
+ # special cases.
+ local plugins="calendar-file calendar-http calendar-weather \
+ itip-formatter plugin-manager default-source addressbook-file \
+ startup-wizard print-message mark-all-read groupwise-features \
+ groupwise-account-setup hula-account-setup mail-account-disable \
+ publish-calendar caldav \
+ bbdb subject-thread save-calendar select-one-source copy-tool \
+ mail-to-task mark-calendar-offline mailing-list-actions \
+ new-mail-notify default-mailer import-ics-attachments"
+
+ # For dev releases, add experimental plugins
+ plugins="${plugins} backup-restore folder-unsubscribe mail-to-meeting \
+ prefer-plain save-attachments"
+
+ if use bogofilter; then
+ plugins="${plugins} bf-junk-plugin"
+ else
+ plugins="${plugins} sa-junk-plugin"
+ fi
+
+ # The special cases
+
+ # remove this due to bug #128035 re-enable later if it doesn't dep on
+ # gstreamer-0.8
+ # use gstreamer && plugins="${plugins} audio-inline"
+ use dbus && plugins="${plugins} new-mail-notify"
+ use mono && plugins="${plugins} mono"
+
+ if built_with_use gnome-extra/evolution-data-server ldap; then
+ plugins="${plugins} exchange-operations"
+ fi
+
+ local pluginlist=""
+ for p in $plugins; do
+ [ "x$pluginlist" != "x" ] && pluginlist="${pluginlist},"
+ pluginlist="${pluginlist}${p}"
+ done
+
+ G2CONF="${G2CONF} --enable-plugins=${pluginlist}"
+}
+
+src_unpack() {
+ unpack ${P}.tar.bz2
+ cd "${S}"
+
+ gnome2_omf_fix help/omf.make
+
+ # Accept the list of plugins separated by commas instead of spaces.
+ epatch ${FILESDIR}/${PN}-2.3.7-configure_plugins.patch
+
+ # Move evo to URI-based saving
+ epatch ${FILESDIR}/${PN}-2.8.0-uri.patch
+
+ # Fix 64-bit warnings
+ epatch ${FILESDIR}/${PN}-2.8.0-64-bit.patch
+
+ # Fix missing includes
+ epatch ${FILESDIR}/${PN}-2.8.0-includes.patch
+
+ # Fix blank replys
+ epatch ${FILESDIR}/${PN}-2.8.0-blank-reply.patch
+
+ # Add bogofilter junk plugin source
+ use bogofilter && epatch ${FILESDIR}/${PN}-2.7.3-bf-junk.patch.gz
+
+
+ eaclocal || die
+ _elibtoolize --copy --force || die
+ eautoheader || die
+ eautomake || die
+ intltoolize --force || die
+ eautoconf || die
+}
+
+src_compile() {
+ # Use NSS/NSPR only if 'ssl' is enabled.
+ if use ssl ; then
+ sed -i -e "s|mozilla-nss|nss|
+ s|mozilla-nspr|nspr|" ${S}/configure
+ G2CONF="${G2CONF} --enable-nss=yes"
+ else
+ G2CONF="${G2CONF} --without-nspr-libs --without-nspr-includes \
+ --without-nss-libs --without-nss-includes"
+ fi
+# if use ssl ; then
+# NSS_LIB=/usr/$(get_libdir)/nss
+# NSS_INC=/usr/include/nss
+# NSPR_LIB=/usr/$(get_libdir)/nspr
+# NSPR_INC=/usr/include/nspr
+#
+# G2CONF="${G2CONF} \
+# --with-nspr-includes=${NSPR_INC} \
+# --with-nspr-libs=${NSPR_LIB} \
+# --with-nss-includes=${NSS_INC} \
+# --with-nss-libs=${NSS_LIB}"
+# else
+# G2CONF="${G2CONF} --without-nspr-libs --without-nspr-includes \
+# --without-nss-libs --without-nss-includes"
+# fi
+
+
+ # problems with -O3 on gcc-3.3.1
+ replace-flags -O3 -O2
+
+ if [ "${ARCH}" = "hppa" ]; then
+ append-flags "-fPIC -ffunction-sections"
+ export LDFLAGS="-ffunction-sections -Wl,--stub-group-size=25000"
+ fi
+
+ gnome2_src_compile
+}
+
+pkg_postinst() {
+ gnome2_pkg_postinst
+
+ alternatives_auto_makesym "/usr/bin/evolution" "/usr/bin/evolution-[0-9].[0-9]"
+ einfo "To change the default browser if you are not using GNOME, do:"
+ einfo "gconftool-2 --set /desktop/gnome/url-handlers/http/command -t string 'mozilla %s'"
+ einfo "gconftool-2 --set /desktop/gnome/url-handlers/https/command -t string 'mozilla %s'"
+ einfo ""
+ einfo "Replace 'mozilla %s' with which ever browser you use."
+}
--- /dev/null
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/a11y/calendar/ea-gnome-calendar.c evolution-2.7.91.64-bit/a11y/calendar/ea-gnome-calendar.c
+--- evolution-2.7.91.orig/a11y/calendar/ea-gnome-calendar.c 2004-10-29 05:56:35.000000000 -0400
++++ evolution-2.7.91.64-bit/a11y/calendar/ea-gnome-calendar.c 2006-08-24 13:18:28.000000000 -0400
+@@ -29,6 +29,7 @@
+ #include <gtk/gtknotebook.h>
+ #include <libecal/e-cal-time-util.h>
+ #include <libgnome/gnome-i18n.h>
++#include <libedataserver/e-data-server-util.h>
+
+ static void ea_gnome_calendar_class_init (EaGnomeCalendarClass *klass);
+
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/addressbook/gui/widgets/e-minicard.c evolution-2.7.91.64-bit/addressbook/gui/widgets/e-minicard.c
+--- evolution-2.7.91.orig/addressbook/gui/widgets/e-minicard.c 2006-07-22 07:14:49.000000000 -0400
++++ evolution-2.7.91.64-bit/addressbook/gui/widgets/e-minicard.c 2006-08-24 13:18:28.000000000 -0400
+@@ -40,6 +40,7 @@
+ #include "e-minicard-view.h"
+ #include "e-contact-editor.h"
+ #include <e-util/e-icon-factory.h>
++#include <e-util/e-html-utils.h>
+ #include <libebook/e-destination.h>
+ #include "a11y/addressbook/ea-addressbook.h"
+
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/calendar/gui/dialogs/memo-page.h evolution-2.7.91.64-bit/calendar/gui/dialogs/memo-page.h
+--- evolution-2.7.91.orig/calendar/gui/dialogs/memo-page.h 2006-07-22 07:14:51.000000000 -0400
++++ evolution-2.7.91.64-bit/calendar/gui/dialogs/memo-page.h 2006-08-24 13:18:28.000000000 -0400
+@@ -53,6 +53,8 @@
+ GtkType memo_page_get_type (void);
+ MemoPage *memo_page_construct (MemoPage *epage);
+ MemoPage *memo_page_new (BonoboUIComponent *uic, CompEditorPageFlags flags);
++void memo_page_set_show_categories (MemoPage *page, gboolean state);
++void memo_page_set_classification (MemoPage *page, ECalComponentClassification class);
+
+ G_END_DECLS
+
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/calendar/gui/e-calendar-view.h evolution-2.7.91.64-bit/calendar/gui/e-calendar-view.h
+--- evolution-2.7.91.orig/calendar/gui/e-calendar-view.h 2006-08-07 00:47:42.000000000 -0400
++++ evolution-2.7.91.64-bit/calendar/gui/e-calendar-view.h 2006-08-24 13:18:28.000000000 -0400
+@@ -166,6 +166,12 @@
+ gboolean new);
+
+ gboolean e_calendar_view_get_tooltips (ECalendarViewEventData *data);
++void e_calendar_view_move_tip (GtkWidget *widget, int x, int y);
++#ifdef ENABLE_CAIRO
++void draw_curved_rectangle (cairo_t *cr, double x0, double y0,
++ double rect_width, double rect_height,
++ double radius);
++#endif
+ G_END_DECLS
+
+ #endif
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/calendar/gui/e-cal-model-tasks.h evolution-2.7.91.64-bit/calendar/gui/e-cal-model-tasks.h
+--- evolution-2.7.91.orig/calendar/gui/e-cal-model-tasks.h 2005-10-03 02:16:51.000000000 -0400
++++ evolution-2.7.91.64-bit/calendar/gui/e-cal-model-tasks.h 2006-08-24 13:18:28.000000000 -0400
+@@ -63,6 +63,7 @@
+
+ void e_cal_model_tasks_mark_task_complete (ECalModelTasks *model, gint model_row);
+ void e_cal_model_tasks_update_due_tasks (ECalModelTasks *model);
++void e_cal_model_tasks_mark_task_incomplete (ECalModelTasks *model, gint model_row);
+
+ G_END_DECLS
+
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/calendar/gui/e-day-view.c evolution-2.7.91.64-bit/calendar/gui/e-day-view.c
+--- evolution-2.7.91.orig/calendar/gui/e-day-view.c 2006-08-07 00:47:43.000000000 -0400
++++ evolution-2.7.91.64-bit/calendar/gui/e-day-view.c 2006-08-24 13:18:28.000000000 -0400
+@@ -65,6 +65,7 @@
+ #include "calendar-commands.h"
+ #include "calendar-config.h"
+ #include "goto.h"
++#include "e-calendar-view.h"
+ #include "e-cal-model-calendar.h"
+ #include "e-day-view-time-item.h"
+ #include "e-day-view-top-item.h"
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/calendar/gui/e-meeting-store.c evolution-2.7.91.64-bit/calendar/gui/e-meeting-store.c
+--- evolution-2.7.91.orig/calendar/gui/e-meeting-store.c 2006-04-22 00:39:20.000000000 -0400
++++ evolution-2.7.91.64-bit/calendar/gui/e-meeting-store.c 2006-08-24 13:18:28.000000000 -0400
+@@ -1472,7 +1472,7 @@
+ guint
+ e_meeting_store_get_num_queries (EMeetingStore *store)
+ {
+- g_return_if_fail (E_IS_MEETING_STORE (store));
++ g_return_val_if_fail (E_IS_MEETING_STORE (store), 0);
+
+ return store->priv->num_queries;
+ }
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/calendar/gui/e-week-view.c evolution-2.7.91.64-bit/calendar/gui/e-week-view.c
+--- evolution-2.7.91.orig/calendar/gui/e-week-view.c 2006-07-22 07:14:51.000000000 -0400
++++ evolution-2.7.91.64-bit/calendar/gui/e-week-view.c 2006-08-24 13:18:28.000000000 -0400
+@@ -69,6 +69,7 @@
+ #include "e-week-view-layout.h"
+ #include "e-week-view-main-item.h"
+ #include "e-week-view-titles-item.h"
++#include "e-calendar-view.h"
+ #include "misc.h"
+ #include <e-util/e-icon-factory.h>
+
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/calendar/gui/gnome-cal.h evolution-2.7.91.64-bit/calendar/gui/gnome-cal.h
+--- evolution-2.7.91.orig/calendar/gui/gnome-cal.h 2006-07-22 07:14:51.000000000 -0400
++++ evolution-2.7.91.64-bit/calendar/gui/gnome-cal.h 2006-08-24 13:18:29.000000000 -0400
+@@ -198,6 +198,7 @@
+ const char* comp_uid,
+ const char* comp_rid);
+
++GtkWidget * gnome_calendar_get_tag (GnomeCalendar *gcal);
+ G_END_DECLS
+
+ #endif
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/composer/e-msg-composer.c evolution-2.7.91.64-bit/composer/e-msg-composer.c
+--- evolution-2.7.91.orig/composer/e-msg-composer.c 2006-08-07 00:47:43.000000000 -0400
++++ evolution-2.7.91.64-bit/composer/e-msg-composer.c 2006-08-24 13:18:29.000000000 -0400
+@@ -63,6 +63,7 @@
+
+ #include <libgnome/gnome-exec.h>
+ #include <libgnome/gnome-i18n.h>
++#include <libgnome/gnome-help.h>
+ #include <libgnomeui/gnome-uidefs.h>
+ #include <libgnomeui/gnome-window-icon.h>
+
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/e-util/e-profile-event.c evolution-2.7.91.64-bit/e-util/e-profile-event.c
+--- evolution-2.7.91.orig/e-util/e-profile-event.c 2006-02-08 06:43:02.000000000 -0500
++++ evolution-2.7.91.64-bit/e-util/e-profile-event.c 2006-08-24 13:18:29.000000000 -0400
+@@ -133,12 +133,6 @@
+
+ e_event_emit((EEvent *)epe, "event", (EEventTarget *)t);
+ }
+-#else
+-#undef e_profile_event_emit
+-void
+-e_profile_event_emit(const char *id, const char *uid, guint32 flags)
+-{
+-}
+ #endif
+
+ /* ********************************************************************** */
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/e-util/e-util.h evolution-2.7.91.64-bit/e-util/e-util.h
+--- evolution-2.7.91.orig/e-util/e-util.h 2006-07-22 07:14:52.000000000 -0400
++++ evolution-2.7.91.64-bit/e-util/e-util.h 2006-08-24 13:18:52.000000000 -0400
+@@ -29,6 +29,7 @@
+ #include <limits.h>
+ #include <gconf/gconf-client.h>
+ #include <cairo.h>
++#include <gtk/gtk.h>
+
+ #ifdef __cplusplus
+ extern "C" {
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/mail/em-folder-view.c evolution-2.7.91.64-bit/mail/em-folder-view.c
+--- evolution-2.7.91.orig/mail/em-folder-view.c 2006-07-22 07:14:53.000000000 -0400
++++ evolution-2.7.91.64-bit/mail/em-folder-view.c 2006-08-24 13:18:29.000000000 -0400
+@@ -69,6 +69,8 @@
+ #include <gtkhtml/gtkhtml.h>
+ #include <gtkhtml/gtkhtml-stream.h>
+
++#include <libedataserver/e-data-server-util.h>
++
+ #include "menus/gal-view-etable.h"
+ #include "menus/gal-view-factory-etable.h"
+ #include "menus/gal-view-instance.h"
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/mail/em-format-html-display.c evolution-2.7.91.64-bit/mail/em-format-html-display.c
+--- evolution-2.7.91.orig/mail/em-format-html-display.c 2006-08-07 00:47:44.000000000 -0400
++++ evolution-2.7.91.64-bit/mail/em-format-html-display.c 2006-08-24 13:18:29.000000000 -0400
+@@ -42,6 +42,7 @@
+ #include <gtkhtml/gtkhtml-embedded.h>
+ #include <gtkhtml/gtkhtml-search.h>
+
++#include <gtk/gtk.h>
+ #include <gtk/gtkeventbox.h>
+ #include <gtk/gtkvbox.h>
+ #include <gtk/gtkhbox.h>
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/plugins/mono/mono-plugin.c evolution-2.7.91.64-bit/plugins/mono/mono-plugin.c
+--- evolution-2.7.91.orig/plugins/mono/mono-plugin.c 2005-12-17 13:47:10.000000000 -0500
++++ evolution-2.7.91.64-bit/plugins/mono/mono-plugin.c 2006-08-24 13:18:29.000000000 -0400
+@@ -8,6 +8,7 @@
+ #include <mono/metadata/object.h>
+ #include <mono/metadata/appdomain.h>
+ #include <mono/metadata/assembly.h>
++#include <mono/metadata/threads.h>
+ #include <mono/jit/jit.h>
+
+ #define d(x)
--- /dev/null
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/calendar/gui/apps_evolution_calendar.schemas.in.in evolution-2.7.91.uri/calendar/gui/apps_evolution_calendar.schemas.in.in
+--- evolution-2.7.91.orig/calendar/gui/apps_evolution_calendar.schemas.in.in 2006-08-07 00:47:42.000000000 -0400
++++ evolution-2.7.91.uri/calendar/gui/apps_evolution_calendar.schemas.in.in 2006-08-24 13:06:28.000000000 -0400
+@@ -577,5 +577,19 @@
+ <long>The URL template to use as a free/busy data fallback, %u is replaced by the user part of the mail address and %d is replaced by the domain.</long>
+ </locale>
+ </schema>
++
++ <schema>
++ <key>/schemas/apps/evolution/calendar/audio_dir</key>
++ <applyto>/apps/evolution/calendar/audio_dir</applyto>
++ <owner>evolution-calendar</owner>
++ <type>string</type>
++ <locale name="C">
++ <short>Save directory for alarm audio</short>
++ <long>
++ Directory for saving alarm audio files
++ </long>
++ </locale>
++ </schema>
++
+ </schemalist>
+ </gconfschemafile>
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/calendar/gui/calendar-config-keys.h evolution-2.7.91.uri/calendar/gui/calendar-config-keys.h
+--- evolution-2.7.91.orig/calendar/gui/calendar-config-keys.h 2006-07-22 07:14:50.000000000 -0400
++++ evolution-2.7.91.uri/calendar/gui/calendar-config-keys.h 2006-08-24 12:05:43.000000000 -0400
+@@ -91,7 +91,7 @@
+ /* Free/Busy settings */
+ #define CALENDAR_CONFIG_TEMPLATE CALENDAR_CONFIG_PREFIX"/publish/template"
+
+-#define CALENDAR_CONFIG_SAVE_DIR "/apps/evolution/mail/save_dir"
++#define CALENDAR_CONFIG_SAVE_DIR CALENDAR_CONFIG_PREFIX"/audio_dir"
+ G_END_DECLS
+
+ #endif
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/calendar/gui/dialogs/alarm-dialog.c evolution-2.7.91.uri/calendar/gui/dialogs/alarm-dialog.c
+--- evolution-2.7.91.orig/calendar/gui/dialogs/alarm-dialog.c 2006-07-09 23:54:00.000000000 -0400
++++ evolution-2.7.91.uri/calendar/gui/dialogs/alarm-dialog.c 2006-08-24 11:47:41.000000000 -0400
+@@ -1080,6 +1080,7 @@
+ dir = calendar_config_get_dir_path ();
+ if ( dir && *dir )
+ gnome_file_entry_set_default_path (GNOME_FILE_ENTRY (dialog->aalarm_file_entry), dir);
++ g_free(dir);
+ check_custom_sound (dialog);
+ break;
+
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/e-util/e-dialog-utils.c evolution-2.7.91.uri/e-util/e-dialog-utils.c
+--- evolution-2.7.91.orig/e-util/e-dialog-utils.c 2006-05-31 23:29:48.000000000 -0400
++++ evolution-2.7.91.uri/e-util/e-dialog-utils.c 2006-08-24 11:45:27.000000000 -0400
+@@ -28,6 +28,10 @@
+
+ #include "e-dialog-utils.h"
+
++#include <unistd.h>
++#include <glib.h>
++#include <glib/gstdio.h>
++
+ #include <gdkconfig.h>
+ #ifdef GDK_WINDOWING_X11
+ #include <gdk/gdkx.h>
+@@ -37,18 +41,19 @@
+ #include <gtk/gtkplug.h>
+ #include <gtk/gtkversion.h>
+
+-#ifdef USE_GTKFILECHOOSER
+ #include <gtk/gtkfilechooser.h>
+ #include <gtk/gtkfilechooserdialog.h>
+ #include <gtk/gtkstock.h>
+-#else
+-#include <gtk/gtkfilesel.h>
+-#endif
+
+ #include <gconf/gconf-client.h>
+ #include <libgnome/gnome-i18n.h>
+ #include <libgnome/gnome-util.h>
+
++#include <libgnomevfs/gnome-vfs-utils.h>
++
++#include "e-util/e-util.h"
++#include "e-util/e-error.h"
++
+ \f
+ /**
+ * e_notice:
+@@ -261,104 +266,42 @@
+ GtkWidget *fs;
+ char **filename = data;
+ char *uri;
+- const char *path;
+- int btn = GTK_RESPONSE_YES;
+- GConfClient *gconf = gconf_client_get_default();
+- char *dir;
+
+ fs = gtk_widget_get_toplevel (widget);
+-#ifdef USE_GTKFILECHOOSER
+- path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (fs));
+ uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (fs));
+-#else
+- path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs));
+-#endif
+-
+- 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?"));
+- gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
+
+- btn = gtk_dialog_run (GTK_DIALOG (dlg));
+- gtk_widget_destroy (dlg);
+- }
+-
+- if (btn == GTK_RESPONSE_YES) {
+- dir = g_path_get_dirname (path);
+- gconf_client_set_string(gconf, "/apps/evolution/mail/save_dir", dir, NULL);
+- g_free (dir);
++ if (e_file_can_save((GtkWindow *)widget, uri)) {
++ e_file_update_save_path(gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER(fs)), TRUE);
+ *filename = uri;
+ }
+- g_object_unref(gconf);
+
+ gtk_main_quit ();
+ }
+
+-#ifdef USE_GTKFILECHOOSER
+ static void
+ filechooser_response (GtkWidget *fc, gint response_id, gpointer data)
+ {
+- if (response_id == GTK_RESPONSE_ACCEPT)
++ if (response_id == GTK_RESPONSE_OK)
+ save_ok (fc, data);
+ else
+ gtk_widget_destroy (fc);
+ }
+-#endif
+
+ char *
+ e_file_dialog_save (const char *title, const char *fname)
+ {
+ GtkWidget *selection;
+ char *filename = NULL;
+- char *dir, *gdir = NULL;
+- GConfClient *gconf;
+-
+- gconf = gconf_client_get_default();
+- dir = gdir = gconf_client_get_string(gconf, "/apps/evolution/mail/save_dir", NULL);
+- g_object_unref(gconf);
+-
+- if (dir == NULL)
+- dir = (char *)g_get_home_dir();
+-
+-#ifdef USE_GTKFILECHOOSER
+- selection = gtk_file_chooser_dialog_new (title,
+- NULL,
+- GTK_FILE_CHOOSER_ACTION_SAVE,
+- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+- GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+- NULL);
+- gtk_dialog_set_default_response (GTK_DIALOG (selection), GTK_RESPONSE_ACCEPT);
+- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (selection), dir);
+- gtk_file_chooser_set_local_only (selection, FALSE);
+-
+- if (fname)
+- gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER (selection), fname);
+-
+- g_signal_connect (G_OBJECT (selection), "response", G_CALLBACK (filechooser_response), &filename);
+-#else
+- char *path;
+
+- selection = gtk_file_selection_new (title);
+- path = g_strdup_printf ("%s/", dir);
+- gtk_file_selection_set_filename (GTK_FILE_SELECTION (selection), path);
+- g_free (path);
++ selection = e_file_get_save_filesel(NULL, title, fname, GTK_FILE_CHOOSER_ACTION_SAVE);
+
+- g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (selection)->ok_button), "clicked", G_CALLBACK (save_ok), &filename);
+- g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (selection)->cancel_button), "clicked", G_CALLBACK (gtk_main_quit), NULL);
+-#endif
++ g_signal_connect (G_OBJECT (selection), "response", G_CALLBACK (filechooser_response), &filename);
+
+ gtk_widget_show (GTK_WIDGET (selection));
+ gtk_grab_add (GTK_WIDGET (selection));
+ gtk_main ();
+
+ gtk_widget_destroy (GTK_WIDGET (selection));
+- g_free (gdir);
+
+ return filename;
+ }
+@@ -369,83 +312,147 @@
+ GtkWidget *fs;
+ char **filename = data;
+ char *uri;
+- const char *path;
+- GConfClient *gconf = gconf_client_get_default();
+
+ fs = gtk_widget_get_toplevel (widget);
+-#ifdef USE_GTKFILECHOOSER
+- path = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (fs));
+ uri = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (fs));
+-#else
+- path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs));
+-#endif
+
+- gconf_client_set_string(gconf, "/apps/evolution/mail/save_dir", path, NULL);
+- g_object_unref(gconf);
++ e_file_update_save_path(uri, FALSE);
+ *filename = uri;
+
+ gtk_main_quit ();
+ }
+
+-#ifdef USE_GTKFILECHOOSER
+ static void
+ folderchooser_response (GtkWidget *fc, gint response_id, gpointer data)
+ {
+- if (response_id == GTK_RESPONSE_ACCEPT)
++ if (response_id == GTK_RESPONSE_OK)
+ save_folder_ok (fc, data);
+ else
+ gtk_widget_destroy (fc);
+ }
+-#endif
+
+ char *
+ e_file_dialog_save_folder (const char *title)
+ {
+ GtkWidget *selection;
+-#ifndef USE_GTKFILECHOOSER
+- char *path;
+-#endif
+ char *filename = NULL;
+- char *dir, *gdir = NULL;
+- GConfClient *gconf;
+-
+- gconf = gconf_client_get_default();
+- dir = gdir = gconf_client_get_string(gconf, "/apps/evolution/mail/save_dir", NULL);
+- g_object_unref(gconf);
+-
+- if (dir == NULL)
+- dir = (char *)g_get_home_dir();
+-
+-#ifdef USE_GTKFILECHOOSER
+- selection = gtk_file_chooser_dialog_new (title,
+- NULL,
+- GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
+- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+- GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+- NULL);
+- gtk_dialog_set_default_response (GTK_DIALOG (selection), GTK_RESPONSE_ACCEPT);
+- gtk_file_chooser_set_local_only (selection, FALSE);
+- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (selection), dir);
+
++ selection = e_file_get_save_filesel(NULL, title, NULL, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
+ g_signal_connect (G_OBJECT (selection), "response", G_CALLBACK (folderchooser_response), &filename);
+-#else
+- selection = gtk_file_selection_new (title);
+- path = g_strdup_printf ("%s/", dir);
+- gtk_file_selection_set_filename (GTK_FILE_SELECTION (selection), path);
+- g_free (path);
+-
+- g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (selection)->ok_button), "clicked", G_CALLBACK (save_folder_ok), &filename);
+- g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (selection)->cancel_button), "clicked", G_CALLBACK (gtk_main_quit), NULL);
+-#endif
+
+ gtk_widget_show (GTK_WIDGET (selection));
+ gtk_grab_add (GTK_WIDGET (selection));
+ gtk_main ();
+
+ gtk_widget_destroy (GTK_WIDGET (selection));
+- g_free (gdir);
+
+ return filename;
+ }
+
++/**
++ * e_file_get_save_filesel:
++ * @parent: parent window
++ * @title: dialog title
++ * @name: filename
++ * @action: action for dialog
++ *
++ * Creates a save dialog, using the saved directory from gconf. The dialog has
++ * no signals connected and is not shown.
++ **/
++GtkWidget *
++e_file_get_save_filesel (GtkWidget *parent, const char *title, const char *name, GtkFileChooserAction action)
++{
++ GtkWidget *filesel;
++ char *realname, *uri;
++
++ filesel = gtk_file_chooser_dialog_new (title,
++ NULL,
++ action,
++ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
++ GTK_STOCK_SAVE, GTK_RESPONSE_OK,
++ NULL);
++ gtk_dialog_set_default_response (GTK_DIALOG (filesel), GTK_RESPONSE_OK);
++ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filesel), FALSE);
++
++ if (parent)
++ e_dialog_set_transient_for((GtkWindow *)filesel, parent);
++
++ uri = e_file_get_save_path();
++
++ if (name && name[0]) {
++ realname = gnome_vfs_escape_string (name);
++ } else {
++ realname = NULL;
++ }
++
++ gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (filesel), uri);
++
++ if (realname)
++ gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (filesel), realname);
++
++ g_free (realname);
++ g_free (uri);
++
++ return filesel;
++}
++
++/**
++ * e_file_can_save:
++ *
++ * Return TRUE if the URI can be saved to, FALSE otherwise. It checks local
++ * files to see if they're regular and can be accessed. If the file exists and
++ * is writable, it pops up a dialog asking the user if they want to overwrite
++ * it. Returns the users choice.
++ **/
++gboolean
++e_file_can_save(GtkWindow *parent, const char *uri)
++{
++ struct stat st;
++ char *path;
++ gboolean res;
++
++ if (!uri || uri[0] == 0)
++ return FALSE;
+
++ /* Assume remote files are writable; too costly to check */
++ if (!e_file_check_local(uri))
++ return TRUE;
++
++ path = gnome_vfs_get_local_path_from_uri(uri);
++ if (!path)
++ return FALSE;
++
++ /* make sure we can actually save to it... */
++ if (g_stat (path, &st) != -1 && !S_ISREG (st.st_mode)) {
++ g_free(path);
++ return FALSE;
++ }
++
++ res = TRUE;
++ if (g_access (path, F_OK) == 0) {
++ if (g_access (path, W_OK) != 0) { e_error_run(parent, "mail:no-save-path", path, g_strerror(errno), NULL);
++ g_free(path);
++ return FALSE;
++ }
++
++ res = e_error_run(parent, E_ERROR_ASK_FILE_EXISTS_OVERWRITE, path, NULL) == GTK_RESPONSE_OK;
++
++ }
++
++ g_free(path);
++ return res;
++}
++
++gboolean
++e_file_check_local (const char *name)
++{
++ char *uri;
++
++ uri = gnome_vfs_get_local_path_from_uri(name);
++ if (uri) {
++ g_free(uri);
++ return TRUE;
++ }
++
++ return FALSE;
++}
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/e-util/e-dialog-utils.h evolution-2.7.91.uri/e-util/e-dialog-utils.h
+--- evolution-2.7.91.orig/e-util/e-dialog-utils.h 2005-10-18 05:57:20.000000000 -0400
++++ evolution-2.7.91.uri/e-util/e-dialog-utils.h 2006-08-24 11:44:48.000000000 -0400
+@@ -24,6 +24,7 @@
+ #define E_DIALOG_UTILS_H
+
+ #include <gtk/gtkmessagedialog.h>
++#include <gtk/gtkfilechooser.h>
+
+ void e_notice (gpointer parent,
+ GtkMessageType type,
+@@ -43,5 +44,10 @@
+
+ char *e_file_dialog_save_folder (const char *title);
+
++GtkWidget * e_file_get_save_filesel (GtkWidget *parent, const char *title, const char *name, GtkFileChooserAction action);
++
++gboolean e_file_can_save(GtkWindow *parent, const char *uri);
++gboolean e_file_check_local(const char *name);
++
+
+ #endif
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/e-util/e-util.c evolution-2.7.91.uri/e-util/e-util.c
+--- evolution-2.7.91.orig/e-util/e-util.c 2006-07-24 04:21:14.000000000 -0400
++++ evolution-2.7.91.uri/e-util/e-util.c 2006-08-24 11:45:06.000000000 -0400
+@@ -1187,4 +1187,45 @@
+ return font_options;
+ }
+
++/**
++ * e_file_update_save_path:
++ * @uri: URI to store
++ * @free: If TRUE, free uri
++ *
++ * Save the save_dir path for evolution. If free is TRUE, uri gets freed when
++ * done. Genearally, this should be called with the output of
++ * gtk_file_chooser_get_current_folder_uri() The URI must be a path URI, not a
++ * file URI.
++ **/
++void
++e_file_update_save_path(char *uri, gboolean free)
++{
++ GConfClient *gconf = gconf_client_get_default();
++
++ gconf_client_set_string(gconf, "/apps/evolution/mail/save_dir", uri, NULL);
++ g_object_unref(gconf);
++ if (free)
++ g_free(uri);
++}
++
++/**
++ * e_file_get_save_path:
++ *
++ * Return the save_dir path for evolution. If there isn't a save_dir, returns
++ * the users home directory. Returns an allocated URI that should be freed by
++ * the caller.
++ **/
++char *
++e_file_get_save_path(void)
++{
++ GConfClient *gconf = gconf_client_get_default();
++ char *uri;
++
++ uri = gconf_client_get_string(gconf, "/apps/evolution/mail/save_dir", NULL);
++ g_object_unref(gconf);
++
++ if (uri == NULL)
++ uri = gnome_vfs_get_uri_from_local_path(g_get_home_dir());
++ return (uri);
++}
+
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/e-util/e-util.h evolution-2.7.91.uri/e-util/e-util.h
+--- evolution-2.7.91.orig/e-util/e-util.h 2006-07-22 07:14:52.000000000 -0400
++++ evolution-2.7.91.uri/e-util/e-util.h 2006-08-24 11:44:45.000000000 -0400
+@@ -215,6 +215,8 @@
+ Less than 0 for the int means copy the whole string. */
+ gchar *e_strdup_append_strings (gchar *first_string,
+ ...);
++void e_file_update_save_path(char *uri, gboolean free);
++char *e_file_get_save_path(void);
+ cairo_font_options_t * get_font_options ();
+
+ #ifdef __cplusplus
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/mail/em-utils.c evolution-2.7.91.uri/mail/em-utils.c
+--- evolution-2.7.91.orig/mail/em-utils.c 2006-05-31 23:29:48.000000000 -0400
++++ evolution-2.7.91.uri/mail/em-utils.c 2006-08-23 23:50:18.000000000 -0400
+@@ -90,23 +90,6 @@
+
+ #define d(x)
+
+-static gboolean
+-emu_file_check_local (const char *name)
+-{
+- CamelURL *url;
+- gboolean local = FALSE;
+-
+- url = camel_url_new (name, NULL);
+- if (url == NULL)
+- return TRUE;
+-
+- if (!g_ascii_strcasecmp (url->protocol, "file"))
+- local = TRUE;
+-
+- camel_url_free (url);
+-
+- return local;
+-}
+ /**
+ * em_utils_prompt_user:
+ * @parent: parent window
+@@ -375,119 +358,24 @@
+
+ /* Saving messages... */
+
+-static GtkWidget *
+-emu_get_save_filesel (GtkWidget *parent, const char *title, const char *name, GtkFileChooserAction action)
+-{
+- GtkWidget *filesel;
+- const char *dir;
+- char *realname, *gdir;
+- GConfClient *gconf;
+-
+-#ifdef USE_GTKFILECHOOSER
+- filesel = gtk_file_chooser_dialog_new (title,
+- NULL,
+- action,
+- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+- GTK_STOCK_SAVE, GTK_RESPONSE_OK,
+- NULL);
+- gtk_dialog_set_default_response (GTK_DIALOG (filesel), GTK_RESPONSE_OK);
+- gtk_file_chooser_set_local_only (filesel, FALSE);
+-#else
+- char *filename;
+-
+- filesel = gtk_file_selection_new (title);
+-#endif
+-
+- if (parent)
+- e_dialog_set_transient_for((GtkWindow *)filesel, parent);
+-
+- gconf = gconf_client_get_default();
+- dir = gdir = gconf_client_get_string(gconf, "/apps/evolution/mail/save_dir", NULL);
+- g_object_unref(gconf);
+-
+- if (dir == NULL)
+- dir = g_get_home_dir();
+-
+- if (name && name[0]) {
+- realname = g_strdup (name);
+- em_filename_make_safe (realname);
+- } else {
+- realname = NULL;
+- }
+-
+-#ifdef USE_GTKFILECHOOSER
+- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filesel), dir);
+-
+- if (realname)
+- gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (filesel), realname);
+-#else
+- filename = g_build_filename (dir, G_DIR_SEPARATOR_S, realname, NULL);
+- gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesel), filename);
+- g_free (filename);
+-#endif
+-
+- g_free (realname);
+- g_free (gdir);
+-
+- return filesel;
+-}
+-
+-static void
+-emu_update_save_path(const char *filename, gboolean path)
+-{
+- char *dir = path ? (char *)filename : g_path_get_dirname(filename);
+- GConfClient *gconf = gconf_client_get_default();
+-
+- gconf_client_set_string(gconf, "/apps/evolution/mail/save_dir", dir, NULL);
+- g_object_unref(gconf);
+- if (!path)
+- g_free(dir);
+-}
+-
+-static gboolean
+-emu_can_save(GtkWindow *parent, const char *path)
+-{
+- struct stat st;
+-
+- if (!path || path[0] == 0)
+- return FALSE;
+-
+- /* make sure we can actually save to it... */
+- if (g_stat (path, &st) != -1 && !S_ISREG (st.st_mode))
+- return FALSE;
+-
+- if (g_access (path, F_OK) == 0) {
+- if (g_access (path, W_OK) != 0) {
+- e_error_run(parent, "mail:no-save-path", path, g_strerror(errno), NULL);
+- return FALSE;
+- }
+-
+- return e_error_run(parent, E_ERROR_ASK_FILE_EXISTS_OVERWRITE, path, NULL) == GTK_RESPONSE_OK;
+- }
+-
+- return TRUE;
+-}
+-
+ static void
+ emu_save_part_response(GtkWidget *filesel, int response, CamelMimePart *part)
+ {
+- const char *path;
+- const char *uri;
++ char *uri;
+
+ if (response == GTK_RESPONSE_OK) {
+-#ifdef USE_GTKFILECHOOSER
+ uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (filesel));
+- path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filesel));
+-#else
+- path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
+-#endif
+
+- if (emu_file_check_local(uri) && !emu_can_save((GtkWindow *)filesel, path))
++ if (!e_file_can_save((GtkWindow *)filesel, uri)) {
++ g_free(uri);
+ return;
++ }
+
+- emu_update_save_path(path, FALSE);
++ e_file_update_save_path(gtk_file_chooser_get_current_folder_uri(
++ GTK_FILE_CHOOSER(filesel)), TRUE);
+ /* FIXME: popup error if it fails? */
+ mail_save_part(part, uri, NULL, NULL, FALSE);
++ g_free(uri);
+ }
+
+ gtk_widget_destroy((GtkWidget *)filesel);
+@@ -519,7 +407,7 @@
+ }
+ }
+
+- filesel = emu_get_save_filesel(parent, prompt, name, GTK_FILE_CHOOSER_ACTION_SAVE);
++ filesel = e_file_get_save_filesel(parent, prompt, name, GTK_FILE_CHOOSER_ACTION_SAVE);
+ camel_object_ref(part);
+ g_signal_connect (filesel, "response", G_CALLBACK (emu_save_part_response), part);
+ gtk_widget_show (filesel);
+@@ -528,16 +416,11 @@
+ static void
+ emu_save_parts_response (GtkWidget *filesel, int response, GSList *parts)
+ {
+- char *path = NULL;
+ GSList *selected;
++ char *uri = NULL;
+ if (response == GTK_RESPONSE_OK) {
+-#ifdef USE_GTKFILECHOOSER
+- path = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (filesel));
+-#else
+- path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
+-#endif
+-
+- emu_update_save_path(path, TRUE);
++ uri = gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER (filesel));
++ e_file_update_save_path(uri, FALSE);
+
+ for ( selected = parts; selected != NULL; selected = selected->next) {
+ const char *file_name;
+@@ -560,8 +443,8 @@
+ file_name = safe_name;
+ }
+
+- file_path = g_build_filename (path, file_name, NULL);
+- if (!g_file_test(file_path, (G_FILE_TEST_EXISTS)) || e_error_run(NULL, E_ERROR_ASK_FILE_EXISTS_OVERWRITE, file_name, NULL) == GTK_RESPONSE_OK)
++ file_path = g_build_filename (uri, file_name, NULL);
++ if (!e_file_check_local(file_path) || !g_file_test(file_path, (G_FILE_TEST_EXISTS)) || e_error_run(NULL, E_ERROR_ASK_FILE_EXISTS_OVERWRITE, file_name, NULL) == GTK_RESPONSE_OK)
+ mail_save_part(part, file_path, NULL, NULL, FALSE);
+ else
+ g_warning ("Could not save %s. File already exists", file_path);
+@@ -570,7 +453,7 @@
+ g_free (safe_name);
+ }
+
+- g_free (path);
++ g_free (uri);
+ }
+
+ g_slist_free (parts);
+@@ -582,7 +465,7 @@
+ {
+ GtkWidget *filesel;
+
+- filesel = emu_get_save_filesel (parent, prompt, NULL, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
++ filesel = e_file_get_save_filesel (parent, prompt, NULL, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
+ g_signal_connect (filesel, "response", G_CALLBACK (emu_save_parts_response), parts);
+ gtk_widget_show (filesel);
+ }
+@@ -643,21 +526,21 @@
+ static void
+ emu_save_messages_response(GtkWidget *filesel, int response, struct _save_messages_data *data)
+ {
+- const char *path;
++ char *uri;
+
+ if (response == GTK_RESPONSE_OK) {
+-#ifdef USE_GTKFILECHOOSER
+- path = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (filesel));
+-#else
+- path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
+-#endif
++ uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (filesel));
+
+- if (!emu_can_save((GtkWindow *)filesel, path))
++ if (!e_file_can_save((GtkWindow *)filesel, uri)) {
++ g_free(uri);
+ return;
++ }
+
+- emu_update_save_path(path, FALSE);
+- mail_save_messages(data->folder, data->uids, path, NULL, NULL);
++ e_file_update_save_path(gtk_file_chooser_get_current_folder_uri(
++ GTK_FILE_CHOOSER (filesel)), TRUE);
++ mail_save_messages(data->folder, data->uids, uri, NULL, NULL);
+ data->uids = NULL;
++ g_free(uri);
+ }
+
+ camel_object_unref(data->folder);
+@@ -685,7 +568,7 @@
+ g_return_if_fail (CAMEL_IS_FOLDER (folder));
+ g_return_if_fail (uids != NULL);
+
+- filesel = emu_get_save_filesel(parent, _("Save Message..."), NULL, GTK_FILE_CHOOSER_ACTION_SAVE);
++ filesel = e_file_get_save_filesel(parent, _("Save Message..."), NULL, GTK_FILE_CHOOSER_ACTION_SAVE);
+ camel_object_ref(folder);
+
+ data = g_malloc(sizeof(struct _save_messages_data));
+diff --exclude-from=/home/dang/.diffrc -u -ruN evolution-2.7.91.orig/mail/evolution-mail.schemas.in.in evolution-2.7.91.uri/mail/evolution-mail.schemas.in.in
+--- evolution-2.7.91.orig/mail/evolution-mail.schemas.in.in 2006-07-22 07:14:53.000000000 -0400
++++ evolution-2.7.91.uri/mail/evolution-mail.schemas.in.in 2006-08-24 13:04:58.000000000 -0400
+@@ -913,5 +913,20 @@
+ </locale>
+ </schema>
+
++ <!-- save directory settings -->
++
++ <schema>
++ <key>/schemas/apps/evolution/mail/save_dir</key>
++ <applyto>/apps/evolution/mail/save_dir</applyto>
++ <owner>evolution-mail</owner>
++ <type>string</type>
++ <locale name="C">
++ <short>Save directory</short>
++ <long>
++ Directory for saving mail component files
++ </long>
++ </locale>
++ </schema>
++
+ </schemalist>
+ </gconfschemafile>