gimp r27384 - in trunk: . app/display app/widgets



Author: neo
Date: Fri Oct 24 06:48:56 2008
New Revision: 27384
URL: http://svn.gnome.org/viewvc/gimp?rev=27384&view=rev

Log:
2008-10-24  Sven Neumann  <sven gimp org>

	Bug 556896 â Dialogs don't get minimized with single image 
window

	* app/widgets/gimpdialogfactory.[ch]: renamed the new methods to
	gimp_dialog_factories_{show|hide}_with_display().
	Remember if the dialogs were hidden using
	gimp_dialog_factories_hide_with_display() or using
	gimp_dialog_factories_toggle() and keep this into account when
	making them visible again. This ensures that dialogs that were
	hidden using the Tab key won't be shown when the image window is
	uniconified.

	* app/display/gimpdisplayshell.c
	(gimp_display_shell_window_state_event): changed accordingly.



Modified:
   trunk/ChangeLog
   trunk/app/display/gimpdisplayshell.c
   trunk/app/widgets/gimpdialogfactory.c
   trunk/app/widgets/gimpdialogfactory.h

Modified: trunk/app/display/gimpdisplayshell.c
==============================================================================
--- trunk/app/display/gimpdisplayshell.c	(original)
+++ trunk/app/display/gimpdisplayshell.c	Fri Oct 24 06:48:56 2008
@@ -652,11 +652,11 @@
       if (iconified)
         {
           if (gimp_displays_get_num_visible (gimp) == 0)
-            gimp_dialog_factories_hide ();
+            gimp_dialog_factories_hide_with_display ();
         }
       else
         {
-          gimp_dialog_factories_show ();
+          gimp_dialog_factories_show_with_display ();
         }
 
       gimp_display_shell_progress_window_state_changed (shell);

Modified: trunk/app/widgets/gimpdialogfactory.c
==============================================================================
--- trunk/app/widgets/gimpdialogfactory.c	(original)
+++ trunk/app/widgets/gimpdialogfactory.c	Fri Oct 24 06:48:56 2008
@@ -45,6 +45,13 @@
 #include "gimp-log.h"
 
 
+typedef enum
+{
+  GIMP_DIALOGS_SHOWN,
+  GIMP_DIALOGS_HIDDEN_EXPLICITLY,  /* user used the Tab key to hide dialogs */
+  GIMP_DIALOGS_HIDDEN_WITH_DISPLAY /* dialogs are hidden with the display   */
+} GimpDialogsState;
+
 enum
 {
   DOCK_ADDED,
@@ -103,7 +110,7 @@
 
 static guint factory_signals[LAST_SIGNAL] = { 0 };
 
-static gboolean dialogs_shown = TRUE;  /* FIXME */
+static GimpDialogsState dialogs_state = GIMP_DIALOGS_SHOWN;
 
 
 static void
@@ -1079,7 +1086,7 @@
 
   gtk_widget_hide (dialog);
 
-  if (! dialogs_shown)
+  if (dialogs_state != GIMP_DIALOGS_SHOWN)
     g_object_set_data (G_OBJECT (dialog), GIMP_DIALOG_VISIBILITY_KEY,
                        GINT_TO_POINTER (GIMP_DIALOG_VISIBILITY_INVISIBLE));
 }
@@ -1122,48 +1129,62 @@
                         NULL);
 }
 
-void
-gimp_dialog_factories_show (void)
+static void
+gimp_dialog_factories_set_state (GimpDialogsState state)
 {
-  if (! dialogs_shown)
-    {
-      GimpDialogFactoryClass *factory_class;
+  GimpDialogFactoryClass *factory_class;
+
+  factory_class = g_type_class_peek (GIMP_TYPE_DIALOG_FACTORY);
 
-      factory_class = g_type_class_peek (GIMP_TYPE_DIALOG_FACTORY);
+  dialogs_state = state;
 
-      dialogs_shown = TRUE;
+  if (state == GIMP_DIALOGS_SHOWN)
+    {
       g_hash_table_foreach (factory_class->factories,
                             (GHFunc) gimp_dialog_factories_show_foreach,
                             NULL);
     }
+  else
+    {
+      g_hash_table_foreach (factory_class->factories,
+                            (GHFunc) gimp_dialog_factories_hide_foreach,
+                            NULL);
+    }
 }
 
 void
-gimp_dialog_factories_hide (void)
+gimp_dialog_factories_show_with_display (void)
 {
-  if (dialogs_shown)
+  if (dialogs_state == GIMP_DIALOGS_HIDDEN_WITH_DISPLAY)
     {
-      GimpDialogFactoryClass *factory_class;
-
-      factory_class = g_type_class_peek (GIMP_TYPE_DIALOG_FACTORY);
-
-      dialogs_shown = FALSE;
-      g_hash_table_foreach (factory_class->factories,
-                            (GHFunc) gimp_dialog_factories_hide_foreach,
-                            NULL);
+      gimp_dialog_factories_set_state (GIMP_DIALOGS_SHOWN);
     }
 }
 
 void
-gimp_dialog_factories_toggle (void)
+gimp_dialog_factories_hide_with_display (void)
 {
-  if (dialogs_shown)
+  if (dialogs_state == GIMP_DIALOGS_SHOWN)
     {
-      gimp_dialog_factories_hide ();
+      gimp_dialog_factories_set_state (GIMP_DIALOGS_HIDDEN_WITH_DISPLAY);
     }
-  else
+}
+
+void
+gimp_dialog_factories_toggle (void)
+{
+  switch (dialogs_state)
     {
-      gimp_dialog_factories_show ();
+    case GIMP_DIALOGS_SHOWN:
+      gimp_dialog_factories_set_state (GIMP_DIALOGS_HIDDEN_EXPLICITLY);
+      break;
+
+    case GIMP_DIALOGS_HIDDEN_EXPLICITLY:
+      gimp_dialog_factories_set_state (GIMP_DIALOGS_SHOWN);
+      break;
+
+    case GIMP_DIALOGS_HIDDEN_WITH_DISPLAY:
+      break;
     }
 }
 

Modified: trunk/app/widgets/gimpdialogfactory.h
==============================================================================
--- trunk/app/widgets/gimpdialogfactory.h	(original)
+++ trunk/app/widgets/gimpdialogfactory.h	Fri Oct 24 06:48:56 2008
@@ -103,77 +103,77 @@
 };
 
 
-GType               gimp_dialog_factory_get_type  (void) G_GNUC_CONST;
+GType               gimp_dialog_factory_get_type    (void) G_GNUC_CONST;
 
-GimpDialogFactory * gimp_dialog_factory_new       (const gchar       *name,
-                                                   GimpContext       *context,
-                                                   GimpMenuFactory   *menu_factory,
-                                                   GimpDialogNewFunc  new_dock_func,
-                                                   gboolean           toggle_visibility);
-
-GimpDialogFactory * gimp_dialog_factory_from_name (const gchar       *name);
-
-void        gimp_dialog_factory_set_constructor   (GimpDialogFactory *factory,
-                                                   GimpDialogConstructor constructor);
-
-void        gimp_dialog_factory_register_entry    (GimpDialogFactory *factory,
-                                                   const gchar       *identifier,
-                                                   const gchar       *name,
-                                                   const gchar       *blurb,
-                                                   const gchar       *stock_id,
-                                                   const gchar       *help_id,
-                                                   GimpDialogNewFunc  new_func,
-                                                   gint               view_size,
-                                                   gboolean           singleton,
-                                                   gboolean           session_managed,
-                                                   gboolean           remember_size,
-                                                   gboolean           remember_if_open);
+GimpDialogFactory * gimp_dialog_factory_new         (const gchar       *name,
+                                                     GimpContext       *context,
+                                                     GimpMenuFactory   *menu_factory,
+                                                     GimpDialogNewFunc  new_dock_func,
+                                                     gboolean           toggle_visibility);
+
+GimpDialogFactory * gimp_dialog_factory_from_name   (const gchar       *name);
+
+void        gimp_dialog_factory_set_constructor     (GimpDialogFactory *factory,
+                                                     GimpDialogConstructor constructor);
+
+void        gimp_dialog_factory_register_entry      (GimpDialogFactory *factory,
+                                                     const gchar       *identifier,
+                                                     const gchar       *name,
+                                                     const gchar       *blurb,
+                                                     const gchar       *stock_id,
+                                                     const gchar       *help_id,
+                                                     GimpDialogNewFunc  new_func,
+                                                     gint               view_size,
+                                                     gboolean           singleton,
+                                                     gboolean           session_managed,
+                                                     gboolean           remember_size,
+                                                     gboolean           remember_if_open);
 GimpDialogFactoryEntry * gimp_dialog_factory_find_entry
-                                                  (GimpDialogFactory *factory,
-                                                   const gchar       *identifier);
+                                                    (GimpDialogFactory *factory,
+                                                     const gchar       *identifier);
 
 GimpSessionInfo * gimp_dialog_factory_find_session_info
-                                                  (GimpDialogFactory *factory,
-                                                   const gchar       *identifier);
+                                                    (GimpDialogFactory *factory,
+                                                     const gchar       *identifier);
 
-GtkWidget * gimp_dialog_factory_dialog_new        (GimpDialogFactory *factory,
-                                                   GdkScreen         *screen,
-                                                   const gchar       *identifier,
-                                                   gint               view_size,
-                                                   gboolean           present);
-GtkWidget * gimp_dialog_factory_dialog_raise      (GimpDialogFactory *factory,
-                                                   GdkScreen         *screen,
-                                                   const gchar       *identifiers,
-                                                   gint               view_size);
-GtkWidget * gimp_dialog_factory_dockable_new      (GimpDialogFactory *factory,
-                                                   GimpDock          *dock,
-                                                   const gchar       *identifier,
-                                                   gint               view_size);
-GtkWidget * gimp_dialog_factory_dock_new          (GimpDialogFactory *factory,
-                                                   GdkScreen         *screen);
-
-void        gimp_dialog_factory_add_dialog        (GimpDialogFactory *factory,
-                                                   GtkWidget         *dialog);
-void        gimp_dialog_factory_add_foreign       (GimpDialogFactory *factory,
-                                                   const gchar       *identifier,
-                                                   GtkWidget         *dialog);
-void        gimp_dialog_factory_remove_dialog     (GimpDialogFactory *factory,
-                                                   GtkWidget         *dialog);
-
-void        gimp_dialog_factory_show_toolbox      (GimpDialogFactory *toolbox_factory);
-
-void        gimp_dialog_factory_hide_dialog       (GtkWidget         *dialog);
-
-void        gimp_dialog_factories_session_save    (GimpConfigWriter  *writer);
-void        gimp_dialog_factories_session_restore (void);
-void        gimp_dialog_factories_session_clear   (void);
-
-void        gimp_dialog_factories_show            (void);
-void        gimp_dialog_factories_hide            (void);
-void        gimp_dialog_factories_toggle          (void);
+GtkWidget * gimp_dialog_factory_dialog_new          (GimpDialogFactory *factory,
+                                                     GdkScreen         *screen,
+                                                     const gchar       *identifier,
+                                                     gint               view_size,
+                                                     gboolean           present);
+GtkWidget * gimp_dialog_factory_dialog_raise        (GimpDialogFactory *factory,
+                                                     GdkScreen         *screen,
+                                                     const gchar       *identifiers,
+                                                     gint               view_size);
+GtkWidget * gimp_dialog_factory_dockable_new        (GimpDialogFactory *factory,
+                                                     GimpDock          *dock,
+                                                     const gchar       *identifier,
+                                                     gint               view_size);
+GtkWidget * gimp_dialog_factory_dock_new            (GimpDialogFactory *factory,
+                                                     GdkScreen         *screen);
+
+void        gimp_dialog_factory_add_dialog          (GimpDialogFactory *factory,
+                                                     GtkWidget         *dialog);
+void        gimp_dialog_factory_add_foreign         (GimpDialogFactory *factory,
+                                                     const gchar       *identifier,
+                                                     GtkWidget         *dialog);
+void        gimp_dialog_factory_remove_dialog       (GimpDialogFactory *factory,
+                                                     GtkWidget         *dialog);
+
+void        gimp_dialog_factory_show_toolbox        (GimpDialogFactory *toolbox_factory);
+
+void        gimp_dialog_factory_hide_dialog         (GtkWidget         *dialog);
+
+void        gimp_dialog_factories_session_save      (GimpConfigWriter  *writer);
+void        gimp_dialog_factories_session_restore   (void);
+void        gimp_dialog_factories_session_clear     (void);
+
+void        gimp_dialog_factories_show_with_display (void);
+void        gimp_dialog_factories_hide_with_display (void);
+void        gimp_dialog_factories_toggle            (void);
 
-void        gimp_dialog_factories_set_busy        (void);
-void        gimp_dialog_factories_unset_busy      (void);
+void        gimp_dialog_factories_set_busy          (void);
+void        gimp_dialog_factories_unset_busy        (void);
 
 GimpDialogFactory *
             gimp_dialog_factory_from_widget (GtkWidget               *dialog,



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