aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-callbacks.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-04-16 09:01:47 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-04-16 09:01:47 +0800
commitc0d763a702f850c0653e98e951b3de4a8d3c2c06 (patch)
tree62be2edad50c0b669b8a47bd58befd94e053dd4f /mail/mail-callbacks.c
parent2f8b268fd1af1d1b1eb80088c40ccd11a0a4adaf (diff)
downloadgsoc2013-evolution-c0d763a702f850c0653e98e951b3de4a8d3c2c06.tar
gsoc2013-evolution-c0d763a702f850c0653e98e951b3de4a8d3c2c06.tar.gz
gsoc2013-evolution-c0d763a702f850c0653e98e951b3de4a8d3c2c06.tar.bz2
gsoc2013-evolution-c0d763a702f850c0653e98e951b3de4a8d3c2c06.tar.lz
gsoc2013-evolution-c0d763a702f850c0653e98e951b3de4a8d3c2c06.tar.xz
gsoc2013-evolution-c0d763a702f850c0653e98e951b3de4a8d3c2c06.tar.zst
gsoc2013-evolution-c0d763a702f850c0653e98e951b3de4a8d3c2c06.zip
Mark the messages as seen, not unseen. (is_drafts_folder): New function to
2001-04-15 Jeffrey Stedfast <fejj@ximian.com> * mail-callbacks.c (mark_all_as_seen): Mark the messages as seen, not unseen. (is_drafts_folder): New function to attempt to determine if a folder is a drafts folder. (open_msg): Use is_drafts_folder(). (edit_msg): And here. (edit_msg_internal): New function that doesn't do the drafts checking and is only to be used internally. This should save us from having to doubly-check a folder to see if it's a drafts folder when doing an Open on the message. (open_msg): Call edit_msg_internal once we've established that the folder is a drafts folder. svn path=/trunk/; revision=9336
Diffstat (limited to 'mail/mail-callbacks.c')
-rw-r--r--mail/mail-callbacks.c90
1 files changed, 77 insertions, 13 deletions
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 0fabec67f5..8a5e0de29f 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -1006,14 +1006,84 @@ do_edit_messages(CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, void
}
}
}
-
+
+static gboolean
+is_drafts_folder (CamelFolder *folder)
+{
+ /* FIXME: hide other attributes of the URL? */
+ CamelService *service = CAMEL_SERVICE (folder->parent_store);
+ guint32 flags = CAMEL_URL_HIDE_PASSWORD | CAMEL_URL_HIDE_PARAMS;
+ const GSList *accounts;
+ CamelURL *url;
+ char *str;
+
+ if (folder == drafts_folder)
+ return TRUE;
+
+ str = camel_url_to_string (service->url, flags);
+ url = camel_url_new (str, NULL);
+ g_free (str);
+
+ g_free (url->path);
+ url->path = g_strdup_printf ("/%s", folder->full_name);
+
+ accounts = mail_config_get_accounts ();
+ while (accounts) {
+ const MailConfigAccount *account = accounts->data;
+
+ if (account && account->drafts_folder_uri) {
+ CamelURL *drafts_url;
+
+ drafts_url = camel_url_new (account->drafts_folder_uri, NULL);
+
+ if (drafts_url) {
+ g_free (drafts_url->passwd);
+ drafts_url->passwd = NULL;
+
+ if (drafts_url->params) {
+ g_datalist_clear (&url->params);
+ url->params = NULL;
+ }
+
+ if (camel_url_equal (url, drafts_url)) {
+ camel_url_free (drafts_url);
+ camel_url_free (url);
+
+ return TRUE;
+ }
+
+ camel_url_free (drafts_url);
+ }
+ }
+
+ accounts = accounts->next;
+ }
+
+ camel_url_free (url);
+
+ return FALSE;
+}
+
+static void
+edit_msg_internal (FolderBrowser *fb)
+{
+ GPtrArray *uids;
+
+ if (!check_send_configuration (fb))
+ return;
+
+ uids = g_ptr_array_new ();
+ message_list_foreach (fb->message_list, enumerate_msg, uids);
+
+ mail_get_messages (fb->folder, uids, do_edit_messages, fb);
+}
+
void
edit_msg (GtkWidget *widget, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
- GPtrArray *uids;
- if (fb->folder != drafts_folder) {
+ if (is_drafts_folder (fb->folder)) {
GtkWidget *message;
message = gnome_warning_dialog (_("You may only edit messages saved\n"
@@ -1022,13 +1092,7 @@ edit_msg (GtkWidget *widget, gpointer user_data)
return;
}
- if (!check_send_configuration (fb))
- return;
-
- uids = g_ptr_array_new ();
- message_list_foreach (fb->message_list, enumerate_msg, uids);
-
- mail_get_messages (fb->folder, uids, do_edit_messages, fb);
+ edit_msg_internal (fb);
}
static void
@@ -1413,7 +1477,7 @@ do_view_message(CamelFolder *folder, char *uid, CamelMimeMessage *message, void
void
view_msg (GtkWidget *widget, gpointer user_data)
{
- FolderBrowser *fb = user_data;
+ FolderBrowser *fb = FOLDER_BROWSER (user_data);
GPtrArray *uids;
int i;
@@ -1434,8 +1498,8 @@ open_msg (GtkWidget *widget, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
- if (fb->folder == drafts_folder)
- edit_msg (NULL, user_data);
+ if (is_drafts_folder (fb->folder))
+ edit_msg_internal (fb);
else
view_msg (NULL, user_data);
}