Commit 93f580fa authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

if the parent widget is not a GtkWindow, use gtk_widget_get_toplevel() to

2004-02-28  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimpdialog.c (gimp_dialog_new_valist): if the
	parent widget is not a GtkWindow, use gtk_widget_get_toplevel()
	to get a pointer to the window the widget lives in.

	* app/gui/resolution-calibrate-dialog.c: don't make the dialog
	modal. It was a bad idea to do that, leading to problems spotted
	by Pedro Gimeno (bug #135630).
parent 7392745f
......@@ -53,9 +53,9 @@ static gint ruler_height = 1;
*
* Displays a dialog that allows the user to interactively determine
* her monitor resolution. This dialog runs it's own GTK main loop and
* is connected to a #GimpSizeEntry handling the resolution to be
* set. The style and callback parameters are supposed to be only used
* by the user_installation_dialog.
* is connected to a #GimpSizeEntry handling the resolution to be set.
* The style and callback parameters must only be used by the
* user_installation_dialog.
**/
void
resolution_calibrate_dialog (GtkWidget *resolution_entry,
......@@ -85,7 +85,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
dialog = gimp_dialog_new (_("Calibrate Monitor Resolution"),
"calibrate_resolution",
resolution_entry,
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_DIALOG_DESTROY_WITH_PARENT,
NULL, NULL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
......
......@@ -53,9 +53,9 @@ static gint ruler_height = 1;
*
* Displays a dialog that allows the user to interactively determine
* her monitor resolution. This dialog runs it's own GTK main loop and
* is connected to a #GimpSizeEntry handling the resolution to be
* set. The style and callback parameters are supposed to be only used
* by the user_installation_dialog.
* is connected to a #GimpSizeEntry handling the resolution to be set.
* The style and callback parameters must only be used by the
* user_installation_dialog.
**/
void
resolution_calibrate_dialog (GtkWidget *resolution_entry,
......@@ -85,7 +85,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry,
dialog = gimp_dialog_new (_("Calibrate Monitor Resolution"),
"calibrate_resolution",
resolution_entry,
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_DIALOG_DESTROY_WITH_PARENT,
NULL, NULL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
......
......@@ -236,13 +236,15 @@ gimp_dialog_new (const gchar *title,
* gtk_window_set_title().
* @role: The dialog's @role which will be set with
* gtk_window_set_role().
* @parent: The @parent widget of this dialog.
* @parent: The @parent widget of this dialog or %NULL.
* @flags: The @flags (see the #GtkDialog documentation).
* @help_func: The function which will be called if the user presses "F1".
* @help_id: The help_id which will be passed to @help_func.
* @args: A @va_list destribing the action_area buttons.
*
* Creates a new @GimpDialog widget.
* Creates a new @GimpDialog widget. If a @parent widget is specified,
* the dialog will be made transient for the window this widget lives in
* (or or to the @parent widget itself if it is already a #GtkWindow).
*
* For a description of the format of the @va_list describing the
* action_area buttons see gtk_dialog_new_with_buttons().
......@@ -260,9 +262,9 @@ gimp_dialog_new_valist (const gchar *title,
{
GtkWidget *dialog;
g_return_val_if_fail (parent == NULL || GTK_IS_WIDGET (parent), NULL);
g_return_val_if_fail (title != NULL, NULL);
g_return_val_if_fail (role != NULL, NULL);
g_return_val_if_fail (parent == NULL || GTK_IS_WIDGET (parent), NULL);
dialog = g_object_new (GIMP_TYPE_DIALOG,
"title", title,
......@@ -271,6 +273,9 @@ gimp_dialog_new_valist (const gchar *title,
if (parent)
{
if (! GTK_IS_WINDOW (parent))
parent = gtk_widget_get_toplevel (parent);
if (GTK_IS_WINDOW (parent))
{
gtk_window_set_transient_for (GTK_WINDOW (dialog),
......@@ -280,7 +285,6 @@ gimp_dialog_new_valist (const gchar *title,
{
gtk_window_set_screen (GTK_WINDOW (dialog),
gtk_widget_get_screen (parent));
/* TODO */
}
}
......
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