[gimp] app: Introduce GIMP_DIALOG_VISIBILITY_HIDDEN



commit 909acba11debca4226e499fcd1b87349e647eeb4
Author: Martin Nordholts <martinn src gnome org>
Date:   Tue Mar 9 07:48:25 2010 +0100

    app: Introduce GIMP_DIALOG_VISIBILITY_HIDDEN
    
    Introduce GIMP_DIALOG_VISIBILITY_HIDDEN because it is a bit
    counter-intuitive to call gtk_widget_hide() on a dialog and then set
    GIMP_DIALOG_VISIBILITY_VISIBLE on it. No change in program flow has
    been (deliberately) introduced.

 app/widgets/gimpdialogfactory.c |    8 +++++---
 app/widgets/gimpdialogfactory.h |    3 ++-
 app/widgets/gimpsessioninfo.c   |    5 +++++
 3 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/app/widgets/gimpdialogfactory.c b/app/widgets/gimpdialogfactory.c
index 270f820..b65578c 100644
--- a/app/widgets/gimpdialogfactory.c
+++ b/app/widgets/gimpdialogfactory.c
@@ -1364,9 +1364,8 @@ gimp_dialog_factory_hide (GimpDialogFactory *factory)
 
           if (gtk_widget_get_visible (widget))
             {
-              visibility = GIMP_DIALOG_VISIBILITY_VISIBLE;
-
               gtk_widget_hide (widget);
+              visibility = GIMP_DIALOG_VISIBILITY_HIDDEN;
 
               GIMP_LOG (WM, "Hiding '%s' [%p]",
                         gtk_window_get_title (GTK_WINDOW (widget)),
@@ -1402,7 +1401,7 @@ gimp_dialog_factory_show (GimpDialogFactory *factory)
                                                 GIMP_DIALOG_VISIBILITY_KEY));
 
           if (! gtk_widget_get_visible (widget) &&
-              visibility == GIMP_DIALOG_VISIBILITY_VISIBLE)
+              visibility == GIMP_DIALOG_VISIBILITY_HIDDEN)
             {
               GIMP_LOG (WM, "Showing '%s' [%p]",
                         gtk_window_get_title (GTK_WINDOW (widget)),
@@ -1412,6 +1411,9 @@ gimp_dialog_factory_show (GimpDialogFactory *factory)
                * keyboard focus to move.
                */
               gtk_widget_show (widget);
+              g_object_set_data (G_OBJECT (widget),
+                                 GIMP_DIALOG_VISIBILITY_KEY,
+                                 GINT_TO_POINTER (GIMP_DIALOG_VISIBILITY_VISIBLE));
 
               if (gtk_widget_get_visible (widget))
                 gdk_window_raise (gtk_widget_get_window (widget));
diff --git a/app/widgets/gimpdialogfactory.h b/app/widgets/gimpdialogfactory.h
index 56cca12..3e493b0 100644
--- a/app/widgets/gimpdialogfactory.h
+++ b/app/widgets/gimpdialogfactory.h
@@ -30,7 +30,8 @@ typedef enum
 {
   GIMP_DIALOG_VISIBILITY_UNKNOWN = 0,
   GIMP_DIALOG_VISIBILITY_INVISIBLE,
-  GIMP_DIALOG_VISIBILITY_VISIBLE
+  GIMP_DIALOG_VISIBILITY_VISIBLE,
+  GIMP_DIALOG_VISIBILITY_HIDDEN
 } GimpDialogVisibilityState;
 
 
diff --git a/app/widgets/gimpsessioninfo.c b/app/widgets/gimpsessioninfo.c
index 2e83a31..7e91cab 100644
--- a/app/widgets/gimpsessioninfo.c
+++ b/app/widgets/gimpsessioninfo.c
@@ -654,7 +654,12 @@ gimp_session_info_read_geometry (GimpSessionInfo *info)
           info->p->open = FALSE;
           break;
 
+        case GIMP_DIALOG_VISIBILITY_HIDDEN:
         case GIMP_DIALOG_VISIBILITY_VISIBLE:
+          /* Even if a dialog is hidden (with Windows->Hide docks) it
+           * is still considered open. It will be restored the next
+           * time GIMP starts
+           */
           info->p->open = TRUE;
           break;
         }



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