aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-03-09 05:47:58 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-03-09 05:47:58 +0000
commite2571d34b0d0e29406dad2303bae0dafb6b2252a (patch)
tree78259a9f42c25384d369126819748285e95ea800
parenta305abdfe054c5ef5e472d2d99723b4032308b1d (diff)
enabled multiple file selection when attaching files.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@156 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog7
-rw-r--r--ChangeLog.ja8
-rw-r--r--src/compose.c16
-rw-r--r--src/filesel.c51
-rw-r--r--src/filesel.h3
-rw-r--r--src/main.c3
6 files changed, 71 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 402d9276..1da73af2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-03-09
+
+ * src/compose.c: compose_attach_cb(): enabled multiple file selection.
+ * src/main.c: migrate_old_config(): copy also mime.types.
+ * src/filesel.[ch]: filesel_select_files(): returns multiple selected
+ files.
+
2005-03-08
* src/imageview.[ch]: imageview_get_resized_pixbuf(): new.
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 4a732767..af55be9b 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,3 +1,11 @@
+2005-03-09
+
+ * src/compose.c: compose_attach_cb(): 複数ファイルの選択ができる
+ ようにした。
+ * src/main.c: migrate_old_config(): mime.types もコピーするようにした。
+ * src/filesel.[ch]: filesel_select_files(): 複数の選択したファイルを
+ 返す。
+
2005-03-08
* src/imageview.[ch]: imageview_get_resized_pixbuf(): 新規。
diff --git a/src/compose.c b/src/compose.c
index f86d3274..18622d79 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -5257,19 +5257,23 @@ static void compose_draft_cb(gpointer data, guint action, GtkWidget *widget)
static void compose_attach_cb(gpointer data, guint action, GtkWidget *widget)
{
Compose *compose = (Compose *)data;
- gchar *file;
- gchar *utf8_filename;
+ GSList *files;
+ GSList *cur;
- file = filesel_select_file(_("Select file"), NULL,
- GTK_FILE_CHOOSER_ACTION_OPEN);
+ files = filesel_select_files(_("Select files"), NULL,
+ GTK_FILE_CHOOSER_ACTION_OPEN);
+
+ for (cur = files; cur != NULL; cur = cur->next) {
+ gchar *file = (gchar *)cur->data;
+ gchar *utf8_filename;
- if (file && *file) {
utf8_filename = conv_filename_to_utf8(file);
compose_attach_append(compose, file, utf8_filename, NULL);
g_free(utf8_filename);
+ g_free(file);
}
- g_free(file);
+ g_slist_free(files);
}
static void compose_insert_file_cb(gpointer data, guint action,
diff --git a/src/filesel.c b/src/filesel.c
index d480bc92..67db7881 100644
--- a/src/filesel.c
+++ b/src/filesel.c
@@ -29,16 +29,45 @@
#include "alertpanel.h"
#include "utils.h"
-static GtkWidget *filesel_create(const gchar *title,
- GtkFileChooserAction action);
+static GSList *filesel_select_file_full (const gchar *title,
+ const gchar *file,
+ GtkFileChooserAction action,
+ gboolean multiple);
+
+static GtkWidget *filesel_create (const gchar *title,
+ GtkFileChooserAction action);
+
gchar *filesel_select_file(const gchar *title, const gchar *file,
GtkFileChooserAction action)
{
+ GSList *list;
+ gchar *selected = NULL;
+
+ list = filesel_select_file_full(title, file, action, FALSE);
+ if (list) {
+ selected = (gchar *)list->data;
+ slist_free_strings(list->next);
+ }
+ g_slist_free(list);
+
+ return selected;
+}
+
+GSList *filesel_select_files(const gchar *title, const gchar *file,
+ GtkFileChooserAction action)
+{
+ return filesel_select_file_full(title, file, action, TRUE);
+}
+
+static GSList *filesel_select_file_full(const gchar *title, const gchar *file,
+ GtkFileChooserAction action,
+ gboolean multiple)
+{
static gchar *cwd = NULL;
GtkWidget *dialog;
- gchar *filename = NULL;
gchar *prev_dir;
+ GSList *list = NULL;
if (!cwd)
cwd = g_strdup(startup_dir);
@@ -57,24 +86,24 @@ gchar *filesel_select_file(const gchar *title, const gchar *file,
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog),
file);
+ gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog),
+ multiple);
+
gtk_widget_show(dialog);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
- filename = gtk_file_chooser_get_filename
- (GTK_FILE_CHOOSER(dialog));
- if (filename) {
- gchar *dir;
-
- dir = g_dirname(filename);
+ list = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog));
+ if (list) {
g_free(cwd);
- cwd = dir;
+ cwd = gtk_file_chooser_get_current_folder
+ (GTK_FILE_CHOOSER(dialog));
}
}
manage_window_focus_out(dialog, NULL, NULL);
gtk_widget_destroy(dialog);
- return filename;
+ return list;
}
gchar *filesel_save_as(const gchar *file)
diff --git a/src/filesel.h b/src/filesel.h
index 098e31c1..24764d9c 100644
--- a/src/filesel.h
+++ b/src/filesel.h
@@ -26,6 +26,9 @@
gchar *filesel_select_file (const gchar *title,
const gchar *file,
GtkFileChooserAction action);
+GSList *filesel_select_files (const gchar *title,
+ const gchar *file,
+ GtkFileChooserAction action);
gchar *filesel_save_as (const gchar *file);
diff --git a/src/main.c b/src/main.c
index 1b0ee73f..12f057a1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -739,6 +739,9 @@ static void migrate_old_config(void)
if (is_file_exist(OLD_RC_DIR G_DIR_SEPARATOR_S FOLDER_LIST))
copy_file(OLD_RC_DIR G_DIR_SEPARATOR_S FOLDER_LIST,
RC_DIR G_DIR_SEPARATOR_S FOLDER_LIST, FALSE);
+ if (is_file_exist(OLD_RC_DIR G_DIR_SEPARATOR_S "mime.types"))
+ copy_file(OLD_RC_DIR G_DIR_SEPARATOR_S "mime.types",
+ RC_DIR G_DIR_SEPARATOR_S "mime.types", FALSE);
if (is_dir_exist(OLD_RC_DIR G_DIR_SEPARATOR_S TEMPLATE_DIR))
conv_copy_dir(OLD_RC_DIR G_DIR_SEPARATOR_S TEMPLATE_DIR,