aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-callbacks.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-11-29 04:37:43 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-11-29 04:37:43 +0800
commitf22ac8e3a051c76a48206a7a717c21a180148b58 (patch)
tree4dadee5e00f11aaa860ca4042864b57e7fa38989 /mail/mail-callbacks.c
parent1db83e1fb92869bdac0eef802867aef989feb72c (diff)
downloadgsoc2013-evolution-f22ac8e3a051c76a48206a7a717c21a180148b58.tar.gz
gsoc2013-evolution-f22ac8e3a051c76a48206a7a717c21a180148b58.tar.zst
gsoc2013-evolution-f22ac8e3a051c76a48206a7a717c21a180148b58.zip
Added the SaveAs bonobo menu verb thingy.
2000-11-28 Jeffrey Stedfast <fejj@helixcode.com> * folder-browser-factory.c: Added the SaveAs bonobo menu verb thingy. * mail-callbacks.c (save_msg): New callback for saving messages. (save_msg_ok): * folder-browser.c (on_right_click): Add a Save Ass menu item. * mail-ops.c (cleanup_save_messages): Save all emails to the path given. svn path=/trunk/; revision=6699
Diffstat (limited to 'mail/mail-callbacks.c')
-rw-r--r--mail/mail-callbacks.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index fd57b5b6bc..caf62352af 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -672,6 +672,67 @@ edit_msg (GtkWidget *widget, gpointer user_data)
mail_do_edit_messages (fb->folder, uids, (GtkSignalFunc) composer_send_cb);
}
+static void
+save_msg_ok (GtkWidget *widget, gpointer user_data)
+{
+ CamelFolder *folder;
+ GPtrArray *uids;
+ char *path;
+
+ /* FIXME: is path an allocated string? */
+ path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (user_data));
+
+ folder = gtk_object_get_data (GTK_OBJECT (user_data), "folder");
+ uids = gtk_object_get_data (GTK_OBJECT (user_data), "uids");
+ gtk_object_remove_no_notify (GTK_OBJECT (user_data), "uids");
+ mail_do_save_messages (folder, uids, path);
+
+ gtk_widget_destroy (GTK_WIDGET (user_data));
+}
+
+static void
+save_msg_destroy (gpointer user_data)
+{
+ GPtrArray *uids = user_data;
+
+ if (uids) {
+ int i;
+
+ for (i = 0; i < uids->len; i++)
+ g_free (uids->pdata[i]);
+
+ g_ptr_array_free (uids, TRUE);
+ }
+}
+
+void
+save_msg (GtkWidget *widget, gpointer user_data)
+{
+ FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ GtkFileSelection *filesel;
+ GPtrArray *uids;
+ char *title;
+
+ uids = g_ptr_array_new ();
+ message_list_foreach (fb->message_list, enumerate_msg, uids);
+
+ if (uids->len == 1)
+ title = _("Save Message As...");
+ else
+ title = _("Save Messages As...");
+
+ filesel = GTK_FILE_SELECTION (gtk_file_selection_new (title));
+ gtk_object_set_data_full (GTK_OBJECT (filesel), "uids", uids, save_msg_destroy);
+ gtk_object_set_data (GTK_OBJECT (filesel), "folder", fb->folder);
+ gtk_signal_connect (GTK_OBJECT (filesel->ok_button),
+ "clicked", GTK_SIGNAL_FUNC (save_msg_ok), filesel);
+ gtk_signal_connect_object (GTK_OBJECT (filesel->cancel_button),
+ "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
+ GTK_OBJECT (filesel));
+
+ gtk_widget_show (GTK_WIDGET (filesel));
+}
+
void
delete_msg (GtkWidget *button, gpointer user_data)
{