aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--ChangeLog.ja4
-rw-r--r--src/filesel.c44
3 files changed, 49 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 3ecf1d77..1e2b2de8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2007-04-11
+ * src/filesel.c: use custom overwrite confirmation dialog.
+
+2007-04-11
+
* src/filesel.c: use GTK's overwrite confirmation dialog.
2007-04-11
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 1cdd252e..5d2c8fc2 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,5 +1,9 @@
2007-04-11
+ * src/filesel.c: 独自の上書き確認ダイアログを使用するようにした。
+
+2007-04-11
+
* src/filesel.c: GTK の上書き確認ダイアログを使用するようにした。
2007-04-11
diff --git a/src/filesel.c b/src/filesel.c
index 9bf4f0fa..683f4f56 100644
--- a/src/filesel.c
+++ b/src/filesel.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2007 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -44,6 +44,12 @@ static void filesel_save_expander_set_expanded (GtkWidget *dialog,
gboolean expanded);
static gboolean filesel_save_expander_get_expanded (GtkWidget *dialog);
+#if GTK_CHECK_VERSION(2, 8, 0)
+static GtkFileChooserConfirmation filesel_confirm_overwrite_cb
+ (GtkFileChooser *chooser,
+ gpointer data);
+#endif
+
gchar *filesel_select_file(const gchar *title, const gchar *file,
GtkFileChooserAction action)
{
@@ -108,6 +114,9 @@ static GSList *filesel_select_file_full(const gchar *title, const gchar *file,
if (action == GTK_FILE_CHOOSER_ACTION_SAVE) {
gtk_file_chooser_set_do_overwrite_confirmation
(GTK_FILE_CHOOSER(dialog), TRUE);
+ g_signal_connect(GTK_FILE_CHOOSER(dialog), "confirm-overwrite",
+ G_CALLBACK(filesel_confirm_overwrite_cb),
+ NULL);
}
#endif
@@ -148,8 +157,8 @@ gchar *filesel_save_as(const gchar *file)
if (filename && is_file_exist(filename)) {
AlertValue aval;
- aval = alertpanel(_("Overwrite"),
- _("Overwrite existing file?"),
+ aval = alertpanel(_("Overwrite existing file"),
+ _("The file already exists. Do you want to replace it?"),
GTK_STOCK_OK, GTK_STOCK_CANCEL, NULL);
if (G_ALERTDEFAULT != aval) {
g_free(filename);
@@ -247,3 +256,32 @@ static gboolean filesel_save_expander_get_expanded(GtkWidget *dialog)
else
return FALSE;
}
+
+#if GTK_CHECK_VERSION(2, 8, 0)
+static GtkFileChooserConfirmation filesel_confirm_overwrite_cb
+ (GtkFileChooser *chooser,
+ gpointer data)
+{
+ gchar *filename;
+ GtkFileChooserConfirmation ret =
+ GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME;
+
+ filename = gtk_file_chooser_get_filename(chooser);
+
+ if (filename && is_file_exist(filename)) {
+ AlertValue aval;
+
+ aval = alertpanel(_("Overwrite existing file"),
+ _("The file already exists. Do you want to replace it?"),
+ GTK_STOCK_OK, GTK_STOCK_CANCEL, NULL);
+ if (G_ALERTDEFAULT == aval)
+ ret = GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME;
+ else
+ ret = GTK_FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN;
+ }
+
+ g_free(filename);
+
+ return ret;
+}
+#endif