aboutsummaryrefslogtreecommitdiffstats
path: root/mail/e-mail-shell-view-private.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/e-mail-shell-view-private.c')
-rw-r--r--mail/e-mail-shell-view-private.c253
1 files changed, 130 insertions, 123 deletions
diff --git a/mail/e-mail-shell-view-private.c b/mail/e-mail-shell-view-private.c
index b9fe7ab4fd..4ad0d68e59 100644
--- a/mail/e-mail-shell-view-private.c
+++ b/mail/e-mail-shell-view-private.c
@@ -209,6 +209,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
mail_shell_view);
e_mail_shell_view_actions_init (mail_shell_view);
+ e_mail_shell_view_update_search_filter (mail_shell_view);
e_mail_reader_init (reader);
/* Restore the previously selected folder. */
@@ -245,6 +246,135 @@ e_mail_shell_view_private_finalize (EMailShellView *mail_shell_view)
}
void
+e_mail_shell_view_execute_search (EMailShellView *mail_shell_view)
+{
+ /* FIXME */
+}
+
+/* Helper for e_mail_shell_view_create_filter_from_selected() */
+static void
+mail_shell_view_create_filter_cb (CamelFolder *folder,
+ const gchar *uid,
+ CamelMimeMessage *message,
+ gpointer user_data)
+{
+ struct {
+ const gchar *source;
+ gint type;
+ } *filter_data = user_data;
+
+ if (message != NULL)
+ filter_gui_add_from_message (
+ message, filter_data->source, filter_data->type);
+
+ g_free (filter_data);
+}
+
+void
+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;
+ GPtrArray *uids;
+
+ struct {
+ const gchar *source;
+ gint type;
+ } *filter_data;
+
+ 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;
+
+ if (em_utils_folder_is_sent (folder, folder_uri))
+ filter_source = FILTER_SOURCE_OUTGOING;
+ else if (em_utils_folder_is_outbox (folder, folder_uri))
+ filter_source = FILTER_SOURCE_OUTGOING;
+ else
+ filter_source = 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;
+ filter_data->type = filter_type;
+
+ mail_get_message (
+ folder, uids->pdata[0],
+ mail_shell_view_create_filter_cb,
+ filter_data, mail_msg_unordered_push);
+ }
+
+ em_utils_uids_free (uids);
+}
+
+/* Helper for e_mail_shell_view_create_vfolder_from_selected() */
+static void
+mail_shell_view_create_vfolder_cb (CamelFolder *folder,
+ const gchar *uid,
+ CamelMimeMessage *message,
+ gpointer user_data)
+{
+ struct {
+ gchar *uri;
+ gint type;
+ } *vfolder_data = user_data;
+
+ if (message != NULL)
+ vfolder_gui_add_from_message (
+ message, vfolder_data->type, vfolder_data->uri);
+
+ g_free (vfolder_data->uri);
+ g_free (vfolder_data);
+}
+
+void
+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;
+
+ struct {
+ gchar *uri;
+ gint type;
+ } *vfolder_data;
+
+ 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);
+
+ if (uids->len == 1) {
+ vfolder_data = g_malloc (sizeof (*vfolder_data));
+ vfolder_data->uri = g_strdup (folder_uri);
+ vfolder_data->type = vfolder_type;
+
+ mail_get_message (
+ folder, uids->pdata[0],
+ mail_shell_view_create_vfolder_cb,
+ vfolder_data, mail_msg_unordered_push);
+ }
+
+ em_utils_uids_free (uids);
+}
+
+void
e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
{
EShellSidebar *shell_sidebar;
@@ -395,126 +525,3 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
camel_object_free (folder, CAMEL_FOLDER_NAME, folder_name);
g_string_free (buffer, TRUE);
}
-
-/* Helper for e_mail_shell_view_create_filter_from_selected() */
-static void
-mail_shell_view_create_filter_cb (CamelFolder *folder,
- const gchar *uid,
- CamelMimeMessage *message,
- gpointer user_data)
-{
- struct {
- const gchar *source;
- gint type;
- } *filter_data = user_data;
-
- if (message != NULL)
- filter_gui_add_from_message (
- message, filter_data->source, filter_data->type);
-
- g_free (filter_data);
-}
-
-void
-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;
- GPtrArray *uids;
-
- struct {
- const gchar *source;
- gint type;
- } *filter_data;
-
- 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;
-
- if (em_utils_folder_is_sent (folder, folder_uri))
- filter_source = FILTER_SOURCE_OUTGOING;
- else if (em_utils_folder_is_outbox (folder, folder_uri))
- filter_source = FILTER_SOURCE_OUTGOING;
- else
- filter_source = 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;
- filter_data->type = filter_type;
-
- mail_get_message (
- folder, uids->pdata[0],
- mail_shell_view_create_filter_cb,
- filter_data, mail_msg_unordered_push);
- }
-
- em_utils_uids_free (uids);
-}
-
-/* Helper for e_mail_shell_view_create_vfolder_from_selected() */
-static void
-mail_shell_view_create_vfolder_cb (CamelFolder *folder,
- const gchar *uid,
- CamelMimeMessage *message,
- gpointer user_data)
-{
- struct {
- gchar *uri;
- gint type;
- } *vfolder_data = user_data;
-
- if (message != NULL)
- vfolder_gui_add_from_message (
- message, vfolder_data->type, vfolder_data->uri);
-
- g_free (vfolder_data->uri);
- g_free (vfolder_data);
-}
-
-void
-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;
-
- struct {
- gchar *uri;
- gint type;
- } *vfolder_data;
-
- 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);
-
- if (uids->len == 1) {
- vfolder_data = g_malloc (sizeof (*vfolder_data));
- vfolder_data->uri = g_strdup (folder_uri);
- vfolder_data->type = vfolder_type;
-
- mail_get_message (
- folder, uids->pdata[0],
- mail_shell_view_create_vfolder_cb,
- vfolder_data, mail_msg_unordered_push);
- }
-
- em_utils_uids_free (uids);
-}