aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-09-22 11:18:22 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-09-22 11:18:22 +0000
commite804cac393c2dd84a8c570541fec5d6f7245d945 (patch)
treea0480475e799431680bfac040b30d30a0b41aeac /src
parent39a1d4cf0bd2ae39c2300b12f9c826514acd560e (diff)
implemented 'Save all'.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@601 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r--src/filesel.c27
-rw-r--r--src/filesel.h1
-rw-r--r--src/mimeview.c16
-rw-r--r--src/mimeview.h1
4 files changed, 40 insertions, 5 deletions
diff --git a/src/filesel.c b/src/filesel.c
index 1921901f..7d87a928 100644
--- a/src/filesel.c
+++ b/src/filesel.c
@@ -151,6 +151,23 @@ gchar *filesel_save_as(const gchar *file)
return filename;
}
+gchar *filesel_select_dir(const gchar *dir)
+{
+ GSList *list;
+ gchar *selected = NULL;
+
+ list = filesel_select_file_full(_("Select directory"), dir,
+ GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
+ FALSE);
+ if (list) {
+ selected = (gchar *)list->data;
+ slist_free_strings(list->next);
+ }
+ g_slist_free(list);
+
+ return selected;
+}
+
static GtkWidget *filesel_create(const gchar *title,
GtkFileChooserAction action)
{
@@ -160,14 +177,16 @@ static GtkWidget *filesel_create(const gchar *title,
dialog = gtk_file_chooser_dialog_new
(title, NULL, action,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- action == GTK_FILE_CHOOSER_ACTION_SAVE ? GTK_STOCK_SAVE
- : GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ (action == GTK_FILE_CHOOSER_ACTION_SAVE ||
+ action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ ? GTK_STOCK_SAVE : GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
else
dialog = gtk_file_chooser_dialog_new
(title, NULL, action,
- action == GTK_FILE_CHOOSER_ACTION_SAVE ? GTK_STOCK_SAVE
- : GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ (action == GTK_FILE_CHOOSER_ACTION_SAVE ||
+ action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ ? GTK_STOCK_SAVE : GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NULL);
gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
diff --git a/src/filesel.h b/src/filesel.h
index 24764d9c..43b48ec8 100644
--- a/src/filesel.h
+++ b/src/filesel.h
@@ -31,5 +31,6 @@ GSList *filesel_select_files (const gchar *title,
GtkFileChooserAction action);
gchar *filesel_save_as (const gchar *file);
+gchar *filesel_select_dir (const gchar *dir);
#endif /* __FILESEL_H__ */
diff --git a/src/mimeview.c b/src/mimeview.c
index 10439bdd..1e3014d2 100644
--- a/src/mimeview.c
+++ b/src/mimeview.c
@@ -124,7 +124,8 @@ static GtkItemFactoryEntry mimeview_popup_entries[] =
{N_("/_Open"), NULL, mimeview_launch, 0, NULL},
{N_("/Open _with..."), NULL, mimeview_open_with, 0, NULL},
{N_("/_Display as text"), NULL, mimeview_display_as_text, 0, NULL},
- {N_("/_Save as..."), NULL, mimeview_save_as, 0, NULL}
+ {N_("/_Save as..."), NULL, mimeview_save_as, 0, NULL},
+ {N_("/Save _all..."), NULL, mimeview_save_all, 0, NULL}
#if USE_GPGME
,
{N_("/_Check signature"), NULL, mimeview_check_signature, 0, NULL}
@@ -1024,6 +1025,19 @@ void mimeview_save_as(MimeView *mimeview)
g_free(filename);
}
+void mimeview_save_all(MimeView *mimeview)
+{
+ gchar *dir;
+
+ dir = filesel_select_dir(NULL);
+ if (!dir) return;
+
+ if (procmime_get_all_parts(dir, mimeview->file, mimeview->mimeinfo) < 0)
+ alertpanel_error(_("Can't save the attachments."));
+
+ g_free(dir);
+}
+
static void mimeview_launch(MimeView *mimeview)
{
MimeInfo *partinfo;
diff --git a/src/mimeview.h b/src/mimeview.h
index 72d3f6fd..6e11f9fe 100644
--- a/src/mimeview.h
+++ b/src/mimeview.h
@@ -88,5 +88,6 @@ void mimeview_pass_key_press_event (MimeView *mimeview,
GdkEventKey *event);
void mimeview_save_as (MimeView *mimeview);
+void mimeview_save_all (MimeView *mimeview);
#endif /* __MIMEVIEW_H__ */