aboutsummaryrefslogtreecommitdiffstats
path: root/mail/e-mail-reader.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-11-11 01:14:07 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-11-11 07:18:11 +0800
commit3dfdf087fc7657905fc7804b59414ecd3d74028e (patch)
tree45a5bb547ca73ebaea9c3276860f93df6d417006 /mail/e-mail-reader.c
parentf70ecb0406903e0fdc09bbf1c9a3367c7ba55ec2 (diff)
downloadgsoc2013-evolution-3dfdf087fc7657905fc7804b59414ecd3d74028e.tar.gz
gsoc2013-evolution-3dfdf087fc7657905fc7804b59414ecd3d74028e.tar.zst
gsoc2013-evolution-3dfdf087fc7657905fc7804b59414ecd3d74028e.zip
Kill more redundant save dialogs and related utilities.
Diffstat (limited to 'mail/e-mail-reader.c')
-rw-r--r--mail/e-mail-reader.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index d77fafc448..02739f04d9 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -34,7 +34,7 @@
#include "e-util/e-charset.h"
#include "e-util/e-util.h"
#include "e-util/gconf-bridge.h"
-#include "shell/e-shell.h"
+#include "shell/e-shell-utils.h"
#include "widgets/misc/e-popup-action.h"
#include "widgets/misc/e-menu-tool-action.h"
@@ -801,18 +801,50 @@ static void
action_mail_save_as_cb (GtkAction *action,
EMailReader *reader)
{
+ EShell *shell;
+ EShellBackend *shell_backend;
MessageList *message_list;
+ CamelMessageInfo *info;
CamelFolder *folder;
- GtkWindow *window;
GPtrArray *uids;
+ GFile *file;
+ const gchar *title;
+ const gchar *suggestion;
+ gchar *uri;
message_list = e_mail_reader_get_message_list (reader);
- window = e_mail_reader_get_window (reader);
+ shell_backend = e_mail_reader_get_shell_backend (reader);
+ shell = e_shell_backend_get_shell (shell_backend);
folder = message_list->folder;
uids = message_list_get_selected (message_list);
+ g_return_if_fail (uids->len > 0);
+
+ title = ngettext ("Save Message", "Save Messages", uids->len);
+
+ /* Suggest as a filename the subject of the first message. */
+ info = camel_folder_get_message_info (folder, uids->pdata[0]);
+ if (info != NULL) {
+ suggestion = camel_message_info_subject (info);
+ camel_message_info_free (info);
+ } else
+ suggestion = NULL;
+
+ file = e_shell_run_save_dialog (shell, title, suggestion, NULL, NULL);
+
+ if (file == NULL) {
+ em_utils_uids_free (uids);
+ return;
+ }
+
+ uri = g_file_get_uri (file);
+
+ /* This eats the UID array, so do not free it. */
+ mail_save_messages (folder, uids, uri, NULL, NULL);
+
+ g_free (uri);
- em_utils_save_messages (window, folder, uids);
+ g_object_unref (file);
}
static void