diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-shell-content.c | 1 | ||||
-rw-r--r-- | mail/em-event.c | 16 | ||||
-rw-r--r-- | mail/em-event.h | 17 | ||||
-rw-r--r-- | mail/em-utils.c | 135 | ||||
-rw-r--r-- | mail/em-utils.h | 4 |
5 files changed, 61 insertions, 112 deletions
diff --git a/mail/e-mail-shell-content.c b/mail/e-mail-shell-content.c index abb7e8fa26..b801093116 100644 --- a/mail/e-mail-shell-content.c +++ b/mail/e-mail-shell-content.c @@ -29,7 +29,6 @@ #include "widgets/menus/gal-view-etable.h" #include "widgets/menus/gal-view-instance.h" -#include "em-folder-view.h" #include "em-search-context.h" #include "em-utils.h" #include "mail-config.h" diff --git a/mail/em-event.c b/mail/em-event.c index b1bf7a7d05..5bc03ac875 100644 --- a/mail/em-event.c +++ b/mail/em-event.c @@ -147,16 +147,6 @@ em_event_target_new_folder (EMEvent *eme, const gchar *uri, guint new) return t; } -EMEventTargetFolderBrowser * -em_event_target_new_folder_browser (EMEvent *eme, EMFolderBrowser *emfb) -{ - EMEventTargetFolderBrowser *t = e_event_target_new(&eme->popup, EM_EVENT_TARGET_FOLDER_BROWSER, sizeof(*t)); - - t->emfb = emfb; - - return t; -} - EMEventTargetComposer * em_event_target_new_composer (EMEvent *eme, const EMsgComposer *composer, guint32 flags) { @@ -221,11 +211,6 @@ static const EEventHookTargetMask emeh_folder_masks[] = { { NULL } }; -static const EEventHookTargetMask emeh_folder_browser_masks[] = { - { "folderbrowser", EM_EVENT_FOLDER_BROWSER }, - { NULL } -}; - static const EEventHookTargetMask emeh_composer_masks[] = { { "sendoption", EM_EVENT_COMPOSER_SEND_OPTION }, { NULL } @@ -248,7 +233,6 @@ static const EEventHookTargetMask emeh_custom_icon_masks[] = { static const EEventHookTargetMap emeh_targets[] = { { "folder", EM_EVENT_TARGET_FOLDER, emeh_folder_masks }, - { "folderbrowser", EM_EVENT_TARGET_FOLDER_BROWSER, emeh_folder_browser_masks }, { "message", EM_EVENT_TARGET_MESSAGE, emeh_message_masks }, { "composer", EM_EVENT_TARGET_COMPOSER, emeh_composer_masks}, { "sendreceive", EM_EVENT_TARGET_SEND_RECEIVE, emeh_send_receive_masks}, diff --git a/mail/em-event.h b/mail/em-event.h index 770daa72f2..6680e88982 100644 --- a/mail/em-event.h +++ b/mail/em-event.h @@ -28,7 +28,6 @@ #include "e-util/e-event.h" #include "composer/e-msg-composer.h" -#include "mail/em-folder-browser.h" G_BEGIN_DECLS @@ -38,18 +37,12 @@ typedef struct _EMEventClass EMEventClass; /* Current target description */ enum _em_event_target_t { EM_EVENT_TARGET_FOLDER, - EM_EVENT_TARGET_FOLDER_BROWSER, EM_EVENT_TARGET_MESSAGE, EM_EVENT_TARGET_COMPOSER, EM_EVENT_TARGET_SEND_RECEIVE, EM_EVENT_TARGET_CUSTOM_ICON }; -/* Flags for FOLDER BROWSER Events*/ -enum { - EM_EVENT_FOLDER_BROWSER = 1<< 0 -}; - /* Flags that describe TARGET_FOLDER */ enum { EM_EVENT_FOLDER_NEWMAIL = 1<< 0 @@ -102,15 +95,6 @@ struct _EMEventTargetComposer { EMsgComposer *composer; }; -typedef struct _EMEventTargetFolderBrowser EMEventTargetFolderBrowser; - -struct _EMEventTargetFolderBrowser { - EEventTarget target; - - EMFolderBrowser *emfb; -}; - - typedef struct _EMEventTargetSendReceive EMEventTargetSendReceive; struct _EMEventTargetSendReceive { @@ -149,7 +133,6 @@ GType em_event_get_type(void); EMEvent *em_event_peek(void); EMEventTargetFolder *em_event_target_new_folder(EMEvent *emp, const gchar *uri, guint32 flags); -EMEventTargetFolderBrowser *em_event_target_new_folder_browser (EMEvent *eme, EMFolderBrowser *emfb); EMEventTargetComposer *em_event_target_new_composer(EMEvent *emp, const EMsgComposer *composer, guint32 flags); EMEventTargetMessage *em_event_target_new_message(EMEvent *emp, CamelFolder *folder, CamelMimeMessage *message, const gchar *uid, guint32 flags); EMEventTargetSendReceive * em_event_target_new_send_receive(EMEvent *eme, GtkWidget *table, gpointer data, gint row, guint32 flags); diff --git a/mail/em-utils.c b/mail/em-utils.c index e2af699898..1c3c6be40e 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -75,7 +75,6 @@ #include "em-utils.h" #include "em-composer-utils.h" -#include "em-folder-view.h" #include "em-format-quote.h" #include "em-account-editor.h" #include "e-attachment.h" @@ -775,59 +774,9 @@ em_utils_add_vcard (GtkWindow *parent, const gchar *vcard) /* ********************************************************************** */ /* Flag-for-Followup... */ -/* tag-editor callback data */ -struct ted_t { - EMFolderView *emfv; - MessageTagEditor *editor; - CamelFolder *folder; - GPtrArray *uids; -}; - -static void -ted_free (struct ted_t *ted) -{ - camel_object_unref (ted->folder); - em_utils_uids_free (ted->uids); - g_free (ted); -} - -static void -tag_editor_response (GtkWidget *dialog, gint button, struct ted_t *ted) -{ - CamelFolder *folder; - CamelTag *tags, *t; - GPtrArray *uids; - gint i; - - if (button == GTK_RESPONSE_OK && (tags = message_tag_editor_get_tag_list (ted->editor))) { - folder = ted->folder; - uids = ted->uids; - - camel_folder_freeze (folder); - for (i = 0; i < uids->len; i++) { - CamelMessageInfo *mi = camel_folder_get_message_info(folder, uids->pdata[i]); - - if (mi) { - for (t = tags; t; t = t->next) - camel_message_info_set_user_tag(mi, t->name, t->value); - - camel_message_info_free(mi); - } - } - - camel_folder_thaw (folder); - camel_tag_list_free (&tags); - - if (ted->emfv->preview) - em_format_redraw (EM_FORMAT (ted->emfv->preview)); - } - - gtk_widget_destroy (dialog); -} - /** * em_utils_flag_for_followup: - * @parent: parent window + * @reader: an #EMailReader * @folder: folder containing messages to flag * @uids: uids of messages to flag * @@ -835,37 +784,38 @@ tag_editor_response (GtkWidget *dialog, gint button, struct ted_t *ted) * @folder and @uids. **/ void -em_utils_flag_for_followup (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids) +em_utils_flag_for_followup (EMailReader *reader, + CamelFolder *folder, + GPtrArray *uids) { - GtkWidget *editor; - struct ted_t *ted; + EMFormatHTMLDisplay *html_display; + MessageTagEditor *editor; + GtkWindow *parent; + CamelTag *tags; gint i; - g_return_if_fail (GTK_IS_WINDOW (parent)); + g_return_if_fail (E_IS_MAIL_READER (reader)); g_return_if_fail (CAMEL_IS_FOLDER (folder)); g_return_if_fail (uids != NULL); - editor = (GtkWidget *) message_tag_followup_new (); + editor = message_tag_followup_new (); + parent = e_mail_reader_get_window (reader); gtk_window_set_transient_for (GTK_WINDOW (editor), parent); - camel_object_ref (folder); - - ted = g_new (struct ted_t, 1); - ted->emfv = (EMFolderView *) parent; - ted->editor = MESSAGE_TAG_EDITOR (editor); - ted->folder = folder; - ted->uids = uids; - for (i = 0; i < uids->len; i++) { CamelMessageInfo *info; info = camel_folder_get_message_info (folder, uids->pdata[i]); - if (info) { - message_tag_followup_append_message (MESSAGE_TAG_FOLLOWUP (editor), - camel_message_info_from (info), - camel_message_info_subject (info)); - camel_message_info_free(info); - } + + if (info == NULL) + continue; + + message_tag_followup_append_message ( + MESSAGE_TAG_FOLLOWUP (editor), + camel_message_info_from (info), + camel_message_info_subject (info)); + + camel_message_info_free(info); } /* special-case... */ @@ -874,18 +824,49 @@ em_utils_flag_for_followup (GtkWindow *parent, CamelFolder *folder, GPtrArray *u info = camel_folder_get_message_info (folder, uids->pdata[0]); if (info) { - const CamelTag *tags = camel_message_info_user_tags(info); + tags = (CamelTag *) camel_message_info_user_tags (info); if (tags) - message_tag_editor_set_tag_list (MESSAGE_TAG_EDITOR (editor), (CamelTag *)tags); - camel_message_info_free(info); + message_tag_editor_set_tag_list (editor, tags); + camel_message_info_free (info); } } - g_signal_connect (editor, "response", G_CALLBACK (tag_editor_response), ted); - g_object_weak_ref ((GObject *) editor, (GWeakNotify) ted_free, ted); + if (gtk_dialog_run (GTK_DIALOG (editor)) != GTK_RESPONSE_OK) + goto exit; + + tags = message_tag_editor_get_tag_list (editor); + if (tags == NULL) + goto exit; + + camel_folder_freeze (folder); + for (i = 0; i < uids->len; i++) { + CamelMessageInfo *info; + CamelTag *iter; + + info = camel_folder_get_message_info(folder, uids->pdata[i]); + + if (info == NULL) + continue; + + for (iter = tags; iter != NULL; iter = iter->next) + camel_message_info_set_user_tag ( + info, iter->name, iter->value); + + camel_message_info_free (info); + } + + camel_folder_thaw (folder); + camel_tag_list_free (&tags); + + html_display = e_mail_reader_get_html_display (reader); + em_format_redraw (EM_FORMAT (html_display)); + +exit: + /* XXX We shouldn't be freeing this. */ + em_utils_uids_free (uids); - gtk_widget_show (editor); + gtk_widget_destroy (GTK_WIDGET (editor)); } /** diff --git a/mail/em-utils.h b/mail/em-utils.h index 63056b28f4..64c4d7aba7 100644 --- a/mail/em-utils.h +++ b/mail/em-utils.h @@ -32,6 +32,8 @@ #include <camel/camel-mime-part.h> #include <camel/camel-stream.h> +#include <mail/e-mail-reader.h> + G_BEGIN_DECLS struct _EMFormat; @@ -55,7 +57,7 @@ void em_utils_save_messages (GtkWindow *parent, CamelFolder *folder, GPtrArray * void em_utils_add_address(GtkWindow *parent, const gchar *email); void em_utils_add_vcard(GtkWindow *parent, const gchar *vcard); -void em_utils_flag_for_followup (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids); +void em_utils_flag_for_followup (EMailReader *reader, CamelFolder *folder, GPtrArray *uids); void em_utils_flag_for_followup_clear (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids); void em_utils_flag_for_followup_completed (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids); |