Commit e397c0ef authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

set the new "do-overwrite-confirmation" property on GtkFileChooser.

2005-12-28  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpfiledialog.[ch]: set the new
	"do-overwrite-confirmation" property on GtkFileChooser. Removed
	gimp_file_overwrite_dialog().

	* app/dialogs/file-save-dialog.c (file_save_dialog_check_uri):
	removed broken code which tried to figure if a file exists.
	Fixes bug #309729.

	* app/widgets/gimpdnd-xds.c: added gimp_file_overwrite_dialog()
	here as private utility function.
parent 338c7851
2005-12-28 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpfiledialog.[ch]: set the new
"do-overwrite-confirmation" property on GtkFileChooser. Removed
gimp_file_overwrite_dialog().
* app/dialogs/file-save-dialog.c (file_save_dialog_check_uri):
removed broken code which tried to figure if a file exists.
Fixes bug #309729.
* app/widgets/gimpdnd-xds.c: added gimp_file_overwrite_dialog()
here as private utility function.
2005-12-28 Michael Natterer <mitch@gimp.org>
* app/dialogs/about-dialog.c: set the new "wrap-license" property
......
......@@ -372,16 +372,6 @@ file_save_dialog_check_uri (GtkWidget *save_dialog,
return FALSE;
}
if (gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (save_dialog), uri))
{
if (! gimp_file_overwrite_dialog (save_dialog, uri))
{
g_free (uri);
g_free (basename);
return FALSE;
}
}
*ret_uri = uri;
*ret_basename = basename;
*ret_save_proc = save_proc;
......
......@@ -31,6 +31,8 @@
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "widgets-types.h"
#include "core/gimp.h"
......@@ -41,6 +43,8 @@
#include "gimpdnd-xds.h"
#include "gimpfiledialog.h"
#include "gimpmessagebox.h"
#include "gimpmessagedialog.h"
#include "gimp-intl.h"
......@@ -55,6 +59,14 @@
#define MAX_URI_LEN 4096
/* local function prototypes */
static gboolean gimp_file_overwrite_dialog (GtkWidget *parent,
const gchar *uri);
/* public functions */
void
gimp_dnd_xds_source_set (GdkDragContext *context,
GimpImage *image)
......@@ -177,3 +189,56 @@ gimp_dnd_xds_save_image (GdkDragContext *context,
g_free (uri);
}
/* private functions */
static gboolean
gimp_file_overwrite_dialog (GtkWidget *parent,
const gchar *uri)
{
GtkWidget *dialog;
gchar *filename;
gboolean overwrite = FALSE;
dialog = gimp_message_dialog_new (_("File Exists"), GIMP_STOCK_WARNING,
parent, GTK_DIALOG_DESTROY_WITH_PARENT,
gimp_standard_help_func, NULL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
_("_Replace"), GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
filename = file_utils_uri_display_name (uri);
gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
_("A file named '%s' already exists."),
filename);
g_free (filename);
gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box,
_("Do you want to replace it with the image "
"you are saving?"));
if (GTK_IS_DIALOG (parent))
gtk_dialog_set_response_sensitive (GTK_DIALOG (parent),
GTK_RESPONSE_CANCEL, FALSE);
g_object_ref (dialog);
overwrite = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
gtk_widget_destroy (dialog);
g_object_unref (dialog);
if (GTK_IS_DIALOG (parent))
gtk_dialog_set_response_sensitive (GTK_DIALOG (parent),
GTK_RESPONSE_CANCEL, TRUE);
return overwrite;
}
......@@ -43,8 +43,6 @@
#include "gimpfiledialog.h"
#include "gimpfileprocview.h"
#include "gimphelp-ids.h"
#include "gimpmessagebox.h"
#include "gimpmessagedialog.h"
#include "gimpprogressbox.h"
#include "gimpview.h"
#include "gimpviewrendererimagefile.h"
......@@ -286,10 +284,11 @@ gimp_file_dialog_new (Gimp *gimp,
}
dialog = g_object_new (GIMP_TYPE_FILE_DIALOG,
"title", title,
"role", role,
"action", action,
"local-only", local_only,
"title", title,
"role", role,
"action", action,
"local-only", local_only,
"do-overwrite-confirmation", TRUE,
NULL);
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
......@@ -400,58 +399,6 @@ gimp_file_dialog_set_image (GimpFileDialog *dialog,
}
gboolean
gimp_file_overwrite_dialog (GtkWidget *parent,
const gchar *uri)
{
GtkWidget *dialog;
gchar *filename;
gboolean overwrite = FALSE;
dialog = gimp_message_dialog_new (_("File Exists"), GIMP_STOCK_WARNING,
parent, GTK_DIALOG_DESTROY_WITH_PARENT,
gimp_standard_help_func, NULL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
_("_Replace"), GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
filename = file_utils_uri_display_name (uri);
gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
_("A file named '%s' already exists."),
filename);
g_free (filename);
gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box,
_("Do you want to replace it with the image "
"you are saving?"));
if (GTK_IS_DIALOG (parent))
gtk_dialog_set_response_sensitive (GTK_DIALOG (parent),
GTK_RESPONSE_CANCEL, FALSE);
g_object_ref (dialog);
overwrite = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
gtk_widget_destroy (dialog);
g_object_unref (dialog);
if (GTK_IS_DIALOG (parent))
gtk_dialog_set_response_sensitive (GTK_DIALOG (parent),
GTK_RESPONSE_CANCEL, TRUE);
return overwrite;
}
/* private functions */
static void
......
......@@ -78,9 +78,6 @@ void gimp_file_dialog_set_image (GimpFileDialog *dialog,
GimpImage *gimage,
gboolean save_a_copy);
gboolean gimp_file_overwrite_dialog (GtkWidget *parent,
const gchar *uri);
G_END_DECLS
#endif /* __GIMP_FILE_DIALOG_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment