[evolution/evolution-3-12] Bug 524365 - Expand folder tree for message Move/Copy folder selector
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/evolution-3-12] Bug 524365 - Expand folder tree for message Move/Copy folder selector
- Date: Wed, 3 Dec 2014 13:06:28 +0000 (UTC)
commit 201ad0628d8ee55aa7f4c25de3b3b02d17824f63
Author: Milan Crha <mcrha redhat com>
Date: Wed Dec 3 14:05:59 2014 +0100
Bug 524365 - Expand folder tree for message Move/Copy folder selector
mail/e-mail-reader.c | 94 ++++++++++++++++----------------------------------
1 files changed, 30 insertions(+), 64 deletions(-)
---
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index d962d32..01ad296 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -318,8 +318,8 @@ action_mail_check_for_junk_cb (GtkAction *action,
}
static void
-action_mail_copy_cb (GtkAction *action,
- EMailReader *reader)
+mail_reader_copy_or_move_selected_messages (EMailReader *reader,
+ gboolean is_move)
{
CamelFolder *folder;
EMailBackend *backend;
@@ -341,10 +341,9 @@ action_mail_copy_cb (GtkAction *action,
model = em_folder_tree_model_get_default ();
- dialog = em_folder_selector_new (
- window, model,
- EM_FOLDER_SELECTOR_CAN_CREATE,
- _("Copy to Folder"), NULL, _("C_opy"));
+ dialog = em_folder_selector_new (window, model,EM_FOLDER_SELECTOR_CAN_CREATE,
+ is_move ? _("Move to Folder") : _("Copy to Folder"), NULL,
+ is_move ? _("_Move") : _("C_opy"));
selector = EM_FOLDER_SELECTOR (dialog);
folder_tree = em_folder_selector_get_folder_tree (selector);
@@ -354,10 +353,25 @@ action_mail_copy_cb (GtkAction *action,
EMFT_EXCLUDE_NOSELECT |
EMFT_EXCLUDE_VIRTUAL |
EMFT_EXCLUDE_VTRASH);
+ gtk_tree_view_expand_all (GTK_TREE_VIEW (folder_tree));
- if (default_xfer_messages_uri != NULL)
+ if (default_xfer_messages_uri != NULL) {
em_folder_tree_set_selected (
folder_tree, default_xfer_messages_uri, FALSE);
+ } else {
+ CamelFolder *folder = e_mail_reader_ref_folder (reader);
+
+ if (folder) {
+ gchar *uri = e_mail_folder_uri_from_folder (folder);
+
+ if (uri) {
+ em_folder_tree_set_selected (folder_tree, uri, FALSE);
+ g_free (uri);
+ }
+
+ g_object_unref (folder);
+ }
+ }
if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
goto exit;
@@ -370,7 +384,7 @@ action_mail_copy_cb (GtkAction *action,
if (uri != NULL)
mail_transfer_messages (
session, folder, uids,
- FALSE, uri, 0, NULL, NULL);
+ is_move, uri, 0, NULL, NULL);
exit:
gtk_widget_destroy (dialog);
@@ -380,6 +394,13 @@ exit:
}
static void
+action_mail_copy_cb (GtkAction *action,
+ EMailReader *reader)
+{
+ mail_reader_copy_or_move_selected_messages (reader, FALSE);
+}
+
+static void
action_mail_delete_cb (GtkAction *action,
EMailReader *reader)
{
@@ -821,62 +842,7 @@ static void
action_mail_move_cb (GtkAction *action,
EMailReader *reader)
{
- CamelFolder *folder;
- EMailBackend *backend;
- EMailSession *session;
- EMFolderSelector *selector;
- EMFolderTree *folder_tree;
- EMFolderTreeModel *model;
- GtkWidget *dialog;
- GtkWindow *window;
- GPtrArray *uids;
- const gchar *uri;
-
- backend = e_mail_reader_get_backend (reader);
- session = e_mail_backend_get_session (backend);
-
- folder = e_mail_reader_ref_folder (reader);
- uids = e_mail_reader_get_selected_uids (reader);
- window = e_mail_reader_get_window (reader);
-
- model = em_folder_tree_model_get_default ();
-
- dialog = em_folder_selector_new (
- window, model,
- EM_FOLDER_SELECTOR_CAN_CREATE,
- _("Move to Folder"), NULL, _("_Move"));
-
- selector = EM_FOLDER_SELECTOR (dialog);
- folder_tree = em_folder_selector_get_folder_tree (selector);
-
- em_folder_tree_set_excluded (
- folder_tree,
- EMFT_EXCLUDE_NOSELECT |
- EMFT_EXCLUDE_VIRTUAL |
- EMFT_EXCLUDE_VTRASH);
-
- if (default_xfer_messages_uri != NULL)
- em_folder_tree_set_selected (
- folder_tree, default_xfer_messages_uri, FALSE);
-
- if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
- goto exit;
-
- uri = em_folder_selector_get_selected_uri (selector);
-
- g_free (default_xfer_messages_uri);
- default_xfer_messages_uri = g_strdup (uri);
-
- if (uri != NULL)
- mail_transfer_messages (
- session, folder, uids,
- TRUE, uri, 0, NULL, NULL);
-
-exit:
- gtk_widget_destroy (dialog);
-
- g_clear_object (&folder);
- g_ptr_array_unref (uids);
+ mail_reader_copy_or_move_selected_messages (reader, TRUE);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]