[gimp] app: attach the "Set Canvas Size" dialog to the image



commit d90ce3b97ca84546d681a3acccf93a7479f46b10
Author: Michael Natterer <mitch gimp org>
Date:   Sat Sep 24 15:10:19 2016 +0200

    app: attach the "Set Canvas Size" dialog to the image

 app/actions/image-commands.c |   39 ++++++++++++++++++++++-----------------
 1 files changed, 22 insertions(+), 17 deletions(-)
---
diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c
index 304bac9..b973bd6 100644
--- a/app/actions/image-commands.c
+++ b/app/actions/image-commands.c
@@ -499,23 +499,28 @@ image_resize_cmd_callback (GtkAction *action,
   return_if_no_widget (widget, data);
   return_if_no_display (display, data);
 
-  if (image_resize_unit != GIMP_UNIT_PERCENT)
-    image_resize_unit = gimp_display_get_shell (display)->unit;
-
-  dialog = resize_dialog_new (GIMP_VIEWABLE (image),
-                              action_data_get_context (data),
-                              _("Set Image Canvas Size"), "gimp-image-resize",
-                              widget,
-                              gimp_standard_help_func, GIMP_HELP_IMAGE_RESIZE,
-                              image_resize_unit,
-                              image_resize_callback,
-                              display);
-
-  g_signal_connect_object (display, "disconnect",
-                           G_CALLBACK (gtk_widget_destroy),
-                           dialog, G_CONNECT_SWAPPED);
-
-  gtk_widget_show (dialog);
+#define RESIZE_DIALOG_KEY "gimp-resize-dialog"
+
+  dialog = dialogs_get_dialog (G_OBJECT (image), RESIZE_DIALOG_KEY);
+
+  if (! dialog)
+    {
+      if (image_resize_unit != GIMP_UNIT_PERCENT)
+        image_resize_unit = gimp_display_get_shell (display)->unit;
+
+      dialog = resize_dialog_new (GIMP_VIEWABLE (image),
+                                  action_data_get_context (data),
+                                  _("Set Image Canvas Size"), "gimp-image-resize",
+                                  widget,
+                                  gimp_standard_help_func, GIMP_HELP_IMAGE_RESIZE,
+                                  image_resize_unit,
+                                  image_resize_callback,
+                                  display);
+
+      dialogs_attach_dialog (G_OBJECT (image), RESIZE_DIALOG_KEY, dialog);
+    }
+
+  gtk_window_present (GTK_WINDOW (dialog));
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]