aboutsummaryrefslogtreecommitdiffstats
path: root/mail/e-mail-shell-view-private.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-12-19 04:08:19 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-12-19 04:08:19 +0800
commit085aca4a852917a1278440a86fae21111bd8fd9d (patch)
treeff278716f10a42472e0bad0ac342f30016661890 /mail/e-mail-shell-view-private.c
parentda75a8ebebe61c6f36c961f63f47f4a446502eed (diff)
downloadgsoc2013-evolution-085aca4a852917a1278440a86fae21111bd8fd9d.tar
gsoc2013-evolution-085aca4a852917a1278440a86fae21111bd8fd9d.tar.gz
gsoc2013-evolution-085aca4a852917a1278440a86fae21111bd8fd9d.tar.bz2
gsoc2013-evolution-085aca4a852917a1278440a86fae21111bd8fd9d.tar.lz
gsoc2013-evolution-085aca4a852917a1278440a86fae21111bd8fd9d.tar.xz
gsoc2013-evolution-085aca4a852917a1278440a86fae21111bd8fd9d.tar.zst
gsoc2013-evolution-085aca4a852917a1278440a86fae21111bd8fd9d.zip
Implement folder tree popup actions. Purge EPopup from EMFolderTree.
svn path=/branches/kill-bonobo/; revision=36917
Diffstat (limited to 'mail/e-mail-shell-view-private.c')
-rw-r--r--mail/e-mail-shell-view-private.c125
1 files changed, 124 insertions, 1 deletions
diff --git a/mail/e-mail-shell-view-private.c b/mail/e-mail-shell-view-private.c
index 1dfe6c430d..1ead83c162 100644
--- a/mail/e-mail-shell-view-private.c
+++ b/mail/e-mail-shell-view-private.c
@@ -156,7 +156,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
/* Cache these to avoid lots of awkward casting. */
priv->mail_shell_content = g_object_ref (shell_content);
- priv->mail_shell_sidebar = g_object_ref (shell_content);
+ priv->mail_shell_sidebar = g_object_ref (shell_sidebar);
mail_shell_content = E_MAIL_SHELL_CONTENT (shell_content);
folder_view = e_mail_shell_content_get_folder_view (mail_shell_content);
@@ -372,3 +372,126 @@ 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)
+{
+ EMailShellContent *mail_shell_content;
+ EMFolderView *folder_view;
+ 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));
+
+ mail_shell_content = mail_shell_view->priv->mail_shell_content;
+ folder_view = e_mail_shell_content_get_folder_view (mail_shell_content);
+ folder_uri = folder_view->folder_uri;
+ folder = folder_view->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 (folder_view->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)
+{
+ EMailShellContent *mail_shell_content;
+ EMFolderView *folder_view;
+ 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));
+
+ mail_shell_content = mail_shell_view->priv->mail_shell_content;
+ folder_view = e_mail_shell_content_get_folder_view (mail_shell_content);
+ folder_uri = folder_view->folder_uri;
+ folder = folder_view->folder;
+
+ uids = message_list_get_selected (folder_view->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);
+}