aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
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 /plugins
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 'plugins')
-rw-r--r--plugins/groupwise-features/gw-ui.c14
-rw-r--r--plugins/groupwise-features/junk-mail-settings.c11
-rw-r--r--plugins/groupwise-features/mail-retract.c17
-rw-r--r--plugins/groupwise-features/status-track.c17
-rw-r--r--plugins/mail-to-task/mail-to-task.c12
-rw-r--r--plugins/mailing-list-actions/mailing-list-actions.c24
-rw-r--r--plugins/templates/templates.c14
7 files changed, 47 insertions, 62 deletions
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);