From 5e938b590f66a44ed69e0867efe5158b634a7f57 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 1 Dec 2009 11:43:13 -0500 Subject: Expand the EMailReader interface so it's easier to use. Adds the following methods: CamelFolder * (*get_folder) (EMailReader *reader); const gchar * (*get_folder_uri) (EMailReader *reader); GPtrArray * (*get_selected_uids) (EMailReader *reader); --- doc/reference/shell/tmpl/e-error.sgml | 120 --------- doc/reference/shell/tmpl/eshell-unused.sgml | 106 ++++++++ mail/e-mail-browser.c | 9 +- mail/e-mail-reader-utils.c | 55 ++--- mail/e-mail-reader.c | 268 +++++++++++---------- mail/e-mail-reader.h | 6 + mail/em-utils.c | 6 +- modules/mail/e-mail-shell-content.c | 59 ++--- modules/mail/e-mail-shell-view-actions.c | 54 ++--- modules/mail/e-mail-shell-view-private.c | 76 +++--- modules/mail/e-mail-shell-view.c | 9 +- plugins/groupwise-features/gw-ui.c | 14 +- plugins/groupwise-features/junk-mail-settings.c | 11 +- plugins/groupwise-features/mail-retract.c | 17 +- plugins/groupwise-features/status-track.c | 17 +- plugins/mail-to-task/mail-to-task.c | 12 +- .../mailing-list-actions/mailing-list-actions.c | 24 +- plugins/templates/templates.c | 14 +- 18 files changed, 415 insertions(+), 462 deletions(-) diff --git a/doc/reference/shell/tmpl/e-error.sgml b/doc/reference/shell/tmpl/e-error.sgml index 21055001f5..0aaf3e01c6 100644 --- a/doc/reference/shell/tmpl/e-error.sgml +++ b/doc/reference/shell/tmpl/e-error.sgml @@ -17,123 +17,3 @@ Error Dialog Functions - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -@parent: -@tag: -@arg0: -@Varargs: -@Returns: - - - - - - - -@parent: -@tag: -@arg0: -@ap: -@Returns: - - - - - - - -@parent: -@tag: -@arg0: -@Varargs: -@Returns: - - - - - - - -@parent: -@tag: -@arg0: -@ap: -@Returns: - - - - - - - -@dialog: -@Returns: - - diff --git a/doc/reference/shell/tmpl/eshell-unused.sgml b/doc/reference/shell/tmpl/eshell-unused.sgml index f8c2fbcec9..9478259742 100644 --- a/doc/reference/shell/tmpl/eshell-unused.sgml +++ b/doc/reference/shell/tmpl/eshell-unused.sgml @@ -583,6 +583,60 @@ intelligent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1858,6 +1912,58 @@ intelligent @revision: @Returns: + + + + + +@dialog: +@Returns: + + + + + + +@parent: +@tag: +@arg0: +@Varargs: +@Returns: + + + + + + +@parent: +@tag: +@arg0: +@ap: +@Returns: + + + + + + +@parent: +@tag: +@arg0: +@Varargs: +@Returns: + + + + + + +@parent: +@tag: +@arg0: +@ap: +@Returns: + diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c index e0d6aa9e16..ab27694778 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -193,7 +193,6 @@ mail_browser_message_selected_cb (EMailBrowser *browser, const gchar *uid) { EMFormatHTMLDisplay *html_display; - GtkWidget *message_list; CamelMessageInfo *info; CamelFolder *folder; EMailReader *reader; @@ -202,10 +201,9 @@ mail_browser_message_selected_cb (EMailBrowser *browser, return; reader = E_MAIL_READER (browser); + folder = e_mail_reader_get_folder (reader); html_display = e_mail_reader_get_html_display (reader); - message_list = e_mail_reader_get_message_list (reader); - folder = MESSAGE_LIST (message_list)->folder; info = camel_folder_get_message_info (folder, uid); if (info == NULL) @@ -606,7 +604,6 @@ mail_browser_set_message (EMailReader *reader, const gchar *uid) { EMailReaderIface *iface; - GtkWidget *message_list; CamelMessageInfo *info; CamelFolder *folder; @@ -619,9 +616,7 @@ mail_browser_set_message (EMailReader *reader, return; } - message_list = e_mail_reader_get_message_list (reader); - - folder = MESSAGE_LIST (message_list)->folder; + folder = e_mail_reader_get_folder (reader); info = camel_folder_get_message_info (folder, uid); if (info != NULL) { diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index de171d90ad..ff129a4a87 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -68,7 +68,6 @@ e_mail_reader_confirm_delete (EMailReader *reader) CamelFolder *folder; GtkWidget *check_button; GtkWidget *content_area; - GtkWidget *message_list; GtkWidget *dialog; GtkWindow *window; const gchar *label; @@ -79,15 +78,13 @@ e_mail_reader_confirm_delete (EMailReader *reader) g_return_val_if_fail (E_IS_MAIL_READER (reader), FALSE); - message_list = e_mail_reader_get_message_list (reader); + folder = e_mail_reader_get_folder (reader); window = e_mail_reader_get_window (reader); shell_backend = e_mail_reader_get_shell_backend (reader); shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - folder = MESSAGE_LIST (message_list)->folder; - prompt_delete_in_vfolder = e_shell_settings_get_boolean ( shell_settings, "mail-prompt-delete-in-vfolder"); @@ -131,7 +128,6 @@ e_mail_reader_mark_as_read (EMailReader *reader, const gchar *uid) { EMFormatHTMLDisplay *html_display; - GtkWidget *message_list; CamelFolder *folder; guint32 mask, set; guint32 flags; @@ -139,10 +135,9 @@ e_mail_reader_mark_as_read (EMailReader *reader, g_return_if_fail (E_IS_MAIL_READER (reader)); g_return_if_fail (uid != NULL); + folder = e_mail_reader_get_folder (reader); html_display = e_mail_reader_get_html_display (reader); - message_list = e_mail_reader_get_message_list (reader); - folder = MESSAGE_LIST (message_list)->folder; flags = camel_folder_get_message_flags (folder, uid); if (!(flags & CAMEL_MESSAGE_SEEN)) { @@ -162,21 +157,19 @@ e_mail_reader_mark_selected (EMailReader *reader, guint32 mask, guint32 set) { - GtkWidget *message_list; CamelFolder *folder; GPtrArray *uids; guint ii; g_return_val_if_fail (E_IS_MAIL_READER (reader), 0); - message_list = e_mail_reader_get_message_list (reader); + folder = e_mail_reader_get_folder (reader); - folder = MESSAGE_LIST (message_list)->folder; if (folder == NULL) return 0; camel_folder_freeze (folder); - uids = message_list_get_selected (MESSAGE_LIST (message_list)); + uids = e_mail_reader_get_selected_uids (reader); for (ii = 0; ii < uids->len; ii++) camel_folder_set_message_flags ( @@ -192,7 +185,6 @@ guint e_mail_reader_open_selected (EMailReader *reader) { EShellBackend *shell_backend; - GtkWidget *message_list; CamelFolder *folder; GtkWindow *window; GPtrArray *views; @@ -202,14 +194,12 @@ e_mail_reader_open_selected (EMailReader *reader) g_return_val_if_fail (E_IS_MAIL_READER (reader), 0); - message_list = e_mail_reader_get_message_list (reader); + folder = e_mail_reader_get_folder (reader); + folder_uri = e_mail_reader_get_folder_uri (reader); shell_backend = e_mail_reader_get_shell_backend (reader); + uids = e_mail_reader_get_selected_uids (reader); window = e_mail_reader_get_window (reader); - folder = MESSAGE_LIST (message_list)->folder; - folder_uri = MESSAGE_LIST (message_list)->folder_uri; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); - if (!em_utils_ask_open_many (window, uids->len)) { em_utils_uids_free (uids); return 0; @@ -283,7 +273,6 @@ void e_mail_reader_print (EMailReader *reader, GtkPrintOperationAction action) { - GtkWidget *message_list; EMFormatHTMLDisplay *html_display; EMFormatHTMLPrint *html_print; CamelFolder *folder; @@ -291,17 +280,16 @@ e_mail_reader_print (EMailReader *reader, g_return_if_fail (E_IS_MAIL_READER (reader)); - html_display = e_mail_reader_get_html_display (reader); - message_list = e_mail_reader_get_message_list (reader); - - folder = MESSAGE_LIST (message_list)->folder; + folder = e_mail_reader_get_folder (reader); g_return_if_fail (folder != NULL); /* XXX Learn to handle len > 1. */ - uids = message_list_get_selected (MESSAGE_LIST (message_list)); + uids = e_mail_reader_get_selected_uids (reader); if (uids->len != 1) goto exit; + html_display = e_mail_reader_get_html_display (reader); + html_print = em_format_html_print_new ( (EMFormatHTML *) html_display, action); em_format_merge_handler ( @@ -382,10 +370,10 @@ e_mail_reader_reply_to_message (EMailReader *reader, html_display = e_mail_reader_get_html_display (reader); html = ((EMFormatHTML *) html_display)->html; + folder = e_mail_reader_get_folder (reader); message_list = e_mail_reader_get_message_list (reader); window = e_mail_reader_get_window (reader); - folder = MESSAGE_LIST (message_list)->folder; uid = MESSAGE_LIST (message_list)->cursor_uid; g_return_if_fail (uid != NULL); @@ -480,7 +468,6 @@ void e_mail_reader_create_filter_from_selected (EMailReader *reader, gint filter_type) { - GtkWidget *message_list; CamelFolder *folder; const gchar *filter_source; const gchar *folder_uri; @@ -493,10 +480,8 @@ e_mail_reader_create_filter_from_selected (EMailReader *reader, g_return_if_fail (E_IS_MAIL_READER (reader)); - message_list = e_mail_reader_get_message_list (reader); - - folder = MESSAGE_LIST (message_list)->folder; - folder_uri = MESSAGE_LIST (message_list)->folder_uri; + folder = e_mail_reader_get_folder (reader); + folder_uri = e_mail_reader_get_folder_uri (reader); if (em_utils_folder_is_sent (folder, folder_uri)) filter_source = E_FILTER_SOURCE_OUTGOING; @@ -505,7 +490,7 @@ e_mail_reader_create_filter_from_selected (EMailReader *reader, else filter_source = E_FILTER_SOURCE_INCOMING; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); + uids = e_mail_reader_get_selected_uids (reader); if (uids->len == 1) { filter_data = g_malloc (sizeof (*filter_data)); @@ -545,7 +530,6 @@ void e_mail_reader_create_vfolder_from_selected (EMailReader *reader, gint vfolder_type) { - GtkWidget *message_list; CamelFolder *folder; const gchar *folder_uri; GPtrArray *uids; @@ -557,12 +541,9 @@ e_mail_reader_create_vfolder_from_selected (EMailReader *reader, g_return_if_fail (E_IS_MAIL_READER (reader)); - message_list = e_mail_reader_get_message_list (reader); - - folder = MESSAGE_LIST (message_list)->folder; - folder_uri = MESSAGE_LIST (message_list)->folder_uri; - - uids = message_list_get_selected (MESSAGE_LIST (message_list)); + folder = e_mail_reader_get_folder (reader); + folder_uri = e_mail_reader_get_folder_uri (reader); + uids = e_mail_reader_get_selected_uids (reader); if (uids->len == 1) { vfolder_data = g_malloc (sizeof (*vfolder_data)); diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 9055d6b26a..7ea11698a4 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -69,17 +69,14 @@ action_mail_add_sender_cb (GtkAction *action, { EShell *shell; EShellBackend *shell_backend; - GtkWidget *message_list; CamelMessageInfo *info; CamelFolder *folder; GPtrArray *uids; const gchar *address; - message_list = e_mail_reader_get_message_list (reader); + folder = e_mail_reader_get_folder (reader); shell_backend = e_mail_reader_get_shell_backend (reader); - - folder = MESSAGE_LIST (message_list)->folder; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); + uids = e_mail_reader_get_selected_uids (reader); if (uids->len != 1) goto exit; @@ -159,14 +156,11 @@ static void action_mail_check_for_junk_cb (GtkAction *action, EMailReader *reader) { - GtkWidget *message_list; CamelFolder *folder; GPtrArray *uids; - message_list = e_mail_reader_get_message_list (reader); - - folder = MESSAGE_LIST (message_list)->folder; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); + folder = e_mail_reader_get_folder (reader); + uids = e_mail_reader_get_selected_uids (reader); mail_filter_junk (folder, uids); } @@ -188,21 +182,18 @@ static void action_mail_copy_cb (GtkAction *action, EMailReader *reader) { - GtkWidget *message_list; CamelFolder *folder; GtkWidget *folder_tree; GtkWidget *dialog; - GtkWindow *parent; - GPtrArray *selected; + GtkWindow *window; + GPtrArray *uids; const gchar *uri; - parent = e_mail_reader_get_window (reader); - message_list = e_mail_reader_get_message_list (reader); + folder = e_mail_reader_get_folder (reader); + window = e_mail_reader_get_window (reader); + uids = e_mail_reader_get_selected_uids (reader); folder_tree = em_folder_tree_new (); - selected = message_list_get_selected (MESSAGE_LIST (message_list)); - - folder = MESSAGE_LIST (message_list)->folder; em_folder_tree_set_excluded ( EM_FOLDER_TREE (folder_tree), @@ -210,7 +201,7 @@ action_mail_copy_cb (GtkAction *action, EMFT_EXCLUDE_VTRASH); dialog = em_folder_selector_new ( - parent, EM_FOLDER_TREE (folder_tree), + window, EM_FOLDER_TREE (folder_tree), EM_FOLDER_SELECTOR_CAN_CREATE, _("Copy to Folder"), NULL, _("C_opy")); @@ -230,13 +221,13 @@ action_mail_copy_cb (GtkAction *action, if (uri != NULL) { mail_transfer_messages ( - folder, selected, FALSE, uri, 0, NULL, NULL); - selected = NULL; + folder, uids, FALSE, uri, 0, NULL, NULL); + uids = NULL; } exit: - if (selected != NULL) - em_utils_uids_free (selected); + if (uids != NULL) + em_utils_uids_free (uids); gtk_widget_destroy (dialog); } @@ -290,14 +281,11 @@ static void action_mail_filters_apply_cb (GtkAction *action, EMailReader *reader) { - GtkWidget *message_list; CamelFolder *folder; GPtrArray *uids; - message_list = e_mail_reader_get_message_list (reader); - - folder = MESSAGE_LIST (message_list)->folder; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); + folder = e_mail_reader_get_folder (reader); + uids = e_mail_reader_get_selected_uids (reader); mail_filter_on_demand (folder, uids); } @@ -314,18 +302,15 @@ action_mail_flag_clear_cb (GtkAction *action, EMailReader *reader) { EMFormatHTMLDisplay *html_display; - GtkWidget *message_list; CamelFolder *folder; GtkWindow *window; GPtrArray *uids; + folder = e_mail_reader_get_folder (reader); html_display = e_mail_reader_get_html_display (reader); - message_list = e_mail_reader_get_message_list (reader); + uids = e_mail_reader_get_selected_uids (reader); window = e_mail_reader_get_window (reader); - folder = MESSAGE_LIST (message_list)->folder; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); - em_utils_flag_for_followup_clear (window, folder, uids); em_format_redraw (EM_FORMAT (html_display)); @@ -336,18 +321,15 @@ action_mail_flag_completed_cb (GtkAction *action, EMailReader *reader) { EMFormatHTMLDisplay *html_display; - GtkWidget *message_list; CamelFolder *folder; GtkWindow *window; GPtrArray *uids; + folder = e_mail_reader_get_folder (reader); html_display = e_mail_reader_get_html_display (reader); - message_list = e_mail_reader_get_message_list (reader); + uids = e_mail_reader_get_selected_uids (reader); window = e_mail_reader_get_window (reader); - folder = MESSAGE_LIST (message_list)->folder; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); - em_utils_flag_for_followup_completed (window, folder, uids); em_format_redraw (EM_FORMAT (html_display)); @@ -357,17 +339,14 @@ static void action_mail_flag_for_followup_cb (GtkAction *action, EMailReader *reader) { - GtkWidget *message_list; CamelFolder *folder; GtkWindow *window; GPtrArray *uids; - message_list = e_mail_reader_get_message_list (reader); + folder = e_mail_reader_get_folder (reader); + uids = e_mail_reader_get_selected_uids (reader); window = e_mail_reader_get_window (reader); - folder = MESSAGE_LIST (message_list)->folder; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); - em_utils_flag_for_followup (reader, folder, uids); } @@ -375,18 +354,16 @@ static void action_mail_forward_cb (GtkAction *action, EMailReader *reader) { - GtkWidget *message_list; CamelFolder *folder; GtkWindow *window; GPtrArray *uids; const gchar *folder_uri; - message_list = e_mail_reader_get_message_list (reader); + folder = e_mail_reader_get_folder (reader); + folder_uri = e_mail_reader_get_folder_uri (reader); + uids = e_mail_reader_get_selected_uids (reader); window = e_mail_reader_get_window (reader); - folder = MESSAGE_LIST (message_list)->folder; - folder_uri = MESSAGE_LIST (message_list)->folder_uri; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); g_return_if_fail (uids != NULL); if (em_utils_ask_open_many (window, uids->len)) @@ -399,18 +376,16 @@ static void action_mail_forward_attached_cb (GtkAction *action, EMailReader *reader) { - GtkWidget *message_list; CamelFolder *folder; GtkWindow *window; GPtrArray *uids; const gchar *folder_uri; - message_list = e_mail_reader_get_message_list (reader); + folder = e_mail_reader_get_folder (reader); + folder_uri = e_mail_reader_get_folder_uri (reader); + uids = e_mail_reader_get_selected_uids (reader); window = e_mail_reader_get_window (reader); - folder = MESSAGE_LIST (message_list)->folder; - folder_uri = MESSAGE_LIST (message_list)->folder_uri; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); g_return_if_fail (uids != NULL); if (em_utils_ask_open_many (window, uids->len)) @@ -423,18 +398,16 @@ static void action_mail_forward_inline_cb (GtkAction *action, EMailReader *reader) { - GtkWidget *message_list; CamelFolder *folder; GtkWindow *window; GPtrArray *uids; const gchar *folder_uri; - message_list = e_mail_reader_get_message_list (reader); + folder = e_mail_reader_get_folder (reader); + folder_uri = e_mail_reader_get_folder_uri (reader); + uids = e_mail_reader_get_selected_uids (reader); window = e_mail_reader_get_window (reader); - folder = MESSAGE_LIST (message_list)->folder; - folder_uri = MESSAGE_LIST (message_list)->folder_uri; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); g_return_if_fail (uids != NULL); if (em_utils_ask_open_many (window, uids->len)) @@ -447,18 +420,16 @@ static void action_mail_forward_quoted_cb (GtkAction *action, EMailReader *reader) { - GtkWidget *message_list; CamelFolder *folder; GtkWindow *window; GPtrArray *uids; const gchar *folder_uri; - message_list = e_mail_reader_get_message_list (reader); + folder = e_mail_reader_get_folder (reader); + folder_uri = e_mail_reader_get_folder_uri (reader); + uids = e_mail_reader_get_selected_uids (reader); window = e_mail_reader_get_window (reader); - folder = MESSAGE_LIST (message_list)->folder; - folder_uri = MESSAGE_LIST (message_list)->folder_uri; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); g_return_if_fail (uids != NULL); if (em_utils_ask_open_many (window, uids->len)) @@ -555,16 +526,13 @@ static void action_mail_message_edit_cb (GtkAction *action, EMailReader *reader) { - GtkWidget *message_list; CamelFolder *folder; GtkWindow *window; GPtrArray *uids; + folder = e_mail_reader_get_folder (reader); + uids = e_mail_reader_get_selected_uids (reader); window = e_mail_reader_get_window (reader); - message_list = e_mail_reader_get_message_list (reader); - - folder = MESSAGE_LIST (message_list)->folder; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); em_utils_edit_messages (folder, uids, FALSE); } @@ -573,12 +541,9 @@ static void action_mail_message_new_cb (GtkAction *action, EMailReader *reader) { - GtkWidget *message_list; const gchar *folder_uri; - message_list = e_mail_reader_get_message_list (reader); - - folder_uri = MESSAGE_LIST (message_list)->folder_uri; + folder_uri = e_mail_reader_get_folder_uri (reader); em_utils_compose_new_message (folder_uri); } @@ -594,21 +559,18 @@ static void action_mail_move_cb (GtkAction *action, EMailReader *reader) { - GtkWidget *message_list; CamelFolder *folder; GtkWidget *folder_tree; GtkWidget *dialog; - GtkWindow *parent; - GPtrArray *selected; + GtkWindow *window; + GPtrArray *uids; const gchar *uri; - parent = e_mail_reader_get_window (reader); - message_list = e_mail_reader_get_message_list (reader); + folder = e_mail_reader_get_folder (reader); + uids = e_mail_reader_get_selected_uids (reader); + window = e_mail_reader_get_window (reader); folder_tree = em_folder_tree_new (); - selected = message_list_get_selected (MESSAGE_LIST (message_list)); - - folder = MESSAGE_LIST (message_list)->folder; em_folder_tree_set_excluded ( EM_FOLDER_TREE (folder_tree), @@ -616,7 +578,7 @@ action_mail_move_cb (GtkAction *action, EMFT_EXCLUDE_VTRASH); dialog = em_folder_selector_new ( - parent, EM_FOLDER_TREE (folder_tree), + window, EM_FOLDER_TREE (folder_tree), EM_FOLDER_SELECTOR_CAN_CREATE, _("Move to Folder"), NULL, _("_Move")); @@ -636,13 +598,13 @@ action_mail_move_cb (GtkAction *action, if (uri != NULL) { mail_transfer_messages ( - folder, selected, TRUE, uri, 0, NULL, NULL); - selected = NULL; + folder, uids, TRUE, uri, 0, NULL, NULL); + uids = NULL; } exit: - if (selected != NULL) - em_utils_uids_free (selected); + if (uids != NULL) + em_utils_uids_free (uids); gtk_widget_destroy (dialog); } @@ -795,10 +757,10 @@ action_mail_redirect_cb (GtkAction *action, GtkWindow *window; const gchar *uid; + folder = e_mail_reader_get_folder (reader); message_list = e_mail_reader_get_message_list (reader); window = e_mail_reader_get_window (reader); - folder = MESSAGE_LIST (message_list)->folder; uid = MESSAGE_LIST (message_list)->cursor_uid; g_return_if_fail (uid != NULL); @@ -832,7 +794,6 @@ action_mail_save_as_cb (GtkAction *action, { EShell *shell; EShellBackend *shell_backend; - GtkWidget *message_list; CamelMessageInfo *info; CamelFolder *folder; GPtrArray *uids; @@ -841,12 +802,10 @@ action_mail_save_as_cb (GtkAction *action, const gchar *suggestion; gchar *uri; - message_list = e_mail_reader_get_message_list (reader); + folder = e_mail_reader_get_folder (reader); shell_backend = e_mail_reader_get_shell_backend (reader); - shell = e_shell_backend_get_shell (shell_backend); + uids = e_mail_reader_get_selected_uids (reader); - folder = MESSAGE_LIST (message_list)->folder; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); g_return_if_fail (uids->len > 0); title = ngettext ("Save Message", "Save Messages", uids->len); @@ -859,6 +818,7 @@ action_mail_save_as_cb (GtkAction *action, } else suggestion = NULL; + shell = e_shell_backend_get_shell (shell_backend); file = e_shell_run_save_dialog (shell, title, suggestion, NULL, NULL); if (file == NULL) { @@ -947,18 +907,16 @@ action_mail_show_source_cb (GtkAction *action, { EMFormatHTMLDisplay *html_display; EShellBackend *shell_backend; - GtkWidget *message_list; CamelFolder *folder; GtkWidget *browser; GPtrArray *uids; const gchar *folder_uri; - message_list = e_mail_reader_get_message_list (reader); + folder = e_mail_reader_get_folder (reader); + folder_uri = e_mail_reader_get_folder_uri (reader); shell_backend = e_mail_reader_get_shell_backend (reader); + uids = e_mail_reader_get_selected_uids (reader); - folder = MESSAGE_LIST (message_list)->folder; - folder_uri = MESSAGE_LIST (message_list)->folder_uri; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); g_return_if_fail (uids->len > 0); browser = e_mail_browser_new (shell_backend); @@ -976,15 +934,12 @@ static void action_mail_toggle_important_cb (GtkAction *action, EMailReader *reader) { - GtkWidget *message_list; CamelFolder *folder; GPtrArray *uids; guint ii; - message_list = e_mail_reader_get_message_list (reader); - - folder = MESSAGE_LIST (message_list)->folder; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); + folder = e_mail_reader_get_folder (reader); + uids = e_mail_reader_get_selected_uids (reader); camel_folder_freeze (folder); @@ -1060,15 +1015,15 @@ action_search_folder_recipient_cb (GtkAction *action, EMailReader *reader) { EMFormatHTMLDisplay *html_display; - GtkWidget *message_list; EWebView *web_view; CamelURL *curl; + const gchar *folder_uri; const gchar *uri; /* This action is defined in EMailDisplay. */ + folder_uri = e_mail_reader_get_folder_uri (reader); html_display = e_mail_reader_get_html_display (reader); - message_list = e_mail_reader_get_message_list (reader); web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html); @@ -1080,13 +1035,10 @@ action_search_folder_recipient_cb (GtkAction *action, if (curl->path != NULL && *curl->path != '\0') { CamelInternetAddress *inet_addr; - const gchar *folder_uri; /* Ensure vfolder is running. */ vfolder_load_storage (); - folder_uri = MESSAGE_LIST (message_list)->folder_uri; - inet_addr = camel_internet_address_new (); camel_address_decode (CAMEL_ADDRESS (inet_addr), curl->path); vfolder_gui_add_from_address (inet_addr, AUTO_TO, folder_uri); @@ -1101,15 +1053,15 @@ action_search_folder_sender_cb (GtkAction *action, EMailReader *reader) { EMFormatHTMLDisplay *html_display; - GtkWidget *message_list; EWebView *web_view; CamelURL *curl; + const gchar *folder_uri; const gchar *uri; /* This action is defined in EMailDisplay. */ + folder_uri = e_mail_reader_get_folder_uri (reader); html_display = e_mail_reader_get_html_display (reader); - message_list = e_mail_reader_get_message_list (reader); web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html); @@ -1121,13 +1073,10 @@ action_search_folder_sender_cb (GtkAction *action, if (curl->path != NULL && *curl->path != '\0') { CamelInternetAddress *inet_addr; - const gchar *folder_uri; /* Ensure vfolder is running. */ vfolder_load_storage (); - folder_uri = MESSAGE_LIST (message_list)->folder_uri; - inet_addr = camel_internet_address_new (); camel_address_decode (CAMEL_ADDRESS (inet_addr), curl->path); vfolder_gui_add_from_address (inet_addr, AUTO_FROM, folder_uri); @@ -1918,10 +1867,12 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader) { EMFormatHTMLDisplay *html_display; GtkWidget *message_list; + CamelFolder *folder; const gchar *cursor_uid; const gchar *format_uid; const gchar *key; + folder = e_mail_reader_get_folder (reader); html_display = e_mail_reader_get_html_display (reader); message_list = e_mail_reader_get_message_list (reader); @@ -1944,8 +1895,7 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader) gint op_id; op_id = mail_get_messagex ( - MESSAGE_LIST (message_list)->folder, - cursor_uid, + folder, cursor_uid, mail_reader_message_loaded_cb, g_object_ref (reader), mail_msg_fast_ordered_push); @@ -2007,24 +1957,58 @@ mail_reader_emit_folder_loaded (EMailReader *reader) g_signal_emit (reader, signals[FOLDER_LOADED], 0); } +static GPtrArray * +mail_reader_get_selected_uids (EMailReader *reader) +{ + GtkWidget *message_list; + + message_list = e_mail_reader_get_message_list (reader); + + return message_list_get_selected (MESSAGE_LIST (message_list)); +} + +static CamelFolder * +mail_reader_get_folder (EMailReader *reader) +{ + GtkWidget *message_list; + + message_list = e_mail_reader_get_message_list (reader); + + return MESSAGE_LIST (message_list)->folder; +} + +static const gchar * +mail_reader_get_folder_uri (EMailReader *reader) +{ + GtkWidget *message_list; + + message_list = e_mail_reader_get_message_list (reader); + + return MESSAGE_LIST (message_list)->folder_uri; +} + static void mail_reader_set_folder (EMailReader *reader, CamelFolder *folder, const gchar *folder_uri) { EMFormatHTMLDisplay *html_display; + CamelFolder *previous_folder; GtkWidget *message_list; + const gchar *previous_folder_uri; gboolean outgoing; html_display = e_mail_reader_get_html_display (reader); message_list = e_mail_reader_get_message_list (reader); - if (MESSAGE_LIST (message_list)->folder != NULL) - mail_sync_folder ( - MESSAGE_LIST (message_list)->folder, NULL, NULL); + previous_folder = e_mail_reader_get_folder (reader); + previous_folder_uri = e_mail_reader_get_folder_uri (reader); + + if (previous_folder != NULL) + mail_sync_folder (previous_folder, NULL, NULL); /* Skip the rest if we're already viewing the folder. */ - if (g_strcmp0 (folder_uri, MESSAGE_LIST (message_list)->folder_uri) == 0) + if (g_strcmp0 (folder_uri, previous_folder_uri) == 0) return; outgoing = folder != NULL && folder_uri != NULL && ( @@ -2416,6 +2400,9 @@ mail_reader_init_charset_actions (EMailReader *reader) static void mail_reader_class_init (EMailReaderIface *iface) { + iface->get_selected_uids = mail_reader_get_selected_uids; + iface->get_folder = mail_reader_get_folder; + iface->get_folder_uri = mail_reader_get_folder_uri; iface->set_folder = mail_reader_set_folder; iface->set_message = mail_reader_set_message; iface->update_actions = mail_reader_update_actions; @@ -2673,7 +2660,6 @@ e_mail_reader_changed (EMailReader *reader) guint32 e_mail_reader_check_state (EMailReader *reader) { - GtkWidget *message_list; GPtrArray *uids; CamelFolder *folder; CamelStore *store = NULL; @@ -2698,10 +2684,9 @@ e_mail_reader_check_state (EMailReader *reader) g_return_val_if_fail (E_IS_MAIL_READER (reader), 0); - message_list = e_mail_reader_get_message_list (reader); - uids = message_list_get_selected (MESSAGE_LIST (message_list)); - folder_uri = MESSAGE_LIST (message_list)->folder_uri; - folder = MESSAGE_LIST (message_list)->folder; + folder = e_mail_reader_get_folder (reader); + folder_uri = e_mail_reader_get_folder_uri (reader); + uids = e_mail_reader_get_selected_uids (reader); if (folder != NULL) { store = CAMEL_STORE (folder->parent_store); @@ -2921,6 +2906,19 @@ e_mail_reader_get_popup_menu (EMailReader *reader) return iface->get_popup_menu (reader); } +GPtrArray * +e_mail_reader_get_selected_uids (EMailReader *reader) +{ + EMailReaderIface *iface; + + g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL); + + iface = E_MAIL_READER_GET_IFACE (reader); + g_return_val_if_fail (iface->get_selected_uids != NULL, NULL); + + return iface->get_selected_uids (reader); +} + EShellBackend * e_mail_reader_get_shell_backend (EMailReader *reader) { @@ -2947,6 +2945,32 @@ e_mail_reader_get_window (EMailReader *reader) return iface->get_window (reader); } +CamelFolder * +e_mail_reader_get_folder (EMailReader *reader) +{ + EMailReaderIface *iface; + + g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL); + + iface = E_MAIL_READER_GET_IFACE (reader); + g_return_val_if_fail (iface->get_folder != NULL, NULL); + + return iface->get_folder (reader); +} + +const gchar * +e_mail_reader_get_folder_uri (EMailReader *reader) +{ + EMailReaderIface *iface; + + g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL); + + iface = E_MAIL_READER_GET_IFACE (reader); + g_return_val_if_fail (iface->get_folder_uri != NULL, NULL); + + return iface->get_folder_uri (reader); +} + void e_mail_reader_set_folder (EMailReader *reader, CamelFolder *folder, diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h index 122d11fb88..6e3b8d4f9a 100644 --- a/mail/e-mail-reader.h +++ b/mail/e-mail-reader.h @@ -90,9 +90,12 @@ struct _EMailReaderIface { (*get_html_display) (EMailReader *reader); GtkWidget * (*get_message_list) (EMailReader *reader); GtkMenu * (*get_popup_menu) (EMailReader *reader); + GPtrArray * (*get_selected_uids) (EMailReader *reader); EShellBackend * (*get_shell_backend) (EMailReader *reader); GtkWindow * (*get_window) (EMailReader *reader); + CamelFolder * (*get_folder) (EMailReader *reader); + const gchar * (*get_folder_uri) (EMailReader *reader); void (*set_folder) (EMailReader *reader, CamelFolder *folder, const gchar *folder_uri); @@ -118,8 +121,11 @@ EMFormatHTMLDisplay * e_mail_reader_get_html_display (EMailReader *reader); GtkWidget * e_mail_reader_get_message_list (EMailReader *reader); GtkMenu * e_mail_reader_get_popup_menu (EMailReader *reader); +GPtrArray * e_mail_reader_get_selected_uids (EMailReader *reader); EShellBackend * e_mail_reader_get_shell_backend (EMailReader *reader); GtkWindow * e_mail_reader_get_window (EMailReader *reader); +CamelFolder * e_mail_reader_get_folder (EMailReader *reader); +const gchar * e_mail_reader_get_folder_uri (EMailReader *reader); void e_mail_reader_set_folder (EMailReader *reader, CamelFolder *folder, const gchar *folder_uri); diff --git a/mail/em-utils.c b/mail/em-utils.c index 1238fcf2e5..3cb662e5bd 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -399,7 +399,7 @@ em_utils_flag_for_followup (EMailReader *reader, EShellBackend *shell_backend; EShell *shell; GtkWidget *editor; - GtkWindow *parent; + GtkWindow *window; CamelTag *tags; gint i; @@ -408,8 +408,8 @@ em_utils_flag_for_followup (EMailReader *reader, g_return_if_fail (uids != NULL); editor = e_mail_tag_editor_new (); - parent = e_mail_reader_get_window (reader); - gtk_window_set_transient_for (GTK_WINDOW (editor), parent); + window = e_mail_reader_get_window (reader); + gtk_window_set_transient_for (GTK_WINDOW (editor), window); shell_backend = e_mail_reader_get_shell_backend (reader); shell = e_shell_backend_get_shell (shell_backend); diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c index fb4a6ab4fb..9be6677de3 100644 --- a/modules/mail/e-mail-shell-content.c +++ b/modules/mail/e-mail-shell-content.c @@ -135,7 +135,7 @@ mail_shell_content_scroll_timeout_cb (EMailShellContent *mail_shell_content) EMailShellContentPrivate *priv = mail_shell_content->priv; EShellContent *shell_content; EShellView *shell_view; - MessageList *message_list; + GtkWidget *message_list; EMailReader *reader; GKeyFile *key_file; const gchar *folder_uri; @@ -150,8 +150,8 @@ mail_shell_content_scroll_timeout_cb (EMailShellContent *mail_shell_content) key_file = e_shell_view_get_state_key_file (shell_view); reader = E_MAIL_READER (mail_shell_content); + folder_uri = e_mail_reader_get_folder_uri (reader); message_list = e_mail_reader_get_message_list (reader); - folder_uri = message_list->folder_uri; if (folder_uri == NULL) goto skip; @@ -166,7 +166,8 @@ mail_shell_content_scroll_timeout_cb (EMailShellContent *mail_shell_content) position = g_key_file_get_double ( key_file, group_name, key, NULL); - message_list_set_scrollbar_position (message_list, position); + message_list_set_scrollbar_position ( + MESSAGE_LIST (message_list), position); } g_free (group_name); @@ -275,14 +276,15 @@ mail_shell_content_display_view_cb (EMailShellContent *mail_shell_content, GalView *gal_view) { EMailReader *reader; - MessageList *message_list; + GtkWidget *message_list; reader = E_MAIL_READER (mail_shell_content); message_list = e_mail_reader_get_message_list (reader); if (GAL_IS_VIEW_ETABLE (gal_view)) gal_view_etable_attach_tree ( - GAL_VIEW_ETABLE (gal_view), message_list->tree); + GAL_VIEW_ETABLE (gal_view), + MESSAGE_LIST (message_list)->tree); } static void @@ -444,7 +446,7 @@ mail_shell_content_constructed (GObject *object) EShellView *shell_view; EShellViewClass *shell_view_class; EMailReader *reader; - MessageList *message_list; + GtkWidget *message_list; GConfBridge *bridge; GtkWidget *container; GtkWidget *widget; @@ -588,14 +590,14 @@ mail_shell_content_get_html_display (EMailReader *reader) return priv->html_display; } -static MessageList * +static GtkWidget * mail_shell_content_get_message_list (EMailReader *reader) { EMailShellContentPrivate *priv; priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); - return MESSAGE_LIST (priv->message_list); + return priv->message_list; } static GtkMenu * @@ -650,18 +652,19 @@ mail_shell_content_set_folder (EMailReader *reader, { EMailShellContentPrivate *priv; EMailReaderIface *default_iface; - MessageList *message_list; + GtkWidget *message_list; + CamelFolder *old_folder; gboolean different_folder; priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (reader); + old_folder = e_mail_reader_get_folder (reader); message_list = e_mail_reader_get_message_list (reader); - message_list_freeze (message_list); + message_list_freeze (MESSAGE_LIST (message_list)); different_folder = - message_list->folder != NULL && - folder != message_list->folder; + (old_folder != NULL && folder != old_folder); /* Chain up to interface's default set_folder() method. */ default_iface = g_type_default_interface_peek (E_TYPE_MAIL_READER); @@ -679,14 +682,15 @@ mail_shell_content_set_folder (EMailReader *reader, priv->suppress_message_selection = FALSE; /* This is a one-time-only callback. */ - if (message_list->cursor_uid == NULL && priv->message_list_built_id == 0) + if (MESSAGE_LIST (message_list)->cursor_uid == NULL && + priv->message_list_built_id == 0) priv->message_list_built_id = g_signal_connect_swapped ( message_list, "message-list-built", G_CALLBACK (mail_shell_content_message_list_built_cb), reader); exit: - message_list_thaw (message_list); + message_list_thaw (MESSAGE_LIST (message_list)); } static void @@ -847,12 +851,12 @@ e_mail_shell_content_set_preview_visible (EMailShellContent *mail_shell_content, * message if necessary, so we don't get an empty preview. */ if (preview_visible) { EMailReader *reader; - MessageList *message_list; + GtkWidget *message_list; const gchar *cursor_uid; reader = E_MAIL_READER (mail_shell_content); message_list = e_mail_reader_get_message_list (reader); - cursor_uid = message_list->cursor_uid; + cursor_uid = MESSAGE_LIST (message_list)->cursor_uid; if (cursor_uid != NULL) e_mail_reader_set_message (reader, cursor_uid); @@ -925,11 +929,12 @@ e_mail_shell_content_update_view_instance (EMailShellContent *mail_shell_content EShellViewClass *shell_view_class; GalViewCollection *view_collection; GalViewInstance *view_instance; - MessageList *message_list; + CamelFolder *folder; GtkOrientable *orientable; GtkOrientation orientation; gboolean outgoing_folder; gboolean show_vertical_view; + const gchar *folder_uri; gchar *view_id; g_return_if_fail (E_IS_MAIL_SHELL_CONTENT (mail_shell_content)); @@ -940,21 +945,22 @@ e_mail_shell_content_update_view_instance (EMailShellContent *mail_shell_content view_collection = shell_view_class->view_collection; reader = E_MAIL_READER (mail_shell_content); - message_list = e_mail_reader_get_message_list (reader); + folder = e_mail_reader_get_folder (reader); + folder_uri = e_mail_reader_get_folder_uri (reader); /* If no folder is selected, return silently. */ - if (message_list->folder == NULL) + if (folder == NULL) return; /* If we have a folder, we should also have a URI. */ - g_return_if_fail (message_list->folder_uri != NULL); + g_return_if_fail (folder_uri != NULL); if (mail_shell_content->priv->view_instance != NULL) { g_object_unref (mail_shell_content->priv->view_instance); mail_shell_content->priv->view_instance = NULL; } - view_id = mail_config_folder_to_safe_url (message_list->folder); + view_id = mail_config_folder_to_safe_url (folder); view_instance = e_shell_view_new_view_instance (shell_view, view_id); mail_shell_content->priv->view_instance = view_instance; @@ -992,12 +998,9 @@ e_mail_shell_content_update_view_instance (EMailShellContent *mail_shell_content g_free (view_id); outgoing_folder = - em_utils_folder_is_drafts ( - message_list->folder, message_list->folder_uri) || - em_utils_folder_is_outbox ( - message_list->folder, message_list->folder_uri) || - em_utils_folder_is_sent ( - message_list->folder, message_list->folder_uri); + em_utils_folder_is_drafts (folder, folder_uri) || + em_utils_folder_is_outbox (folder, folder_uri) || + em_utils_folder_is_sent (folder, folder_uri); if (outgoing_folder) { if (show_vertical_view) @@ -1017,7 +1020,7 @@ e_mail_shell_content_update_view_instance (EMailShellContent *mail_shell_content gchar *state_filename; state_filename = mail_config_folder_to_cachename ( - message_list->folder, "et-header-"); + folder, "et-header-"); if (g_file_test (state_filename, G_FILE_TEST_IS_REGULAR)) { ETableSpecification *spec; diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index a23f0a8dc2..93a3bf63a1 100644 --- a/modules/mail/e-mail-shell-view-actions.c +++ b/modules/mail/e-mail-shell-view-actions.c @@ -83,7 +83,6 @@ action_mail_create_search_folder_cb (GtkAction *action, EMailReader *reader; EShellView *shell_view; EShellContent *shell_content; - GtkWidget *message_list; EFilterRule *search_rule; EMVFolderRule *vfolder_rule; const gchar *folder_uri; @@ -103,8 +102,7 @@ action_mail_create_search_folder_cb (GtkAction *action, search_text = "''"; reader = E_MAIL_READER (shell_content); - message_list = e_mail_reader_get_message_list (reader); - folder_uri = MESSAGE_LIST (message_list)->folder_uri; + folder_uri = e_mail_reader_get_folder_uri (reader); search_rule = vfolder_clone_rule (search_rule); rule_name = g_strdup_printf ("%s %s", search_rule->name, search_text); @@ -195,7 +193,6 @@ action_mail_folder_expunge_cb (GtkAction *action, EMailShellView *mail_shell_view) { EMailReader *reader; - GtkWidget *message_list; EShellWindow *shell_window; EShellView *shell_view; CamelFolder *folder; @@ -204,9 +201,8 @@ action_mail_folder_expunge_cb (GtkAction *action, shell_window = e_shell_view_get_shell_window (shell_view); reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); - message_list = e_mail_reader_get_message_list (reader); - folder = MESSAGE_LIST (message_list)->folder; + folder = e_mail_reader_get_folder (reader); g_return_if_fail (folder != NULL); em_utils_expunge_folder (GTK_WIDGET (shell_window), folder); @@ -217,7 +213,6 @@ action_mail_folder_mark_all_as_read_cb (GtkAction *action, EMailShellView *mail_shell_view) { EMailReader *reader; - GtkWidget *message_list; EShellWindow *shell_window; EShellView *shell_view; CamelFolder *folder; @@ -232,9 +227,8 @@ action_mail_folder_mark_all_as_read_cb (GtkAction *action, parent = GTK_WINDOW (shell_window); reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); - message_list = e_mail_reader_get_message_list (reader); - folder = MESSAGE_LIST (message_list)->folder; + folder = e_mail_reader_get_folder (reader); g_return_if_fail (folder != NULL); key = "/apps/evolution/mail/prompts/mark_all_read"; @@ -243,7 +237,7 @@ action_mail_folder_mark_all_as_read_cb (GtkAction *action, if (!em_utils_prompt_user (parent, key, prompt, NULL)) return; - uids = message_list_get_uids (MESSAGE_LIST (message_list)); + uids = e_mail_reader_get_selected_uids (reader); camel_folder_freeze (folder); for (ii = 0; ii < uids->len; ii++) @@ -482,8 +476,8 @@ action_mail_hide_selected_cb (GtkAction *action, reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); message_list = e_mail_reader_get_message_list (reader); + uids = e_mail_reader_get_selected_uids (reader); - uids = message_list_get_selected (MESSAGE_LIST (message_list)); message_list_hide_uids (MESSAGE_LIST (message_list), uids); em_utils_uids_free (uids); } @@ -493,7 +487,6 @@ action_mail_label_cb (GtkToggleAction *action, EMailShellView *mail_shell_view) { EMailReader *reader; - GtkWidget *message_list; CamelFolder *folder; GPtrArray *uids; const gchar *tag; @@ -503,10 +496,8 @@ action_mail_label_cb (GtkToggleAction *action, g_return_if_fail (tag != NULL); reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); - message_list = e_mail_reader_get_message_list (reader); - folder = MESSAGE_LIST (message_list)->folder; - - uids = message_list_get_selected (MESSAGE_LIST (message_list)); + folder = e_mail_reader_get_folder (reader); + uids = e_mail_reader_get_selected_uids (reader); for (ii = 0; ii < uids->len; ii++) { if (gtk_toggle_action_get_active (action)) @@ -534,7 +525,6 @@ action_mail_label_new_cb (GtkAction *action, EMailLabelDialog *label_dialog; EMailLabelListStore *store; EMailReader *reader; - GtkWidget *message_list; CamelFolder *folder; GtkTreeModel *model; GtkTreeIter iter; @@ -580,10 +570,8 @@ action_mail_label_new_cb (GtkAction *action, label_tag = e_mail_label_list_store_get_tag (store, &iter); reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); - message_list = e_mail_reader_get_message_list (reader); - - folder = MESSAGE_LIST (message_list)->folder; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); + folder = e_mail_reader_get_folder (reader); + uids = e_mail_reader_get_selected_uids (reader); for (ii = 0; ii < uids->len; ii++) camel_folder_set_message_user_flag ( @@ -606,7 +594,6 @@ action_mail_label_none_cb (GtkAction *action, EShellSettings *shell_settings; EShellWindow *shell_window; EMailReader *reader; - GtkWidget *message_list; GtkTreeModel *tree_model; CamelFolder *folder; GtkTreeIter iter; @@ -623,9 +610,8 @@ action_mail_label_none_cb (GtkAction *action, shell_settings, "mail-label-list-store"); reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); - message_list = e_mail_reader_get_message_list (reader); - uids = message_list_get_selected (MESSAGE_LIST (message_list)); - folder = MESSAGE_LIST (message_list)->folder; + folder = e_mail_reader_get_folder (reader); + uids = e_mail_reader_get_selected_uids (reader); valid = gtk_tree_model_get_iter_first (tree_model, &iter); @@ -918,7 +904,6 @@ action_search_filter_cb (GtkRadioAction *action, EShellContent *shell_content; EShellWindow *shell_window; EMailReader *reader; - GtkWidget *message_list; GKeyFile *key_file; const gchar *folder_uri; @@ -927,8 +912,7 @@ action_search_filter_cb (GtkRadioAction *action, key_file = e_shell_view_get_state_key_file (shell_view); reader = E_MAIL_READER (shell_content); - message_list = e_mail_reader_get_message_list (reader); - folder_uri = MESSAGE_LIST (message_list)->folder_uri; + folder_uri = e_mail_reader_get_folder_uri (reader); if (folder_uri != NULL) { const gchar *key; @@ -956,7 +940,6 @@ action_search_scope_cb (GtkRadioAction *action, EShellContent *shell_content; EShellWindow *shell_window; EMailReader *reader; - GtkWidget *message_list; GKeyFile *key_file; const gchar *folder_uri; @@ -965,8 +948,7 @@ action_search_scope_cb (GtkRadioAction *action, key_file = e_shell_view_get_state_key_file (shell_view); reader = E_MAIL_READER (shell_content); - message_list = e_mail_reader_get_message_list (reader); - folder_uri = MESSAGE_LIST (message_list)->folder_uri; + folder_uri = e_mail_reader_get_folder_uri (reader); if (folder_uri != NULL) { const gchar *key; @@ -1600,7 +1582,7 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) /* Helper for e_mail_shell_view_update_popup_labels() */ static void mail_shell_view_update_label_action (GtkToggleAction *action, - MessageList *message_list, + EMailReader *reader, GPtrArray *uids, const gchar *label_tag) { @@ -1610,7 +1592,7 @@ mail_shell_view_update_label_action (GtkToggleAction *action, gboolean sensitive; guint ii; - folder = message_list->folder; + folder = e_mail_reader_get_folder (reader); /* Figure out the proper label action state for the selected * messages. If all the selected messages have the given label, @@ -1660,7 +1642,6 @@ e_mail_shell_view_update_popup_labels (EMailShellView *mail_shell_view) EShellWindow *shell_window; EShellView *shell_view; EMailReader *reader; - GtkWidget *message_list; GtkUIManager *ui_manager; GtkActionGroup *action_group; GtkTreeModel *tree_model; @@ -1692,8 +1673,7 @@ e_mail_shell_view_update_popup_labels (EMailShellView *mail_shell_view) e_action_group_remove_all_actions (action_group); reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); - message_list = e_mail_reader_get_message_list (reader); - uids = message_list_get_selected (MESSAGE_LIST (message_list)); + uids = e_mail_reader_get_selected_uids (reader); valid = gtk_tree_model_get_iter_first (tree_model, &iter); @@ -1724,7 +1704,7 @@ e_mail_shell_view_update_popup_labels (EMailShellView *mail_shell_view) /* Configure the action before we connect to signals. */ mail_shell_view_update_label_action ( GTK_TOGGLE_ACTION (label_action), - MESSAGE_LIST (message_list), uids, tag); + reader, uids, tag); g_signal_connect ( label_action, "toggled", diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c index ab48de07cd..ec02aacea8 100644 --- a/modules/mail/e-mail-shell-view-private.c +++ b/modules/mail/e-mail-shell-view-private.c @@ -100,7 +100,7 @@ mail_shell_view_folder_tree_selection_done_cb (EMailShellView *mail_shell_view, { EMailShellSidebar *mail_shell_sidebar; EMFolderTree *folder_tree; - MessageList *message_list; + GtkWidget *message_list; EMailReader *reader; const gchar *list_uri; gchar *tree_uri; @@ -111,7 +111,11 @@ mail_shell_view_folder_tree_selection_done_cb (EMailShellView *mail_shell_view, mail_shell_sidebar = mail_shell_view->priv->mail_shell_sidebar; folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); - list_uri = message_list->folder_uri; + /* Don't use e_mail_reader_get_folder_uri() here. The fact that + * the method gets the folder URI from the message list is supposed + * to be a hidden implementation detail, and we want to explicitly + * get the folder URI from the message list here. */ + list_uri = MESSAGE_LIST (message_list)->folder_uri; tree_uri = em_folder_tree_get_selected_uri (folder_tree); /* If the folder tree and message list disagree on the current @@ -275,7 +279,7 @@ mail_shell_view_scroll_cb (EMailShellView *mail_shell_view, EShellWindow *shell_window; EShellSettings *shell_settings; EMailReader *reader; - MessageList *message_list; + GtkWidget *message_list; gboolean magic_spacebar; if (html->binding_handled) @@ -299,14 +303,16 @@ mail_shell_view_scroll_cb (EMailShellView *mail_shell_view, message_list = e_mail_reader_get_message_list (reader); if (scroll_type == GTK_SCROLL_PAGE_FORWARD) { - gtk_widget_grab_focus (GTK_WIDGET (message_list)); + gtk_widget_grab_focus (message_list); message_list_select ( - message_list, MESSAGE_LIST_SELECT_NEXT, + MESSAGE_LIST (message_list), + MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN); } else { - gtk_widget_grab_focus (GTK_WIDGET (message_list)); + gtk_widget_grab_focus (message_list); message_list_select ( - message_list, MESSAGE_LIST_SELECT_PREVIOUS, + MESSAGE_LIST (message_list), + MESSAGE_LIST_SELECT_PREVIOUS, 0, CAMEL_MESSAGE_SEEN); } } @@ -322,21 +328,21 @@ static void mail_shell_view_prepare_for_quit_cb (EMailShellView *mail_shell_view, EActivity *activity) { + CamelFolder *folder; EMailReader *reader; - MessageList *message_list; /* If we got here, it means the application is shutting down * and this is the last EMailShellView instance. Synchronize * the currently selected folder before we terminate. */ reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); - message_list = e_mail_reader_get_message_list (reader); + folder = e_mail_reader_get_folder (reader); - if (message_list->folder == NULL) + if (folder == NULL) return; mail_sync_folder ( - message_list->folder, + folder, mail_shell_view_prepare_for_quit_done_cb, g_object_ref (activity)); } @@ -421,7 +427,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) GtkTreeSelection *selection; GtkTreeModel *tree_model; GtkUIManager *ui_manager; - MessageList *message_list; + GtkWidget *message_list; EMailReader *reader; EWebView *web_view; const gchar *source; @@ -479,17 +485,17 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) mail_shell_view); g_signal_connect_swapped ( - message_list->tree, "key-press", + MESSAGE_LIST (message_list)->tree, "key-press", G_CALLBACK (mail_shell_view_message_list_key_press_cb), mail_shell_view); g_signal_connect_swapped ( - message_list->tree, "popup-menu", + MESSAGE_LIST (message_list)->tree, "popup-menu", G_CALLBACK (mail_shell_view_message_list_popup_menu_cb), mail_shell_view); g_signal_connect_swapped ( - message_list->tree, "right-click", + MESSAGE_LIST (message_list)->tree, "right-click", G_CALLBACK (mail_shell_view_message_list_right_click_cb), mail_shell_view); @@ -619,7 +625,6 @@ e_mail_shell_view_restore_state (EMailShellView *mail_shell_view) EShellView *shell_view; EShellContent *shell_content; EMailReader *reader; - MessageList *message_list; const gchar *folder_uri; gchar *group_name; @@ -631,8 +636,7 @@ e_mail_shell_view_restore_state (EMailShellView *mail_shell_view) shell_content = e_shell_view_get_shell_content (shell_view); reader = E_MAIL_READER (shell_content); - message_list = e_mail_reader_get_message_list (reader); - folder_uri = message_list->folder_uri; + folder_uri = e_mail_reader_get_folder_uri (reader); if (folder_uri == NULL) return; @@ -666,7 +670,6 @@ e_mail_shell_view_create_filter_from_selected (EMailShellView *mail_shell_view, gint filter_type) { EMailReader *reader; - MessageList *message_list; CamelFolder *folder; const gchar *filter_source; const gchar *folder_uri; @@ -680,9 +683,9 @@ e_mail_shell_view_create_filter_from_selected (EMailShellView *mail_shell_view, g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view)); reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); - message_list = e_mail_reader_get_message_list (reader); - folder_uri = message_list->folder_uri; - folder = message_list->folder; + folder = e_mail_reader_get_folder (reader); + folder_uri = e_mail_reader_get_folder_uri (reader); + uids = e_mail_reader_get_selected_uids (reader); if (em_utils_folder_is_sent (folder, folder_uri)) filter_source = E_FILTER_SOURCE_OUTGOING; @@ -691,8 +694,6 @@ e_mail_shell_view_create_filter_from_selected (EMailShellView *mail_shell_view, else filter_source = E_FILTER_SOURCE_INCOMING; - uids = message_list_get_selected (message_list); - if (uids->len == 1) { filter_data = g_malloc (sizeof (*filter_data)); filter_data->source = filter_source; @@ -732,7 +733,6 @@ e_mail_shell_view_create_vfolder_from_selected (EMailShellView *mail_shell_view, gint vfolder_type) { EMailReader *reader; - MessageList *message_list; CamelFolder *folder; const gchar *folder_uri; GPtrArray *uids; @@ -745,11 +745,9 @@ e_mail_shell_view_create_vfolder_from_selected (EMailShellView *mail_shell_view, g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view)); reader = E_MAIL_READER (mail_shell_view->priv->mail_shell_content); - message_list = e_mail_reader_get_message_list (reader); - folder_uri = message_list->folder_uri; - folder = message_list->folder; - - uids = message_list_get_selected (message_list); + folder = e_mail_reader_get_folder (reader); + folder_uri = e_mail_reader_get_folder_uri (reader); + uids = e_mail_reader_get_selected_uids (reader); if (uids->len == 1) { vfolder_data = g_malloc (sizeof (*vfolder_data)); @@ -772,10 +770,9 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) EShellSidebar *shell_sidebar; EShellView *shell_view; EMailReader *reader; - MessageList *message_list; CamelStore *local_store; CamelFolder *folder; - GPtrArray *selected; + GPtrArray *uids; GString *buffer; const gchar *display_name; const gchar *folder_uri; @@ -795,9 +792,8 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); reader = E_MAIL_READER (mail_shell_content); - message_list = e_mail_reader_get_message_list (reader); - folder_uri = message_list->folder_uri; - folder = message_list->folder; + folder = e_mail_reader_get_folder (reader); + folder_uri = e_mail_reader_get_folder_uri (reader); local_store = e_mail_local_get_store (); @@ -828,12 +824,12 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) NULL); buffer = g_string_sized_new (256); - selected = message_list_get_selected (message_list); + uids = e_mail_reader_get_selected_uids (reader); - if (selected->len > 1) + if (uids->len > 1) g_string_append_printf ( buffer, ngettext ("%d selected, ", "%d selected, ", - selected->len), selected->len); + uids->len), uids->len); if (CAMEL_IS_VTRASH_FOLDER (folder)) { CamelVTrashFolder *trash_folder; @@ -884,7 +880,7 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) num_deleted - num_junked + num_junked_not_deleted; - if (num_unread > 0 && selected->len <= 1) + if (num_unread > 0 && uids->len <= 1) g_string_append_printf ( buffer, ngettext ("%d unread, ", "%d unread, ", num_unread), num_unread); @@ -893,7 +889,7 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view) num_visible), num_visible); } - em_utils_uids_free (selected); + em_utils_uids_free (uids); /* Choose a suitable folder name for displaying. */ if (folder->parent_store == local_store && ( diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c index 7cd7bdfaf4..70ab01c618 100644 --- a/modules/mail/e-mail-shell-view.c +++ b/modules/mail/e-mail-shell-view.c @@ -123,12 +123,11 @@ mail_shell_view_execute_search (EShellView *shell_view) mail_shell_content = E_MAIL_SHELL_CONTENT (shell_content); reader = E_MAIL_READER (shell_content); + folder = e_mail_reader_get_folder (reader); + folder_uri = e_mail_reader_get_folder_uri (reader); html_display = e_mail_reader_get_html_display (reader); message_list = e_mail_reader_get_message_list (reader); - folder_uri = MESSAGE_LIST (message_list)->folder_uri; - folder = MESSAGE_LIST (message_list)->folder; - if (folder_uri != NULL) { GKeyFile *key_file; const gchar *key; @@ -464,11 +463,9 @@ mail_shell_view_update_actions (EShellView *shell_view) uri = em_folder_tree_get_selected_uri (folder_tree); if (uri != NULL) { EMFolderTreeModel *model; - GtkWidget *message_list; const gchar *folder_uri; - message_list = e_mail_reader_get_message_list (reader); - folder_uri = MESSAGE_LIST (message_list)->folder_uri; + folder_uri = e_mail_reader_get_folder_uri (reader); /* XXX If the user right-clicks on a folder other than what * the message list is showing, disable folder rename. diff --git a/plugins/groupwise-features/gw-ui.c b/plugins/groupwise-features/gw-ui.c index 4a33a692cd..c1146ff4d1 100644 --- a/plugins/groupwise-features/gw-ui.c +++ b/plugins/groupwise-features/gw-ui.c @@ -204,19 +204,17 @@ update_mmp_entries_cb (EShellView *shell_view, gpointer user_data) if (visible) { EShellContent *shell_content; EMailReader *reader; - GtkWidget *message_list; - GPtrArray *selected; + GPtrArray *uids; shell_content = e_shell_view_get_shell_content (shell_view); - reader = (EMailReader *) (shell_content); - message_list = e_mail_reader_get_message_list (reader); - selected = message_list_get_selected (MESSAGE_LIST (message_list)); + reader = E_MAIL_READER (shell_content); + uids = e_mail_reader_get_selected_uids (reader); - if (selected) - n_selected = selected->len; + if (uids) + n_selected = uids->len; - em_utils_uids_free (selected); + em_utils_uids_free (uids); visible = n_selected > 0; } diff --git a/plugins/groupwise-features/junk-mail-settings.c b/plugins/groupwise-features/junk-mail-settings.c index 4fc4b735c0..61a5cb0ac9 100644 --- a/plugins/groupwise-features/junk-mail-settings.c +++ b/plugins/groupwise-features/junk-mail-settings.c @@ -68,16 +68,15 @@ gw_junk_mail_settings_cb (GtkAction *action, EShellView *shell_view) gchar *msg; EShellContent *shell_content; EMailReader *reader; - GtkWidget *message_list; + CamelFolder *folder; shell_content = e_shell_view_get_shell_content (shell_view); - reader = (EMailReader *) (shell_content); - message_list = e_mail_reader_get_message_list (reader); - g_return_if_fail (message_list != NULL); - g_return_if_fail (MESSAGE_LIST (message_list)->folder != NULL); + reader = E_MAIL_READER (shell_content); + folder = e_mail_reader_get_folder (reader); + g_return_if_fail (folder != NULL); - cnc = get_cnc (MESSAGE_LIST (message_list)->folder->parent_store); + cnc = get_cnc (folder->parent_store); dialog = gtk_dialog_new_with_buttons (_("Junk Settings"), NULL, diff --git a/plugins/groupwise-features/mail-retract.c b/plugins/groupwise-features/mail-retract.c index adb97e250e..0ef1fd8e88 100644 --- a/plugins/groupwise-features/mail-retract.c +++ b/plugins/groupwise-features/mail-retract.c @@ -43,22 +43,19 @@ get_selected_info (EShellView *shell_view, CamelFolder **folder, gchar **selecte { EShellContent *shell_content; EMailReader *reader; - GtkWidget *message_list; - GPtrArray *selected; + GPtrArray *uids; shell_content = e_shell_view_get_shell_content (shell_view); - reader = (EMailReader *) (shell_content); - message_list = e_mail_reader_get_message_list (reader); - g_return_val_if_fail (message_list != NULL, FALSE); + reader = E_MAIL_READER (shell_content); + uids = e_mail_reader_get_selected_uids (reader); - selected = message_list_get_selected (MESSAGE_LIST (message_list)); - if (selected && selected->len == 1) { - *folder = MESSAGE_LIST (message_list)->folder; - *selected_uid = g_strdup (g_ptr_array_index (selected, 0)); + if (uids && uids->len == 1) { + *folder = e_mail_reader_get_folder (reader); + *selected_uid = g_strdup (g_ptr_array_index (uids, 0)); } - em_utils_uids_free (selected); + em_utils_uids_free (uids); return *selected_uid != NULL; } diff --git a/plugins/groupwise-features/status-track.c b/plugins/groupwise-features/status-track.c index 018e69261a..622fc3b6cd 100644 --- a/plugins/groupwise-features/status-track.c +++ b/plugins/groupwise-features/status-track.c @@ -65,24 +65,21 @@ get_selected_message (EShellView *shell_view, CamelFolder **folder, gchar **sele CamelMimeMessage *msg = NULL; EShellContent *shell_content; EMailReader *reader; - GtkWidget *message_list; - GPtrArray *selected; + GPtrArray *uids; shell_content = e_shell_view_get_shell_content (shell_view); - reader = (EMailReader *) (shell_content); - message_list = e_mail_reader_get_message_list (reader); - g_return_val_if_fail (message_list != NULL, NULL); + reader = E_MAIL_READER (shell_content); + uids = e_mail_reader_get_selected_uids (reader); - selected = message_list_get_selected (MESSAGE_LIST (message_list)); - if (selected && selected->len == 1) { - *folder = MESSAGE_LIST (message_list)->folder; - *selected_uid = g_strdup (g_ptr_array_index (selected, 0)); + if (uids && uids->len == 1) { + *folder = e_mail_reader_get_folder (reader); + *selected_uid = g_strdup (g_ptr_array_index (uids, 0)); msg = camel_folder_get_message (*folder, *selected_uid, NULL); } - em_utils_uids_free (selected); + em_utils_uids_free (uids); return msg; } diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c index 6b79b78e94..fc62561a5e 100644 --- a/plugins/mail-to-task/mail-to-task.c +++ b/plugins/mail-to-task/mail-to-task.c @@ -926,18 +926,16 @@ mail_to_event (ECalSourceType source_type, gboolean with_attendees, EMailReader *reader) { - GtkWidget *message_list; CamelFolder *folder; - GPtrArray *selected; + GPtrArray *uids; ESourceList *source_list = NULL; gboolean done = FALSE; GSList *groups, *p; ESource *source = NULL; GError *error = NULL; - message_list = e_mail_reader_get_message_list (reader); - selected = message_list_get_selected (MESSAGE_LIST (message_list)); - folder = MESSAGE_LIST (message_list)->folder; + folder = e_mail_reader_get_folder (reader); + uids = e_mail_reader_get_selected_uids (reader); if (!e_cal_get_sources (&source_list, source_type, &error)) { e_notice (NULL, GTK_MESSAGE_ERROR, _("Cannot get source list. %s"), error ? error->message : _("Unknown error.")); @@ -1005,10 +1003,10 @@ mail_to_event (ECalSourceType source_type, data = g_new0 (AsyncData, 1); data->client = client; data->folder = folder; - data->uids = selected; + data->uids = uids; data->with_attendees = with_attendees; - if (selected->len == 1) + if (uids->len == 1) data->selected_text = get_selected_text (reader); else data->selected_text = NULL; diff --git a/plugins/mailing-list-actions/mailing-list-actions.c b/plugins/mailing-list-actions/mailing-list-actions.c index 006215bf3f..8304345730 100644 --- a/plugins/mailing-list-actions/mailing-list-actions.c +++ b/plugins/mailing-list-actions/mailing-list-actions.c @@ -108,12 +108,12 @@ emla_list_action_do (CamelFolder *folder, EMsgComposer *composer; gint send_message_response; EAccount *account; - GtkWindow *parent; + GtkWindow *window; if (msg == NULL) return; - parent = e_mail_reader_get_window (action_data->reader); + window = e_mail_reader_get_window (action_data->reader); for (t = 0; t < G_N_ELEMENTS (emla_action_headers); t++) { if (emla_action_headers[t].action == action && @@ -123,7 +123,7 @@ emla_list_action_do (CamelFolder *folder, if (!header) { /* there was no header matching the action */ - e_alert_run_dialog_for_args (parent, MESSAGE_NO_HEADER, NULL); + e_alert_run_dialog_for_args (window, MESSAGE_NO_HEADER, NULL); goto exit; } @@ -132,7 +132,7 @@ emla_list_action_do (CamelFolder *folder, if (action == EMLA_ACTION_POST) { while (*headerpos == ' ') headerpos++; if (g_ascii_strcasecmp (headerpos, "NO") == 0) { - e_alert_run_dialog_for_args (parent, MESSAGE_POSTING_NOT_ALLOWED, NULL); + e_alert_run_dialog_for_args (window, MESSAGE_POSTING_NOT_ALLOWED, NULL); goto exit; } } @@ -143,7 +143,7 @@ emla_list_action_do (CamelFolder *folder, while (*headerpos == ' ') headerpos++; if (*headerpos != '<' || (end = strchr (headerpos++, '>')) == NULL) { e_alert_run_dialog_for_args ( - parent, MESSAGE_MALFORMED_HEADER, + window, MESSAGE_MALFORMED_HEADER, emla_action_headers[t].header, header, NULL); goto exit; } @@ -156,7 +156,7 @@ emla_list_action_do (CamelFolder *folder, send_message_response = GTK_RESPONSE_NO; else send_message_response = e_alert_run_dialog_for_args ( - parent, MESSAGE_ASK_SEND_MESSAGE, + window, MESSAGE_ASK_SEND_MESSAGE, url, NULL); if (send_message_response == GTK_RESPONSE_YES) { @@ -174,7 +174,7 @@ emla_list_action_do (CamelFolder *folder, goto exit; } else { - e_show_uri (parent, url); + e_show_uri (window, url); goto exit; } g_free (url); @@ -189,7 +189,7 @@ emla_list_action_do (CamelFolder *folder, } /* if we got here, there's no valid action */ - e_alert_run_dialog_for_args (parent, MESSAGE_NO_ACTION, header, NULL); + e_alert_run_dialog_for_args (window, MESSAGE_NO_ACTION, header, NULL); exit: g_object_unref (action_data->reader); @@ -202,17 +202,15 @@ static void emla_list_action (EMailReader *reader, EmlaAction action) { - GtkWidget *message_list; CamelFolder *folder; GPtrArray *uids; emla_action_data *data; const gchar *folder_uri; - message_list = e_mail_reader_get_message_list (reader); + folder = e_mail_reader_get_folder (reader); + folder_uri = e_mail_reader_get_folder_uri (reader); + uids = e_mail_reader_get_selected_uids (reader); - folder = MESSAGE_LIST (message_list)->folder; - folder_uri = MESSAGE_LIST (message_list)->folder_uri; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); g_return_if_fail (uids->len == 1); data = g_malloc (sizeof (emla_action_data)); diff --git a/plugins/templates/templates.c b/plugins/templates/templates.c index 5c9f795c20..e562685e95 100644 --- a/plugins/templates/templates.c +++ b/plugins/templates/templates.c @@ -698,8 +698,8 @@ update_actions_cb (EShellView *shell_view) EShellWindow *shell_window; GtkActionGroup *action_group; GtkUIManager *ui_manager; - GtkWidget *message_list; CamelFolderInfo *folder_info; + CamelFolder *templates_folder; CamelFolder *folder; CamelStore *store; EMailReader *reader; @@ -724,10 +724,8 @@ update_actions_cb (EShellView *shell_view) return; reader = E_MAIL_READER (shell_content); - message_list = e_mail_reader_get_message_list (reader); - - folder = MESSAGE_LIST (message_list)->folder; - uids = message_list_get_selected (MESSAGE_LIST (message_list)); + folder = e_mail_reader_get_folder (reader); + uids = e_mail_reader_get_selected_uids (reader); if (uids->len != 1) goto exit; @@ -735,10 +733,10 @@ update_actions_cb (EShellView *shell_view) /* Now recursively build template submenus in the pop-up menu. */ store = e_mail_local_get_store (); - folder = e_mail_local_get_folder (E_MAIL_FOLDER_TEMPLATES); + templates_folder = e_mail_local_get_folder (E_MAIL_FOLDER_TEMPLATES); folder_info = camel_store_get_folder_info ( - store, folder->full_name, + store, templates_folder->full_name, CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_FAST, NULL); @@ -746,7 +744,7 @@ update_actions_cb (EShellView *shell_view) ui_manager, action_group, "/mail-message-popup/mail-message-templates", &action_count, merge_id, folder_info, - MESSAGE_LIST (message_list)->folder, uids->pdata[0]); + folder, uids->pdata[0]); exit: em_utils_uids_free (uids); -- cgit