aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Williams <peterw@src.gnome.org>2000-08-25 03:52:24 +0800
committerPeter Williams <peterw@src.gnome.org>2000-08-25 03:52:24 +0800
commit37471a4d5261636aea1a330ed2c42db9e665a9f9 (patch)
treed69efc71dc628fc3acc1d1afbf0c1a89b6ea3c31
parentba232a706ec696459290430ffd35b50536b80ce8 (diff)
downloadgsoc2013-evolution-37471a4d5261636aea1a330ed2c42db9e665a9f9.tar.gz
gsoc2013-evolution-37471a4d5261636aea1a330ed2c42db9e665a9f9.tar.zst
gsoc2013-evolution-37471a4d5261636aea1a330ed2c42db9e665a9f9.zip
Start adding progress info; make flag_all_messages camel-safe; make the no new mail dialog more descriptive.
svn path=/trunk/; revision=5016
-rw-r--r--mail/ChangeLog19
-rw-r--r--mail/mail-callbacks.c6
-rw-r--r--mail/mail-ops.c40
-rw-r--r--mail/mail-ops.h2
-rw-r--r--mail/mail-tools.c11
5 files changed, 70 insertions, 8 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 9513bc684e..811e918928 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,22 @@
+2000-08-24 Peter Williams <peterw@helixcode.com>
+
+ * mail-callbacks.c (mark_all_seen): Don't call camel_folder_get_uids
+ here. IMAP, for example, will try to communicate with the IMAP
+ server during that call.
+
+ * mail-ops.c (cleanup_fetch_mail): Tell the user
+ which URL has no new mail, as they may be checking
+ more than one source.
+ (mail_do_flag_all_messages): New function. Flags all of
+ the messages in a folder. Something of a hack. This merely
+ extends the flag_messages operation; it doesn't implement
+ a new one.
+ (do_flag_messages et al): Fetch the uids if we need to;
+ use camel_folder_free_uids if necessary, etc.
+
+ * mail-tools.c (mail_tool_move_folder_contents): Add
+ messages to tell the user what's going on.
+
2000-08-24 Christopher James Lahey <clahey@helixcode.com>
* folder-browser-factory.c: Fixed some warnings in the uihandler
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 3942b86a41..f80b91e136 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -453,14 +453,12 @@ mark_all_seen (BonoboUIHandler *uih, void *user_data, const char *path)
{
FolderBrowser *fb = FOLDER_BROWSER(user_data);
MessageList *ml = fb->message_list;
- GPtrArray *uids;
if (ml->folder == NULL)
return;
- uids = camel_folder_get_uids (ml->folder);
- mail_do_flag_messages (ml->folder, uids, FALSE,
- CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
+ mail_do_flag_all_messages (ml->folder, FALSE,
+ CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
}
void
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 55d392786d..7703122388 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -161,8 +161,12 @@ cleanup_fetch_mail (gpointer in_data, gpointer op_data, CamelException *ex)
if (data->empty && !camel_exception_is_set (ex)) {
GtkWidget *dialog;
+ gchar *str;
- dialog = gnome_ok_dialog (_("There is no new mail."));
+ str = g_strdup_printf (_("There is no new mail at %s."),
+ input->source_url);
+ dialog = gnome_ok_dialog (str);
+ g_free (str);
mail_dialog_run_and_close (GNOME_DIALOG (dialog));
}
@@ -615,6 +619,7 @@ typedef struct flag_messages_input_s
gboolean invert;
guint32 mask;
guint32 set;
+ gboolean flag_all;
}
flag_messages_input_t;
@@ -653,7 +658,7 @@ setup_flag_messages (gpointer in_data, gpointer op_data, CamelException *ex)
return;
}
- if (input->uids == NULL) {
+ if (!input->flag_all && input->uids == NULL) {
camel_exception_set (ex, CAMEL_EXCEPTION_INVALID_PARAM,
"No messages to flag have been specified.");
return;
@@ -670,6 +675,8 @@ do_flag_messages (gpointer in_data, gpointer op_data, CamelException *ex)
mail_tool_camel_lock_up ();
camel_folder_freeze (input->source);
+ if (input->uids == NULL)
+ input->uids = camel_folder_get_uids (input->source);
mail_tool_camel_lock_down ();
for (i = 0; i < input->uids->len; i++) {
@@ -686,10 +693,15 @@ do_flag_messages (gpointer in_data, gpointer op_data, CamelException *ex)
input->mask, input->set);
}
- g_free (input->uids->pdata[i]);
+ if (input->flag_all == FALSE)
+ g_free (input->uids->pdata[i]);
}
mail_tool_camel_lock_up ();
+ if (input->flag_all) {
+ camel_folder_free_uids (input->source, input->uids);
+ input->uids = NULL;
+ }
camel_folder_thaw (input->source);
mail_tool_camel_lock_down ();
}
@@ -701,7 +713,9 @@ cleanup_flag_messages (gpointer in_data, gpointer op_data,
flag_messages_input_t *input = (flag_messages_input_t *) in_data;
camel_object_unref (CAMEL_OBJECT (input->source));
- g_ptr_array_free (input->uids, TRUE);
+
+ if (input->uids)
+ g_ptr_array_free (input->uids, TRUE);
}
static const mail_operation_spec op_flag_messages = {
@@ -725,6 +739,24 @@ mail_do_flag_messages (CamelFolder *source, GPtrArray *uids,
input->invert = invert;
input->mask = mask;
input->set = set;
+ input->flag_all = FALSE;
+
+ mail_operation_queue (&op_flag_messages, input, TRUE);
+}
+
+void
+mail_do_flag_all_messages (CamelFolder *source, gboolean invert,
+ guint32 mask, guint32 set)
+{
+ flag_messages_input_t *input;
+
+ input = g_new (flag_messages_input_t, 1);
+ input->source = source;
+ input->uids = NULL;
+ input->invert = invert;
+ input->mask = mask;
+ input->set = set;
+ input->flag_all = TRUE;
mail_operation_queue (&op_flag_messages, input, TRUE);
}
diff --git a/mail/mail-ops.h b/mail/mail-ops.h
index 3566c40116..bcd2d1e2bc 100644
--- a/mail/mail-ops.h
+++ b/mail/mail-ops.h
@@ -45,6 +45,8 @@ void mail_do_transfer_messages (CamelFolder *source, GPtrArray *uids,
void mail_do_flag_messages (CamelFolder *source, GPtrArray *uids,
gboolean invert,
guint32 mask, guint32 set);
+void mail_do_flag_all_messages (CamelFolder *source, gboolean invert,
+ guint32 mask, guint32 set);
void mail_do_scan_subfolders (const gchar *source_uri, EvolutionStorage *storage);
void mail_do_attach_message (CamelFolder *folder, const char *uid,
EMsgComposer *composer);
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index d082409468..42eb6e1912 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -260,6 +260,8 @@ mail_tool_move_folder_contents (CamelFolder *source, CamelFolder *dest, gboolean
/* Get all uids of source */
+ mail_op_set_message ("Examining %s", source->full_name);
+
uids = camel_folder_get_uids (source);
printf ("mail_tool_move_folder: got %d messages in source\n", uids->len);
@@ -305,6 +307,11 @@ mail_tool_move_folder_contents (CamelFolder *source, CamelFolder *dest, gboolean
for (i = 0; i < uids->len; i++) {
CamelMimeMessage *msg;
const CamelMessageInfo *info;
+
+ /* Info */
+
+ mail_op_set_message ("Retrieving message %d of %d", i, uids->len);
+
/* Get the message */
msg = camel_folder_get_message (source, uids->pdata[i], ex);
@@ -315,6 +322,8 @@ mail_tool_move_folder_contents (CamelFolder *source, CamelFolder *dest, gboolean
/* Append it to dest */
+ mail_op_set_message ("Writing message %d of %d", i, uids->len);
+
info = camel_folder_get_message_info (source, uids->pdata[i]);
camel_folder_append_message (dest, msg, info, ex);
if (camel_exception_is_set (ex)) {
@@ -340,6 +349,8 @@ mail_tool_move_folder_contents (CamelFolder *source, CamelFolder *dest, gboolean
} else
camel_folder_free_uids (source, uids);
+ mail_op_set_message ("Saving changes to %s", source->full_name);
+
camel_folder_sync (source, TRUE, ex);
cleanup: