[gimp] Move the Image Selection Menu to GimpDockWindow



commit 1bf84999e4a4968f5e1c79e167d1888c4a125fe0
Author: Martin Nordholts <martinn src gnome org>
Date:   Sat Dec 5 21:20:18 2009 +0100

    Move the Image Selection Menu to GimpDockWindow
    
    Move the Image Selection Menu from GimpMenuDock to
    GimpDockWindow. That is, if a dock window contains many docks then
    they will share the same Image Selection Menu.
    
    To do this we need to move around quite a bit of code. Move the
    "context", "dialog-factory" and "ui-manager" properties from GimpDock
    to GimpToolbox, GimpMenuDock doesn't need it any longer. Turn the
    GimpDock getters for these properties into wrappers that go to the
    GimpDockWindow properties. In some places, most notably GimpToolbox
    construction, we use the GimpToolbox values of these properties, but
    most of the time it works fine to just use the GimpDockWindow
    properties. GimpDock::setup() and set/get_aux_info() have also been
    moved to GimpDockWindow since the only aux info for docks was for the
    image selection menu.
    
    Also, we don't bother porting gimp_menu_dock_destroy() to
    GimpDockWindow, but we leave the code around. If this is a problem, it
    will show.

 app/actions/dock-actions.c               |    6 +-
 app/actions/dock-commands.c              |   39 +-
 app/dialogs/dialogs-constructors.c       |    4 +-
 app/widgets/gimpdock.c                   |  187 ++--------
 app/widgets/gimpdock.h                   |   10 -
 app/widgets/gimpdockable.c               |   12 +-
 app/widgets/gimpdockcolumns.c            |    4 +-
 app/widgets/gimpdockwindow.c             |  612 ++++++++++++++++++++++++++----
 app/widgets/gimpdockwindow.h             |   35 ++-
 app/widgets/gimpmenudock.c               |  478 +-----------------------
 app/widgets/gimpmenudock.h               |   10 +-
 app/widgets/gimpsessioninfo-aux.c        |    4 +-
 app/widgets/gimpsessioninfo-dockable.c   |   12 +-
 app/widgets/gimptoolbox-color-area.c     |    2 +-
 app/widgets/gimptoolbox-dnd.c            |   22 +-
 app/widgets/gimptoolbox-image-area.c     |    2 +-
 app/widgets/gimptoolbox-indicator-area.c |    8 +-
 app/widgets/gimptoolbox.c                |  205 ++++++++---
 app/widgets/gimptoolbox.h                |   13 +-
 themes/Default/gtkrc                     |    2 +-
 themes/Small/gtkrc                       |    2 +-
 21 files changed, 835 insertions(+), 834 deletions(-)
---
diff --git a/app/actions/dock-actions.c b/app/actions/dock-actions.c
index d077df3..4b8226b 100644
--- a/app/actions/dock-actions.c
+++ b/app/actions/dock-actions.c
@@ -106,13 +106,13 @@ dock_actions_update (GimpActionGroup *group,
       
       if (GIMP_IS_MENU_DOCK (dock))
         {
-          GimpMenuDock *menu_dock = GIMP_MENU_DOCK (dock);
+          GimpDockWindow *dock_window = gimp_dock_window_from_dock (dock);
 
           SET_VISIBLE ("dock-show-image-menu",    TRUE);
           SET_VISIBLE ("dock-auto-follow-active", TRUE);
 
-          SET_ACTIVE ("dock-show-image-menu",    gimp_menu_dock_get_show_image_menu (menu_dock));
-          SET_ACTIVE ("dock-auto-follow-active", gimp_menu_dock_get_auto_follow_active (menu_dock));
+          SET_ACTIVE ("dock-show-image-menu",    gimp_dock_window_get_show_image_menu (dock_window));
+          SET_ACTIVE ("dock-auto-follow-active", gimp_dock_window_get_auto_follow_active (dock_window));
         }
       else
         {
diff --git a/app/actions/dock-commands.c b/app/actions/dock-commands.c
index 2f4fbb4..3ee6180 100644
--- a/app/actions/dock-commands.c
+++ b/app/actions/dock-commands.c
@@ -24,27 +24,22 @@
 #include "actions-types.h"
 
 #include "widgets/gimpdockwindow.h"
-#include "widgets/gimpmenudock.h"
+#include "widgets/gimpdockwindow.h"
 
 #include "actions.h"
 #include "dock-commands.h"
 
 
-static GimpMenuDock *
-dock_commands_get_menudock_from_widget (GtkWidget *widget)
+static GimpDockWindow *
+dock_commands_get_dock_window_from_widget (GtkWidget *widget)
 {
-  GtkWidget    *toplevel  = gtk_widget_get_toplevel (widget);
-  GimpMenuDock *menu_dock = NULL;
+  GtkWidget      *toplevel    = gtk_widget_get_toplevel (widget);
+  GimpDockWindow *dock_window = NULL;
 
   if (GIMP_IS_DOCK_WINDOW (toplevel))
-    {
-      GimpDock *dock = gimp_dock_window_get_dock (GIMP_DOCK_WINDOW (toplevel));
-
-      if (GIMP_IS_MENU_DOCK (dock))
-        menu_dock = GIMP_MENU_DOCK (dock);
-    }
+    dock_window = GIMP_DOCK_WINDOW (toplevel);
 
-  return menu_dock;
+  return dock_window;
 }
 
 
@@ -54,16 +49,16 @@ void
 dock_toggle_image_menu_cmd_callback (GtkAction *action,
                                      gpointer   data)
 {
-  GtkWidget    *widget    = NULL;
-  GimpMenuDock *menu_dock = NULL;
+  GtkWidget      *widget      = NULL;
+  GimpDockWindow *dock_window = NULL;
   return_if_no_widget (widget, data);
 
-  menu_dock = dock_commands_get_menudock_from_widget (widget);
+  dock_window = dock_commands_get_dock_window_from_widget (widget);
 
-  if (menu_dock)
+  if (dock_window)
     {
       gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
-      gimp_menu_dock_set_show_image_menu (menu_dock, active);
+      gimp_dock_window_set_show_image_menu (dock_window, active);
     }
 }
 
@@ -71,15 +66,15 @@ void
 dock_toggle_auto_cmd_callback (GtkAction *action,
                                gpointer   data)
 {
-  GtkWidget    *widget    = NULL;
-  GimpMenuDock *menu_dock = NULL;
+  GtkWidget      *widget      = NULL;
+  GimpDockWindow *dock_window = NULL;
   return_if_no_widget (widget, data);
 
-  menu_dock = dock_commands_get_menudock_from_widget (widget);
+  dock_window = dock_commands_get_dock_window_from_widget (widget);
 
-  if (menu_dock)
+  if (dock_window)
     {
       gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
-      gimp_menu_dock_set_auto_follow_active (menu_dock, active);
+      gimp_dock_window_set_auto_follow_active (dock_window, active);
     }
 }
diff --git a/app/dialogs/dialogs-constructors.c b/app/dialogs/dialogs-constructors.c
index 1b2471e..508b634 100644
--- a/app/dialogs/dialogs-constructors.c
+++ b/app/dialogs/dialogs-constructors.c
@@ -248,9 +248,7 @@ dialogs_dock_new (GimpDialogFactory *factory,
                   GimpContext       *context,
                   GimpUIManager     *ui_manager)
 {
-  return gimp_menu_dock_new (factory,
-                             context->gimp->images,
-                             context->gimp->displays);
+  return gimp_menu_dock_new ();
 }
 
 GtkWidget *
diff --git a/app/widgets/gimpdock.c b/app/widgets/gimpdock.c
index 438cec2..e421240 100644
--- a/app/widgets/gimpdock.c
+++ b/app/widgets/gimpdock.c
@@ -34,6 +34,7 @@
 #include "gimpdock.h"
 #include "gimpdockable.h"
 #include "gimpdockbook.h"
+#include "gimpdockwindow.h"
 #include "gimppanedbox.h"
 #include "gimpuimanager.h"
 #include "gimpwidgets-utils.h"
@@ -46,14 +47,6 @@
 
 enum
 {
-  PROP_0,
-  PROP_CONTEXT,
-  PROP_DIALOG_FACTORY,
-  PROP_UI_MANAGER
-};
-
-enum
-{
   BOOK_ADDED,
   BOOK_REMOVED,
   TITLE_INVALIDATED,
@@ -64,10 +57,6 @@ enum
 
 struct _GimpDockPrivate
 {
-  GimpDialogFactory *dialog_factory;
-  GimpContext       *context;
-  GimpUIManager     *ui_manager;
-
   GtkWidget         *main_vbox;
   GtkWidget         *paned_vbox;
 
@@ -77,14 +66,6 @@ struct _GimpDockPrivate
 };
 
 
-static void      gimp_dock_set_property      (GObject               *object,
-                                              guint                  property_id,
-                                              const GValue          *value,
-                                              GParamSpec            *pspec);
-static void      gimp_dock_get_property      (GObject               *object,
-                                              guint                  property_id,
-                                              GValue                *value,
-                                              GParamSpec            *pspec);
 static void      gimp_dock_style_set         (GtkWidget             *widget,
                                               GtkStyle              *prev_style);
 
@@ -109,7 +90,6 @@ static guint dock_signals[LAST_SIGNAL] = { 0 };
 static void
 gimp_dock_class_init (GimpDockClass *klass)
 {
-  GObjectClass   *object_class     = G_OBJECT_CLASS (klass);
   GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class     = GTK_WIDGET_CLASS (klass);
 
@@ -151,40 +131,16 @@ gimp_dock_class_init (GimpDockClass *klass)
                   gimp_marshal_VOID__VOID,
                   G_TYPE_NONE, 0);
 
-  object_class->set_property     = gimp_dock_set_property;
-  object_class->get_property     = gimp_dock_get_property;
-
   gtk_object_class->destroy      = gimp_dock_destroy;
 
   widget_class->style_set        = gimp_dock_style_set;
 
-  klass->setup                   = NULL;
   klass->set_host_geometry_hints = NULL;
   klass->book_added              = gimp_dock_real_book_added;
   klass->book_removed            = gimp_dock_real_book_removed;
   klass->title_invalidated       = NULL;
   klass->geometry_invalidated    = NULL;
 
-  g_object_class_install_property (object_class, PROP_CONTEXT,
-                                   g_param_spec_object ("context", NULL, NULL,
-                                                        GIMP_TYPE_CONTEXT,
-                                                        GIMP_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT_ONLY));
-
-  g_object_class_install_property (object_class, PROP_DIALOG_FACTORY,
-                                   g_param_spec_object ("dialog-factory",
-                                                        NULL, NULL,
-                                                        GIMP_TYPE_DIALOG_FACTORY,
-                                                        GIMP_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT_ONLY));
-
-  g_object_class_install_property (object_class, PROP_UI_MANAGER,
-                                   g_param_spec_object ("ui-manager",
-                                                        NULL, NULL,
-                                                        GIMP_TYPE_UI_MANAGER,
-                                                        GIMP_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT_ONLY));
-
   gtk_widget_class_install_style_property (widget_class,
                                            g_param_spec_double ("font-scale",
                                                                 NULL, NULL,
@@ -205,8 +161,6 @@ gimp_dock_init (GimpDock *dock)
   dock->p = G_TYPE_INSTANCE_GET_PRIVATE (dock,
                                          GIMP_TYPE_DOCK,
                                          GimpDockPrivate);
-  dock->p->context        = NULL;
-  dock->p->dialog_factory = NULL;
   dock->p->ID             = dock_ID++;
 
   name = g_strdup_printf ("gimp-internal-dock-%d", dock->p->ID);
@@ -226,62 +180,6 @@ gimp_dock_init (GimpDock *dock)
 }
 
 static void
-gimp_dock_set_property (GObject      *object,
-                        guint         property_id,
-                        const GValue *value,
-                        GParamSpec   *pspec)
-{
-  GimpDock *dock = GIMP_DOCK (object);
-
-  switch (property_id)
-    {
-    case PROP_CONTEXT:
-      dock->p->context = g_value_dup_object (value);
-      break;
-
-    case PROP_DIALOG_FACTORY:
-      dock->p->dialog_factory = g_value_get_object (value);
-      break;
-
-    case PROP_UI_MANAGER:
-      dock->p->ui_manager = g_value_dup_object (value);
-      break;
-
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-      break;
-    }
-}
-
-static void
-gimp_dock_get_property (GObject    *object,
-                        guint       property_id,
-                        GValue     *value,
-                        GParamSpec *pspec)
-{
-  GimpDock *dock = GIMP_DOCK (object);
-
-  switch (property_id)
-    {
-    case PROP_CONTEXT:
-      g_value_set_object (value, dock->p->context);
-      break;
-
-    case PROP_DIALOG_FACTORY:
-      g_value_set_object (value, dock->p->dialog_factory);
-      break;
-
-    case PROP_UI_MANAGER:
-      g_value_set_object (value, dock->p->ui_manager);
-      break;
-
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-      break;
-    }
-}
-
-static void
 gimp_dock_style_set (GtkWidget *widget,
                      GtkStyle  *prev_style)
 {
@@ -338,18 +236,6 @@ gimp_dock_destroy (GtkObject *object)
   while (dock->p->dockbooks)
     gimp_dock_remove_book (dock, GIMP_DOCKBOOK (dock->p->dockbooks->data));
 
-  if (dock->p->ui_manager)
-    {
-      g_object_unref (dock->p->ui_manager);
-      dock->p->ui_manager = NULL;
-    }
-
-  if (dock->p->context)
-    {
-      g_object_unref (dock->p->context);
-      dock->p->context = NULL;
-    }
-
   GTK_OBJECT_CLASS (parent_class)->destroy (object);
 }
 
@@ -413,38 +299,6 @@ gimp_dock_dropped_cb (GtkWidget *source,
 
 /*  public functions  */
 
-void
-gimp_dock_setup (GimpDock       *dock,
-                 const GimpDock *template)
-{
-  g_return_if_fail (GIMP_IS_DOCK (dock));
-  g_return_if_fail (GIMP_IS_DOCK (template));
-
-  if (GIMP_DOCK_GET_CLASS (dock)->setup)
-    GIMP_DOCK_GET_CLASS (dock)->setup (dock, template);
-}
-
-void
-gimp_dock_set_aux_info (GimpDock *dock,
-                        GList    *aux_info)
-{
-  g_return_if_fail (GIMP_IS_DOCK (dock));
-
-  if (GIMP_DOCK_GET_CLASS (dock)->set_aux_info)
-    GIMP_DOCK_GET_CLASS (dock)->set_aux_info (dock, aux_info);
-}
-
-GList *
-gimp_dock_get_aux_info (GimpDock *dock)
-{
-  g_return_val_if_fail (GIMP_IS_DOCK (dock), NULL);
-
-  if (GIMP_DOCK_GET_CLASS (dock)->get_aux_info)
-    return GIMP_DOCK_GET_CLASS (dock)->get_aux_info (dock);
-
-  return NULL;
-}
-
 gchar *
 gimp_dock_get_title (GimpDock *dock)
 {
@@ -499,28 +353,60 @@ gimp_dock_invalidate_geometry (GimpDock *dock)
   g_signal_emit (dock, dock_signals[GEOMETRY_INVALIDATED], 0);
 }
 
+/**
+ * gimp_dock_get_context:
+ * @dock:
+ *
+ * Returns: The #GimpContext for the #GimpDockWindow the @dock is in.
+ **/
 GimpContext *
 gimp_dock_get_context (GimpDock *dock)
 {
+  GimpDockWindow *dock_window = NULL;
+
   g_return_val_if_fail (GIMP_IS_DOCK (dock), NULL);
 
-  return dock->p->context;
+  dock_window = gimp_dock_window_from_dock (dock);
+
+  return gimp_dock_window_get_context (dock_window);
 }
 
+/**
+ * gimp_dock_get_dialog_factory:
+ * @dock:
+ *
+ * Returns: The #GimpDialogFactory for the #GimpDockWindow the @dock
+ *          is in.
+ **/
 GimpDialogFactory *
 gimp_dock_get_dialog_factory (GimpDock *dock)
 {
+  GimpDockWindow *dock_window = NULL;
+
   g_return_val_if_fail (GIMP_IS_DOCK (dock), NULL);
 
-  return dock->p->dialog_factory;
+  dock_window = gimp_dock_window_from_dock (dock);
+
+  return gimp_dock_window_get_dialog_factory (dock_window);
 }
 
+/**
+ * gimp_dock_get_ui_manager:
+ * @dock:
+ *
+ * Returns: The #GimpUIManager for the #GimpDockWindow the @dock is
+ *          in.
+ **/
 GimpUIManager *
 gimp_dock_get_ui_manager (GimpDock *dock)
 {
+  GimpDockWindow *dock_window = NULL;
+
   g_return_val_if_fail (GIMP_IS_DOCK (dock), NULL);
 
-  return dock->p->ui_manager;
+  dock_window = gimp_dock_window_from_dock (dock);
+
+  return gimp_dock_window_get_ui_manager (dock_window);
 }
 
 GList *
@@ -633,4 +519,3 @@ gimp_dock_remove_book (GimpDock     *dock,
 
   g_object_unref (dockbook);
 }
-
diff --git a/app/widgets/gimpdock.h b/app/widgets/gimpdock.h
index 5e8a05a..6077f4e 100644
--- a/app/widgets/gimpdock.h
+++ b/app/widgets/gimpdock.h
@@ -50,11 +50,6 @@ struct _GimpDockClass
   GtkVBoxClass  parent_class;
 
   /*  virtual functions  */
-  void    (* setup)                   (GimpDock       *dock,
-                                       const GimpDock *template);
-  void    (* set_aux_info)            (GimpDock       *dock,
-                                       GList          *aux_info);
-  GList * (* get_aux_info)            (GimpDock       *dock);
   gchar * (* get_title)               (GimpDock       *dock);
   void    (* set_host_geometry_hints) (GimpDock       *dock,
                                        GtkWindow      *window);
@@ -71,11 +66,6 @@ struct _GimpDockClass
 
 GType               gimp_dock_get_type                (void) G_GNUC_CONST;
 
-void                gimp_dock_setup                   (GimpDock       *dock,
-                                                       const GimpDock *template);
-void                gimp_dock_set_aux_info            (GimpDock       *dock,
-                                                       GList          *aux_info);
-GList             * gimp_dock_get_aux_info            (GimpDock       *dock);
 gchar             * gimp_dock_get_title               (GimpDock       *dock);
 void                gimp_dock_invalidate_title        (GimpDock       *dock);
 void                gimp_dock_set_host_geometry_hints (GimpDock       *dock,
diff --git a/app/widgets/gimpdockable.c b/app/widgets/gimpdockable.c
index 3d736b6..7f874bb 100644
--- a/app/widgets/gimpdockable.c
+++ b/app/widgets/gimpdockable.c
@@ -1075,21 +1075,23 @@ gimp_dockable_set_drag_handler (GimpDockable *dockable,
 void
 gimp_dockable_detach (GimpDockable *dockable)
 {
-  GimpDock       *src_dock    = NULL;
-  GtkWidget      *dock        = NULL;
-  GtkWidget      *dockbook    = NULL;
-  GimpDockWindow *dock_window = NULL;
+  GimpDockWindow *src_dock_window = NULL;
+  GimpDock       *src_dock        = NULL;
+  GtkWidget      *dock            = NULL;
+  GimpDockWindow *dock_window     = NULL;
+  GtkWidget      *dockbook        = NULL;
 
   g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
   g_return_if_fail (GIMP_IS_DOCKBOOK (dockable->dockbook));
 
   src_dock = gimp_dockbook_get_dock (dockable->dockbook);
+  src_dock_window = gimp_dock_window_from_dock (src_dock);
 
   dock = gimp_dialog_factory_dock_with_window_new (gimp_dock_get_dialog_factory (src_dock),
                                                    gtk_widget_get_screen (GTK_WIDGET (dockable)));
   dock_window = gimp_dock_window_from_dock (GIMP_DOCK (dock));
   gtk_window_set_position (GTK_WINDOW (dock_window), GTK_WIN_POS_MOUSE);
-  gimp_dock_setup (GIMP_DOCK (dock), src_dock);
+  gimp_dock_window_setup (dock_window, src_dock_window);
 
   dockbook = gimp_dockbook_new (gimp_dock_get_dialog_factory (GIMP_DOCK (dock))->menu_factory);
 
diff --git a/app/widgets/gimpdockcolumns.c b/app/widgets/gimpdockcolumns.c
index 19375ff..74c3c6a 100644
--- a/app/widgets/gimpdockcolumns.c
+++ b/app/widgets/gimpdockcolumns.c
@@ -134,9 +134,7 @@ gimp_dock_columns_dropped_cb (GtkWidget         *source,
     return FALSE;
 
   /* Create and insert new dock into columns */
-  dock = gimp_menu_dock_new (global_dock_factory,
-                             global_dock_factory->context->gimp->images,
-                             global_dock_factory->context->gimp->displays);
+  dock = gimp_menu_dock_new ();
   gimp_dock_columns_add_dock (dock_columns, GIMP_DOCK (dock), insert_index);
 
   /* Put a now dockbook in the dock */
diff --git a/app/widgets/gimpdockwindow.c b/app/widgets/gimpdockwindow.c
index fe193a0..65aa6af 100644
--- a/app/widgets/gimpdockwindow.c
+++ b/app/widgets/gimpdockwindow.c
@@ -21,6 +21,8 @@
 
 #include "config.h"
 
+#include <gegl.h>
+
 #include <gtk/gtk.h>
 
 #include "libgimpwidgets/gimpwidgets.h"
@@ -35,13 +37,19 @@
 #include "core/gimpcontext.h"
 #include "core/gimpcontainer.h"
 #include "core/gimpcontainer.h"
+#include "core/gimplist.h"
+#include "core/gimpimage.h"
 
+#include "gimpcontainercombobox.h"
+#include "gimpcontainerview.h"
 #include "gimpdialogfactory.h"
 #include "gimpdock.h"
 #include "gimpdockbook.h"
 #include "gimpdockcolumns.h"
 #include "gimpdockwindow.h"
+#include "gimphelp-ids.h"
 #include "gimpmenufactory.h"
+#include "gimpsessioninfo-aux.h"
 #include "gimpsessioninfo.h"
 #include "gimpuimanager.h"
 #include "gimpwidgets-utils.h"
@@ -50,7 +58,12 @@
 #include "gimp-intl.h"
 
 
-#define DEFAULT_DOCK_HEIGHT 300
+#define DEFAULT_DOCK_HEIGHT          300
+#define DEFAULT_MENU_VIEW_SIZE       GTK_ICON_SIZE_SMALL_TOOLBAR
+#define AUX_INFO_SHOW_IMAGE_MENU     "show-image-menu"
+#define AUX_INFO_FOLLOW_ACTIVE_IMAGE "follow-active-image"
+
+
 
 
 enum
@@ -59,6 +72,8 @@ enum
   PROP_CONTEXT,
   PROP_DIALOG_FACTORY,
   PROP_UI_MANAGER_NAME,
+  PROP_IMAGE_CONTAINER,
+  PROP_DISPLAY_CONTAINER,
   PROP_ALLOW_DOCKBOOK_ABSENCE
 };
 
@@ -80,38 +95,55 @@ struct _GimpDockWindowPrivate
   guint              update_title_idle_id;
 
   gint               ID;
+
+  GimpContainer     *image_container;
+  GimpContainer     *display_container;
+
+  gboolean           show_image_menu;
+  gboolean           auto_follow_active;
+
+  GtkWidget         *image_combo;
+  GtkWidget         *auto_button;
 };
 
-static GObject *  gimp_dock_window_constructor       (GType                  type,
-                                                      guint                  n_params,
-                                                      GObjectConstructParam *params);
-static void       gimp_dock_window_dispose           (GObject               *object);
-static void       gimp_dock_window_set_property      (GObject               *object,
-                                                      guint                  property_id,
-                                                      const GValue          *value,
-                                                      GParamSpec            *pspec);
-static void       gimp_dock_window_get_property      (GObject               *object,
-                                                      guint                  property_id,
-                                                      GValue                *value,
-                                                      GParamSpec            *pspec);
-static void       gimp_dock_window_style_set         (GtkWidget             *widget,
-                                                      GtkStyle              *prev_style);
-static gboolean   gimp_dock_window_delete_event      (GtkWidget             *widget,
-                                                      GdkEventAny           *event);
-static void       gimp_dock_window_display_changed   (GimpDockWindow        *dock_window,
-                                                      GimpObject            *display,
-                                                      GimpContext           *context);
-static void       gimp_dock_window_image_changed     (GimpDockWindow        *dock_window,
-                                                      GimpImage             *image,
-                                                      GimpContext           *context);
-static void       gimp_dock_window_image_flush       (GimpImage             *image,
-                                                      gboolean               invalidate_preview,
-                                                      GimpDockWindow        *dock_window);
-static void       gimp_dock_window_update_title      (GimpDockWindow        *dock_window);
-static gboolean   gimp_dock_window_update_title_idle (GimpDockWindow        *dock_window);
-static void       gimp_dock_window_dock_removed      (GimpDockWindow        *dock_window,
-                                                      GimpDock              *dock,
-                                                      GimpDockColumns       *dock_columns);
+static GObject * gimp_dock_window_constructor             (GType                  type,
+                                                           guint                  n_params,
+                                                           GObjectConstructParam *params);
+static void      gimp_dock_window_dispose                 (GObject               *object);
+static void      gimp_dock_window_set_property            (GObject               *object,
+                                                           guint                  property_id,
+                                                           const GValue          *value,
+                                                           GParamSpec            *pspec);
+static void      gimp_dock_window_get_property            (GObject               *object,
+                                                           guint                  property_id,
+                                                           GValue                *value,
+                                                           GParamSpec            *pspec);
+static void      gimp_dock_window_style_set               (GtkWidget             *widget,
+                                                           GtkStyle              *prev_style);
+static gboolean  gimp_dock_window_delete_event            (GtkWidget             *widget,
+                                                           GdkEventAny           *event);
+static void      gimp_dock_window_display_changed         (GimpDockWindow        *dock_window,
+                                                           GimpObject            *display,
+                                                           GimpContext           *context);
+static void      gimp_dock_window_image_changed           (GimpDockWindow        *dock_window,
+                                                           GimpImage             *image,
+                                                           GimpContext           *context);
+static void      gimp_dock_window_image_flush             (GimpImage             *image,
+                                                           gboolean               invalidate_preview,
+                                                           GimpDockWindow        *dock_window);
+static void      gimp_dock_window_update_title            (GimpDockWindow        *dock_window);
+static gboolean  gimp_dock_window_update_title_idle       (GimpDockWindow        *dock_window);
+static void      gimp_dock_window_dock_removed            (GimpDockWindow        *dock_window,
+                                                           GimpDock              *dock,
+                                                           GimpDockColumns       *dock_columns);
+static void      gimp_dock_window_factory_display_changed (GimpContext           *context,
+                                                           GimpObject            *display,
+                                                           GimpDock              *dock);
+static void      gimp_dock_window_factory_image_changed   (GimpContext           *context,
+                                                           GimpImage             *image,
+                                                           GimpDock              *dock);
+static void      gimp_dock_window_auto_clicked            (GtkWidget             *widget,
+                                                           GimpDock              *dock);
 
 
 G_DEFINE_TYPE (GimpDockWindow, gimp_dock_window, GIMP_TYPE_WINDOW)
@@ -124,13 +156,13 @@ gimp_dock_window_class_init (GimpDockWindowClass *klass)
   GObjectClass   *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  object_class->constructor     = gimp_dock_window_constructor;
-  object_class->dispose         = gimp_dock_window_dispose;
-  object_class->set_property    = gimp_dock_window_set_property;
-  object_class->get_property    = gimp_dock_window_get_property;
+  object_class->constructor  = gimp_dock_window_constructor;
+  object_class->dispose      = gimp_dock_window_dispose;
+  object_class->set_property = gimp_dock_window_set_property;
+  object_class->get_property = gimp_dock_window_get_property;
 
-  widget_class->style_set       = gimp_dock_window_style_set;
-  widget_class->delete_event    = gimp_dock_window_delete_event;
+  widget_class->style_set    = gimp_dock_window_style_set;
+  widget_class->delete_event = gimp_dock_window_delete_event;
 
   g_object_class_install_property (object_class, PROP_CONTEXT,
                                    g_param_spec_object ("context", NULL, NULL,
@@ -152,6 +184,20 @@ gimp_dock_window_class_init (GimpDockWindowClass *klass)
                                                         GIMP_PARAM_READWRITE |
                                                         G_PARAM_CONSTRUCT_ONLY));
 
+  g_object_class_install_property (object_class, PROP_IMAGE_CONTAINER,
+                                   g_param_spec_object ("image-container",
+                                                        NULL, NULL,
+                                                        GIMP_TYPE_CONTAINER,
+                                                        GIMP_PARAM_READWRITE |
+                                                        G_PARAM_CONSTRUCT_ONLY));
+
+  g_object_class_install_property (object_class, PROP_DISPLAY_CONTAINER,
+                                   g_param_spec_object ("display-container",
+                                                        NULL, NULL,
+                                                        GIMP_TYPE_CONTAINER,
+                                                        GIMP_PARAM_READWRITE |
+                                                        G_PARAM_CONSTRUCT_ONLY));
+
   g_object_class_install_property (object_class, PROP_ALLOW_DOCKBOOK_ABSENCE,
                                    g_param_spec_boolean ("allow-dockbook-absence",
                                                          NULL, NULL,
@@ -159,6 +205,7 @@ gimp_dock_window_class_init (GimpDockWindowClass *klass)
                                                          GIMP_PARAM_READWRITE |
                                                          G_PARAM_CONSTRUCT_ONLY));
 
+
   gtk_widget_class_install_style_property (widget_class,
                                            g_param_spec_int ("default-height",
                                                              NULL, NULL,
@@ -166,6 +213,13 @@ gimp_dock_window_class_init (GimpDockWindowClass *klass)
                                                              DEFAULT_DOCK_HEIGHT,
                                                              GIMP_PARAM_READABLE));
 
+  gtk_widget_class_install_style_property (widget_class,
+                                           g_param_spec_enum ("menu-preview-size",
+                                                              NULL, NULL,
+                                                              GTK_TYPE_ICON_SIZE,
+                                                              DEFAULT_MENU_VIEW_SIZE,
+                                                              GIMP_PARAM_READABLE));
+
   g_type_class_add_private (klass, sizeof (GimpDockWindowPrivate));
 }
 
@@ -173,32 +227,80 @@ static void
 gimp_dock_window_init (GimpDockWindow *dock_window)
 {
   static gint  dock_window_ID = 1;
-  gchar       *name;
+  gchar       *name           = NULL;
 
   /* Initialize members */
   dock_window->p = G_TYPE_INSTANCE_GET_PRIVATE (dock_window,
                                                 GIMP_TYPE_DOCK_WINDOW,
                                                 GimpDockWindowPrivate);
-  dock_window->p->ID           = dock_window_ID++;
-  dock_window->p->dock_columns = g_object_new (GIMP_TYPE_DOCK_COLUMNS, NULL);
-
-  /* Some common initialization for all dock windows */
-  gtk_container_add (GTK_CONTAINER (dock_window),
-                     GTK_WIDGET (dock_window->p->dock_columns));
-  gtk_widget_show (GTK_WIDGET (dock_window->p->dock_columns));
-  gtk_window_set_resizable (GTK_WINDOW (dock_window), TRUE);
-  gtk_window_set_focus_on_map (GTK_WINDOW (dock_window), FALSE);
+  dock_window->p->ID                 = dock_window_ID++;
+  dock_window->p->auto_follow_active = TRUE;
 
   /* Initialize theming and style-setting stuff */
   name = g_strdup_printf ("gimp-dock-%d", dock_window->p->ID);
   gtk_widget_set_name (GTK_WIDGET (dock_window), name);
   g_free (name);
 
-  /* Destroy the dock window when the last dock is removed */
-  g_signal_connect_object (dock_window->p->dock_columns, "dock-removed",
-                           G_CALLBACK (gimp_dock_window_dock_removed),
-                           dock_window,
-                           G_CONNECT_SWAPPED);
+  /* Misc */
+  gtk_window_set_resizable (GTK_WINDOW (dock_window), TRUE);
+  gtk_window_set_focus_on_map (GTK_WINDOW (dock_window), FALSE);
+
+  /* Setup widget hierarchy */
+  {
+    GtkWidget *vbox = NULL;
+
+    /* Top-level GtkVBox */
+    vbox = gtk_vbox_new (FALSE, 0);
+    gtk_container_add (GTK_CONTAINER (dock_window), vbox);
+    gtk_widget_show (vbox);
+
+    /* Image selection menu */
+    {
+      GtkWidget *hbox = NULL;
+
+      /* GtkHBox */
+      hbox = gtk_hbox_new (FALSE, 2);
+      gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+      if (dock_window->p->show_image_menu)
+        gtk_widget_show (hbox);
+
+      /* Image combo */
+      dock_window->p->image_combo = gimp_container_combo_box_new (NULL, NULL, 16, 1);
+      gtk_box_pack_start (GTK_BOX (hbox), dock_window->p->image_combo, TRUE, TRUE, 0);
+      g_signal_connect (dock_window->p->image_combo, "destroy",
+                        G_CALLBACK (gtk_widget_destroyed),
+                        &dock_window->p->image_combo);
+      gimp_help_set_help_data (dock_window->p->image_combo,
+                               NULL, GIMP_HELP_DOCK_IMAGE_MENU);
+      gtk_widget_show (dock_window->p->image_combo);
+
+      /* Auto button */
+      dock_window->p->auto_button = gtk_toggle_button_new_with_label (_("Auto"));
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dock_window->p->auto_button),
+                                    dock_window->p->auto_follow_active);
+      gtk_box_pack_start (GTK_BOX (hbox), dock_window->p->auto_button, FALSE, FALSE, 0);
+      gtk_widget_show (dock_window->p->auto_button);
+
+      g_signal_connect (dock_window->p->auto_button, "clicked",
+                        G_CALLBACK (gimp_dock_window_auto_clicked),
+                        dock_window);
+
+      gimp_help_set_help_data (dock_window->p->auto_button,
+                               _("When enabled the dialog automatically "
+                                 "follows the image you are working on."),
+                               GIMP_HELP_DOCK_AUTO_BUTTON);
+    }
+
+    /* GimpDockColumns */
+    dock_window->p->dock_columns =g_object_new (GIMP_TYPE_DOCK_COLUMNS, NULL);
+    gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (dock_window->p->dock_columns),
+                        TRUE, TRUE, 0);
+    gtk_widget_show (GTK_WIDGET (dock_window->p->dock_columns));
+    g_signal_connect_object (dock_window->p->dock_columns, "dock-removed",
+                             G_CALLBACK (gimp_dock_window_dock_removed),
+                             dock_window,
+                             G_CONNECT_SWAPPED);
+  }
 }
 
 static GObject *
@@ -206,15 +308,29 @@ gimp_dock_window_constructor (GType                  type,
                               guint                  n_params,
                               GObjectConstructParam *params)
 {
-  GObject        *object;
-  GimpDockWindow *dock_window;
-  GimpGuiConfig  *config;
-  GtkAccelGroup  *accel_group;
+  GObject        *object           = NULL;
+  GimpDockWindow *dock_window      = NULL;
+  GimpGuiConfig  *config           = NULL;
+  GtkAccelGroup  *accel_group      = NULL;
+  Gimp           *gimp             = NULL;
+  GtkSettings    *settings         = NULL;
+  gint            menu_view_width  = -1;
+  gint            menu_view_height = -1;
 
   /* Init */
   object      = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
   dock_window = GIMP_DOCK_WINDOW (object);
-  config      = GIMP_GUI_CONFIG (dock_window->p->context->gimp->config);
+  gimp        = GIMP (dock_window->p->context->gimp);
+  config      = GIMP_GUI_CONFIG (gimp->config);
+
+  /* Create a separate context per dock so that docks can be bound to
+   * a specific image and does not necessarily have to follow the
+   * active image in the user context
+   */
+  g_object_unref (dock_window->p->context);
+  dock_window->p->context           = gimp_context_new (gimp, "Dock Context", NULL);
+  dock_window->p->image_container   = gimp->images;
+  dock_window->p->display_container = gimp->displays;
 
   /* Setup hints */
   gimp_window_set_hint (GTK_WINDOW (dock_window), config->dock_window_hint);
@@ -227,9 +343,8 @@ gimp_dock_window_constructor (GType                  type,
                                    dock_window->p->ui_manager_name,
                                    dock_window,
                                    config->tearoff_menus);
-  accel_group =
+  accel_group = 
     gtk_ui_manager_get_accel_group (GTK_UI_MANAGER (dock_window->p->ui_manager));
-
   gtk_window_add_accel_group (GTK_WINDOW (dock_window), accel_group);
 
   g_signal_connect_object (dock_window->p->context, "display-changed",
@@ -242,10 +357,50 @@ gimp_dock_window_constructor (GType                  type,
                            G_CONNECT_SWAPPED);
 
   dock_window->p->image_flush_handler_id =
-    gimp_container_add_handler (dock_window->p->context->gimp->images, "flush",
+    gimp_container_add_handler (gimp->images, "flush",
                                 G_CALLBACK (gimp_dock_window_image_flush),
                                 dock_window);
 
+  gimp_context_define_properties (dock_window->p->context,
+                                  GIMP_CONTEXT_ALL_PROPS_MASK &
+                                  ~(GIMP_CONTEXT_IMAGE_MASK |
+                                    GIMP_CONTEXT_DISPLAY_MASK),
+                                  FALSE);
+  gimp_context_set_parent (dock_window->p->context, dock_window->p->dialog_factory->context);
+
+  if (dock_window->p->auto_follow_active)
+    {
+      if (gimp_context_get_display (dock_window->p->dialog_factory->context))
+        gimp_context_copy_property (dock_window->p->dialog_factory->context, dock_window->p->context,
+                                    GIMP_CONTEXT_PROP_DISPLAY);
+      else
+        gimp_context_copy_property (dock_window->p->dialog_factory->context, dock_window->p->context,
+                                    GIMP_CONTEXT_PROP_IMAGE);
+    }
+
+  g_signal_connect_object (dock_window->p->dialog_factory->context, "display-changed",
+                           G_CALLBACK (gimp_dock_window_factory_display_changed),
+                           dock_window,
+                           0);
+  g_signal_connect_object (dock_window->p->dialog_factory->context, "image-changed",
+                           G_CALLBACK (gimp_dock_window_factory_image_changed),
+                           dock_window,
+                           0);
+
+  settings = gtk_widget_get_settings (GTK_WIDGET (dock_window));
+  gtk_icon_size_lookup_for_settings (settings,
+                                     DEFAULT_MENU_VIEW_SIZE,
+                                     &menu_view_width,
+                                     &menu_view_height);
+
+  g_object_set (dock_window->p->image_combo,
+                "container", dock_window->p->image_container,
+                "context",   dock_window->p->context,
+                NULL);
+
+  gimp_help_connect (GTK_WIDGET (dock_window), gimp_standard_help_func,
+                     GIMP_HELP_DOCK, NULL);
+
   /* Done! */
   return object;
 }
@@ -289,6 +444,33 @@ gimp_dock_window_dispose (GObject *object)
   G_OBJECT_CLASS (parent_class)->dispose (object);
 }
 
+#if 0
+/* XXX: Do we need this any longer? Doesn't seem like it */
+static void       gimp_dock_window_destroy           (GtkObject      *object);
+  GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
+  gtk_object_class->destroy     = gimp_dock_window_destroy;
+static void
+gimp_dock_window_destroy (GtkObject *object)
+{
+  GimpDockWindow *dock = GIMP_DOCK_WINDOW (object);
+
+  /*  remove the image menu and the auto button manually here because
+   *  of weird cross-connections with GimpDock's context
+   */
+  /*  FIXME: Fix this when fixing GimpContext management */
+  if (gimp_dock_get_main_vbox (GIMP_DOCK (dock)) && dock->p->image_combo)
+    {
+      GtkWidget *parent = gtk_widget_get_parent (dock->p->image_combo);
+
+      if (parent)
+        gtk_container_remove (GTK_CONTAINER (gimp_dock_get_main_vbox (GIMP_DOCK (dock))),
+                              parent);
+    }
+
+  GTK_OBJECT_CLASS (parent_class)->destroy (object);
+}
+#endif
+
 static void
 gimp_dock_window_set_property (GObject      *object,
                                guint         property_id,
@@ -312,6 +494,14 @@ gimp_dock_window_set_property (GObject      *object,
       dock_window->p->ui_manager_name = g_value_dup_string (value);
       break;
 
+    case PROP_IMAGE_CONTAINER:
+      dock_window->p->image_container = g_value_dup_object (value);
+      break;
+
+    case PROP_DISPLAY_CONTAINER:
+      dock_window->p->display_container = g_value_dup_object (value);
+      break;
+
     case PROP_ALLOW_DOCKBOOK_ABSENCE:
       dock_window->p->allow_dockbook_absence = g_value_get_boolean (value);
       break;
@@ -344,6 +534,14 @@ gimp_dock_window_get_property (GObject    *object,
       g_value_set_string (value, dock_window->p->ui_manager_name);
       break;
 
+    case PROP_IMAGE_CONTAINER:
+      g_value_set_object (value, dock_window->p->image_container);
+      break;
+
+    case PROP_DISPLAY_CONTAINER:
+      g_value_set_object (value, dock_window->p->display_container);
+      break;
+
     case PROP_ALLOW_DOCKBOOK_ABSENCE:
       g_value_set_boolean (value, dock_window->p->allow_dockbook_absence);
       break;
@@ -358,15 +556,50 @@ static void
 gimp_dock_window_style_set (GtkWidget *widget,
                             GtkStyle  *prev_style)
 {
+  GimpDockWindow *dock_window      = GIMP_DOCK_WINDOW (widget);
+  GtkStyle       *button_style;
+  GtkIconSize     menu_view_size;
+  GtkSettings    *settings;
+  gint            menu_view_width  = 18;
+  gint            menu_view_height = 18;
+  gint            focus_line_width;
+  gint            focus_padding;
+  gint            ythickness;
+
   gint default_height = DEFAULT_DOCK_HEIGHT;
 
   GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
 
   gtk_widget_style_get (widget,
                         "default-height", &default_height,
+                        "menu-preview-size", &menu_view_size,
                         NULL);
 
   gtk_window_set_default_size (GTK_WINDOW (widget), -1, default_height);
+
+  settings = gtk_widget_get_settings (dock_window->p->image_combo);
+  gtk_icon_size_lookup_for_settings (settings,
+                                     menu_view_size,
+                                     &menu_view_width,
+                                     &menu_view_height);
+
+  gtk_widget_style_get (dock_window->p->auto_button,
+                        "focus-line-width", &focus_line_width,
+                        "focus-padding",    &focus_padding,
+                        NULL);
+
+  button_style = gtk_widget_get_style (widget);
+  ythickness = button_style->ythickness;
+
+  gimp_container_view_set_view_size (GIMP_CONTAINER_VIEW (dock_window->p->image_combo),
+                                     menu_view_height, 1);
+
+  gtk_widget_set_size_request (dock_window->p->auto_button, -1,
+                               menu_view_height +
+                               2 * (1 /* CHILD_SPACING */ +
+                                    ythickness            +
+                                    focus_padding         +
+                                    focus_line_width));
 }
 
 /**
@@ -417,15 +650,6 @@ gimp_dock_window_display_changed (GimpDockWindow *dock_window,
 }
 
 static void
-gimp_dock_window_image_changed (GimpDockWindow *dock_window,
-                                GimpImage     *image,
-                                GimpContext   *context)
-{
-  gimp_ui_manager_update (dock_window->p->ui_manager,
-                          gimp_context_get_display (context));
-}
-
-static void
 gimp_dock_window_image_flush (GimpImage      *image,
                               gboolean        invalidate_preview,
                               GimpDockWindow *dock_window)
@@ -485,6 +709,129 @@ gimp_dock_window_dock_removed (GimpDockWindow  *dock_window,
     gtk_widget_destroy (GTK_WIDGET (dock_window));
 }
 
+static void
+gimp_dock_window_factory_display_changed (GimpContext *context,
+                                          GimpObject  *display,
+                                          GimpDock    *dock)
+{
+  GimpDockWindow *dock_window = GIMP_DOCK_WINDOW (dock);
+
+  if (display && dock_window->p->auto_follow_active)
+    gimp_context_set_display (dock_window->p->context, display);
+}
+
+static void
+gimp_dock_window_factory_image_changed (GimpContext *context,
+                                        GimpImage   *image,
+                                        GimpDock    *dock)
+{
+  GimpDockWindow *dock_window = GIMP_DOCK_WINDOW (dock);
+
+  /*  won't do anything if we already set the display above  */
+  if (image && dock_window->p->auto_follow_active)
+    gimp_context_set_image (dock_window->p->context, image);
+}
+
+static void
+gimp_dock_window_image_changed (GimpDockWindow *dock_window,
+                                GimpImage      *image,
+                                GimpContext    *context)
+{
+  GimpContainer *image_container   = dock_window->p->image_container;
+  GimpContainer *display_container = dock_window->p->display_container;
+
+  if (image == NULL && ! gimp_container_is_empty (image_container))
+    {
+      image = GIMP_IMAGE (gimp_container_get_first_child (image_container));
+
+      /*  this invokes this function recursively but we don't enter
+       *  the if() branch the second time
+       */
+      gimp_context_set_image (context, image);
+
+      /*  stop the emission of the original signal (the emission of
+       *  the recursive signal is finished)
+       */
+      g_signal_stop_emission_by_name (context, "image-changed");
+    }
+  else if (image != NULL && ! gimp_container_is_empty (display_container))
+    {
+      GimpObject *display;
+      GimpImage  *display_image;
+      gboolean    find_display = TRUE;
+
+      display = gimp_context_get_display (context);
+
+      if (display)
+        {
+          g_object_get (display, "image", &display_image, NULL);
+
+          if (display_image)
+            {
+              g_object_unref (display_image);
+
+              if (display_image == image)
+                find_display = FALSE;
+            }
+        }
+
+      if (find_display)
+        {
+          GList *list;
+
+          for (list = GIMP_LIST (display_container)->list;
+               list;
+               list = g_list_next (list))
+            {
+              display = GIMP_OBJECT (list->data);
+
+              g_object_get (display, "image", &display_image, NULL);
+
+              if (display_image)
+                {
+                  g_object_unref (display_image);
+
+                  if (display_image == image)
+                    {
+                      /*  this invokes this function recursively but we
+                       *  don't enter the if(find_display) branch the
+                       *  second time
+                       */
+                      gimp_context_set_display (context, display);
+
+                      /*  don't stop signal emission here because the
+                       *  context's image was not changed by the
+                       *  recursive call
+                       */
+                      break;
+                    }
+                }
+            }
+        }
+    }
+
+  gimp_ui_manager_update (dock_window->p->ui_manager,
+                          gimp_context_get_display (context));
+}
+
+static void
+gimp_dock_window_auto_clicked (GtkWidget *widget,
+                               GimpDock  *dock)
+{
+  GimpDockWindow *dock_window = GIMP_DOCK_WINDOW (dock);
+
+  gimp_toggle_button_update (widget, &dock_window->p->auto_follow_active);
+
+  if (dock_window->p->auto_follow_active)
+    {
+      gimp_context_copy_properties (dock_window->p->dialog_factory->context,
+                                    dock_window->p->context,
+                                    GIMP_CONTEXT_DISPLAY_MASK |
+                                    GIMP_CONTEXT_IMAGE_MASK);
+    }
+}
+
+
 void
 gimp_dock_window_add_dock (GimpDockWindow *dock_window,
                            GimpDock       *dock,
@@ -544,6 +891,22 @@ gimp_dock_window_get_ui_manager (GimpDockWindow *dock_window)
   return dock_window->p->ui_manager;
 }
 
+GimpContext *
+gimp_dock_window_get_context (GimpDockWindow *dock_window)
+{
+  g_return_val_if_fail (GIMP_IS_DOCK_WINDOW (dock_window), NULL);
+
+  return dock_window->p->context;
+}
+
+GimpDialogFactory *
+gimp_dock_window_get_dialog_factory (GimpDockWindow *dock_window)
+{
+  g_return_val_if_fail (GIMP_IS_DOCK_WINDOW (dock_window), NULL);
+
+  return dock_window->p->dialog_factory;
+}
+
 /**
  * gimp_dock_window_get_docks:
  * @dock_window:
@@ -576,6 +939,117 @@ gimp_dock_window_get_dock (GimpDockWindow *dock_window)
   return g_list_length (docks) > 0 ? GIMP_DOCK (docks->data) : NULL;
 }
 
+gboolean
+gimp_dock_window_get_auto_follow_active (GimpDockWindow *dock_window)
+{
+  g_return_val_if_fail (GIMP_IS_DOCK_WINDOW (dock_window), FALSE);
+
+  return dock_window->p->auto_follow_active;
+}
+
+void
+gimp_dock_window_set_auto_follow_active (GimpDockWindow *dock_window,
+                                         gboolean        auto_follow_active)
+{
+  g_return_if_fail (GIMP_IS_DOCK_WINDOW (dock_window));
+
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dock_window->p->auto_button),
+                                auto_follow_active ? TRUE : FALSE);
+}
+
+gboolean
+gimp_dock_window_get_show_image_menu (GimpDockWindow *dock_window)
+{
+  g_return_val_if_fail (GIMP_IS_DOCK_WINDOW (dock_window), FALSE);
+
+  return dock_window->p->show_image_menu;
+}
+
+void
+gimp_dock_window_set_show_image_menu (GimpDockWindow *dock_window,
+                                      gboolean        show)
+{
+  GtkWidget *parent;
+
+  g_return_if_fail (GIMP_IS_DOCK_WINDOW (dock_window));
+
+  parent = gtk_widget_get_parent (dock_window->p->image_combo);
+
+  gtk_widget_set_visible (parent, show);
+
+  dock_window->p->show_image_menu = show ? TRUE : FALSE;
+}
+
+void
+gimp_dock_window_setup (GimpDockWindow *dock_window,
+                        GimpDockWindow *template)
+{
+  gimp_dock_window_set_auto_follow_active (GIMP_DOCK_WINDOW (dock_window),
+                                           template->p->auto_follow_active);
+  gimp_dock_window_set_show_image_menu (GIMP_DOCK_WINDOW (dock_window),
+                                        template->p->show_image_menu);
+}
+
+void
+gimp_dock_window_set_aux_info (GimpDockWindow *dock_window,
+                               GList          *aux_info)
+{
+  GList        *list;
+  gboolean      menu_shown  = dock_window->p->show_image_menu;
+  gboolean      auto_follow = dock_window->p->auto_follow_active;
+
+  g_return_if_fail (GIMP_IS_DOCK_WINDOW (dock_window));
+
+  for (list = aux_info; list; list = g_list_next (list))
+    {
+      GimpSessionInfoAux *aux = list->data;
+
+      if (! strcmp (aux->name, AUX_INFO_SHOW_IMAGE_MENU))
+        {
+          menu_shown = ! g_ascii_strcasecmp (aux->value, "true");
+        }
+      else if (! strcmp (aux->name, AUX_INFO_FOLLOW_ACTIVE_IMAGE))
+        {
+          auto_follow = ! g_ascii_strcasecmp (aux->value, "true");
+        }
+    }
+
+  if (menu_shown != dock_window->p->show_image_menu)
+    gimp_dock_window_set_show_image_menu (dock_window, menu_shown);
+
+  if (auto_follow != dock_window->p->auto_follow_active)
+    gimp_dock_window_set_auto_follow_active (dock_window, auto_follow);
+}
+
+GList *
+gimp_dock_window_get_aux_info (GimpDockWindow *dock_window)
+{
+  GList              *aux_info = NULL;
+  GimpSessionInfoAux *aux      = NULL;
+
+  g_return_val_if_fail (GIMP_IS_DOCK_WINDOW (dock_window), NULL);
+
+  if (dock_window->p->allow_dockbook_absence)
+    {
+      /* Assume it is the toolbox; it does not have aux info */
+      return NULL;
+    }
+
+  g_return_val_if_fail (GIMP_IS_DOCK_WINDOW (dock_window), NULL);
+
+  aux = gimp_session_info_aux_new (AUX_INFO_SHOW_IMAGE_MENU,
+                                   dock_window->p->show_image_menu ?
+                                   "true" : "false");
+  aux_info = g_list_append (aux_info, aux);
+
+  aux = gimp_session_info_aux_new (AUX_INFO_FOLLOW_ACTIVE_IMAGE,
+                                   dock_window->p->auto_follow_active ?
+                                   "true" : "false");
+  aux_info = g_list_append (aux_info, aux);
+
+  return aux_info;
+}
+
 
 /**
  * gimp_dock_window_from_dock:
diff --git a/app/widgets/gimpdockwindow.h b/app/widgets/gimpdockwindow.h
index 707403a..c935ffc 100644
--- a/app/widgets/gimpdockwindow.h
+++ b/app/widgets/gimpdockwindow.h
@@ -55,18 +55,31 @@ struct _GimpDockWindowClass
 };
 
 
-GType               gimp_dock_window_get_type         (void) G_GNUC_CONST;
-gint                gimp_dock_window_get_id           (GimpDockWindow *dock_window);
-void                gimp_dock_window_add_dock         (GimpDockWindow *dock_window,
-                                                       GimpDock       *dock,
-                                                       gint            index);
-void                gimp_dock_window_remove_dock      (GimpDockWindow *dock_window,
-                                                       GimpDock       *dock);
-GimpUIManager     * gimp_dock_window_get_ui_manager   (GimpDockWindow *dock_window);
-GList             * gimp_dock_window_get_docks        (GimpDockWindow *dock_window);
-GimpDock          * gimp_dock_window_get_dock         (GimpDockWindow *dock_window);
+GType               gimp_dock_window_get_type               (void) G_GNUC_CONST;
+gint                gimp_dock_window_get_id                 (GimpDockWindow *dock_window);
+void                gimp_dock_window_add_dock               (GimpDockWindow *dock_window,
+                                                             GimpDock       *dock,
+                                                             gint            index);
+void                gimp_dock_window_remove_dock            (GimpDockWindow *dock_window,
+                                                             GimpDock       *dock);
+GimpUIManager     * gimp_dock_window_get_ui_manager         (GimpDockWindow *dock_window);
+GimpContext       * gimp_dock_window_get_context            (GimpDockWindow *dock);
+GimpDialogFactory * gimp_dock_window_get_dialog_factory     (GimpDockWindow *dock);
+GList             * gimp_dock_window_get_docks              (GimpDockWindow *dock_window);
+GimpDock          * gimp_dock_window_get_dock               (GimpDockWindow *dock_window);
+gboolean            gimp_dock_window_get_auto_follow_active (GimpDockWindow *menu_dock);
+void                gimp_dock_window_set_auto_follow_active (GimpDockWindow *menu_dock,
+                                                             gboolean        show);
+gboolean            gimp_dock_window_get_show_image_menu    (GimpDockWindow *menu_dock);
+void                gimp_dock_window_set_show_image_menu    (GimpDockWindow *menu_dock,
+                                                             gboolean        show);
+void                gimp_dock_window_setup                  (GimpDockWindow *dock_window,
+                                                             GimpDockWindow *template);
+void                gimp_dock_window_set_aux_info           (GimpDockWindow *dock,
+                                                             GList          *aux_info);
+GList             * gimp_dock_window_get_aux_info           (GimpDockWindow *dock);
 
-GimpDockWindow    * gimp_dock_window_from_dock        (GimpDock       *dock);
+GimpDockWindow    * gimp_dock_window_from_dock              (GimpDock       *dock);
 
 
 #endif /* __GIMP_DOCK_WINDOW_H__ */
diff --git a/app/widgets/gimpmenudock.c b/app/widgets/gimpmenudock.c
index 24f47b4..9a95c6d 100644
--- a/app/widgets/gimpmenudock.c
+++ b/app/widgets/gimpmenudock.c
@@ -36,46 +36,24 @@
 #include "core/gimplist.h"
 
 #include "gimpdialogfactory.h"
-#include "gimpcontainercombobox.h"
-#include "gimpcontainerview.h"
 #include "gimpdockable.h"
 #include "gimpdockbook.h"
-#include "gimphelp-ids.h"
 #include "gimpmenudock.h"
-#include "gimpsessioninfo-aux.h"
 
 #include "gimp-intl.h"
 
 
 #define DEFAULT_MINIMAL_WIDTH  200
-#define DEFAULT_MENU_VIEW_SIZE GTK_ICON_SIZE_SMALL_TOOLBAR
 
 struct _GimpMenuDockPrivate
 {
-  GimpContainer *image_container;
-  GimpContainer *display_container;
-
-  gboolean       show_image_menu;
-  gboolean       auto_follow_active;
-
-  GtkWidget     *image_combo;
-  GtkWidget     *auto_button;
+  gint make_sizeof_greater_than_zero;
 };
 
 
-static GObject * gimp_menu_dock_constructor   (GType                  type,
-                                               guint                  n_params,
-                                               GObjectConstructParam *params);
-static void   gimp_menu_dock_destroy                 (GtkObject      *object);
-
 static void   gimp_menu_dock_style_set               (GtkWidget      *widget,
                                                       GtkStyle       *prev_style);
 
-static void   gimp_menu_dock_setup                   (GimpDock       *dock,
-                                                      const GimpDock *template);
-static void   gimp_menu_dock_set_aux_info            (GimpDock       *dock,
-                                                      GList          *aux_info);
-static GList *gimp_menu_dock_get_aux_info            (GimpDock       *dock);
 static gchar *gimp_menu_dock_get_title               (GimpDock       *dock);
 static void   gimp_menu_dock_book_added              (GimpDock       *dock,
                                                       GimpDockbook   *dockbook);
@@ -86,17 +64,6 @@ static void   gimp_menu_dock_dockbook_changed        (GimpDockbook   *dockbook,
                                                       GimpDockable   *dockable,
                                                       GimpMenuDock   *dock);
 
-static void   gimp_menu_dock_factory_display_changed (GimpContext    *context,
-                                                      GimpObject     *display,
-                                                      GimpDock       *dock);
-static void   gimp_menu_dock_factory_image_changed   (GimpContext    *context,
-                                                      GimpImage      *image,
-                                                      GimpDock       *dock);
-static void   gimp_menu_dock_image_changed           (GimpContext    *context,
-                                                      GimpImage      *image,
-                                                      GimpDock       *dock);
-static void   gimp_menu_dock_auto_clicked            (GtkWidget      *widget,
-                                                      GimpDock       *dock);
 
 
 G_DEFINE_TYPE (GimpMenuDock, gimp_menu_dock, GIMP_TYPE_DOCK)
@@ -107,20 +74,11 @@ G_DEFINE_TYPE (GimpMenuDock, gimp_menu_dock, GIMP_TYPE_DOCK)
 static void
 gimp_menu_dock_class_init (GimpMenuDockClass *klass)
 {
-  GObjectClass   *object_class     = G_OBJECT_CLASS (klass);
-  GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
-  GtkWidgetClass *widget_class     = GTK_WIDGET_CLASS (klass);
-  GimpDockClass  *dock_class       = GIMP_DOCK_CLASS (klass);
-
-  object_class->constructor = gimp_menu_dock_constructor;
-
-  gtk_object_class->destroy = gimp_menu_dock_destroy;
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+  GimpDockClass  *dock_class   = GIMP_DOCK_CLASS (klass);
 
   widget_class->style_set   = gimp_menu_dock_style_set;
 
-  dock_class->setup         = gimp_menu_dock_setup;
-  dock_class->set_aux_info  = gimp_menu_dock_set_aux_info;
-  dock_class->get_aux_info  = gimp_menu_dock_get_aux_info;
   dock_class->get_title     = gimp_menu_dock_get_title;
   dock_class->book_added    = gimp_menu_dock_book_added;
   dock_class->book_removed  = gimp_menu_dock_book_removed;
@@ -132,12 +90,6 @@ gimp_menu_dock_class_init (GimpMenuDockClass *klass)
                                                              G_MAXINT,
                                                              DEFAULT_MINIMAL_WIDTH,
                                                              GIMP_PARAM_READABLE));
-  gtk_widget_class_install_style_property (widget_class,
-                                           g_param_spec_enum ("menu-preview-size",
-                                                              NULL, NULL,
-                                                              GTK_TYPE_ICON_SIZE,
-                                                              DEFAULT_MENU_VIEW_SIZE,
-                                                              GIMP_PARAM_READABLE));
 
   g_type_class_add_private (klass, sizeof (GimpMenuDockPrivate));
 }
@@ -145,204 +97,21 @@ gimp_menu_dock_class_init (GimpMenuDockClass *klass)
 static void
 gimp_menu_dock_init (GimpMenuDock *dock)
 {
-  GtkWidget *hbox;
-
-  dock->p = G_TYPE_INSTANCE_GET_PRIVATE (dock,
-                                         GIMP_TYPE_MENU_DOCK,
-                                         GimpMenuDockPrivate);
-  dock->p->image_container      = NULL;
-  dock->p->display_container    = NULL;
-  dock->p->show_image_menu      = FALSE;
-  dock->p->auto_follow_active   = TRUE;
-
-  hbox = gtk_hbox_new (FALSE, 2);
-  gtk_box_pack_start (GTK_BOX (gimp_dock_get_main_vbox (GIMP_DOCK (dock))), hbox,
-                      FALSE, FALSE, 0);
-  gtk_box_reorder_child (GTK_BOX (gimp_dock_get_main_vbox (GIMP_DOCK (dock))), hbox, 0);
-
-  if (dock->p->show_image_menu)
-    gtk_widget_show (hbox);
-
-  dock->p->image_combo = gimp_container_combo_box_new (NULL, NULL, 16, 1);
-  gtk_box_pack_start (GTK_BOX (hbox), dock->p->image_combo, TRUE, TRUE, 0);
-  gtk_widget_show (dock->p->image_combo);
-
-  g_signal_connect (dock->p->image_combo, "destroy",
-                    G_CALLBACK (gtk_widget_destroyed),
-                    &dock->p->image_combo);
-
-  gimp_help_set_help_data (dock->p->image_combo, NULL, GIMP_HELP_DOCK_IMAGE_MENU);
-
-  dock->p->auto_button = gtk_toggle_button_new_with_label (_("Auto"));
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dock->p->auto_button),
-                                dock->p->auto_follow_active);
-  gtk_box_pack_start (GTK_BOX (hbox), dock->p->auto_button, FALSE, FALSE, 0);
-  gtk_widget_show (dock->p->auto_button);
-
-  g_signal_connect (dock->p->auto_button, "clicked",
-                    G_CALLBACK (gimp_menu_dock_auto_clicked),
-                    dock);
-
-  gimp_help_set_help_data (dock->p->auto_button,
-                           _("When enabled the dialog automatically "
-                             "follows the image you are working on."),
-                           GIMP_HELP_DOCK_AUTO_BUTTON);
-}
-
-static GObject *
-gimp_menu_dock_constructor (GType                  type,
-                            guint                  n_params,
-                            GObjectConstructParam *params)
-{
-  GObject      *object;
-  GimpMenuDock *dock;
-
-  object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
-
-  dock = GIMP_MENU_DOCK (object);
-
-  return object;
-}
-
-static void
-gimp_menu_dock_destroy (GtkObject *object)
-{
-  GimpMenuDock *dock = GIMP_MENU_DOCK (object);
-
-  /*  remove the image menu and the auto button manually here because
-   *  of weird cross-connections with GimpDock's context
-   */
-  if (gimp_dock_get_main_vbox (GIMP_DOCK (dock)) && dock->p->image_combo)
-    {
-      GtkWidget *parent = gtk_widget_get_parent (dock->p->image_combo);
-
-      if (parent)
-        gtk_container_remove (GTK_CONTAINER (gimp_dock_get_main_vbox (GIMP_DOCK (dock))),
-                              parent);
-    }
-
-  GTK_OBJECT_CLASS (parent_class)->destroy (object);
 }
 
 static void
 gimp_menu_dock_style_set (GtkWidget *widget,
                           GtkStyle  *prev_style)
 {
-  GimpMenuDock *menu_dock        = GIMP_MENU_DOCK (widget);
-  GtkStyle     *button_style;
-  gint          minimal_width;
-  GtkIconSize   menu_view_size;
-  GtkSettings  *settings;
-  gint          menu_view_width  = 18;
-  gint          menu_view_height = 18;
-  gint          focus_line_width;
-  gint          focus_padding;
-  gint          ythickness;
+  gint minimal_width = -1;
 
   GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
 
   gtk_widget_style_get (widget,
-                        "minimal-width",     &minimal_width,
-                        "menu-preview-size", &menu_view_size,
+                        "minimal-width", &minimal_width,
                         NULL);
 
-  settings = gtk_widget_get_settings (menu_dock->p->image_combo);
-  gtk_icon_size_lookup_for_settings (settings,
-                                     menu_view_size,
-                                     &menu_view_width,
-                                     &menu_view_height);
-
-  gtk_widget_style_get (menu_dock->p->auto_button,
-                        "focus-line-width", &focus_line_width,
-                        "focus-padding",    &focus_padding,
-                        NULL);
-
-  button_style = gtk_widget_get_style (widget);
-  ythickness = button_style->ythickness;
-
   gtk_widget_set_size_request (widget, minimal_width, -1);
-
-  gimp_container_view_set_view_size (GIMP_CONTAINER_VIEW (menu_dock->p->image_combo),
-                                     menu_view_height, 1);
-
-  gtk_widget_set_size_request (menu_dock->p->auto_button, -1,
-                               menu_view_height +
-                               2 * (1 /* CHILD_SPACING */ +
-                                    ythickness            +
-                                    focus_padding         +
-                                    focus_line_width));
-}
-
-static void
-gimp_menu_dock_setup (GimpDock       *dock,
-                      const GimpDock *template)
-{
-  if (GIMP_IS_MENU_DOCK (template))
-    {
-      gboolean auto_follow_active;
-      gboolean show_image_menu;
-
-      auto_follow_active = GIMP_MENU_DOCK (template)->p->auto_follow_active;
-      show_image_menu    = GIMP_MENU_DOCK (template)->p->show_image_menu;
-
-      gimp_menu_dock_set_auto_follow_active (GIMP_MENU_DOCK (dock),
-                                             auto_follow_active);
-      gimp_menu_dock_set_show_image_menu (GIMP_MENU_DOCK (dock),
-                                          show_image_menu);
-    }
-}
-
-#define AUX_INFO_SHOW_IMAGE_MENU     "show-image-menu"
-#define AUX_INFO_FOLLOW_ACTIVE_IMAGE "follow-active-image"
-
-static void
-gimp_menu_dock_set_aux_info (GimpDock *dock,
-                             GList    *aux_info)
-{
-  GimpMenuDock *menu_dock   = GIMP_MENU_DOCK (dock);
-  GList        *list;
-  gboolean      menu_shown  = menu_dock->p->show_image_menu;
-  gboolean      auto_follow = menu_dock->p->auto_follow_active;
-
-  for (list = aux_info; list; list = g_list_next (list))
-    {
-      GimpSessionInfoAux *aux = list->data;
-
-      if (! strcmp (aux->name, AUX_INFO_SHOW_IMAGE_MENU))
-        {
-          menu_shown = ! g_ascii_strcasecmp (aux->value, "true");
-        }
-      else if (! strcmp (aux->name, AUX_INFO_FOLLOW_ACTIVE_IMAGE))
-        {
-          auto_follow = ! g_ascii_strcasecmp (aux->value, "true");
-        }
-    }
-
-  if (menu_shown != menu_dock->p->show_image_menu)
-    gimp_menu_dock_set_show_image_menu (menu_dock, menu_shown);
-
-  if (auto_follow != menu_dock->p->auto_follow_active)
-    gimp_menu_dock_set_auto_follow_active (menu_dock, auto_follow);
-}
-
-static GList *
-gimp_menu_dock_get_aux_info (GimpDock *dock)
-{
-  GimpMenuDock       *menu_dock = GIMP_MENU_DOCK (dock);
-  GList              *aux_info  = NULL;
-  GimpSessionInfoAux *aux;
-
-  aux = gimp_session_info_aux_new (AUX_INFO_SHOW_IMAGE_MENU,
-                                   menu_dock->p->show_image_menu ?
-                                   "true" : "false");
-  aux_info = g_list_append (aux_info, aux);
-
-  aux = gimp_session_info_aux_new (AUX_INFO_FOLLOW_ACTIVE_IMAGE,
-                                   menu_dock->p->auto_follow_active ?
-                                   "true" : "false");
-  aux_info = g_list_append (aux_info, aux);
-
-  return aux_info;
 }
 
 static void
@@ -378,123 +147,9 @@ gimp_menu_dock_book_removed (GimpDock     *dock,
 }
 
 GtkWidget *
-gimp_menu_dock_new (GimpDialogFactory *dialog_factory,
-                    GimpContainer     *image_container,
-                    GimpContainer     *display_container)
+gimp_menu_dock_new (void)
 {
-  GimpMenuDock *menu_dock;
-  GimpContext  *context;
-  GtkSettings  *settings;
-  gint          menu_view_width;
-  gint          menu_view_height;
-
-  g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL);
-  g_return_val_if_fail (GIMP_IS_CONTAINER (image_container), NULL);
-  g_return_val_if_fail (GIMP_IS_CONTAINER (display_container), NULL);
-
-  /* Create a separate context per dock so that docks can be bound to
-   * a specific image and does not necessarily have to follow the
-   * active image in the user context
-   */
-  context = gimp_context_new (dialog_factory->context->gimp,
-                              "Dock Context", NULL);
-
-  menu_dock = g_object_new (GIMP_TYPE_MENU_DOCK,
-                            "context",             context,
-                            "dialog-factory",      dialog_factory,
-                            NULL);
-  g_object_unref (context);
-
-  menu_dock->p->image_container   = image_container;
-  menu_dock->p->display_container = display_container;
-
-  gimp_help_connect (GTK_WIDGET (menu_dock), gimp_standard_help_func,
-                     GIMP_HELP_DOCK, NULL);
-
-  gimp_context_define_properties (context,
-                                  GIMP_CONTEXT_ALL_PROPS_MASK &
-                                  ~(GIMP_CONTEXT_IMAGE_MASK |
-                                    GIMP_CONTEXT_DISPLAY_MASK),
-                                  FALSE);
-  gimp_context_set_parent (context, dialog_factory->context);
-
-  if (menu_dock->p->auto_follow_active)
-    {
-      if (gimp_context_get_display (dialog_factory->context))
-        gimp_context_copy_property (dialog_factory->context, context,
-                                    GIMP_CONTEXT_PROP_DISPLAY);
-      else
-        gimp_context_copy_property (dialog_factory->context, context,
-                                    GIMP_CONTEXT_PROP_IMAGE);
-    }
-
-  g_signal_connect_object (dialog_factory->context, "display-changed",
-                           G_CALLBACK (gimp_menu_dock_factory_display_changed),
-                           menu_dock,
-                           0);
-  g_signal_connect_object (dialog_factory->context, "image-changed",
-                           G_CALLBACK (gimp_menu_dock_factory_image_changed),
-                           menu_dock,
-                           0);
-
-  g_signal_connect_object (context, "image-changed",
-                           G_CALLBACK (gimp_menu_dock_image_changed),
-                           menu_dock,
-                           0);
-
-  settings = gtk_widget_get_settings (GTK_WIDGET (menu_dock));
-  gtk_icon_size_lookup_for_settings (settings,
-                                     DEFAULT_MENU_VIEW_SIZE,
-                                     &menu_view_width,
-                                     &menu_view_height);
-
-  g_object_set (menu_dock->p->image_combo,
-                "container", image_container,
-                "context",   context,
-                NULL);
-
-  return GTK_WIDGET (menu_dock);
-}
-
-gboolean
-gimp_menu_dock_get_auto_follow_active (GimpMenuDock *menu_dock)
-{
-  g_return_val_if_fail (GIMP_IS_MENU_DOCK (menu_dock), FALSE);
-
-  return menu_dock->p->auto_follow_active;
-}
-
-void
-gimp_menu_dock_set_auto_follow_active (GimpMenuDock *menu_dock,
-                                       gboolean      auto_follow_active)
-{
-  g_return_if_fail (GIMP_IS_MENU_DOCK (menu_dock));
-
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (menu_dock->p->auto_button),
-                                auto_follow_active ? TRUE : FALSE);
-}
-
-gboolean
-gimp_menu_dock_get_show_image_menu (GimpMenuDock *menu_dock)
-{
-  g_return_val_if_fail (GIMP_IS_MENU_DOCK (menu_dock), FALSE);
-
-  return menu_dock->p->show_image_menu;
-}
-
-void
-gimp_menu_dock_set_show_image_menu (GimpMenuDock *menu_dock,
-                                    gboolean      show)
-{
-  GtkWidget *parent;
-
-  g_return_if_fail (GIMP_IS_MENU_DOCK (menu_dock));
-
-  parent = gtk_widget_get_parent (menu_dock->p->image_combo);
-
-  gtk_widget_set_visible (parent, show);
-
-  menu_dock->p->show_image_menu = show ? TRUE : FALSE;
+  return g_object_new (GIMP_TYPE_MENU_DOCK, NULL);
 }
 
 static void
@@ -542,122 +197,3 @@ gimp_menu_dock_get_title (GimpDock *dock)
   return g_string_free (title, FALSE);
 }
 
-static void
-gimp_menu_dock_factory_display_changed (GimpContext *context,
-                                        GimpObject  *display,
-                                        GimpDock    *dock)
-{
-  GimpMenuDock *menu_dock = GIMP_MENU_DOCK (dock);
-
-  if (display && menu_dock->p->auto_follow_active)
-    gimp_context_set_display (gimp_dock_get_context (dock), display);
-}
-
-static void
-gimp_menu_dock_factory_image_changed (GimpContext *context,
-                                      GimpImage   *image,
-                                      GimpDock    *dock)
-{
-  GimpMenuDock *menu_dock = GIMP_MENU_DOCK (dock);
-
-  /*  won't do anything if we already set the display above  */
-  if (image && menu_dock->p->auto_follow_active)
-    gimp_context_set_image (gimp_dock_get_context (dock), image);
-}
-
-static void
-gimp_menu_dock_image_changed (GimpContext *context,
-                              GimpImage   *image,
-                              GimpDock    *dock)
-{
-  GimpMenuDock  *menu_dock         = GIMP_MENU_DOCK (dock);
-  GimpContainer *image_container   = menu_dock->p->image_container;
-  GimpContainer *display_container = menu_dock->p->display_container;
-
-  if (image == NULL && ! gimp_container_is_empty (image_container))
-    {
-      image = GIMP_IMAGE (gimp_container_get_first_child (image_container));
-
-      /*  this invokes this function recursively but we don't enter
-       *  the if() branch the second time
-       */
-      gimp_context_set_image (context, image);
-
-      /*  stop the emission of the original signal (the emission of
-       *  the recursive signal is finished)
-       */
-      g_signal_stop_emission_by_name (context, "image-changed");
-    }
-  else if (image != NULL && ! gimp_container_is_empty (display_container))
-    {
-      GimpObject *display;
-      GimpImage  *display_image;
-      gboolean    find_display = TRUE;
-
-      display = gimp_context_get_display (context);
-
-      if (display)
-        {
-          g_object_get (display, "image", &display_image, NULL);
-
-          if (display_image)
-            {
-              g_object_unref (display_image);
-
-              if (display_image == image)
-                find_display = FALSE;
-            }
-        }
-
-      if (find_display)
-        {
-          GList *list;
-
-          for (list = GIMP_LIST (display_container)->list;
-               list;
-               list = g_list_next (list))
-            {
-              display = GIMP_OBJECT (list->data);
-
-              g_object_get (display, "image", &display_image, NULL);
-
-              if (display_image)
-                {
-                  g_object_unref (display_image);
-
-                  if (display_image == image)
-                    {
-                      /*  this invokes this function recursively but we
-                       *  don't enter the if(find_display) branch the
-                       *  second time
-                       */
-                      gimp_context_set_display (context, display);
-
-                      /*  don't stop signal emission here because the
-                       *  context's image was not changed by the
-                       *  recursive call
-                       */
-                      break;
-                    }
-                }
-            }
-        }
-    }
-}
-
-static void
-gimp_menu_dock_auto_clicked (GtkWidget *widget,
-                             GimpDock  *dock)
-{
-  GimpMenuDock *menu_dock = GIMP_MENU_DOCK (dock);
-
-  gimp_toggle_button_update (widget, &menu_dock->p->auto_follow_active);
-
-  if (menu_dock->p->auto_follow_active)
-    {
-      gimp_context_copy_properties (gimp_dock_get_dialog_factory (dock)->context,
-                                    gimp_dock_get_context (dock),
-                                    GIMP_CONTEXT_DISPLAY_MASK |
-                                    GIMP_CONTEXT_IMAGE_MASK);
-    }
-}
diff --git a/app/widgets/gimpmenudock.h b/app/widgets/gimpmenudock.h
index dbf75ac..0077346 100644
--- a/app/widgets/gimpmenudock.h
+++ b/app/widgets/gimpmenudock.h
@@ -50,16 +50,8 @@ struct _GimpMenuDockClass
 
 GType       gimp_menu_dock_get_type (void) G_GNUC_CONST;
 
-GtkWidget * gimp_menu_dock_new      (GimpDialogFactory *dialog_factory,
-                                     GimpContainer     *image_container,
-                                     GimpContainer     *display_container);
+GtkWidget * gimp_menu_dock_new      (void);
 
-gboolean    gimp_menu_dock_get_auto_follow_active (GimpMenuDock *menu_dock);
-void        gimp_menu_dock_set_auto_follow_active (GimpMenuDock *menu_dock,
-                                                   gboolean      show);
-gboolean    gimp_menu_dock_get_show_image_menu    (GimpMenuDock *menu_dock);
-void        gimp_menu_dock_set_show_image_menu    (GimpMenuDock *menu_dock,
-                                                   gboolean      show);
 
 
 #endif /* __GIMP_MENU_DOCK_H__ */
diff --git a/app/widgets/gimpsessioninfo-aux.c b/app/widgets/gimpsessioninfo-aux.c
index e9fcf1d..74de662 100644
--- a/app/widgets/gimpsessioninfo-aux.c
+++ b/app/widgets/gimpsessioninfo-aux.c
@@ -289,7 +289,7 @@ gimp_session_info_aux_set_list (GtkWidget *dialog,
   /* FIXME: make the aux-info stuff generic */
 
   if (GIMP_IS_DOCK_WINDOW (dialog))
-    gimp_dock_set_aux_info (gimp_dock_window_get_dock (GIMP_DOCK_WINDOW (dialog)), aux_list);
+    gimp_dock_window_set_aux_info (GIMP_DOCK_WINDOW (dialog), aux_list);
   else if (GIMP_IS_DOCKABLE (dialog))
     gimp_dockable_set_aux_info (GIMP_DOCKABLE (dialog), aux_list);
 }
@@ -300,7 +300,7 @@ gimp_session_info_aux_get_list (GtkWidget *dialog)
   /* FIXME: make the aux-info stuff generic */
 
   if (GIMP_IS_DOCK_WINDOW (dialog))
-    return gimp_dock_get_aux_info (gimp_dock_window_get_dock (GIMP_DOCK_WINDOW (dialog)));
+    return gimp_dock_window_get_aux_info (GIMP_DOCK_WINDOW (dialog));
   else if (GIMP_IS_DOCKABLE (dialog))
     return gimp_dockable_get_aux_info (GIMP_DOCKABLE (dialog));
 
diff --git a/app/widgets/gimpsessioninfo-dockable.c b/app/widgets/gimpsessioninfo-dockable.c
index d2bf71f..e198631 100644
--- a/app/widgets/gimpsessioninfo-dockable.c
+++ b/app/widgets/gimpsessioninfo-dockable.c
@@ -26,13 +26,14 @@
 
 #include "widgets-types.h"
 
-#include "gimpcontainerview.h"
 #include "gimpcontainerview-utils.h"
+#include "gimpcontainerview.h"
 #include "gimpdialogfactory.h"
 #include "gimpdock.h"
 #include "gimpdockable.h"
 #include "gimpsessioninfo-aux.h"
 #include "gimpsessioninfo-dockable.h"
+#include "gimptoolbox.h"
 
 
 enum
@@ -281,11 +282,12 @@ gimp_session_info_dockable_restore (GimpSessionInfoDockable *info,
       info->view_size > GIMP_VIEW_SIZE_GIGANTIC)
     info->view_size = -1;
 
-  /*  use the new dock's dialog factory to create dockables
-   *  because it may be different from the dialog factory
-   *  the dock was created from.
+  /* FIXME: Merge global_dock_factory and global_toolbox_factory
+   * somehow so we don't need this hack
    */
-  dockable = gimp_dialog_factory_dockable_new (gimp_dock_get_dialog_factory (dock),
+  dockable = gimp_dialog_factory_dockable_new ((GIMP_IS_TOOLBOX (dock) ?
+                                                gimp_toolbox_get_dialog_factory (GIMP_TOOLBOX (dock)) :
+                                                gimp_dock_get_dialog_factory (dock)),
                                                dock,
                                                info->identifier,
                                                info->view_size);
diff --git a/app/widgets/gimptoolbox-color-area.c b/app/widgets/gimptoolbox-color-area.c
index b38c8da..47cd4e4 100644
--- a/app/widgets/gimptoolbox-color-area.c
+++ b/app/widgets/gimptoolbox-color-area.c
@@ -67,7 +67,7 @@ gimp_toolbox_color_area_create (GimpToolbox *toolbox,
 
   g_return_val_if_fail (GIMP_IS_TOOLBOX (toolbox), NULL);
 
-  context = gimp_dock_get_context (GIMP_DOCK (toolbox));
+  context = gimp_toolbox_get_context (toolbox);
 
   color_area = gimp_fg_bg_editor_new (context);
   gtk_widget_set_size_request (color_area, width, height);
diff --git a/app/widgets/gimptoolbox-dnd.c b/app/widgets/gimptoolbox-dnd.c
index 6260d58..43e0436 100644
--- a/app/widgets/gimptoolbox-dnd.c
+++ b/app/widgets/gimptoolbox-dnd.c
@@ -87,46 +87,46 @@ static void   gimp_toolbox_drop_pixbuf    (GtkWidget       *widget,
 void
 gimp_toolbox_dnd_init (GimpToolbox *toolbox)
 {
-  GimpDock *dock;
+  GimpContext *context = NULL;
 
   g_return_if_fail (GIMP_IS_TOOLBOX (toolbox));
 
-  dock = GIMP_DOCK (toolbox);
+  context = gimp_toolbox_get_context (toolbox);
 
   gimp_dnd_uri_list_dest_add (GTK_WIDGET (toolbox),
                               gimp_toolbox_drop_uri_list,
-                              gimp_dock_get_context (dock));
+                              context);
   gimp_dnd_uri_list_dest_add (gimp_toolbox_get_vbox (toolbox),
                               gimp_toolbox_drop_uri_list,
-                              gimp_dock_get_context (dock));
+                              context);
 
   gimp_dnd_viewable_dest_add (gimp_toolbox_get_vbox (toolbox),
                               GIMP_TYPE_LAYER,
                               gimp_toolbox_drop_drawable,
-                              gimp_dock_get_context (dock));
+                              context);
   gimp_dnd_viewable_dest_add (gimp_toolbox_get_vbox (toolbox),
                               GIMP_TYPE_LAYER_MASK,
                               gimp_toolbox_drop_drawable,
-                              gimp_dock_get_context (dock));
+                              context);
   gimp_dnd_viewable_dest_add (gimp_toolbox_get_vbox (toolbox),
                               GIMP_TYPE_CHANNEL,
                               gimp_toolbox_drop_drawable,
-                              gimp_dock_get_context (dock));
+                              context);
   gimp_dnd_viewable_dest_add (gimp_toolbox_get_vbox (toolbox),
                               GIMP_TYPE_TOOL_INFO,
                               gimp_toolbox_drop_tool,
-                              gimp_dock_get_context (dock));
+                              context);
   gimp_dnd_viewable_dest_add (gimp_toolbox_get_vbox (toolbox),
                               GIMP_TYPE_BUFFER,
                               gimp_toolbox_drop_buffer,
-                              gimp_dock_get_context (dock));
+                              context);
 
   gimp_dnd_component_dest_add (gimp_toolbox_get_vbox (toolbox),
                                gimp_toolbox_drop_component,
-                               gimp_dock_get_context (dock));
+                               context);
   gimp_dnd_pixbuf_dest_add    (gimp_toolbox_get_vbox (toolbox),
                                gimp_toolbox_drop_pixbuf,
-                               gimp_dock_get_context (dock));
+                               context);
 }
 
 
diff --git a/app/widgets/gimptoolbox-image-area.c b/app/widgets/gimptoolbox-image-area.c
index 6e7e125..c4dea25 100644
--- a/app/widgets/gimptoolbox-image-area.c
+++ b/app/widgets/gimptoolbox-image-area.c
@@ -91,7 +91,7 @@ gimp_toolbox_image_area_create (GimpToolbox *toolbox,
 
   g_return_val_if_fail (GIMP_IS_TOOLBOX (toolbox), NULL);
 
-  context = gimp_dock_get_context (GIMP_DOCK (toolbox));
+  context = gimp_toolbox_get_context (toolbox);
 
   image_view = gimp_view_new_full_by_types (context,
                                             GIMP_TYPE_VIEW, GIMP_TYPE_IMAGE,
diff --git a/app/widgets/gimptoolbox-indicator-area.c b/app/widgets/gimptoolbox-indicator-area.c
index 815423d..3d9fc9c 100644
--- a/app/widgets/gimptoolbox-indicator-area.c
+++ b/app/widgets/gimptoolbox-indicator-area.c
@@ -51,7 +51,7 @@ brush_preview_clicked (GtkWidget       *widget,
                        GdkModifierType  state,
                        GimpToolbox     *toolbox)
 {
-  gimp_dialog_factory_dialog_raise (gimp_dock_get_dialog_factory (GIMP_DOCK (toolbox)),
+  gimp_dialog_factory_dialog_raise (gimp_toolbox_get_dialog_factory (toolbox),
                                     gtk_widget_get_screen (widget),
                                     "gimp-brush-grid|gimp-brush-list", -1);
 }
@@ -73,7 +73,7 @@ pattern_preview_clicked (GtkWidget       *widget,
                          GdkModifierType  state,
                          GimpToolbox     *toolbox)
 {
-  gimp_dialog_factory_dialog_raise (gimp_dock_get_dialog_factory (GIMP_DOCK (toolbox)),
+  gimp_dialog_factory_dialog_raise (gimp_toolbox_get_dialog_factory (toolbox),
                                     gtk_widget_get_screen (widget),
                                     "gimp-pattern-grid|gimp-pattern-list", -1);
 }
@@ -95,7 +95,7 @@ gradient_preview_clicked (GtkWidget       *widget,
                           GdkModifierType  state,
                           GimpToolbox     *toolbox)
 {
-  gimp_dialog_factory_dialog_raise (gimp_dock_get_dialog_factory (GIMP_DOCK (toolbox)),
+  gimp_dialog_factory_dialog_raise (gimp_toolbox_get_dialog_factory (toolbox),
                                     gtk_widget_get_screen (widget),
                                     "gimp-gradient-list|gimp-gradient-grid", -1);
 }
@@ -126,7 +126,7 @@ gimp_toolbox_indicator_area_create (GimpToolbox *toolbox)
 
   g_return_val_if_fail (GIMP_IS_TOOLBOX (toolbox), NULL);
 
-  context = gimp_dock_get_context (GIMP_DOCK (toolbox));
+  context = gimp_toolbox_get_context (toolbox);
 
   indicator_table = gtk_table_new (2, 2, FALSE);
   gtk_table_set_row_spacings (GTK_TABLE (indicator_table), CELL_SPACING);
diff --git a/app/widgets/gimptoolbox.c b/app/widgets/gimptoolbox.c
index 00cca63..06867c2 100644
--- a/app/widgets/gimptoolbox.c
+++ b/app/widgets/gimptoolbox.c
@@ -62,29 +62,49 @@
 #define TOOL_BUTTON_DATA_KEY   "gimp-tool-button"
 #define TOOL_INFO_DATA_KEY     "gimp-tool-info"
 
+enum
+{
+  PROP_0,
+  PROP_CONTEXT,
+  PROP_DIALOG_FACTORY,
+  PROP_UI_MANAGER
+};
+
 
 struct _GimpToolboxPrivate
 {
-  GtkWidget *vbox;
+  GimpContext       *context;
+  GimpDialogFactory *dialog_factory;
+  GimpUIManager     *ui_manager;
 
-  GtkWidget *header;
-  GtkWidget *tool_wbox;
+  GtkWidget         *vbox;
 
-  GtkWidget *area_wbox;
-  GtkWidget *color_area;
-  GtkWidget *foo_area;
-  GtkWidget *image_area;
+  GtkWidget         *header;
+  GtkWidget         *tool_wbox;
+
+  GtkWidget         *area_wbox;
+  GtkWidget         *color_area;
+  GtkWidget         *foo_area;
+  GtkWidget         *image_area;
 
-  gint       tool_rows;
-  gint       tool_columns;
-  gint       area_rows;
-  gint       area_columns;
+  gint               tool_rows;
+  gint               tool_columns;
+  gint               area_rows;
+  gint               area_columns;
 };
 
 
 static GObject   * gimp_toolbox_constructor        (GType           type,
                                                     guint           n_params,
                                                     GObjectConstructParam *params);
+static void        gimp_toolbox_set_property       (GObject               *object,
+                                                    guint                  property_id,
+                                                    const GValue          *value,
+                                                    GParamSpec            *pspec);
+static void        gimp_toolbox_get_property       (GObject               *object,
+                                                    guint                  property_id,
+                                                    GValue                *value,
+                                                    GParamSpec            *pspec);
 
 static void        gimp_toolbox_size_allocate      (GtkWidget      *widget,
                                                     GtkAllocation  *allocation);
@@ -160,6 +180,8 @@ gimp_toolbox_class_init (GimpToolboxClass *klass)
   GimpDockClass  *dock_class   = GIMP_DOCK_CLASS (klass);
 
   object_class->constructor           = gimp_toolbox_constructor;
+  object_class->set_property          = gimp_toolbox_set_property;
+  object_class->get_property          = gimp_toolbox_get_property;
 
   widget_class->size_allocate         = gimp_toolbox_size_allocate;
   widget_class->style_set             = gimp_toolbox_style_set;
@@ -171,6 +193,27 @@ gimp_toolbox_class_init (GimpToolboxClass *klass)
   dock_class->book_added              = gimp_toolbox_book_added;
   dock_class->book_removed            = gimp_toolbox_book_removed;
 
+  g_object_class_install_property (object_class, PROP_CONTEXT,
+                                   g_param_spec_object ("context",
+                                                        NULL, NULL,
+                                                        GIMP_TYPE_CONTEXT,
+                                                        GIMP_PARAM_READWRITE |
+                                                        G_PARAM_CONSTRUCT));
+
+  g_object_class_install_property (object_class, PROP_DIALOG_FACTORY,
+                                   g_param_spec_object ("dialog-factory",
+                                                        NULL, NULL,
+                                                        GIMP_TYPE_DIALOG_FACTORY,
+                                                        GIMP_PARAM_READWRITE |
+                                                        G_PARAM_CONSTRUCT_ONLY));
+
+  g_object_class_install_property (object_class, PROP_UI_MANAGER,
+                                   g_param_spec_object ("ui-manager",
+                                                        NULL, NULL,
+                                                        GIMP_TYPE_UI_MANAGER,
+                                                        GIMP_PARAM_READWRITE |
+                                                        G_PARAM_CONSTRUCT_ONLY));
+
   gtk_widget_class_install_style_property (widget_class,
                                            g_param_spec_enum ("tool-icon-size",
                                                               NULL, NULL,
@@ -206,7 +249,6 @@ gimp_toolbox_constructor (GType                  type,
 {
   GObject       *object;
   GimpToolbox   *toolbox;
-  GimpContext   *context;
   GimpGuiConfig *config;
   GtkWidget     *main_vbox;
   GdkDisplay    *display;
@@ -216,8 +258,7 @@ gimp_toolbox_constructor (GType                  type,
 
   toolbox = GIMP_TOOLBOX (object);
 
-  context = gimp_dock_get_context (GIMP_DOCK (toolbox));
-  config  = GIMP_GUI_CONFIG (context->gimp->config);
+  config  = GIMP_GUI_CONFIG (toolbox->p->context->gimp->config);
 
   main_vbox = gimp_dock_get_main_vbox (GIMP_DOCK (toolbox));
 
@@ -277,16 +318,16 @@ gimp_toolbox_constructor (GType                  type,
     {
       g_signal_connect (toolbox, "motion-notify-event",
                         G_CALLBACK (toolbox_check_device),
-                        context->gimp);
+                        toolbox->p->context->gimp);
 
       gtk_widget_add_events (GTK_WIDGET (toolbox), GDK_POINTER_MOTION_MASK);
       gtk_widget_set_extension_events (GTK_WIDGET (toolbox),
                                        GDK_EXTENSION_EVENTS_CURSOR);
     }
 
-  toolbox_create_tools (toolbox, context);
+  toolbox_create_tools (toolbox, toolbox->p->context);
 
-  toolbox->p->color_area = toolbox_create_color_area (toolbox, context);
+  toolbox->p->color_area = toolbox_create_color_area (toolbox, toolbox->p->context);
   gtk_wrap_box_pack_wrapped (GTK_WRAP_BOX (toolbox->p->area_wbox),
                              toolbox->p->color_area,
                              TRUE, TRUE, FALSE, TRUE, TRUE);
@@ -297,7 +338,7 @@ gimp_toolbox_constructor (GType                  type,
                            G_CALLBACK (toolbox_area_notify),
                            toolbox->p->color_area, 0);
 
-  toolbox->p->foo_area = toolbox_create_foo_area (toolbox, context);
+  toolbox->p->foo_area = toolbox_create_foo_area (toolbox, toolbox->p->context);
   gtk_wrap_box_pack (GTK_WRAP_BOX (toolbox->p->area_wbox), toolbox->p->foo_area,
                      TRUE, TRUE, FALSE, TRUE);
   if (config->toolbox_foo_area)
@@ -307,7 +348,7 @@ gimp_toolbox_constructor (GType                  type,
                            G_CALLBACK (toolbox_area_notify),
                            toolbox->p->foo_area, 0);
 
-  toolbox->p->image_area = toolbox_create_image_area (toolbox, context);
+  toolbox->p->image_area = toolbox_create_image_area (toolbox, toolbox->p->context);
   gtk_wrap_box_pack (GTK_WRAP_BOX (toolbox->p->area_wbox), toolbox->p->image_area,
                      TRUE, TRUE, FALSE, TRUE);
   if (config->toolbox_image_area)
@@ -317,7 +358,7 @@ gimp_toolbox_constructor (GType                  type,
                            G_CALLBACK (toolbox_area_notify),
                            toolbox->p->image_area, 0);
 
-  g_signal_connect_object (context, "tool-changed",
+  g_signal_connect_object (toolbox->p->context, "tool-changed",
                            G_CALLBACK (toolbox_tool_changed),
                            toolbox,
                            0);
@@ -331,6 +372,62 @@ gimp_toolbox_constructor (GType                  type,
 }
 
 static void
+gimp_toolbox_set_property (GObject      *object,
+                           guint         property_id,
+                           const GValue *value,
+                           GParamSpec   *pspec)
+{
+  GimpToolbox *toolbox = GIMP_TOOLBOX (object);
+
+  switch (property_id)
+    {
+    case PROP_CONTEXT:
+      toolbox->p->context = g_value_dup_object (value);
+      break;
+
+    case PROP_DIALOG_FACTORY:
+      toolbox->p->dialog_factory = g_value_dup_object (value);
+      break;
+
+    case PROP_UI_MANAGER:
+      toolbox->p->ui_manager = g_value_dup_object (value);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+    }
+}
+
+static void
+gimp_toolbox_get_property (GObject    *object,
+                           guint       property_id,
+                           GValue     *value,
+                           GParamSpec *pspec)
+{
+  GimpToolbox *toolbox = GIMP_TOOLBOX (object);
+
+  switch (property_id)
+    {
+    case PROP_CONTEXT:
+      g_value_set_object (value, toolbox->p->context);
+      break;
+
+    case PROP_DIALOG_FACTORY:
+      g_value_set_object (value, toolbox->p->dialog_factory);
+      break;
+
+    case PROP_UI_MANAGER:
+      g_value_set_object (value, toolbox->p->ui_manager);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+    }
+}
+
+static void
 gimp_toolbox_size_allocate (GtkWidget     *widget,
                             GtkAllocation *allocation)
 {
@@ -343,10 +440,10 @@ gimp_toolbox_size_allocate (GtkWidget     *widget,
   if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
     GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
 
-  if (! gimp_dock_get_context (GIMP_DOCK (widget)))
+  if (! gimp_toolbox_get_context (toolbox))
     return;
 
-  gimp = gimp_dock_get_context (GIMP_DOCK (widget))->gimp;
+  gimp = gimp_toolbox_get_context (toolbox)->gimp;
 
   config = GIMP_GUI_CONFIG (gimp->config);
 
@@ -437,6 +534,7 @@ static void
 gimp_toolbox_style_set (GtkWidget *widget,
                         GtkStyle  *previous_style)
 {
+  GimpToolbox    *toolbox = GIMP_TOOLBOX (widget);
   Gimp           *gimp;
   GtkIconSize     tool_icon_size;
   GtkReliefStyle  relief;
@@ -444,10 +542,10 @@ gimp_toolbox_style_set (GtkWidget *widget,
 
   GTK_WIDGET_CLASS (parent_class)->style_set (widget, previous_style);
 
-  if (! gimp_dock_get_context (GIMP_DOCK (widget)))
+  if (! gimp_toolbox_get_context (toolbox))
     return;
 
-  gimp = gimp_dock_get_context (GIMP_DOCK (widget))->gimp;
+  gimp = gimp_toolbox_get_context (toolbox)->gimp;
 
   gtk_widget_style_get (widget,
                         "tool-icon-size", &tool_icon_size,
@@ -492,7 +590,7 @@ gimp_toolbox_button_press_event (GtkWidget      *widget,
       clipboard = gtk_widget_get_clipboard (widget, GDK_SELECTION_PRIMARY);
       gtk_clipboard_request_text (clipboard,
                                   toolbox_paste_received,
-                                  g_object_ref (gimp_dock_get_context (GIMP_DOCK (widget))));
+                                  g_object_ref (gimp_toolbox_get_context (GIMP_TOOLBOX (widget))));
 
       return TRUE;
     }
@@ -589,7 +687,7 @@ gimp_toolbox_set_host_geometry_hints (GimpDock  *dock,
   GimpToolInfo *tool_info;
   GtkWidget    *tool_button;
 
-  gimp = gimp_dock_get_context (GIMP_DOCK (toolbox))->gimp;
+  gimp = gimp_toolbox_get_context (toolbox)->gimp;
 
   tool_info = gimp_get_tool_info (gimp, "gimp-rect-select-tool");
   tool_button = g_object_get_data (G_OBJECT (tool_info), TOOL_BUTTON_DATA_KEY);
@@ -629,22 +727,39 @@ gimp_toolbox_set_host_geometry_hints (GimpDock  *dock,
 }
 
 GtkWidget *
-gimp_toolbox_new (GimpDialogFactory *dialog_factory,
+gimp_toolbox_new (GimpDialogFactory *factory,
                   GimpContext       *context,
                   GimpUIManager     *ui_manager)
 {
-  GimpToolbox *toolbox;
+  return g_object_new (GIMP_TYPE_TOOLBOX,
+                       "dialog-factory", factory,
+                       "context",        context,
+                       "ui-manager",     ui_manager,
+                       NULL);
+}
 
-  g_return_val_if_fail (GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL);
-  g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
+GimpContext *
+gimp_toolbox_get_context (GimpToolbox *toolbox)
+{
+  g_return_val_if_fail (GIMP_IS_TOOLBOX (toolbox), NULL);
+
+  return toolbox->p->context;
+}
 
-  toolbox = g_object_new (GIMP_TYPE_TOOLBOX,
-                          "context",             context,
-                          "dialog-factory",      dialog_factory,
-                          "ui-manager",          ui_manager,
-                          NULL);
+GimpDialogFactory *
+gimp_toolbox_get_dialog_factory (GimpToolbox *toolbox)
+{
+  g_return_val_if_fail (GIMP_IS_TOOLBOX (toolbox), NULL);
+
+  return toolbox->p->dialog_factory;
+}
+
+GimpUIManager *
+gimp_toolbox_get_ui_manager (GimpToolbox *toolbox)
+{
+  g_return_val_if_fail (GIMP_IS_TOOLBOX (toolbox), NULL);
 
-  return GTK_WIDGET (toolbox);
+  return toolbox->p->ui_manager;
 }
 
 GtkWidget *
@@ -710,13 +825,12 @@ toolbox_create_tools (GimpToolbox *toolbox,
                         G_CALLBACK (toolbox_tool_button_press),
                         toolbox);
 
-      if (gimp_dock_get_ui_manager (GIMP_DOCK (toolbox)))
+      if (toolbox->p->ui_manager)
         {
-          GimpUIManager *ui_manager;
-          GtkAction     *action;
-          const gchar   *identifier;
-          gchar         *tmp;
-          gchar         *name;
+          GtkAction   *action     = NULL;
+          const gchar *identifier = NULL;
+          gchar       *tmp        = NULL;
+          gchar       *name       = NULL;
 
           identifier = gimp_object_get_name (tool_info);
 
@@ -725,8 +839,7 @@ toolbox_create_tools (GimpToolbox *toolbox,
           name = g_strdup_printf ("tools-%s", tmp);
           g_free (tmp);
 
-          ui_manager  = gimp_dock_get_ui_manager (GIMP_DOCK (toolbox));
-          action      = gimp_ui_manager_find_action (ui_manager, "tools", name);
+          action = gimp_ui_manager_find_action (toolbox->p->ui_manager, "tools", name);
           g_free (name);
 
           if (action)
@@ -898,7 +1011,7 @@ toolbox_tool_button_toggled (GtkWidget   *widget,
                                                TOOL_INFO_DATA_KEY);
 
   if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
-    gimp_context_set_tool (gimp_dock_get_context (GIMP_DOCK (toolbox)), tool_info);
+    gimp_context_set_tool (gimp_toolbox_get_context (toolbox), tool_info);
 }
 
 static gboolean
@@ -908,7 +1021,7 @@ toolbox_tool_button_press (GtkWidget      *widget,
 {
   if (event->type == GDK_2BUTTON_PRESS && event->button == 1)
     {
-      gimp_dialog_factory_dialog_raise (gimp_dock_get_dialog_factory (GIMP_DOCK (toolbox)),
+      gimp_dialog_factory_dialog_raise (toolbox->p->dialog_factory,
                                         gtk_widget_get_screen (widget),
                                         "gimp-tool-options",
                                         -1);
diff --git a/app/widgets/gimptoolbox.h b/app/widgets/gimptoolbox.h
index 386ab8b..efaf23d 100644
--- a/app/widgets/gimptoolbox.h
+++ b/app/widgets/gimptoolbox.h
@@ -46,12 +46,15 @@ struct _GimpToolboxClass
 };
 
 
-GType       gimp_toolbox_get_type (void) G_GNUC_CONST;
+GType               gimp_toolbox_get_type           (void) G_GNUC_CONST;
+GtkWidget *         gimp_toolbox_new                (GimpDialogFactory *factory,
+                                                     GimpContext       *context,
+                                                     GimpUIManager     *ui_manager);
+GimpContext *       gimp_toolbox_get_context        (GimpToolbox       *toolbox);
+GimpDialogFactory * gimp_toolbox_get_dialog_factory (GimpToolbox       *toolbox);
+GimpUIManager *     gimp_toolbox_get_ui_manager     (GimpToolbox       *toolbox);
+GtkWidget *         gimp_toolbox_get_vbox           (GimpToolbox       *toolbox);
 
-GtkWidget * gimp_toolbox_new      (GimpDialogFactory *factory,
-                                   GimpContext       *context,
-                                   GimpUIManager     *ui_manager);
-GtkWidget * gimp_toolbox_get_vbox (GimpToolbox       *toolbox);
 
 
 #endif /* __GIMP_TOOLBOX_H__ */
diff --git a/themes/Default/gtkrc b/themes/Default/gtkrc
index 1bc8141..5148805 100644
--- a/themes/Default/gtkrc
+++ b/themes/Default/gtkrc
@@ -40,7 +40,7 @@ style "gimp-default-style"
   GimpDockWindow::default-height    = 300
   GimpDock::font-scale              = 0.8333
   GimpMenuDock::minimal-width       = 200
-  GimpMenuDock::menu-preview-size   = button
+  GimpDockWindow::menu-preview-size = button
   GimpToolbox::tool-icon-size       = button
   GimpToolbox::button-relief        = none
   GimpDockbook::tab-border          = 0
diff --git a/themes/Small/gtkrc b/themes/Small/gtkrc
index dea7e63..c41a49f 100644
--- a/themes/Small/gtkrc
+++ b/themes/Small/gtkrc
@@ -47,7 +47,7 @@ style "gimp-default-style"
   GimpDockWindow::default-height    = 240
   GimpDock::font-scale              = 0.8333
   GimpMenuDock::minimal-width       = 200
-  GimpMenuDock::menu-preview-size   = small-toolbar
+  GimpDockWindow::menu-preview-size = small-toolbar
   GimpToolbox::tool-icon-size       = menu
   GimpToolbox::button-relief        = none
   GimpDockbook::tab-border          = 0



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