app/gdisplay.[ch] made the warning_dialog a per-display variable. The old

2000-04-26  Michael Natterer  <mitch@gimp.org>

	* app/gdisplay.[ch]
	* app/gdisplay_ops.c: made the warning_dialog a per-display
	variable. The old behaviour of having only one global variable
	can easily result in loss of work and should IMHO be considered
	a bug.
This commit is contained in:
Michael Natterer 2000-04-26 21:04:35 +00:00 committed by Michael Natterer
parent df5b3da35f
commit 4c24479a58
9 changed files with 28 additions and 32 deletions

View File

@ -1,3 +1,11 @@
2000-04-26 Michael Natterer <mitch@gimp.org>
* app/gdisplay.[ch]
* app/gdisplay_ops.c: made the warning_dialog a per-display
variable. The old behaviour of having only one global variable
can easily result in loss of work and should IMHO be considered
a bug.
Wed Apr 26 22:35:36 CEST 2000 Stanislav Brabec <utx@penguin.cz>
On request of Martin Weber <martweb@gmx.net>:

View File

@ -132,6 +132,8 @@ gdisplay_new (GimpImage *gimage,
gdisp->cd_list = NULL;
gdisp->cd_ui = NULL;
gdisp->warning_dialog = NULL;
/* format the title */
gdisplay_format_title (gdisp, title, MAX_TITLE_BUF);

View File

@ -158,6 +158,8 @@ struct _GDisplay
GList *cd_list; /* color display conversion stuff */
GtkWidget *cd_ui; /* color display filter dialog */
GtkWidget *warning_dialog; /* "Changes were made to %s. Close anyway?" */
};

View File

@ -40,8 +40,6 @@ static void gdisplay_close_warning_callback (GtkWidget *widget,
static void gdisplay_close_warning_dialog (gchar *image_name,
GDisplay *gdisp);
static GtkWidget *warning_dialog = NULL;
/*
* This file is for operations on the gdisplay object
*/
@ -279,7 +277,7 @@ gdisplay_close_warning_callback (GtkWidget *widget,
gdisp = (GDisplay *) data;
menus_set_sensitive ("<Image>/File/Close", TRUE);
gdisp->warning_dialog = NULL;
if (close)
gtk_widget_destroy (gdisp->shell);
@ -292,22 +290,16 @@ gdisplay_close_warning_dialog (gchar *image_name,
GtkWidget *mbox;
gchar *warning_buf;
/* FIXUP this will raise any prexsisting close dialogs, which can be a
a bit confusing if you tried to close a new window because you had
forgotten the old dialog was still around */
/* If a warning dialog already exists raise the window and get out */
if (warning_dialog != NULL)
if (gdisp->warning_dialog != NULL)
{
gdk_window_raise (warning_dialog->window);
gdk_window_raise (gdisp->warning_dialog->window);
return;
}
menus_set_sensitive ("<Image>/File/Close", FALSE);
warning_buf =
g_strdup_printf (_("Changes were made to %s.\nClose anyway?"), image_name);
warning_dialog = mbox =
gdisp->warning_dialog = mbox =
gimp_query_boolean_box (image_name,
gimp_standard_help_func,
"dialogs/really_close.html",
@ -320,9 +312,5 @@ gdisplay_close_warning_dialog (gchar *image_name,
g_free (warning_buf);
gtk_signal_connect (GTK_OBJECT (mbox), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&warning_dialog);
gtk_widget_show (mbox);
}

View File

@ -132,6 +132,8 @@ gdisplay_new (GimpImage *gimage,
gdisp->cd_list = NULL;
gdisp->cd_ui = NULL;
gdisp->warning_dialog = NULL;
/* format the title */
gdisplay_format_title (gdisp, title, MAX_TITLE_BUF);

View File

@ -158,6 +158,8 @@ struct _GDisplay
GList *cd_list; /* color display conversion stuff */
GtkWidget *cd_ui; /* color display filter dialog */
GtkWidget *warning_dialog; /* "Changes were made to %s. Close anyway?" */
};

View File

@ -132,6 +132,8 @@ gdisplay_new (GimpImage *gimage,
gdisp->cd_list = NULL;
gdisp->cd_ui = NULL;
gdisp->warning_dialog = NULL;
/* format the title */
gdisplay_format_title (gdisp, title, MAX_TITLE_BUF);

View File

@ -158,6 +158,8 @@ struct _GDisplay
GList *cd_list; /* color display conversion stuff */
GtkWidget *cd_ui; /* color display filter dialog */
GtkWidget *warning_dialog; /* "Changes were made to %s. Close anyway?" */
};

View File

@ -40,8 +40,6 @@ static void gdisplay_close_warning_callback (GtkWidget *widget,
static void gdisplay_close_warning_dialog (gchar *image_name,
GDisplay *gdisp);
static GtkWidget *warning_dialog = NULL;
/*
* This file is for operations on the gdisplay object
*/
@ -279,7 +277,7 @@ gdisplay_close_warning_callback (GtkWidget *widget,
gdisp = (GDisplay *) data;
menus_set_sensitive ("<Image>/File/Close", TRUE);
gdisp->warning_dialog = NULL;
if (close)
gtk_widget_destroy (gdisp->shell);
@ -292,22 +290,16 @@ gdisplay_close_warning_dialog (gchar *image_name,
GtkWidget *mbox;
gchar *warning_buf;
/* FIXUP this will raise any prexsisting close dialogs, which can be a
a bit confusing if you tried to close a new window because you had
forgotten the old dialog was still around */
/* If a warning dialog already exists raise the window and get out */
if (warning_dialog != NULL)
if (gdisp->warning_dialog != NULL)
{
gdk_window_raise (warning_dialog->window);
gdk_window_raise (gdisp->warning_dialog->window);
return;
}
menus_set_sensitive ("<Image>/File/Close", FALSE);
warning_buf =
g_strdup_printf (_("Changes were made to %s.\nClose anyway?"), image_name);
warning_dialog = mbox =
gdisp->warning_dialog = mbox =
gimp_query_boolean_box (image_name,
gimp_standard_help_func,
"dialogs/really_close.html",
@ -320,9 +312,5 @@ gdisplay_close_warning_dialog (gchar *image_name,
g_free (warning_buf);
gtk_signal_connect (GTK_OBJECT (mbox), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&warning_dialog);
gtk_widget_show (mbox);
}