[gimp] Move the statusbar back to GimpDisplayShell



commit dee0afed7934818299bc644201539917cf60d05e
Author: Michael Natterer <mitch gimp org>
Date:   Sun Oct 4 15:31:38 2009 +0200

    Move the statusbar back to GimpDisplayShell
    
    Keeping it in GimpImageWindow was a bad idea because
    - it wasted space
    - it produced evil code because
    - it conceptually didn't belong there

 app/actions/actions.c                     |   38 ++++------
 app/display/gimpdisplay.c                 |    3 +-
 app/display/gimpdisplayshell-appearance.c |   17 ++--
 app/display/gimpdisplayshell-cursor.c     |   23 ++----
 app/display/gimpdisplayshell-handlers.c   |   34 +++------
 app/display/gimpdisplayshell-progress.c   |  118 +++++++++++------------------
 app/display/gimpdisplayshell.c            |   32 +++++++-
 app/display/gimpdisplayshell.h            |    4 +
 app/display/gimpimagewindow.c             |  110 +++++----------------------
 app/display/gimpimagewindow.h             |    1 -
 app/display/gimpstatusbar.c               |   20 +++++
 app/gui/gui.c                             |   25 ++-----
 app/tools/gimpmeasuretool.c               |    6 +-
 app/tools/gimptool.c                      |  104 ++++++++-----------------
 14 files changed, 202 insertions(+), 333 deletions(-)
---
diff --git a/app/actions/actions.c b/app/actions/actions.c
index a95a827..85ff0cf 100644
--- a/app/actions/actions.c
+++ b/app/actions/actions.c
@@ -631,30 +631,24 @@ action_message (GimpDisplay *display,
                 const gchar *format,
                 ...)
 {
-  GimpImageWindow *window;
+  GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (display->shell);
+  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);
+  const gchar      *stock_id  = NULL;
+  va_list           args;
 
-  window = gimp_display_shell_get_window (GIMP_DISPLAY_SHELL (display->shell));
-
-  if (window)
+  if (GIMP_IS_TOOL_OPTIONS (object))
     {
-      GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
-      const gchar   *stock_id  = NULL;
-      va_list        args;
-
-      if (GIMP_IS_TOOL_OPTIONS (object))
-        {
-          GimpToolInfo *tool_info = GIMP_TOOL_OPTIONS (object)->tool_info;
-
-          stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
-        }
-      else if (GIMP_IS_VIEWABLE (object))
-        {
-          stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (object));
-        }
+      GimpToolInfo *tool_info = GIMP_TOOL_OPTIONS (object)->tool_info;
 
-      va_start (args, format);
-      gimp_statusbar_push_temp_valist (statusbar, GIMP_MESSAGE_INFO,
-                                       stock_id, format, args);
-      va_end (args);
+      stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
     }
+  else if (GIMP_IS_VIEWABLE (object))
+    {
+      stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (object));
+    }
+
+  va_start (args, format);
+  gimp_statusbar_push_temp_valist (statusbar, GIMP_MESSAGE_INFO,
+                                   stock_id, format, args);
+  va_end (args);
 }
diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c
index 6fa6ffb..4952628 100644
--- a/app/display/gimpdisplay.c
+++ b/app/display/gimpdisplay.c
@@ -429,8 +429,7 @@ gimp_display_new (Gimp              *gimp,
   gimp_image_window_set_active_shell (window,
                                       GIMP_DISPLAY_SHELL (display->shell));
 
-  /* FIXME image window */
-  g_signal_connect (gimp_image_window_get_statusbar (GIMP_IMAGE_WINDOW (window)),
+  g_signal_connect (gimp_display_shell_get_statusbar (GIMP_DISPLAY_SHELL (display->shell)),
                     "cancel",
                     G_CALLBACK (gimp_display_progress_canceled),
                     display);
diff --git a/app/display/gimpdisplayshell-appearance.c b/app/display/gimpdisplayshell-appearance.c
index 1ac3fde..e9600c8 100644
--- a/app/display/gimpdisplayshell-appearance.c
+++ b/app/display/gimpdisplayshell-appearance.c
@@ -74,8 +74,14 @@ gimp_display_shell_appearance_update (GimpDisplayShell *shell)
   window  = gimp_display_shell_get_window (shell);
 
   if (window)
-    appearance_set_action_active (shell, "view-fullscreen",
-                                  gimp_image_window_get_fullscreen (window));
+    {
+      gboolean fullscreen = gimp_image_window_get_fullscreen (window);
+
+      appearance_set_action_active (shell, "view-fullscreen", fullscreen);
+
+      gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (shell->statusbar),
+                                         ! fullscreen);
+    }
 
   gimp_display_shell_set_show_menubar       (shell,
                                              options->show_menubar);
@@ -136,19 +142,14 @@ gimp_display_shell_set_show_statusbar (GimpDisplayShell *shell,
                                        gboolean          show)
 {
   GimpDisplayOptions *options;
-  GimpImageWindow    *window;
 
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
 
   options = appearance_get_options (shell);
-  window  = gimp_display_shell_get_window (shell);
 
   g_object_set (options, "show-statusbar", show, NULL);
 
-  if (window && gimp_image_window_get_active_shell (window) == shell)
-    {
-      gimp_image_window_set_show_statusbar (window, show);
-    }
+  gimp_statusbar_set_visible (GIMP_STATUSBAR (shell->statusbar), show);
 
   appearance_set_action_active (shell, "view-show-statusbar", show);
 }
diff --git a/app/display/gimpdisplayshell-cursor.c b/app/display/gimpdisplayshell-cursor.c
index cb00e79..c2fe294 100644
--- a/app/display/gimpdisplayshell-cursor.c
+++ b/app/display/gimpdisplayshell-cursor.c
@@ -37,7 +37,6 @@
 #include "gimpdisplayshell-cursor.h"
 #include "gimpdisplayshell-expose.h"
 #include "gimpdisplayshell-transform.h"
-#include "gimpimagewindow.h"
 #include "gimpstatusbar.h"
 
 
@@ -126,7 +125,7 @@ gimp_display_shell_update_cursor (GimpDisplayShell    *shell,
                                   gdouble              image_x,
                                   gdouble              image_y)
 {
-  GimpImageWindow   *window;
+  GimpStatusbar     *statusbar;
   GimpDialogFactory *factory;
   GimpSessionInfo   *session_info;
   GimpImage         *image;
@@ -162,14 +161,9 @@ gimp_display_shell_update_cursor (GimpDisplayShell    *shell,
   /*  use the passed image_coords for the statusbar because they are
    *  possibly snapped...
    */
-  window = gimp_display_shell_get_window (shell);
+  statusbar = gimp_display_shell_get_statusbar (shell);
 
-  if (window && gimp_image_window_get_active_shell (window))
-    {
-      GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
-
-      gimp_statusbar_update_cursor (statusbar, precision, image_x, image_y);
-    }
+  gimp_statusbar_update_cursor (statusbar, precision, image_x, image_y);
 
   factory = gimp_dialog_factory_from_name ("dock");
   session_info = gimp_dialog_factory_find_session_info (factory,
@@ -200,20 +194,15 @@ gimp_display_shell_update_cursor (GimpDisplayShell    *shell,
 void
 gimp_display_shell_clear_cursor (GimpDisplayShell *shell)
 {
-  GimpImageWindow   *window;
+  GimpStatusbar     *statusbar;
   GimpDialogFactory *factory;
   GimpSessionInfo   *session_info;
 
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
 
-  window = gimp_display_shell_get_window (shell);
+  statusbar = gimp_display_shell_get_statusbar (shell);
 
-  if (window && gimp_image_window_get_active_shell (window) == shell)
-    {
-      GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
-
-      gimp_statusbar_clear_cursor (statusbar);
-    }
+  gimp_statusbar_clear_cursor (statusbar);
 
   factory = gimp_dialog_factory_from_name ("dock");
   session_info = gimp_dialog_factory_find_session_info (factory,
diff --git a/app/display/gimpdisplayshell-handlers.c b/app/display/gimpdisplayshell-handlers.c
index 6882c06..d73a433 100644
--- a/app/display/gimpdisplayshell-handlers.c
+++ b/app/display/gimpdisplayshell-handlers.c
@@ -586,18 +586,13 @@ gimp_display_shell_saved_handler (GimpImage        *image,
                                   const gchar      *uri,
                                   GimpDisplayShell *shell)
 {
-  GimpImageWindow *window = gimp_display_shell_get_window (shell);
+  GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
+  gchar         *filename  = file_utils_uri_display_name (uri);
 
-  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);
-    }
+  gimp_statusbar_push_temp (statusbar, GIMP_MESSAGE_INFO,
+                            GTK_STOCK_SAVE, _("Image saved to '%s'"),
+                            filename);
+  g_free (filename);
 }
 
 static void
@@ -605,18 +600,13 @@ gimp_display_shell_exported_handler (GimpImage        *image,
                                      const gchar      *uri,
                                      GimpDisplayShell *shell)
 {
-  GimpImageWindow *window = gimp_display_shell_get_window (shell);
+  GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
+  gchar         *filename  = file_utils_uri_display_name (uri);
 
-  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);
-    }
+  gimp_statusbar_push_temp (statusbar, GIMP_MESSAGE_INFO,
+                            GTK_STOCK_SAVE, _("Image exported to '%s'"),
+                            filename);
+  g_free (filename);
 }
 
 static void
diff --git a/app/display/gimpdisplayshell-progress.c b/app/display/gimpdisplayshell-progress.c
index ffd318c..36729e9 100644
--- a/app/display/gimpdisplayshell-progress.c
+++ b/app/display/gimpdisplayshell-progress.c
@@ -27,104 +27,74 @@
 
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-progress.h"
-#include "gimpimagewindow.h"
 #include "gimpstatusbar.h"
 
 
-/* FIXME: need to store the shell's progress state in the shell itself
- * instead of simply dispatching to the statusbar. Otherwise it's
- * impossible to switch an image window between two shells that both
- * have active progress messages.
- */
-
-
-static GimpProgress *
-gimp_display_shell_progress_get_real_progress (GimpProgress *progress)
-{
-  GimpDisplayShell *shell  = GIMP_DISPLAY_SHELL (progress);
-  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);
-
-      return GIMP_PROGRESS (statusbar);
-    }
-
-  return NULL;
-}
-
 static GimpProgress *
 gimp_display_shell_progress_start (GimpProgress *progress,
                                    const gchar  *message,
                                    gboolean      cancelable)
 {
-  progress = gimp_display_shell_progress_get_real_progress (progress);
+  GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (progress);
+  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);
 
-  if (progress)
-    return gimp_progress_start (progress, message, cancelable);
-
-  return NULL;
+  return gimp_progress_start (GIMP_PROGRESS (statusbar), message, cancelable);
 }
 
 static void
 gimp_display_shell_progress_end (GimpProgress *progress)
 {
-  progress = gimp_display_shell_progress_get_real_progress (progress);
+  GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (progress);
+  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);
 
-  if (progress)
-    gimp_progress_end (progress);
+  gimp_progress_end (GIMP_PROGRESS (statusbar));
 }
 
 static gboolean
 gimp_display_shell_progress_is_active (GimpProgress *progress)
 {
-  progress = gimp_display_shell_progress_get_real_progress (progress);
-
-  if (progress)
-    return gimp_progress_is_active (progress);
+  GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (progress);
+  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);
 
-  return FALSE;
+  return gimp_progress_is_active (GIMP_PROGRESS (statusbar));
 }
 
 static void
 gimp_display_shell_progress_set_text (GimpProgress *progress,
                                       const gchar  *message)
 {
-  progress = gimp_display_shell_progress_get_real_progress (progress);
+  GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (progress);
+  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);
 
-  if (progress)
-    gimp_progress_set_text (progress, message);
+  gimp_progress_set_text (GIMP_PROGRESS (statusbar), message);
 }
 
 static void
 gimp_display_shell_progress_set_value (GimpProgress *progress,
                                        gdouble       percentage)
 {
-  progress = gimp_display_shell_progress_get_real_progress (progress);
+  GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (progress);
+  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);
 
-  if (progress)
-    gimp_progress_set_value (progress, percentage);
+  gimp_progress_set_value (GIMP_PROGRESS (statusbar), percentage);
 }
 
 static gdouble
 gimp_display_shell_progress_get_value (GimpProgress *progress)
 {
-  progress = gimp_display_shell_progress_get_real_progress (progress);
-
-  if (progress)
-    return gimp_progress_get_value (progress);
+  GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (progress);
+  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);
 
-  return 0.0;
+  return gimp_progress_get_value (GIMP_PROGRESS (statusbar));
 }
 
 static void
 gimp_display_shell_progress_pulse (GimpProgress *progress)
 {
-  progress = gimp_display_shell_progress_get_real_progress (progress);
+  GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (progress);
+  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);
 
-  if (progress)
-    gimp_progress_pulse (progress);
+  gimp_progress_pulse (GIMP_PROGRESS (statusbar));
 }
 
 static guint32
@@ -145,32 +115,30 @@ gimp_display_shell_progress_message (GimpProgress        *progress,
                                      const gchar         *domain,
                                      const gchar         *message)
 {
-  progress = gimp_display_shell_progress_get_real_progress (progress);
+  GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (progress);
+  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);
 
-  if (progress)
+  switch (severity)
     {
-      switch (severity)
-        {
-        case GIMP_MESSAGE_ERROR:
-          /* error messages are never handled here */
-          break;
-
-        case GIMP_MESSAGE_WARNING:
-          /* warning messages go to the statusbar, if it's visible */
-          if (! gimp_statusbar_get_visible (GIMP_STATUSBAR (progress)))
-            break;
-          else
-            return gimp_progress_message (progress, gimp,
-                                          severity, domain, message);
-
-        case GIMP_MESSAGE_INFO:
-          /* info messages go to the statusbar;
-           * if they are not handled there, they are swallowed
-           */
-          gimp_progress_message (progress, gimp,
-                                 severity, domain, message);
-          return TRUE;
-        }
+    case GIMP_MESSAGE_ERROR:
+      /* error messages are never handled here */
+      break;
+
+    case GIMP_MESSAGE_WARNING:
+      /* warning messages go to the statusbar, if it's visible */
+      if (! gimp_statusbar_get_visible (statusbar))
+        break;
+      else
+        return gimp_progress_message (GIMP_PROGRESS (statusbar), gimp,
+                                      severity, domain, message);
+
+    case GIMP_MESSAGE_INFO:
+      /* info messages go to the statusbar;
+       * if they are not handled there, they are swallowed
+       */
+      gimp_progress_message (GIMP_PROGRESS (statusbar), gimp,
+                             severity, domain, message);
+      return TRUE;
     }
 
   return FALSE;
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index f362a2e..d3ff17e 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -859,10 +859,12 @@ gimp_display_shell_new (GimpDisplay       *display,
    *     |             +-- vscrollbar
    *     |
    *     +-- lower_hbox
-   *            |
-   *            +-- quick_mask
-   *            +-- hscrollbar
-   *            +-- navbutton
+   *     |      |
+   *     |      +-- quick_mask
+   *     |      +-- hscrollbar
+   *     |      +-- navbutton
+   *     |
+   *     +-- statusbar
    */
 
   /*  first, set up the container hierarchy  *********************************/
@@ -1080,6 +1082,14 @@ gimp_display_shell_new (GimpDisplay       *display,
                            _("Navigate the image display"),
                            GIMP_HELP_IMAGE_WINDOW_NAV_BUTTON);
 
+  /*  the statusbar  ********************************************************/
+
+  shell->statusbar = gimp_statusbar_new ();
+  gimp_statusbar_set_shell (GIMP_STATUSBAR (shell->statusbar), shell);
+  gimp_help_set_help_data (shell->statusbar, NULL,
+                           GIMP_HELP_IMAGE_WINDOW_STATUS_BAR);
+  gtk_box_pack_end (GTK_BOX (shell), shell->statusbar, FALSE, FALSE, 0);
+
   /*  pack all the widgets  **************************************************/
 
   /*  fill the inner_table  */
@@ -1139,6 +1149,8 @@ gimp_display_shell_new (GimpDisplay       *display,
       gimp_help_set_help_data (shell->canvas,
                                _("Drop image files here to open them"),
                                NULL);
+
+      gimp_statusbar_empty (GIMP_STATUSBAR (shell->statusbar));
     }
 
   /* make sure the information is up-to-date */
@@ -1156,6 +1168,14 @@ gimp_display_shell_get_window (GimpDisplayShell *shell)
                                                      GIMP_TYPE_IMAGE_WINDOW));
 }
 
+GimpStatusbar *
+gimp_display_shell_get_statusbar (GimpDisplayShell *shell)
+{
+  g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
+
+  return GIMP_STATUSBAR (shell->statusbar);
+}
+
 void
 gimp_display_shell_reconnect (GimpDisplayShell *shell)
 {
@@ -1206,6 +1226,8 @@ gimp_display_shell_empty (GimpDisplayShell *shell)
   gimp_help_set_help_data (shell->canvas,
                            _("Drop image files here to open them"), NULL);
 
+  gimp_statusbar_empty (GIMP_STATUSBAR (shell->statusbar));
+
   gimp_display_shell_expose_full (shell);
 
   user_context = gimp_get_user_context (shell->display->gimp);
@@ -1251,6 +1273,8 @@ gimp_display_shell_fill (GimpDisplayShell *shell,
 
   gimp_help_set_help_data (shell->canvas, NULL, NULL);
 
+  gimp_statusbar_fill (GIMP_STATUSBAR (shell->statusbar));
+
   /* A size-allocate will always occur because the scrollbars will
    * become visible forcing the canvas to become smaller
    */
diff --git a/app/display/gimpdisplayshell.h b/app/display/gimpdisplayshell.h
index 081b19a..9a489fc 100644
--- a/app/display/gimpdisplayshell.h
+++ b/app/display/gimpdisplayshell.h
@@ -135,6 +135,8 @@ struct _GimpDisplayShell
   GtkWidget         *zoom_button;      /*  NE: zoom toggle button             */
   GtkWidget         *nav_ebox;         /*  SE: navigation event box           */
 
+  GtkWidget         *statusbar;        /*  statusbar                          */
+
   guchar            *render_buf;       /*  buffer for rendering the image     */
 
   guint              title_idle_id;    /*  title update idle ID               */
@@ -223,6 +225,8 @@ GtkWidget       * gimp_display_shell_new           (GimpDisplay        *display,
 
 GimpImageWindow * gimp_display_shell_get_window    (GimpDisplayShell   *shell);
 
+GimpStatusbar   * gimp_display_shell_get_statusbar (GimpDisplayShell   *shell);
+
 void              gimp_display_shell_reconnect     (GimpDisplayShell   *shell);
 
 void              gimp_display_shell_empty         (GimpDisplayShell   *shell);
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index 3439ede..9bc6df2 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -81,7 +81,6 @@ struct _GimpImageWindowPrivate
   GtkWidget         *right_hpane;
   GtkWidget         *notebook;
   GtkWidget         *right_docks;
-  GtkWidget         *statusbar;
 
   GdkWindowState     window_state;
   gboolean           is_empty;
@@ -142,9 +141,6 @@ static void      gimp_image_window_shell_scaled        (GimpDisplayShell    *she
 static void      gimp_image_window_shell_title_notify  (GimpDisplayShell    *shell,
                                                         const GParamSpec    *pspec,
                                                         GimpImageWindow     *window);
-static void      gimp_image_window_shell_status_notify (GimpDisplayShell    *shell,
-                                                        const GParamSpec    *pspec,
-                                                        GimpImageWindow     *window);
 static void      gimp_image_window_shell_icon_notify   (GimpDisplayShell    *shell,
                                                         const GParamSpec    *pspec,
                                                         GimpImageWindow     *window);
@@ -319,13 +315,6 @@ gimp_image_window_constructor (GType                  type,
   if (config->single_window_mode)
     gtk_widget_show (private->right_docks);
 
-  /* Create the statusbar */
-  private->statusbar = gimp_statusbar_new ();
-  gimp_help_set_help_data (private->statusbar, NULL,
-                           GIMP_HELP_IMAGE_WINDOW_STATUS_BAR);
-  gtk_box_pack_end (GTK_BOX (private->main_vbox), private->statusbar,
-                    FALSE, FALSE, 0);
-
   return object;
 }
 
@@ -480,15 +469,13 @@ gimp_image_window_window_state_event (GtkWidget           *widget,
         gtk_widget_set_name (private->menubar,
                              fullscreen ? "gimp-menubar-fullscreen" : NULL);
 
-      gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (private->statusbar),
-                                         ! fullscreen);
-
       gimp_display_shell_appearance_update (shell);
     }
 
   if (event->changed_mask & GDK_WINDOW_STATE_ICONIFIED)
     {
-      gboolean iconified = gimp_image_window_is_iconified (window);
+      GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (shell);
+      gboolean       iconified = gimp_image_window_is_iconified (window);
 
       GIMP_LOG (WM, "Image window '%s' [%p] set %s",
                 gtk_window_get_title (GTK_WINDOW (widget)),
@@ -509,10 +496,8 @@ gimp_image_window_window_state_event (GtkWidget           *widget,
           gimp_dialog_factories_show_with_display ();
         }
 
-      if (gimp_progress_is_active (GIMP_PROGRESS (private->statusbar)))
+      if (gimp_progress_is_active (GIMP_PROGRESS (statusbar)))
         {
-          GimpStatusbar *statusbar = GIMP_STATUSBAR (private->statusbar);
-
           if (iconified)
             gimp_statusbar_override_window_title (statusbar);
           else
@@ -527,15 +512,17 @@ static void
 gimp_image_window_style_set (GtkWidget *widget,
                              GtkStyle  *prev_style)
 {
-  GimpImageWindow        *window  = GIMP_IMAGE_WINDOW (widget);
-  GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
+  GimpImageWindow        *window    = GIMP_IMAGE_WINDOW (widget);
+  GimpImageWindowPrivate *private   = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
+  GimpDisplayShell       *shell     = gimp_image_window_get_active_shell (window);
+  GimpStatusbar          *statusbar = gimp_display_shell_get_statusbar (shell);
   GtkRequisition          requisition;
   GdkGeometry             geometry;
   GdkWindowHints          geometry_mask;
 
   GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
 
-  gtk_widget_size_request (private->statusbar, &requisition);
+  gtk_widget_size_request (GTK_WIDGET (statusbar), &requisition);
 
   geometry.min_height = 23;
 
@@ -579,18 +566,6 @@ gimp_image_window_get_ui_manager (GimpImageWindow *window)
   return private->menubar_manager;
 }
 
-GimpStatusbar *
-gimp_image_window_get_statusbar (GimpImageWindow *window)
-{
-  GimpImageWindowPrivate *private;
-
-  g_return_val_if_fail (GIMP_IS_IMAGE_WINDOW (window), FALSE);
-
-  private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
-
-  return GIMP_STATUSBAR (private->statusbar);
-}
-
 GimpDockColumns  *
 gimp_image_window_get_left_docks (GimpImageWindow  *window)
 {
@@ -778,31 +753,6 @@ gimp_image_window_get_show_menubar (GimpImageWindow *window)
 }
 
 void
-gimp_image_window_set_show_statusbar (GimpImageWindow *window,
-                                      gboolean         show)
-{
-  GimpImageWindowPrivate *private;
-
-  g_return_if_fail (GIMP_IS_IMAGE_WINDOW (window));
-
-  private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
-
-  gimp_statusbar_set_visible (GIMP_STATUSBAR (private->statusbar), show);
-}
-
-gboolean
-gimp_image_window_get_show_statusbar (GimpImageWindow *window)
-{
-  GimpImageWindowPrivate *private;
-
-  g_return_val_if_fail (GIMP_IS_IMAGE_WINDOW (window), FALSE);
-
-  private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
-
-  return GTK_WIDGET_VISIBLE (private->statusbar);
-}
-
-void
 gimp_image_window_set_show_docks (GimpImageWindow *window,
                                   gboolean         show)
 {
@@ -942,8 +892,10 @@ gimp_image_window_shrink_wrap (GimpImageWindow *window,
 
   if (resize)
     {
-      if (width < private->statusbar->requisition.width)
-        width = private->statusbar->requisition.width;
+      GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (active_shell);
+
+      if (width < GTK_WIDGET (statusbar)->requisition.width)
+        width = GTK_WIDGET (statusbar)->requisition.width;
 
       width  = width  + border_width;
       height = height + border_height;
@@ -976,9 +928,10 @@ gimp_image_window_show_tooltip (GimpUIManager   *manager,
                                 const gchar     *tooltip,
                                 GimpImageWindow *window)
 {
-  GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
+  GimpDisplayShell *shell     = gimp_image_window_get_active_shell (window);
+  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);
 
-  gimp_statusbar_push (GIMP_STATUSBAR (private->statusbar), "menu-tooltip",
+  gimp_statusbar_push (statusbar, "menu-tooltip",
                        NULL, "%s", tooltip);
 }
 
@@ -986,9 +939,10 @@ static void
 gimp_image_window_hide_tooltip (GimpUIManager   *manager,
                                 GimpImageWindow *window)
 {
-  GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
+  GimpDisplayShell *shell     = gimp_image_window_get_active_shell (window);
+  GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);
 
-  gimp_statusbar_pop (GIMP_STATUSBAR (private->statusbar), "menu-tooltip");
+  gimp_statusbar_pop (statusbar, "menu-tooltip");
 }
 
 static gboolean
@@ -1031,11 +985,10 @@ gimp_image_window_switch_page (GtkNotebook     *notebook,
                                             gimp_image_window_shell_title_notify,
                                             window);
       g_signal_handlers_disconnect_by_func (private->active_shell,
-                                            gimp_image_window_shell_status_notify,
-                                            window);
-      g_signal_handlers_disconnect_by_func (private->active_shell,
                                             gimp_image_window_shell_icon_notify,
                                             window);
+
+      gimp_image_window_hide_tooltip (private->menubar_manager, window);
     }
 
   private->active_shell = shell;
@@ -1046,18 +999,12 @@ gimp_image_window_switch_page (GtkNotebook     *notebook,
                     G_CALLBACK (gimp_image_window_image_notify),
                     window);
 
-  gimp_statusbar_set_shell (GIMP_STATUSBAR (private->statusbar),
-                            private->active_shell);
-
   g_signal_connect (private->active_shell, "scaled",
                     G_CALLBACK (gimp_image_window_shell_scaled),
                     window);
   g_signal_connect (private->active_shell, "notify::title",
                     G_CALLBACK (gimp_image_window_shell_title_notify),
                     window);
-  g_signal_connect (private->active_shell, "notify::status",
-                    G_CALLBACK (gimp_image_window_shell_status_notify),
-                    window);
   g_signal_connect (private->active_shell, "notify::icon",
                     G_CALLBACK (gimp_image_window_shell_icon_notify),
                     window);
@@ -1066,8 +1013,6 @@ gimp_image_window_switch_page (GtkNotebook     *notebook,
 
   if (! active_display->image)
     {
-      gimp_statusbar_empty (GIMP_STATUSBAR (private->statusbar));
-
       gimp_dialog_factory_add_foreign (private->display_factory,
                                        "gimp-empty-image-window",
                                        GTK_WIDGET (window));
@@ -1092,8 +1037,6 @@ gimp_image_window_image_notify (GimpDisplay      *display,
 
           gimp_dialog_factory_remove_dialog (private->display_factory,
                                              GTK_WIDGET (window));
-
-          gimp_statusbar_fill (GIMP_STATUSBAR (private->statusbar));
         }
     }
   else if (g_list_length (private->shells) == 1)
@@ -1129,8 +1072,6 @@ gimp_image_window_image_notify (GimpDisplay      *display,
                                        "gimp-empty-image-window",
                                        GTK_WIDGET (window));
 
-      gimp_statusbar_empty (GIMP_STATUSBAR (private->statusbar));
-
       gtk_window_unmaximize (GTK_WINDOW (window));
       gtk_window_resize (GTK_WINDOW (window), width, height);
     }
@@ -1164,17 +1105,6 @@ gimp_image_window_shell_title_notify (GimpDisplayShell *shell,
 }
 
 static void
-gimp_image_window_shell_status_notify (GimpDisplayShell *shell,
-                                       const GParamSpec *pspec,
-                                       GimpImageWindow  *window)
-{
-  GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
-
-  gimp_statusbar_replace (GIMP_STATUSBAR (private->statusbar), "title",
-                          NULL, "%s", shell->status);
-}
-
-static void
 gimp_image_window_shell_icon_notify (GimpDisplayShell *shell,
                                      const GParamSpec *pspec,
                                      GimpImageWindow  *window)
diff --git a/app/display/gimpimagewindow.h b/app/display/gimpimagewindow.h
index edacc66..b110b7e 100644
--- a/app/display/gimpimagewindow.h
+++ b/app/display/gimpimagewindow.h
@@ -46,7 +46,6 @@ struct _GimpImageWindowClass
 GType              gimp_image_window_get_type           (void) G_GNUC_CONST;
 
 GimpUIManager    * gimp_image_window_get_ui_manager     (GimpImageWindow  *window);
-GimpStatusbar    * gimp_image_window_get_statusbar      (GimpImageWindow  *window);
 GimpDockColumns  * gimp_image_window_get_left_docks     (GimpImageWindow  *window);
 GimpDockColumns  * gimp_image_window_get_right_docks    (GimpImageWindow  *window);
 
diff --git a/app/display/gimpstatusbar.c b/app/display/gimpstatusbar.c
index edb3bbb..9ff4388 100644
--- a/app/display/gimpstatusbar.c
+++ b/app/display/gimpstatusbar.c
@@ -110,6 +110,9 @@ static void     gimp_statusbar_scale_activated    (GimpScaleComboBox *combo,
                                                    GimpStatusbar     *statusbar);
 static void     gimp_statusbar_shell_scaled       (GimpDisplayShell  *shell,
                                                    GimpStatusbar     *statusbar);
+static void     gimp_statusbar_shell_status_notify(GimpDisplayShell  *shell,
+                                                   const GParamSpec  *pspec,
+                                                   GimpStatusbar     *statusbar);
 static guint    gimp_statusbar_get_context_id     (GimpStatusbar     *statusbar,
                                                    const gchar       *context);
 static gboolean gimp_statusbar_temp_timeout       (GimpStatusbar     *statusbar);
@@ -676,6 +679,10 @@ gimp_statusbar_set_shell (GimpStatusbar    *statusbar,
       g_signal_handlers_disconnect_by_func (statusbar->shell,
                                             gimp_statusbar_shell_scaled,
                                             statusbar);
+
+      g_signal_handlers_disconnect_by_func (statusbar->shell,
+                                            gimp_statusbar_shell_status_notify,
+                                            statusbar);
     }
 
   statusbar->shell = shell;
@@ -683,6 +690,10 @@ gimp_statusbar_set_shell (GimpStatusbar    *statusbar,
   g_signal_connect_object (statusbar->shell, "scaled",
                            G_CALLBACK (gimp_statusbar_shell_scaled),
                            statusbar, 0);
+
+  g_signal_connect_object (statusbar->shell, "notify::status",
+                           G_CALLBACK (gimp_statusbar_shell_status_notify),
+                           statusbar, 0);
 }
 
 gboolean
@@ -1428,6 +1439,15 @@ gimp_statusbar_shell_scaled (GimpDisplayShell *shell,
 }
 
 static void
+gimp_statusbar_shell_status_notify (GimpDisplayShell *shell,
+                                    const GParamSpec *pspec,
+                                    GimpStatusbar    *statusbar)
+{
+  gimp_statusbar_replace (statusbar, "title",
+                          NULL, "%s", shell->status);
+}
+
+static void
 gimp_statusbar_unit_changed (GimpUnitComboBox *combo,
                              GimpStatusbar    *statusbar)
 {
diff --git a/app/gui/gui.c b/app/gui/gui.c
index 978ce81..27c7141 100644
--- a/app/gui/gui.c
+++ b/app/gui/gui.c
@@ -43,7 +43,6 @@
 #include "display/gimpdisplay-foreach.h"
 #include "display/gimpdisplayshell.h"
 #include "display/gimpdisplayshell-render.h"
-#include "display/gimpimagewindow.h"
 #include "display/gimpstatusbar.h"
 
 #include "tools/gimp-tools.h"
@@ -721,16 +720,11 @@ gui_menu_show_tooltip (GimpUIManager *manager,
 
   if (display)
     {
-      GimpDisplayShell *shell  = GIMP_DISPLAY_SHELL (display->shell);
-      GimpImageWindow  *window = gimp_display_shell_get_window (shell);
+      GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (display->shell);
+      GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);
 
-      if (window)
-        {
-          GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
-
-          gimp_statusbar_push (statusbar, "menu-tooltip",
-                               NULL, "%s", tooltip);
-        }
+      gimp_statusbar_push (statusbar, "menu-tooltip",
+                           NULL, "%s", tooltip);
     }
 }
 
@@ -743,15 +737,10 @@ gui_menu_hide_tooltip (GimpUIManager *manager,
 
   if (display)
     {
-      GimpDisplayShell *shell  = GIMP_DISPLAY_SHELL (display->shell);
-      GimpImageWindow  *window = gimp_display_shell_get_window (shell);
+      GimpDisplayShell *shell     = GIMP_DISPLAY_SHELL (display->shell);
+      GimpStatusbar    *statusbar = gimp_display_shell_get_statusbar (shell);
 
-      if (window)
-        {
-          GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
-
-          gimp_statusbar_pop (statusbar, "menu-tooltip");
-        }
+      gimp_statusbar_pop (statusbar, "menu-tooltip");
     }
 }
 
diff --git a/app/tools/gimpmeasuretool.c b/app/tools/gimpmeasuretool.c
index 788df9b..fa072cf 100644
--- a/app/tools/gimpmeasuretool.c
+++ b/app/tools/gimpmeasuretool.c
@@ -44,7 +44,7 @@
 
 #include "display/gimpdisplay.h"
 #include "display/gimpdisplayshell.h"
-#include "display/gimpimagewindow.h"
+#include "display/gimpdisplayshell-appearance.h"
 
 #include "gimpmeasureoptions.h"
 #include "gimpmeasuretool.h"
@@ -333,10 +333,8 @@ gimp_measure_tool_button_press (GimpTool            *tool,
   /*  create the info window if necessary  */
   if (! measure->dialog)
     {
-      GimpImageWindow *window = gimp_display_shell_get_window (shell);
-
       if (options->use_info_window ||
-          ! gimp_image_window_get_show_statusbar (window))
+          ! gimp_display_shell_get_show_statusbar (shell))
         {
           measure->dialog = gimp_measure_tool_dialog_new (measure);
           g_object_add_weak_pointer (G_OBJECT (measure->dialog),
diff --git a/app/tools/gimptool.c b/app/tools/gimptool.c
index 557b78f..931b6c4 100644
--- a/app/tools/gimptool.c
+++ b/app/tools/gimptool.c
@@ -32,7 +32,6 @@
 #include "display/gimpdisplay.h"
 #include "display/gimpdisplayshell.h"
 #include "display/gimpdisplayshell-cursor.h"
-#include "display/gimpimagewindow.h"
 #include "display/gimpstatusbar.h"
 
 #include "gimptool.h"
@@ -896,31 +895,24 @@ gimp_tool_push_status (GimpTool    *tool,
                        ...)
 {
   GimpDisplayShell *shell;
-  GimpImageWindow  *window;
+  const gchar      *stock_id;
+  va_list           args;
 
   g_return_if_fail (GIMP_IS_TOOL (tool));
   g_return_if_fail (GIMP_IS_DISPLAY (display));
   g_return_if_fail (format != NULL);
 
-  shell  = GIMP_DISPLAY_SHELL (display->shell);
-  window = gimp_display_shell_get_window (shell);
+  shell = GIMP_DISPLAY_SHELL (display->shell);
 
-  if (window)
-    {
-      GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
-      const gchar   *stock_id;
-      va_list        args;
-
-      stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
+  stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
 
-      va_start (args, format);
+  va_start (args, format);
 
-      gimp_statusbar_push_valist (statusbar,
-                                  G_OBJECT_TYPE_NAME (tool), stock_id,
-                                  format, args);
+  gimp_statusbar_push_valist (gimp_display_shell_get_statusbar (shell),
+                              G_OBJECT_TYPE_NAME (tool), stock_id,
+                              format, args);
 
-      va_end (args);
-    }
+  va_end (args);
 
   tool->status_displays = g_list_remove (tool->status_displays, display);
   tool->status_displays = g_list_prepend (tool->status_displays, display);
@@ -937,26 +929,19 @@ gimp_tool_push_status_coords (GimpTool            *tool,
                               const gchar         *help)
 {
   GimpDisplayShell *shell;
-  GimpImageWindow  *window;
+  const gchar      *stock_id;
 
   g_return_if_fail (GIMP_IS_TOOL (tool));
   g_return_if_fail (GIMP_IS_DISPLAY (display));
 
-  shell  = GIMP_DISPLAY_SHELL (display->shell);
-  window = gimp_display_shell_get_window (shell);
+  shell = GIMP_DISPLAY_SHELL (display->shell);
 
-  if (window)
-    {
-      GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
-      const gchar   *stock_id;
-
-      stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
+  stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
 
-      gimp_statusbar_push_coords (statusbar,
-                                  G_OBJECT_TYPE_NAME (tool), stock_id,
-                                  precision, title, x, separator, y,
-                                  help);
-    }
+  gimp_statusbar_push_coords (gimp_display_shell_get_statusbar (shell),
+                              G_OBJECT_TYPE_NAME (tool), stock_id,
+                              precision, title, x, separator, y,
+                              help);
 
   tool->status_displays = g_list_remove (tool->status_displays, display);
   tool->status_displays = g_list_prepend (tool->status_displays, display);
@@ -971,25 +956,18 @@ gimp_tool_push_status_length (GimpTool            *tool,
                               const gchar         *help)
 {
   GimpDisplayShell *shell;
-  GimpImageWindow  *window;
+  const gchar      *stock_id;
 
   g_return_if_fail (GIMP_IS_TOOL (tool));
   g_return_if_fail (GIMP_IS_DISPLAY (display));
 
-  shell  = GIMP_DISPLAY_SHELL (display->shell);
-  window = gimp_display_shell_get_window (shell);
+  shell = GIMP_DISPLAY_SHELL (display->shell);
 
-  if (window)
-    {
-      GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
-      const gchar   *stock_id;
+  stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
 
-      stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
-
-      gimp_statusbar_push_length (statusbar,
-                                  G_OBJECT_TYPE_NAME (tool), stock_id,
-                                  title, axis, value, help);
-    }
+  gimp_statusbar_push_length (gimp_display_shell_get_statusbar (shell),
+                              G_OBJECT_TYPE_NAME (tool), stock_id,
+                              title, axis, value, help);
 
   tool->status_displays = g_list_remove (tool->status_displays, display);
   tool->status_displays = g_list_prepend (tool->status_displays, display);
@@ -1002,31 +980,24 @@ gimp_tool_replace_status (GimpTool    *tool,
                           ...)
 {
   GimpDisplayShell *shell;
-  GimpImageWindow  *window;
+  const gchar      *stock_id;
+  va_list           args;
 
   g_return_if_fail (GIMP_IS_TOOL (tool));
   g_return_if_fail (GIMP_IS_DISPLAY (display));
   g_return_if_fail (format != NULL);
 
-  shell  = GIMP_DISPLAY_SHELL (display->shell);
-  window = gimp_display_shell_get_window (shell);
-
-  if (window)
-    {
-      GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
-      const gchar   *stock_id;
-      va_list        args;
+  shell = GIMP_DISPLAY_SHELL (display->shell);
 
-      stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
+  stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
 
-      va_start (args, format);
+  va_start (args, format);
 
-      gimp_statusbar_replace_valist (statusbar,
-                                     G_OBJECT_TYPE_NAME (tool), stock_id,
-                                     format, args);
+  gimp_statusbar_replace_valist (gimp_display_shell_get_statusbar (shell),
+                                 G_OBJECT_TYPE_NAME (tool), stock_id,
+                                 format, args);
 
-      va_end (args);
-    }
+  va_end (args);
 
   tool->status_displays = g_list_remove (tool->status_displays, display);
   tool->status_displays = g_list_prepend (tool->status_displays, display);
@@ -1037,21 +1008,14 @@ gimp_tool_pop_status (GimpTool    *tool,
                       GimpDisplay *display)
 {
   GimpDisplayShell *shell;
-  GimpImageWindow  *window;
 
   g_return_if_fail (GIMP_IS_TOOL (tool));
   g_return_if_fail (GIMP_IS_DISPLAY (display));
 
-  shell  = GIMP_DISPLAY_SHELL (display->shell);
-  window = gimp_display_shell_get_window (shell);
-
-  if (window)
-    {
-      GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
+  shell = GIMP_DISPLAY_SHELL (display->shell);
 
-      gimp_statusbar_pop (statusbar,
-                          G_OBJECT_TYPE_NAME (tool));
-    }
+  gimp_statusbar_pop (gimp_display_shell_get_statusbar (shell),
+                      G_OBJECT_TYPE_NAME (tool));
 
   tool->status_displays = g_list_remove (tool->status_displays, display);
 }



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