[gimp] app: don't call create_display() in image_new_from_template()



commit e19ded379ba797c2743efd3d9e6c14f8a939fc28
Author: Michael Natterer <mitch gimp org>
Date:   Fri May 2 15:38:26 2014 +0200

    app: don't call create_display() in image_new_from_template()
    
    No other gimpimage-new function calls it; instead, call it in
    image_new_from_template()'s callers.

 app/actions/templates-commands.c |    7 ++++++-
 app/core/gimpimage-new.c         |    4 ----
 app/dialogs/image-new-dialog.c   |    7 ++++++-
 3 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/app/actions/templates-commands.c b/app/actions/templates-commands.c
index af7611a..a74fb60 100644
--- a/app/actions/templates-commands.c
+++ b/app/actions/templates-commands.c
@@ -91,7 +91,12 @@ templates_create_image_cmd_callback (GtkAction *action,
 
   if (template && gimp_container_have (container, GIMP_OBJECT (template)))
     {
-      gimp_image_new_from_template (gimp, template, context);
+      GimpImage *image;
+
+      image = gimp_image_new_from_template (gimp, template, context);
+      gimp_create_display (gimp, image, gimp_template_get_unit (template), 1.0);
+      g_object_unref (image);
+
       gimp_image_new_set_last_template (gimp, template);
     }
 }
diff --git a/app/core/gimpimage-new.c b/app/core/gimpimage-new.c
index 021b181..7b2a6e6 100644
--- a/app/core/gimpimage-new.c
+++ b/app/core/gimpimage-new.c
@@ -144,10 +144,6 @@ gimp_image_new_from_template (Gimp         *gimp,
   gimp_image_undo_enable (image);
   gimp_image_clean_all (image);
 
-  gimp_create_display (gimp, image, gimp_template_get_unit (template), 1.0);
-
-  g_object_unref (image);
-
   return image;
 }
 
diff --git a/app/dialogs/image-new-dialog.c b/app/dialogs/image-new-dialog.c
index 4cc3609..2772ec3 100644
--- a/app/dialogs/image-new-dialog.c
+++ b/app/dialogs/image-new-dialog.c
@@ -358,10 +358,15 @@ image_new_create_image (ImageNewDialog *dialog)
 {
   GimpTemplate *template = g_object_ref (dialog->template);
   Gimp         *gimp     = dialog->context->gimp;
+  GimpImage    *image;
 
   gtk_widget_destroy (dialog->dialog);
 
-  gimp_image_new_from_template (gimp, template, gimp_get_user_context (gimp));
+  image = gimp_image_new_from_template (gimp, template,
+                                        gimp_get_user_context (gimp));
+  gimp_create_display (gimp, image, gimp_template_get_unit (template), 1.0);
+  g_object_unref (image);
+
   gimp_image_new_set_last_template (gimp, template);
 
   g_object_unref (template);


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