aboutsummaryrefslogtreecommitdiff
path: root/src/filesel.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-04-11 07:50:06 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-04-11 07:50:06 +0000
commit39dc449d3aedde4af54f6e8cffce95637da4c20a (patch)
tree55bd42f857fcb0444b5520ebad2b1c8d2ecf6494 /src/filesel.c
parentecee51b6ca15f0ed0345993a874f5fc5768af9e5 (diff)
use custom overwrite confirmation dialog in file selection dialog.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1622 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/filesel.c')
-rw-r--r--src/filesel.c44
1 files changed, 41 insertions, 3 deletions
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