aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-05-09 13:08:25 +0800
committerDan Winship <danw@src.gnome.org>2000-05-09 13:08:25 +0800
commitc6de9ace9fe9b4a438583ed143f9b3b99211091d (patch)
tree9e9eb677c5cc455fbf2530812ab730264d75d1c3
parentdebd40014f38065b6a72fbadefd60a0cadd2c89d (diff)
downloadgsoc2013-evolution-c6de9ace9fe9b4a438583ed143f9b3b99211091d.tar
gsoc2013-evolution-c6de9ace9fe9b4a438583ed143f9b3b99211091d.tar.gz
gsoc2013-evolution-c6de9ace9fe9b4a438583ed143f9b3b99211091d.tar.bz2
gsoc2013-evolution-c6de9ace9fe9b4a438583ed143f9b3b99211091d.tar.lz
gsoc2013-evolution-c6de9ace9fe9b4a438583ed143f9b3b99211091d.tar.xz
gsoc2013-evolution-c6de9ace9fe9b4a438583ed143f9b3b99211091d.tar.zst
gsoc2013-evolution-c6de9ace9fe9b4a438583ed143f9b3b99211091d.zip
make this a little less kludgy. Use gnome_error_dialog rather than printf
* folder-browser.c (folder_browser_load_folder): make this a little less kludgy. Use gnome_error_dialog rather than printf on errors. * mail-ops.c (fetch_mail): Fix to work with the new shell stuff... sorta. Will need more fixing later when the new shell framework is more done. * mail-config.c (finish): Call gnome_config_sync so the data actually gets written. svn path=/trunk/; revision=2931
-rw-r--r--mail/ChangeLog13
-rw-r--r--mail/folder-browser.c27
-rw-r--r--mail/mail-config.c2
-rw-r--r--mail/mail-ops.c52
4 files changed, 50 insertions, 44 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index e6f2d4605b..f2faf01123 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,16 @@
+2000-05-09 Dan Winship <danw@helixcode.com>
+
+ * folder-browser.c (folder_browser_load_folder): make this a
+ little less kludgy. Use gnome_error_dialog rather than printf on
+ errors.
+
+ * mail-ops.c (fetch_mail): Fix to work with the new shell stuff...
+ sorta. Will need more fixing later when the new shell framework is
+ more done.
+
+ * mail-config.c (finish): Call gnome_config_sync so the data
+ actually gets written.
+
2000-05-08 Dan Winship <danw@helixcode.com>
* mail-display.c (save_data_cb):
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 424523e212..b7a3c9faa1 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -64,14 +64,23 @@ folder_browser_class_init (GtkObjectClass *object_class)
static gboolean
folder_browser_load_folder (FolderBrowser *fb, const char *name)
{
- char *store_name;
+ char *store_name, *msg;
CamelStore *store;
CamelFolder *new_folder;
CamelException *ex;
gboolean new_folder_exists = FALSE;
- /* Change "file:" to "mbox:". FIXME :) */
- store_name = g_strdup_printf ("mbox%s", strchr (name, ':'));
+ if (strncmp (name, "file:", 5) != 0) {
+ char *msg;
+
+ msg = g_strdup_printf ("Can't open URI %s", name);
+ gnome_error_dialog (msg);
+ g_free (msg);
+ return FALSE;
+ }
+
+ /* Change "file:" to "mbox:". */
+ store_name = g_strdup_printf ("mbox:%s", name + 5);
ex = camel_exception_new ();
store = camel_session_get_store (session, store_name, ex);
@@ -82,8 +91,9 @@ folder_browser_load_folder (FolderBrowser *fb, const char *name)
}
if (camel_exception_get_id (ex)) {
- printf ("Unable to get folder %s: %s\n", name,
- camel_exception_get_description (ex));
+ msg = g_strdup_printf ("Unable to get folder %s: %s\n", name,
+ camel_exception_get_description (ex));
+ gnome_error_dialog (msg);
camel_exception_free (ex);
return FALSE;
}
@@ -91,8 +101,10 @@ folder_browser_load_folder (FolderBrowser *fb, const char *name)
/* If the folder does not exist, we don't want to show it */
new_folder_exists = camel_folder_exists (new_folder, ex);
if (camel_exception_get_id (ex)) {
- printf ("Unable to test for folder existence: %s\n",
- camel_exception_get_description (ex));
+ msg = g_strdup_printf ("Unable to test if folder %s "
+ "exists: %s\n", name,
+ camel_exception_get_description (ex));
+ gnome_error_dialog (msg);
camel_exception_free (ex);
return FALSE;
}
@@ -102,7 +114,6 @@ folder_browser_load_folder (FolderBrowser *fb, const char *name)
gtk_object_unref (GTK_OBJECT (new_folder));
return FALSE;
}
-
if (fb->folder)
gtk_object_unref (GTK_OBJECT (fb->folder));
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 50444b34e9..0467d72bf0 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -878,6 +878,8 @@ finish (GnomeDruidPage *page, gpointer arg1, gpointer window)
path = g_strdup_printf ("=%s/config=/mail/transport", evolution_dir);
gnome_config_set_string (path, transport);
g_free (path);
+
+ gnome_config_sync ();
}
void
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 4ff3299d98..5c68337f52 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -67,14 +67,16 @@ check_configured (void)
return configured;
}
+/* FIXME: This is BROKEN! It fetches mail into whatever folder you're
+ * currently viewing.
+ */
void
fetch_mail (GtkWidget *button, gpointer user_data)
{
-#if 0
FolderBrowser *fb = FOLDER_BROWSER (user_data);
CamelException *ex;
CamelStore *store = NULL;
- CamelFolder *folder = NULL, *outfolder = NULL;
+ CamelFolder *folder = NULL;
int nmsgs, i;
CamelMimeMessage *msg = NULL;
char *path, *url = NULL;
@@ -94,6 +96,7 @@ fetch_mail (GtkWidget *button, gpointer user_data)
return;
}
+ path = CAMEL_SERVICE (fb->folder->parent_store)->url->path;
ex = camel_exception_new ();
/* If fetching mail from an mbox store, safely copy it to a
@@ -103,8 +106,7 @@ fetch_mail (GtkWidget *button, gpointer user_data)
char *tmp_mbox, *source;
int tmpfd;
- tmp_mbox = g_strdup_printf ("%s/movemail.XXXX",
- evolution_folders_dir);
+ tmp_mbox = g_strdup_printf ("%s/movemail.XXXX", path);
#ifdef HAVE_MKSTEMP
tmpfd = mkstemp (tmp_mbox);
#else
@@ -123,8 +125,10 @@ fetch_mail (GtkWidget *button, gpointer user_data)
}
close (tmpfd);
- /* Skip over "mbox://" plus host part (if any) or url. */
- source = strchr (url + 7, '/');
+ /* Skip over "mbox:" plus host part (if any) of url. */
+ source = url + 5;
+ if (!strncmp (source, "//", 2))
+ source = strchr (source + 2, '/');
switch (camel_movemail (source, tmp_mbox, ex)) {
case -1:
@@ -137,7 +141,7 @@ fetch_mail (GtkWidget *button, gpointer user_data)
goto cleanup;
}
- folder = camel_store_get_folder (default_session->store,
+ folder = camel_store_get_folder (fb->folder->parent_store,
strrchr (tmp_mbox, '/') + 1,
ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
@@ -183,20 +187,6 @@ fetch_mail (GtkWidget *button, gpointer user_data)
if (nmsgs == 0)
goto cleanup;
- outfolder = camel_store_get_folder (default_session->store,
- "inbox", ex);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
- mail_exception_dialog ("Unable to open inbox to store mail",
- ex, fb);
- goto cleanup;
- }
- camel_folder_open (outfolder, FOLDER_OPEN_WRITE, ex);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
- mail_exception_dialog ("Unable to open inbox to store mail",
- ex, fb);
- goto cleanup;
- }
-
for (i = 1; i <= nmsgs; i++) {
msg = camel_folder_get_message_by_number (folder, i, ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
@@ -205,7 +195,7 @@ fetch_mail (GtkWidget *button, gpointer user_data)
goto cleanup;
}
- camel_folder_append_message (outfolder, msg, ex);
+ camel_folder_append_message (fb->folder, msg, ex);
if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
mail_exception_dialog ("Unable to write message",
ex, fb);
@@ -221,7 +211,10 @@ fetch_mail (GtkWidget *button, gpointer user_data)
}
msg = NULL;
- folder_browser_set_uri (fb, "inbox"); /* FIXME */
+ /* Redisplay. Ick. FIXME */
+ path = g_strdup_printf ("file://%s", path);
+ folder_browser_set_uri (fb, path);
+ g_free (path);
cleanup:
if (url)
@@ -235,22 +228,9 @@ fetch_mail (GtkWidget *button, gpointer user_data)
camel_service_disconnect (CAMEL_SERVICE (store), ex);
gtk_object_unref (GTK_OBJECT (store));
}
-#if 0
- /* FIXME: we'll want to do this when the rest of the mail
- * stuff is refcounting things properly.
- */
- if (outfolder) {
- if (camel_folder_is_open (outfolder))
- camel_folder_close (outfolder, FALSE, ex);
- gtk_object_unref (GTK_OBJECT (outfolder));
- }
-#endif
camel_exception_free (ex);
if (msg)
gtk_object_unref (GTK_OBJECT (msg));
-#else
- printf ("Sorry, I'm broken! Try again tomorrow.");
-#endif
}