Index: app/display/gimpdisplayshell.c
===================================================================
--- app/display/gimpdisplayshell.c	(revision 27373)
+++ app/display/gimpdisplayshell.c	(working copy)
@@ -60,6 +60,7 @@
 
 #include "gimpcanvas.h"
 #include "gimpdisplay.h"
+#include "gimpdisplay-foreach.h"
 #include "gimpdisplayoptions.h"
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-appearance.h"
@@ -616,12 +617,12 @@ gimp_display_shell_window_state_event (G
                                        GdkEventWindowState *event)
 {
   GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (widget);
+  Gimp             *gimp  = shell->display->gimp;
 
   shell->window_state = event->new_window_state;
 
   if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
     {
-      Gimp            *gimp = shell->display->gimp;
       GimpActionGroup *group;
       gboolean         fullscreen;
 
@@ -645,6 +646,19 @@ gimp_display_shell_window_state_event (G
 
   if (event->changed_mask & GDK_WINDOW_STATE_ICONIFIED)
     {
+      gboolean iconified = (event->new_window_state &
+                            GDK_WINDOW_STATE_ICONIFIED) != 0;
+
+      if (iconified)
+        {
+          if (gimp_displays_get_num_visible (gimp) == 0)
+            gimp_dialog_factories_hide ();
+        }
+      else
+        {
+          gimp_dialog_factories_show ();
+        }
+
       gimp_display_shell_progress_window_state_changed (shell);
     }
 
Index: app/display/gimpdisplay-foreach.c
===================================================================
--- app/display/gimpdisplay-foreach.c	(revision 27373)
+++ app/display/gimpdisplay-foreach.c	(working copy)
@@ -228,6 +228,35 @@ gimp_displays_reconnect (Gimp      *gimp
   g_list_free (contexts);
 }
 
+gint
+gimp_displays_get_num_visible (Gimp *gimp)
+{
+  GList *list;
+  gint   visible = 0;
+
+  g_return_val_if_fail (GIMP_IS_GIMP (gimp), 0);
+
+  for (list = GIMP_LIST (gimp->displays)->list;
+       list;
+       list = g_list_next (list))
+    {
+      GimpDisplay *display = list->data;
+
+      if (GTK_WIDGET_DRAWABLE (display->shell))
+        {
+          GdkWindowState state = gdk_window_get_state (display->shell->window);
+
+          if ((state & (GDK_WINDOW_STATE_WITHDRAWN |
+                        GDK_WINDOW_STATE_ICONIFIED)) == 0)
+            {
+              visible++;
+            }
+        }
+    }
+
+  return visible;
+}
+
 void
 gimp_displays_set_busy (Gimp *gimp)
 {
Index: app/display/gimpdisplay-foreach.h
===================================================================
--- app/display/gimpdisplay-foreach.h	(revision 27373)
+++ app/display/gimpdisplay-foreach.h	(working copy)
@@ -28,6 +28,8 @@ void            gimp_displays_reconnect 
                                                 GimpImage *old,
                                                 GimpImage *new);
 
+gint            gimp_displays_get_num_visible  (Gimp      *gimp);
+
 void            gimp_displays_set_busy         (Gimp      *gimp);
 void            gimp_displays_unset_busy       (Gimp      *gimp);
 
Index: app/widgets/gimpdialogfactory.c
===================================================================
--- app/widgets/gimpdialogfactory.c	(revision 27373)
+++ app/widgets/gimpdialogfactory.c	(working copy)
@@ -1123,25 +1123,47 @@ gimp_dialog_factories_session_clear (voi
 }
 
 void
-gimp_dialog_factories_toggle (void)
+gimp_dialog_factories_show (void)
 {
-  GimpDialogFactoryClass *factory_class;
+  if (! dialogs_shown)
+    {
+      GimpDialogFactoryClass *factory_class;
 
-  factory_class = g_type_class_peek (GIMP_TYPE_DIALOG_FACTORY);
+      factory_class = g_type_class_peek (GIMP_TYPE_DIALOG_FACTORY);
+
+      dialogs_shown = TRUE;
+      g_hash_table_foreach (factory_class->factories,
+                            (GHFunc) gimp_dialog_factories_show_foreach,
+                            NULL);
+    }
+}
 
+void
+gimp_dialog_factories_hide (void)
+{
   if (dialogs_shown)
     {
+      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);
     }
+}
+
+void
+gimp_dialog_factories_toggle (void)
+{
+  if (dialogs_shown)
+    {
+      gimp_dialog_factories_hide ();
+    }
   else
     {
-      dialogs_shown = TRUE;
-      g_hash_table_foreach (factory_class->factories,
-                            (GHFunc) gimp_dialog_factories_show_foreach,
-                            NULL);
+      gimp_dialog_factories_show ();
     }
 }
 
Index: app/widgets/gimpdialogfactory.h
===================================================================
--- app/widgets/gimpdialogfactory.h	(revision 27373)
+++ app/widgets/gimpdialogfactory.h	(working copy)
@@ -168,7 +168,10 @@ void        gimp_dialog_factories_sessio
 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);
+
 void        gimp_dialog_factories_set_busy        (void);
 void        gimp_dialog_factories_unset_busy      (void);
 
