aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-12-02 00:43:13 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-12-02 04:01:14 +0800
commit5e938b590f66a44ed69e0867efe5158b634a7f57 (patch)
treeac3881b20ef9bcff5e93cf478e8d8abf9875dc0a /modules/mail
parent76fbb9d23242cba427d71ded5590a9cad271b2b3 (diff)
downloadgsoc2013-evolution-5e938b590f66a44ed69e0867efe5158b634a7f57.tar.gz
gsoc2013-evolution-5e938b590f66a44ed69e0867efe5158b634a7f57.tar.zst
gsoc2013-evolution-5e938b590f66a44ed69e0867efe5158b634a7f57.zip
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);
Diffstat (limited to 'modules/mail')
-rw-r--r--modules/mail/e-mail-shell-content.c59
-rw-r--r--modules/mail/e-mail-shell-view-actions.c54
-rw-r--r--modules/mail/e-mail-shell-view-private.c76
-rw-r--r--modules/mail/e-mail-shell-view.c9
4 files changed, 87 insertions, 111 deletions
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.