[gimp/cage: 96/130] Bug 622311 - Get rid of status bar grip window in single-window mode



commit cd2ad50f391e02034e9aa4d2c2521a5382ca48e4
Author: Michael Natterer <mitch gimp org>
Date:   Sun Nov 28 13:19:06 2010 +0100

    Bug 622311 - Get rid of status bar grip window in single-window mode
    
    The the presence of docks in the image window into account when
    deciding whether to show the statusbar resize grip, and simply call
    gimp_display_shell_appearance_update() on all shells when
    reconfiguring the UI for single-window-mode (which feels like the
    right thing to do anyway).

 app/display/gimpdisplayshell-appearance.c |   17 ++++++++++++-
 app/gui/gimpuiconfigurer.c                |   35 +++++++++++++++++++++++++---
 2 files changed, 46 insertions(+), 6 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-appearance.c b/app/display/gimpdisplayshell-appearance.c
index 233bf10..9393e05 100644
--- a/app/display/gimpdisplayshell-appearance.c
+++ b/app/display/gimpdisplayshell-appearance.c
@@ -32,6 +32,7 @@
 #include "core/gimpimage.h"
 
 #include "widgets/gimpactiongroup.h"
+#include "widgets/gimpdockcolumns.h"
 #include "widgets/gimprender.h"
 #include "widgets/gimpuimanager.h"
 #include "widgets/gimpwidgets-utils.h"
@@ -73,12 +74,24 @@ gimp_display_shell_appearance_update (GimpDisplayShell *shell)
 
   if (window)
     {
-      gboolean fullscreen = gimp_image_window_get_fullscreen (window);
+      GimpDockColumns *left_docks;
+      GimpDockColumns *right_docks;
+      gboolean         fullscreen;
+      gboolean         has_grip;
+
+      fullscreen = gimp_image_window_get_fullscreen (window);
 
       appearance_set_action_active (shell, "view-fullscreen", fullscreen);
 
+      left_docks  = gimp_image_window_get_left_docks (window);
+      right_docks = gimp_image_window_get_right_docks (window);
+
+      has_grip = (! fullscreen &&
+                  ! (left_docks  && gimp_dock_columns_get_docks (left_docks)) &&
+                  ! (right_docks && gimp_dock_columns_get_docks (right_docks)));
+
       gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (shell->statusbar),
-                                         ! fullscreen);
+                                         has_grip);
     }
 
   gimp_display_shell_set_show_menubar       (shell,
diff --git a/app/gui/gimpuiconfigurer.c b/app/gui/gimpuiconfigurer.c
index a061607..24c8492 100644
--- a/app/gui/gimpuiconfigurer.c
+++ b/app/gui/gimpuiconfigurer.c
@@ -35,6 +35,7 @@
 
 #include "display/gimpdisplay.h"
 #include "display/gimpdisplayshell.h"
+#include "display/gimpdisplayshell-appearance.h"
 #include "display/gimpimagewindow.h"
 
 #include "menus/menus.h"
@@ -231,6 +232,9 @@ gimp_ui_configurer_move_shells (GimpUIConfigurer  *ui_configurer,
       gimp_image_window_remove_shell (source_image_window, shell);
       gimp_image_window_add_shell (target_image_window, shell);
       g_object_unref (shell);
+
+      /* Make sure the shell looks right in this mode */
+      gimp_display_shell_appearance_update (shell);
     }
 }
 
@@ -314,11 +318,12 @@ static void
 gimp_ui_configurer_separate_shells (GimpUIConfigurer *ui_configurer,
                                     GimpImageWindow  *source_image_window)
 {
+  GimpDisplayShell *shell;
+
   /* The last display shell remains in its window */
   while (gimp_image_window_get_n_shells (source_image_window) > 1)
     {
-      GimpDisplayShell *shell            = NULL;
-      GimpImageWindow  *new_image_window = NULL;
+      GimpImageWindow *new_image_window;
 
       /* Create a new image window */
       new_image_window = gimp_image_window_new (ui_configurer->p->gimp,
@@ -340,7 +345,15 @@ gimp_ui_configurer_separate_shells (GimpUIConfigurer *ui_configurer,
 
       /* Show after we have added the shell */
       gtk_widget_show (GTK_WIDGET (new_image_window));
+
+      /* Make sure the shell looks right in this mode */
+      gimp_display_shell_appearance_update (shell);
     }
+
+  /* Make sure the shell remaining in the original window looks right */
+  shell = gimp_image_window_get_shell (source_image_window, 0);
+  if (shell)
+    gimp_display_shell_appearance_update (shell);
 }
 
 /**
@@ -385,9 +398,23 @@ gimp_ui_configurer_configure_for_single_window (GimpUIConfigurer *ui_configurer)
     {
       GimpImageWindow *image_window = GIMP_IMAGE_WINDOW (iter->data);
 
-      /* Don't move stuff to itself */
+      /* Don't move stuff to itself, but update its appearance */
       if (image_window == uber_image_window)
-        continue;
+        {
+          gint n_shells = gimp_image_window_get_n_shells (image_window);
+          gint i;
+
+          for (i = 0; i < n_shells; i++)
+            {
+              GimpDisplayShell *shell;
+
+              shell = gimp_image_window_get_shell (image_window, i);
+
+              gimp_display_shell_appearance_update (shell);
+            }
+
+          continue;
+        }
 
       /* Put the displays in the rest of the image windows into
        * the uber image window



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