[gimp] Move GimpImage::saved and GimpImage::exported handlers to the right place



commit 3189b8f45f2b8fb02342099dc8c6b688da7129fe
Author: Michael Natterer <mitch gimp org>
Date:   Tue Sep 29 22:38:34 2009 +0200

    Move GimpImage::saved and GimpImage::exported handlers to the right place
    
    GimpDisplay is *only* for proxying the image's projection, every other
    image/display connection belongs into GimpDisplayShell, so move these
    handlers from gimpdisplay-handlers.c to gimpdisplayshell-handlers.c.

 app/display/gimpdisplay-handlers.c      |   68 -------------------------------
 app/display/gimpdisplayshell-handlers.c |   62 ++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 68 deletions(-)
---
diff --git a/app/display/gimpdisplay-handlers.c b/app/display/gimpdisplay-handlers.c
index 768b105..6b03f78 100644
--- a/app/display/gimpdisplay-handlers.c
+++ b/app/display/gimpdisplay-handlers.c
@@ -22,19 +22,10 @@
 
 #include "display-types.h"
 
-#include "config/gimpdisplayconfig.h"
-
 #include "core/gimpimage.h"
 
-#include "file/file-utils.h"
-
 #include "gimpdisplay.h"
 #include "gimpdisplay-handlers.h"
-#include "gimpdisplayshell.h"
-#include "gimpimagewindow.h"
-#include "gimpstatusbar.h"
-
-#include "gimp-intl.h"
 
 
 /*  local function prototypes  */
@@ -49,12 +40,6 @@ static void   gimp_display_update_handler    (GimpProjection *projection,
 static void   gimp_display_flush_handler     (GimpImage      *image,
                                               gboolean        invalidate_preview,
                                               GimpDisplay    *display);
-static void   gimp_display_saved_handler     (GimpImage      *image,
-                                              const gchar    *uri,
-                                              GimpDisplay    *display);
-static void   gimp_display_exported_handler  (GimpImage      *image,
-                                              const gchar    *uri,
-                                              GimpDisplay    *display);
 
 
 /*  public functions  */
@@ -87,12 +72,6 @@ gimp_display_connect (GimpDisplay *display,
   g_signal_connect (image, "flush",
                     G_CALLBACK (gimp_display_flush_handler),
                     display);
-  g_signal_connect (image, "saved",
-                    G_CALLBACK (gimp_display_saved_handler),
-                    display);
-  g_signal_connect (image, "exported",
-                    G_CALLBACK (gimp_display_exported_handler),
-                    display);
 }
 
 void
@@ -106,12 +85,6 @@ gimp_display_disconnect (GimpDisplay *display)
   image = display->image;
 
   g_signal_handlers_disconnect_by_func (image,
-                                        gimp_display_saved_handler,
-                                        display);
-  g_signal_handlers_disconnect_by_func (image,
-                                        gimp_display_exported_handler,
-                                        display);
-  g_signal_handlers_disconnect_by_func (image,
                                         gimp_display_flush_handler,
                                         display);
 
@@ -157,44 +130,3 @@ gimp_display_flush_handler (GimpImage   *image,
 {
   gimp_display_flush (display);
 }
-
-static void
-gimp_display_saved_handler (GimpImage   *image,
-                            const gchar *uri,
-                            GimpDisplay *display)
-{
-  GimpDisplayShell *shell  = GIMP_DISPLAY_SHELL (display->shell);
-  GimpImageWindow  *window = gimp_display_shell_get_window (shell);
-
-  if (window && gimp_image_window_get_active_shell (window) == shell)
-    {
-      GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
-      gchar         *filename  = file_utils_uri_display_name (uri);
-
-      gimp_statusbar_push_temp (statusbar, GIMP_MESSAGE_INFO,
-                                GTK_STOCK_SAVE, _("Image saved to '%s'"),
-                                filename);
-      g_free (filename);
-    }
-}
-
-static void
-gimp_display_exported_handler (GimpImage   *image,
-                               const gchar *uri,
-                               GimpDisplay *display)
-{
-  GimpDisplayShell *shell  = GIMP_DISPLAY_SHELL (display->shell);
-  GimpImageWindow  *window = gimp_display_shell_get_window (shell);
-
-  if (window && gimp_image_window_get_active_shell (window) == shell)
-    {
-      GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
-      gchar         *filename  = file_utils_uri_display_name (uri);
-
-      gimp_statusbar_push_temp (statusbar, GIMP_MESSAGE_INFO,
-                                GTK_STOCK_SAVE, _("Image exported to '%s'"),
-                                filename);
-      g_free (filename);
-    }
-}
-
diff --git a/app/display/gimpdisplayshell-handlers.c b/app/display/gimpdisplayshell-handlers.c
index 54788f4..16be205 100644
--- a/app/display/gimpdisplayshell-handlers.c
+++ b/app/display/gimpdisplayshell-handlers.c
@@ -34,6 +34,8 @@
 #include "core/gimpitem.h"
 #include "core/gimptreehandler.h"
 
+#include "file/file-utils.h"
+
 #include "widgets/gimpwidgets-utils.h"
 
 #include "gimpdisplay.h"
@@ -49,6 +51,9 @@
 #include "gimpdisplayshell-selection.h"
 #include "gimpdisplayshell-title.h"
 #include "gimpimagewindow.h"
+#include "gimpstatusbar.h"
+
+#include "gimp-intl.h"
 
 
 /*  local function prototypes  */
@@ -89,6 +94,12 @@ static void   gimp_display_shell_invalidate_preview_handler (GimpImage        *i
                                                              GimpDisplayShell *shell);
 static void   gimp_display_shell_profile_changed_handler    (GimpColorManaged *image,
                                                              GimpDisplayShell *shell);
+static void   gimp_display_shell_saved_handler              (GimpImage        *image,
+                                                             const gchar      *uri,
+                                                             GimpDisplayShell *shell);
+static void   gimp_display_shell_exported_handler           (GimpImage        *image,
+                                                             const gchar      *uri,
+                                                             GimpDisplayShell *shell);
 
 static void   gimp_display_shell_vectors_freeze_handler     (GimpVectors      *vectors,
                                                              GimpDisplayShell *shell);
@@ -178,6 +189,12 @@ gimp_display_shell_connect (GimpDisplayShell *shell)
   g_signal_connect (image, "profile-changed",
                     G_CALLBACK (gimp_display_shell_profile_changed_handler),
                     shell);
+  g_signal_connect (image, "saved",
+                    G_CALLBACK (gimp_display_shell_saved_handler),
+                    shell);
+  g_signal_connect (image, "exported",
+                    G_CALLBACK (gimp_display_shell_exported_handler),
+                    shell);
 
   shell->vectors_freeze_handler =
     gimp_tree_handler_connect (image->vectors, "freeze",
@@ -331,6 +348,12 @@ gimp_display_shell_disconnect (GimpDisplayShell *shell)
   shell->vectors_freeze_handler = NULL;
 
   g_signal_handlers_disconnect_by_func (image,
+                                        gimp_display_shell_exported_handler,
+                                        shell);
+  g_signal_handlers_disconnect_by_func (image,
+                                        gimp_display_shell_saved_handler,
+                                        shell);
+  g_signal_handlers_disconnect_by_func (image,
                                         gimp_display_shell_profile_changed_handler,
                                         shell);
   g_signal_handlers_disconnect_by_func (image,
@@ -556,6 +579,45 @@ gimp_display_shell_profile_changed_handler (GimpColorManaged *image,
   gimp_color_managed_profile_changed (GIMP_COLOR_MANAGED (shell));
 }
 
+
+static void
+gimp_display_shell_saved_handler (GimpImage        *image,
+                                  const gchar      *uri,
+                                  GimpDisplayShell *shell)
+{
+  GimpImageWindow *window = gimp_display_shell_get_window (shell);
+
+  if (window && gimp_image_window_get_active_shell (window) == shell)
+    {
+      GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
+      gchar         *filename  = file_utils_uri_display_name (uri);
+
+      gimp_statusbar_push_temp (statusbar, GIMP_MESSAGE_INFO,
+                                GTK_STOCK_SAVE, _("Image saved to '%s'"),
+                                filename);
+      g_free (filename);
+    }
+}
+
+static void
+gimp_display_shell_exported_handler (GimpImage        *image,
+                                     const gchar      *uri,
+                                     GimpDisplayShell *shell)
+{
+  GimpImageWindow *window = gimp_display_shell_get_window (shell);
+
+  if (window && gimp_image_window_get_active_shell (window) == shell)
+    {
+      GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
+      gchar         *filename  = file_utils_uri_display_name (uri);
+
+      gimp_statusbar_push_temp (statusbar, GIMP_MESSAGE_INFO,
+                                GTK_STOCK_SAVE, _("Image exported to '%s'"),
+                                filename);
+      g_free (filename);
+    }
+}
+
 static void
 gimp_display_shell_vectors_freeze_handler (GimpVectors      *vectors,
                                            GimpDisplayShell *shell)



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