diff options
author | Not Zed <NotZed@Ximian.com> | 2002-08-06 10:45:07 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2002-08-06 10:45:07 +0800 |
commit | abafd9de4f2e7f63ec522aae1009a671cb19425c (patch) | |
tree | c1e2bed3b503d952f824d6db055e0af2a61fb162 /mail/folder-browser.c | |
parent | 4e8deb5e4cb135b2e4f6eed3e1ab8b51fa4228fd (diff) | |
download | gsoc2013-evolution-abafd9de4f2e7f63ec522aae1009a671cb19425c.tar.gz gsoc2013-evolution-abafd9de4f2e7f63ec522aae1009a671cb19425c.tar.zst gsoc2013-evolution-abafd9de4f2e7f63ec522aae1009a671cb19425c.zip |
Unref the driver before returning to main thread, so any closing
2002-08-06 Not Zed <NotZed@Ximian.com>
* mail-ops.c (filter_folder_filter): Unref the driver before
returning to main thread, so any closing operations are handled
async (as in fetch_mail_fetch()), for #28072.
** fixes for #24605.
* mail-vfolder.c (vfolder_gui_add_from_mlist): Removed.
* folder-browser.c (filter_type_uid,vfolder_type_uid): Changed to
accept args directly. Fixed callers.
(filter_mlist_uid,vfolder_mlist_uid): Use filter_type_uid instead
of mlist variant.
(vfolder_type_current): new function to handle setup of vfolders
from the main menu. It now uses the vfolder_type_uid function the
same as the popup.
(vfolder_subject, vfolder_sender, vfolder_recipient,
vfolder_mlist): Changed to use vfolder_type_current.
(filter_type_current): Similar for filters.
(filter_subject, filter_sender, filter_recipient,
filter_mlist): Changed to use filter_type_current.
* mail-autofilter.c (rule_from_message): Handle AUTO_MLIST type.
(rule_from_mlist):
(vfolder_rule_from_mlist):
(filter_rule_from_mlist): Removed.
(filter_gui_add_from_mlist): Removed.
* mail-autofilter.h: Added AUTO_MLIST type.
svn path=/trunk/; revision=17704
Diffstat (limited to 'mail/folder-browser.c')
-rw-r--r-- | mail/folder-browser.c | 143 |
1 files changed, 56 insertions, 87 deletions
diff --git a/mail/folder-browser.c b/mail/folder-browser.c index bff73f9922..b367d124d3 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -1297,91 +1297,63 @@ folder_browser_charset_changed (BonoboUIComponent *component, } } -/* external api to vfolder/filter on X, based on current message */ -void -vfolder_subject (GtkWidget *w, FolderBrowser *fb) -{ - vfolder_gui_add_from_message (fb->mail_display->current_message, AUTO_SUBJECT, fb->uri); -} - -void -vfolder_sender (GtkWidget *w, FolderBrowser *fb) -{ - vfolder_gui_add_from_message (fb->mail_display->current_message, AUTO_FROM, fb->uri); -} +static void vfolder_type_uid(CamelFolder *folder, const char *uid, const char *uri, int type); -void -vfolder_recipient (GtkWidget *w, FolderBrowser *fb) +static void +vfolder_type_current(FolderBrowser *fb, int type) { - vfolder_gui_add_from_message (fb->mail_display->current_message, AUTO_TO, fb->uri); -} + GPtrArray *uids; + int i; -void -vfolder_mlist (GtkWidget *w, FolderBrowser *fb) -{ - char *name; + /* get uid */ + uids = g_ptr_array_new(); + message_list_foreach(fb->message_list, enumerate_msg, uids); - g_return_if_fail (fb->mail_display->current_message != NULL); + if (uids->len == 1) + vfolder_type_uid(fb->folder, (char *)uids->pdata[0], fb->uri, type); - name = header_raw_check_mailing_list(&((CamelMimePart *)fb->mail_display->current_message)->headers); - if (name) { - g_strstrip (name); - vfolder_gui_add_from_mlist(name, fb->uri); - g_free(name); - } + for (i=0; i<uids->len; i++) + g_free(uids->pdata[i]); + g_ptr_array_free(uids, TRUE); } -void -filter_subject (GtkWidget *w, FolderBrowser *fb) -{ - const char *source = FILTER_SOURCE_INCOMING; - - if (folder_browser_is_sent (fb) || folder_browser_is_outbox (fb)) - source = FILTER_SOURCE_OUTGOING; - - filter_gui_add_from_message (fb->mail_display->current_message, source, AUTO_SUBJECT); -} +/* external api to vfolder/filter on X, based on current message */ +void vfolder_subject(GtkWidget *w, FolderBrowser *fb) { vfolder_type_current(fb, AUTO_SUBJECT); } +void vfolder_sender(GtkWidget *w, FolderBrowser *fb) { vfolder_type_current(fb, AUTO_FROM); } +void vfolder_recipient(GtkWidget *w, FolderBrowser *fb) { vfolder_type_current(fb, AUTO_TO); } +void vfolder_mlist(GtkWidget *w, FolderBrowser *fb) { vfolder_type_current(fb, AUTO_MLIST); } -void -filter_sender (GtkWidget *w, FolderBrowser *fb) -{ - const char *source = FILTER_SOURCE_INCOMING; - - if (folder_browser_is_sent (fb) || folder_browser_is_outbox (fb)) - source = FILTER_SOURCE_OUTGOING; - - filter_gui_add_from_message (fb->mail_display->current_message, source, AUTO_FROM); -} +static void filter_type_uid(CamelFolder *folder, const char *uid, const char *source, int type); -void -filter_recipient (GtkWidget *w, FolderBrowser *fb) +static void +filter_type_current(FolderBrowser *fb, int type) { - const char *source = FILTER_SOURCE_INCOMING; - - if (folder_browser_is_sent (fb) || folder_browser_is_outbox (fb)) - source = FILTER_SOURCE_OUTGOING; - - filter_gui_add_from_message (fb->mail_display->current_message, source, AUTO_TO); -} + GPtrArray *uids; + int i; + const char *source; -void -filter_mlist (GtkWidget *w, FolderBrowser *fb) -{ - const char *source = FILTER_SOURCE_INCOMING; - char *name; - - g_return_if_fail (fb->mail_display->current_message != NULL); - if (folder_browser_is_sent (fb) || folder_browser_is_outbox (fb)) source = FILTER_SOURCE_OUTGOING; - - name = header_raw_check_mailing_list(&((CamelMimePart *)fb->mail_display->current_message)->headers); - if (name) { - filter_gui_add_from_mlist(source, name); - g_free(name); - } + else + source = FILTER_SOURCE_INCOMING; + + /* get uid */ + uids = g_ptr_array_new(); + message_list_foreach(fb->message_list, enumerate_msg, uids); + + if (uids->len == 1) + filter_type_uid(fb->folder, (char *)uids->pdata[0], source, type); + + for (i=0; i<uids->len; i++) + g_free(uids->pdata[i]); + g_ptr_array_free(uids, TRUE); } +void filter_subject(GtkWidget *w, FolderBrowser *fb) { filter_type_current(fb, AUTO_SUBJECT); } +void filter_sender(GtkWidget *w, FolderBrowser *fb) { filter_type_current(fb, AUTO_FROM); } +void filter_recipient(GtkWidget *w, FolderBrowser *fb) { filter_type_current(fb, AUTO_TO); } +void filter_mlist(GtkWidget *w, FolderBrowser *fb) { filter_type_current(fb, AUTO_MLIST); } + /* ************************************************************ */ /* popup api to vfolder/filter on X, based on current selection */ @@ -1417,22 +1389,20 @@ vfolder_type_got_message(CamelFolder *folder, const char *uid, CamelMimeMessage } static void -vfolder_type_uid(struct _filter_data *fdata, int type) +vfolder_type_uid(CamelFolder *folder, const char *uid, const char *uri, int type) { struct _filter_data *data; - /* sigh, we need to copy this because the menu will free the one we got passed in */ data = g_malloc0(sizeof(*data)); data->type = type; - data->uri = fdata->uri; - fdata->uri = NULL; - mail_get_message(fdata->folder, fdata->uid, vfolder_type_got_message, data, mail_thread_new); + data->uri = g_strdup(uri); + mail_get_message(folder, uid, vfolder_type_got_message, data, mail_thread_new); } -static void vfolder_subject_uid (GtkWidget *w, struct _filter_data *fdata) { vfolder_type_uid(fdata, AUTO_SUBJECT); } -static void vfolder_sender_uid(GtkWidget *w, struct _filter_data *fdata) { vfolder_type_uid(fdata, AUTO_FROM); } -static void vfolder_recipient_uid(GtkWidget *w, struct _filter_data *fdata) { vfolder_type_uid(fdata, AUTO_TO); } -static void vfolder_mlist_uid(GtkWidget *w, struct _filter_data *fdata) { vfolder_gui_add_from_mlist(fdata->mlist, fdata->uri); } +static void vfolder_subject_uid (GtkWidget *w, struct _filter_data *fdata) { vfolder_type_uid(fdata->folder, fdata->uid, fdata->uri, AUTO_SUBJECT); } +static void vfolder_sender_uid(GtkWidget *w, struct _filter_data *fdata) { vfolder_type_uid(fdata->folder, fdata->uid, fdata->uri, AUTO_FROM); } +static void vfolder_recipient_uid(GtkWidget *w, struct _filter_data *fdata) { vfolder_type_uid(fdata->folder, fdata->uid, fdata->uri, AUTO_TO); } +static void vfolder_mlist_uid(GtkWidget *w, struct _filter_data *fdata) { vfolder_type_uid(fdata->folder, fdata->uid, fdata->uri, AUTO_MLIST); } static void filter_type_got_message(CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *d) @@ -1446,21 +1416,20 @@ filter_type_got_message(CamelFolder *folder, const char *uid, CamelMimeMessage * } static void -filter_type_uid(struct _filter_data *fdata, int type) +filter_type_uid(CamelFolder *folder, const char *uid, const char *source, int type) { struct _filter_data *data; - /* sigh, we need to copy this because the menu will free the one we got passed in */ data = g_malloc0(sizeof(*data)); data->type = type; - data->source = fdata->source; - mail_get_message(fdata->folder, fdata->uid, filter_type_got_message, data, mail_thread_new); + data->source = source; + mail_get_message(folder, uid, filter_type_got_message, data, mail_thread_new); } -static void filter_subject_uid (GtkWidget *w, struct _filter_data *fdata) { filter_type_uid(fdata, AUTO_SUBJECT); } -static void filter_sender_uid(GtkWidget *w, struct _filter_data *fdata) { filter_type_uid(fdata, AUTO_FROM); } -static void filter_recipient_uid(GtkWidget *w, struct _filter_data *fdata) { filter_type_uid(fdata, AUTO_TO); } -static void filter_mlist_uid(GtkWidget *w, struct _filter_data *fdata) { filter_gui_add_from_mlist(fdata->source, fdata->mlist); } +static void filter_subject_uid (GtkWidget *w, struct _filter_data *fdata) { filter_type_uid(fdata->folder, fdata->uid, fdata->source, AUTO_SUBJECT); } +static void filter_sender_uid(GtkWidget *w, struct _filter_data *fdata) { filter_type_uid(fdata->folder, fdata->uid, fdata->source, AUTO_FROM); } +static void filter_recipient_uid(GtkWidget *w, struct _filter_data *fdata) { filter_type_uid(fdata->folder, fdata->uid, fdata->source, AUTO_TO); } +static void filter_mlist_uid(GtkWidget *w, struct _filter_data *fdata) { filter_type_uid(fdata->folder, fdata->uid, fdata->source, AUTO_MLIST); } void hide_none(GtkWidget *w, FolderBrowser *fb) |