diff --git a/ChangeLog b/ChangeLog index dcf8f15f22..823ebec08f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-02-28 Sven Neumann + + * libgimpwidgets/gimpdialog.c: removed the call to + gtk_widget_get_toplevel() again. + Implement the GTK_DIALOG_DESTROY_WITH_PARENT behaviour in a way + that works for GimpDialog. + + * app/gui/resolution-calibrate-dialog.c: pass the toplevel window + to gimp_dialog_new (). + 2004-02-28 Michael Natterer * app/widgets/gimpcellrendererviewable.c: some general cleanup. diff --git a/app/dialogs/resolution-calibrate-dialog.c b/app/dialogs/resolution-calibrate-dialog.c index 238b490c11..6b43880b4b 100644 --- a/app/dialogs/resolution-calibrate-dialog.c +++ b/app/dialogs/resolution-calibrate-dialog.c @@ -84,7 +84,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry, dialog = gimp_dialog_new (_("Calibrate Monitor Resolution"), "calibrate_resolution", - resolution_entry, + gtk_widget_get_toplevel (resolution_entry), GTK_DIALOG_DESTROY_WITH_PARENT, NULL, NULL, @@ -112,6 +112,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry, if (pixbuf) { GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf); + gtk_table_attach (GTK_TABLE (table), image, 0, 1, 0, 1, GTK_SHRINK, GTK_SHRINK, 4, 4); gtk_widget_show (image); @@ -261,8 +262,9 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry, chain_button = GIMP_COORDINATES_CHAINBUTTON (resolution_entry); - if (ABS (x -y) > GIMP_MIN_RESOLUTION) - gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain_button), FALSE); + if (ABS (x - y) > GIMP_MIN_RESOLUTION) + gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain_button), + FALSE); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (resolution_entry), 0, calibrate_xres); diff --git a/app/gui/resolution-calibrate-dialog.c b/app/gui/resolution-calibrate-dialog.c index 238b490c11..6b43880b4b 100644 --- a/app/gui/resolution-calibrate-dialog.c +++ b/app/gui/resolution-calibrate-dialog.c @@ -84,7 +84,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry, dialog = gimp_dialog_new (_("Calibrate Monitor Resolution"), "calibrate_resolution", - resolution_entry, + gtk_widget_get_toplevel (resolution_entry), GTK_DIALOG_DESTROY_WITH_PARENT, NULL, NULL, @@ -112,6 +112,7 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry, if (pixbuf) { GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf); + gtk_table_attach (GTK_TABLE (table), image, 0, 1, 0, 1, GTK_SHRINK, GTK_SHRINK, 4, 4); gtk_widget_show (image); @@ -261,8 +262,9 @@ resolution_calibrate_dialog (GtkWidget *resolution_entry, chain_button = GIMP_COORDINATES_CHAINBUTTON (resolution_entry); - if (ABS (x -y) > GIMP_MIN_RESOLUTION) - gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain_button), FALSE); + if (ABS (x - y) > GIMP_MIN_RESOLUTION) + gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain_button), + FALSE); gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (resolution_entry), 0, calibrate_xres); diff --git a/libgimpwidgets/gimpdialog.c b/libgimpwidgets/gimpdialog.c index de3394569b..cae763e3cc 100644 --- a/libgimpwidgets/gimpdialog.c +++ b/libgimpwidgets/gimpdialog.c @@ -179,6 +179,7 @@ gimp_dialog_close (GtkDialog *dialog) } } + /** * gimp_dialog_new: * @title: The dialog's title which will be set with @@ -242,9 +243,8 @@ gimp_dialog_new (const gchar *title, * @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. 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). + * Creates a new @GimpDialog widget. If a GtkWindow is specified as + * @parent then the dialog will be made transient for this window. * * For a description of the format of the @va_list describing the * action_area buttons see gtk_dialog_new_with_buttons(). @@ -269,13 +269,11 @@ gimp_dialog_new_valist (const gchar *title, dialog = g_object_new (GIMP_TYPE_DIALOG, "title", title, "role", role, + "modal", (flags & GTK_DIALOG_MODAL), NULL); 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), @@ -286,14 +284,13 @@ gimp_dialog_new_valist (const gchar *title, gtk_window_set_screen (GTK_WINDOW (dialog), gtk_widget_get_screen (parent)); } + + if (flags & GTK_DIALOG_DESTROY_WITH_PARENT) + g_signal_connect_object (parent, "destroy", + G_CALLBACK (gimp_dialog_close), + dialog, G_CONNECT_SWAPPED); } - if (flags & GTK_DIALOG_MODAL) - gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); - - if (flags & GTK_DIALOG_DESTROY_WITH_PARENT) - gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE); - if (help_func) gimp_help_connect (dialog, help_func, help_id, dialog);