[gimp] Use gimp_display_set_image() in gimp_display_new()



commit 6ad76d226e0a94f5132cf9212b5e7551c858ce09
Author: Michael Natterer <mitch gimp org>
Date:   Wed Oct 7 19:42:08 2009 +0200

    Use gimp_display_set_image() in gimp_display_new()
    
    instead of manually calling gimp_display_connect(). Make
    gimp_display_set_image() handle displays in construction
    (which don't have a shell yet).

 app/display/gimpdisplay.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c
index e13cc1f..cf45778 100644
--- a/app/display/gimpdisplay.c
+++ b/app/display/gimpdisplay.c
@@ -406,11 +406,7 @@ gimp_display_new (Gimp              *gimp,
 
   /*  refs the image  */
   if (image)
-    {
-      private->instance = image->instance_count++;
-
-      gimp_display_connect (display, image);
-    }
+    gimp_display_set_image (display, image);
 
   /*  get an image window  */
   if (GIMP_GUI_CONFIG (display->config)->single_window_mode)
@@ -614,6 +610,7 @@ gimp_display_set_image (GimpDisplay *display,
 {
   GimpDisplayPrivate *private;
   GimpImage          *old_image = NULL;
+  GimpDisplayShell   *shell;
 
   g_return_if_fail (GIMP_IS_DISPLAY (display));
   g_return_if_fail (image == NULL || GIMP_IS_IMAGE (image));
@@ -643,10 +640,15 @@ gimp_display_set_image (GimpDisplay *display,
   if (old_image)
     g_object_unref (old_image);
 
-  if (image)
-    gimp_display_shell_reconnect (gimp_display_get_shell (display));
-  else
-    gimp_display_shell_icon_update (gimp_display_get_shell (display));
+  shell = gimp_display_get_shell (display);
+
+  if (shell)
+    {
+      if (image)
+        gimp_display_shell_reconnect (shell);
+      else
+        gimp_display_shell_icon_update (shell);
+    }
 
   if (old_image != image)
     g_object_notify (G_OBJECT (display), "image");



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