[gimp] app: Maintain a list of GimpImageWindow:s on an app instance level



commit 301e5c2c3427c3c49e5494dc226c10e80d49441c
Author: Martin Nordholts <martinn src gnome org>
Date:   Sun Oct 4 02:01:53 2009 +0200

    app: Maintain a list of GimpImageWindow:s on an app instance level

 app/core/gimp.c           |   10 ++++++++++
 app/core/gimp.h           |    3 +++
 app/display/gimpdisplay.c |   25 +++++++++++++++----------
 3 files changed, 28 insertions(+), 10 deletions(-)
---
diff --git a/app/core/gimp.c b/app/core/gimp.c
index d7f1036..98712f3 100644
--- a/app/core/gimp.c
+++ b/app/core/gimp.c
@@ -232,6 +232,8 @@ gimp_init (Gimp *gimp)
 
   gimp->next_display_ID     = 1;
 
+  gimp->image_windows       = NULL;
+
   gimp->global_buffer       = NULL;
   gimp->named_buffers       = gimp_list_new (GIMP_TYPE_BUFFER, TRUE);
   gimp_object_set_static_name (GIMP_OBJECT (gimp->named_buffers),
@@ -983,6 +985,14 @@ gimp_get_display_iter (Gimp *gimp)
 }
 
 GList *
+gimp_get_image_window_iter (Gimp *gimp)
+{
+  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+
+  return gimp->image_windows;
+}
+
+GList *
 gimp_get_tool_info_iter (Gimp *gimp)
 {
   g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
diff --git a/app/core/gimp.h b/app/core/gimp.h
index 1f743b9..519dcc2 100644
--- a/app/core/gimp.h
+++ b/app/core/gimp.h
@@ -85,6 +85,8 @@ struct _Gimp
   GimpContainer          *displays;
   gint                    next_display_ID;
 
+  GList                  *image_windows;
+
   GimpBuffer             *global_buffer;
   GimpContainer          *named_buffers;
 
@@ -168,6 +170,7 @@ void           gimp_exit                 (Gimp                *gimp,
 
 GList        * gimp_get_image_iter       (Gimp                *gimp);
 GList        * gimp_get_display_iter     (Gimp                *gimp);
+GList        * gimp_get_image_window_iter(Gimp                *gimp);
 GList        * gimp_get_tool_info_iter   (Gimp                *gimp);
 
 void           gimp_set_global_buffer    (Gimp                *gimp,
diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c
index 9c23b34..6fa6ffb 100644
--- a/app/display/gimpdisplay.c
+++ b/app/display/gimpdisplay.c
@@ -406,16 +406,19 @@ gimp_display_new (Gimp              *gimp,
     }
 
   if (! window)
-    window = g_object_new (GIMP_TYPE_IMAGE_WINDOW,
-                           "menu-factory",    menu_factory,
-                           "display-factory", display_factory,
-                           /* The window position will be overridden by the
-                            * dialog factory, it is only really used on first
-                            * startup.
-                            */
-                           display->image ? NULL : "window-position",
-                           GTK_WIN_POS_CENTER,
-                           NULL);
+    {
+      window = g_object_new (GIMP_TYPE_IMAGE_WINDOW,
+                             "menu-factory",    menu_factory,
+                             "display-factory", display_factory,
+                             /* The window position will be overridden by the
+                              * dialog factory, it is only really used on first
+                              * startup.
+                              */
+                             display->image ? NULL : "window-position",
+                             GTK_WIN_POS_CENTER,
+                             NULL);
+      gimp->image_windows = g_list_prepend (gimp->image_windows, window);
+    }
 
   /*  create the shell for the image  */
   display->shell = gimp_display_shell_new (display, unit, scale,
@@ -493,6 +496,8 @@ gimp_display_delete (GimpDisplay *display)
             }
           else
             {
+              Gimp *gimp = display->gimp;
+              gimp->image_windows = g_list_remove (gimp->image_windows, window);
               gtk_widget_destroy (GTK_WIDGET (window));
             }
         }



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