plug-ins/FractalExplorer/Dialogs.c plug-ins/Lighting/lighting_ui.c

2007-02-02  Sven Neumann  <sven@gimp.org>

	* plug-ins/FractalExplorer/Dialogs.c
	* plug-ins/Lighting/lighting_ui.c
	* plug-ins/common/CML_explorer.c
	* plug-ins/common/channel_mixer.c
	* plug-ins/common/gqbist.c
	* plug-ins/common/spheredesigner.c
	* plug-ins/flame/flame.c
	* plug-ins/gfig/gfig-dialog.c
	* plug-ins/gimpressionist/brush.c
	* plug-ins/ifscompose/ifscompose.c
	* plug-ins/imagemap/imap_file.c
	* plug-ins/metadata/interface.c
	* plug-ins/script-fu/script-fu-console.c: set
	do-overwrite-confirmation on file save dialogs and removed custom
	confirmation dialogs where present.


svn path=/trunk/; revision=21833
This commit is contained in:
Sven Neumann 2007-02-02 08:57:15 +00:00 committed by Sven Neumann
parent aae05d4eaf
commit d055b8f77a
14 changed files with 71 additions and 164 deletions

View File

@ -1,3 +1,21 @@
2007-02-02 Sven Neumann <sven@gimp.org>
* plug-ins/FractalExplorer/Dialogs.c
* plug-ins/Lighting/lighting_ui.c
* plug-ins/common/CML_explorer.c
* plug-ins/common/channel_mixer.c
* plug-ins/common/gqbist.c
* plug-ins/common/spheredesigner.c
* plug-ins/flame/flame.c
* plug-ins/gfig/gfig-dialog.c
* plug-ins/gimpressionist/brush.c
* plug-ins/ifscompose/ifscompose.c
* plug-ins/imagemap/imap_file.c
* plug-ins/metadata/interface.c
* plug-ins/script-fu/script-fu-console.c: set
do-overwrite-confirmation on file save dialogs and removed custom
confirmation dialogs where present.
2007-02-02 Sven Neumann <sven@gimp.org>
* app/actions/error-console-commands.c

View File

@ -1679,13 +1679,14 @@ create_save_file_chooser (GtkWidget *widget,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (window), GTK_RESPONSE_OK);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (window),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_dialog_set_default_response (GTK_DIALOG (window), GTK_RESPONSE_OK);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (window),
TRUE);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&window);

View File

@ -1102,12 +1102,14 @@ save_lighting_preset (GtkWidget *widget,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (window), GTK_RESPONSE_OK);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (window),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_dialog_set_default_response (GTK_DIALOG (window), GTK_RESPONSE_OK);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (window),
TRUE);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed),
@ -1244,12 +1246,11 @@ load_lighting_preset (GtkWidget *widget,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (window), GTK_RESPONSE_OK);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (window),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_dialog_set_default_response (GTK_DIALOG (window), GTK_RESPONSE_OK);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed),

View File

@ -379,8 +379,6 @@ static void CML_save_to_file_callback (GtkWidget *widget,
static void CML_save_to_file_response (GtkWidget *dialog,
gint response_id,
gpointer data);
static gboolean force_overwrite (const gchar *filename,
GtkWidget *parent);
static void CML_preview_update_callback (GtkWidget *widget,
gpointer data);
@ -1947,7 +1945,7 @@ CML_save_to_file_callback (GtkWidget *widget,
if (! dialog)
{
dialog =
gtk_file_chooser_dialog_new (_("Save Parameters To"),
gtk_file_chooser_dialog_new (_("Save CML Explorer Parameters"),
GTK_WINDOW (gtk_widget_get_toplevel (widget)),
GTK_FILE_CHOOSER_ACTION_SAVE,
@ -1960,9 +1958,11 @@ CML_save_to_file_callback (GtkWidget *widget,
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog),
TRUE);
g_signal_connect (dialog, "response",
G_CALLBACK (CML_save_to_file_response),
NULL);
@ -1997,10 +1997,6 @@ CML_save_to_file_response (GtkWidget *dialog,
if (! filename)
return;
if (g_file_test (filename, G_FILE_TEST_EXISTS) &&
! force_overwrite (filename, dialog))
return;
file = g_fopen (filename, "w");
if (! file)
@ -2071,48 +2067,6 @@ CML_save_to_file_response (GtkWidget *dialog,
gtk_widget_hide (dialog);
}
static gboolean
force_overwrite (const gchar *filename,
GtkWidget *parent)
{
GtkWidget *dialog;
GtkWidget *label;
GtkWidget *hbox;
gchar *buffer;
gboolean overwrite;
dialog = gimp_dialog_new (_("CML Explorer: Overwrite File?"), "cml_explorer",
parent, GTK_DIALOG_MODAL,
gimp_standard_help_func, PLUG_IN_PROC,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
hbox, FALSE, FALSE, 12);
gtk_widget_show (hbox);
buffer = g_strdup_printf (_("File '%s' exists.\n"
"Overwrite it?"), filename);
label = gtk_label_new (buffer);
g_free (buffer);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 12);
gtk_widget_show (label);
gtk_widget_show (dialog);
overwrite = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
gtk_widget_destroy (dialog);
return overwrite;
}
/* parameter file loading functions */
static void
@ -2124,7 +2078,7 @@ CML_load_from_file_callback (GtkWidget *widget,
if (! dialog)
{
dialog =
gtk_file_chooser_dialog_new ("",
gtk_file_chooser_dialog_new (_("Load CML Explorer Parameters"),
GTK_WINDOW (gtk_widget_get_toplevel (widget)),
GTK_FILE_CHOOSER_ACTION_OPEN,
@ -2148,11 +2102,6 @@ CML_load_from_file_callback (GtkWidget *widget,
NULL);
}
if ((selective_load_source == 0) || (selective_load_destination == 0))
gtk_window_set_title (GTK_WINDOW (dialog), _("Load Parameters From"));
else
gtk_window_set_title (GTK_WINDOW (dialog), _("Selective Load From"));
if (strlen (VALS.last_file_name) > 0)
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog),
VALS.last_file_name);
@ -2256,9 +2205,10 @@ CML_load_parameter_file (const gchar *filename,
if (version < PARAM_FILE_FORMAT_VERSION)
g_message (_("Warning: '%s' is an old format file."),
gimp_filename_to_utf8 (filename));
if (PARAM_FILE_FORMAT_VERSION < version)
g_message (_("Warning: '%s' is a parameter file for newer "
"CML_explorer than me."),
g_message (_("Warning: '%s' is a parameter file for a newer "
"version of CML Explorer."),
gimp_filename_to_utf8 (filename));
}
for (channel_id = 0; flag && (channel_id < 3); channel_id++)

View File

@ -120,9 +120,6 @@ static void cm_reset_callback (GtkWidget *widget,
static void cm_combo_callback (GtkWidget *widget,
CmParamsType *mix);
static gboolean cm_force_overwrite (const gchar *filename,
GtkWidget *parent);
static gdouble cm_calculate_norm (CmParamsType *mix,
CmChannelType *ch);
@ -1012,9 +1009,11 @@ cm_save_file_callback (GtkWidget *widget,
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog),
TRUE);
g_signal_connect (dialog, "response",
G_CALLBACK (cm_save_file_response_callback),
mix);
@ -1048,13 +1047,6 @@ cm_save_file_response_callback (GtkWidget *dialog,
if (! filename)
return;
if (g_file_test (filename, G_FILE_TEST_EXISTS) &&
! cm_force_overwrite (filename, dialog))
{
g_free (filename);
return;
}
file = g_fopen (filename, "w");
if (! file)
@ -1073,49 +1065,6 @@ cm_save_file_response_callback (GtkWidget *dialog,
gtk_widget_hide (dialog);
}
static gboolean
cm_force_overwrite (const gchar *filename,
GtkWidget *parent)
{
GtkWidget *dlg;
GtkWidget *label;
GtkWidget *hbox;
gchar *buffer;
gboolean overwrite;
dlg = gimp_dialog_new (_("Channel Mixer File Operation Warning"),
PLUG_IN_BINARY,
parent, GTK_DIALOG_MODAL,
gimp_standard_help_func, PLUG_IN_PROC,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
hbox = gtk_hbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
buffer = g_strdup_printf (_("File '%s' exists.\n"
"Overwrite it?"), filename);
label = gtk_label_new (buffer);
g_free (buffer);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
gtk_widget_show (dlg);
overwrite = (gimp_dialog_run (GIMP_DIALOG (dlg)) == GTK_RESPONSE_OK);
gtk_widget_destroy (dlg);
return overwrite;
}
static void
cm_save_file (CmParamsType *mix,
FILE *fp)

View File

@ -734,7 +734,7 @@ dialog_save (GtkWidget *widget,
parent = gtk_widget_get_toplevel (widget);
dialog = gtk_file_chooser_dialog_new (_("Save (middle transform) as QBE File"),
dialog = gtk_file_chooser_dialog_new (_("Save as QBE File"),
GTK_WINDOW (parent),
GTK_FILE_CHOOSER_ACTION_SAVE,
@ -747,9 +747,11 @@ dialog_save (GtkWidget *widget,
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog),
TRUE);
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog), qbist_info.path);
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)

View File

@ -2195,7 +2195,7 @@ fileselect (GtkFileChooserAction action,
gchar *titles[] = { N_("Open File"), N_("Save File") };
void *handlers[] = { loadpreset_response, savepreset_response };
if (!windows[action])
if (! windows[action])
{
GtkWidget *dialog = windows[action] =
gtk_file_chooser_dialog_new (gettext (titles[action]),
@ -2217,6 +2217,10 @@ fileselect (GtkFileChooserAction action,
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
if (action == GTK_FILE_CHOOSER_ACTION_SAVE)
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog),
TRUE);
g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&windows[action]);

View File

@ -481,10 +481,14 @@ make_file_dialog (const gchar *title,
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_dialog_set_default_response (GTK_DIALOG (file_dialog), GTK_RESPONSE_OK);
if (! load_save)
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (file_dialog),
TRUE);
g_object_add_weak_pointer (G_OBJECT (file_dialog), (gpointer) &file_dialog);
gtk_dialog_set_default_response (GTK_DIALOG (file_dialog), GTK_RESPONSE_OK);
gtk_window_set_destroy_with_parent (GTK_WINDOW (file_dialog), TRUE);
g_signal_connect (file_dialog, "delete-event",

View File

@ -696,9 +696,11 @@ gfig_save_action_callback (GtkAction *action,
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog),
TRUE);
g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer) &dialog);
/* FIXME: GFigObj should be a GObject and g_signal_connect_object()

View File

@ -245,9 +245,11 @@ savebrush (GtkWidget *wg,
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog),
TRUE);
path = g_build_filename ((gchar *)thispath->data, "Brushes", NULL);
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), path);

View File

@ -2521,9 +2521,11 @@ ifs_compose_save (GtkWidget *parent)
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog),
TRUE);
g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&dialog);

View File

@ -109,31 +109,6 @@ really_overwrite_cb (GtkMessageDialog *dialog,
gtk_widget_hide (GTK_WIDGET (data));
}
static void
do_file_exists_dialog (GtkWidget *parent)
{
GtkWidget *dialog;
gchar *message;
message =
g_strdup_printf ("<span weight=\"bold\" size=\"larger\">%s</span>\n\n"
"%s",
_("File already exists"),
_("Do you really want to overwrite?"));
dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (parent),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO,
message);
g_free (message);
g_signal_connect (dialog, "response",
G_CALLBACK (really_overwrite_cb),
parent);
gtk_widget_show (dialog);
}
static void
save_cb (GtkWidget *dialog,
gint response_id,
@ -145,13 +120,6 @@ save_cb (GtkWidget *dialog,
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
{
do_file_exists_dialog (dialog);
g_free (filename);
return;
}
save_as (filename);
g_free (filename);
}
@ -180,9 +148,11 @@ do_file_save_as_dialog (void)
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog),
TRUE);
g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&dialog);

View File

@ -506,8 +506,6 @@ file_import_dialog (GtkWidget *parent,
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
/* FIXME: gimp_help_connect? */
gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_OK);
g_signal_connect (dlg, "destroy",
@ -606,10 +604,11 @@ file_export_dialog (GtkWidget *parent,
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
/* FIXME: gimp_help_connect? */
gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_OK);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dlg),
TRUE);
g_signal_connect (dlg, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&dlg);

View File

@ -314,12 +314,15 @@ script_fu_console_save_dialog (ConsoleInterface *console)
GTK_STOCK_SAVE, GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (console->save_dialog),
GTK_RESPONSE_OK);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (console->save_dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_dialog_set_default_response (GTK_DIALOG (console->save_dialog),
GTK_RESPONSE_OK);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (console->save_dialog),
TRUE);
g_object_add_weak_pointer (G_OBJECT (console->save_dialog),
(gpointer) &console->save_dialog);