[gimp] app: add GimpToolPalette which derives from GtkToolPalette



commit 281969b45dbe10ed2920625560b15d1e5dd35af8
Author: Michael Natterer <mitch gimp org>
Date:   Fri Nov 19 23:52:09 2010 +0100

    app: add GimpToolPalette which derives from GtkToolPalette
    
    and move all of GimpToolbox' tool button code there.

 app/widgets/Makefile.am       |    2 +
 app/widgets/gimptoolbox.c     |  527 +++++++++-------------------------------
 app/widgets/gimptoolpalette.c |  536 +++++++++++++++++++++++++++++++++++++++++
 app/widgets/gimptoolpalette.h |   53 ++++
 app/widgets/widgets-types.h   |    1 +
 themes/Default/gtkrc          |    4 +-
 themes/Small/gtkrc            |    4 +-
 7 files changed, 709 insertions(+), 418 deletions(-)
---
diff --git a/app/widgets/Makefile.am b/app/widgets/Makefile.am
index d6201f3..408bb67 100644
--- a/app/widgets/Makefile.am
+++ b/app/widgets/Makefile.am
@@ -340,6 +340,8 @@ libappwidgets_a_sources = \
 	gimptooleditor.h		\
 	gimptooloptionseditor.c		\
 	gimptooloptionseditor.h		\
+	gimptoolpalette.c		\
+	gimptoolpalette.h		\
 	gimptoolpreseteditor.c		\
 	gimptoolpreseteditor.h		\
 	gimptoolpresetfactoryview.c	\
diff --git a/app/widgets/gimptoolbox.c b/app/widgets/gimptoolbox.c
index 7c42bb1..2ae1e6e 100644
--- a/app/widgets/gimptoolbox.c
+++ b/app/widgets/gimptoolbox.c
@@ -32,7 +32,6 @@
 
 #include "core/gimp.h"
 #include "core/gimpcontext.h"
-#include "core/gimptoolinfo.h"
 
 #include "file/file-open.h"
 #include "file/file-utils.h"
@@ -48,6 +47,7 @@
 #include "gimptoolbox-dnd.h"
 #include "gimptoolbox-image-area.h"
 #include "gimptoolbox-indicator-area.h"
+#include "gimptoolpalette.h"
 #include "gimpuimanager.h"
 #include "gimpwidgets-utils.h"
 #include "gtkhwrapbox.h"
@@ -57,11 +57,7 @@
 #include "gimp-intl.h"
 
 
-#define DEFAULT_TOOL_ICON_SIZE GTK_ICON_SIZE_BUTTON
-#define DEFAULT_BUTTON_RELIEF  GTK_RELIEF_NONE
-
-#define TOOL_BUTTON_DATA_KEY   "gimp-tool-item"
-#define TOOL_INFO_DATA_KEY     "gimp-tool-info"
+#define TOOL_BUTTON_DATA_KEY "gimp-tool-palette-item"
 
 enum
 {
@@ -82,14 +78,11 @@ struct _GimpToolboxPrivate
 
   GtkWidget         *header;
   GtkWidget         *tool_palette;
-
   GtkWidget         *area_wbox;
   GtkWidget         *color_area;
   GtkWidget         *foo_area;
   GtkWidget         *image_area;
 
-  gint               tool_rows;
-  gint               tool_columns;
   gint               area_rows;
   gint               area_columns;
 
@@ -99,85 +92,66 @@ struct _GimpToolboxPrivate
 };
 
 
-static GObject   * gimp_toolbox_constructor             (GType                  type,
-                                                         guint                  n_params,
-                                                         GObjectConstructParam *params);
+static void        gimp_toolbox_constructed             (GObject               *object);
 static void        gimp_toolbox_dispose                 (GObject               *object);
-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);
-static void        gimp_toolbox_style_set               (GtkWidget             *widget,
-                                                         GtkStyle              *previous_style);
-static gboolean    gimp_toolbox_button_press_event      (GtkWidget             *widget,
-                                                         GdkEventButton        *event);
-static void        gimp_toolbox_drag_leave              (GtkWidget             *widget,
-                                                         GdkDragContext        *context,
-                                                         guint                  time,
-                                                         GimpToolbox           *toolbox);
-static gboolean    gimp_toolbox_drag_motion             (GtkWidget             *widget,
-                                                         GdkDragContext        *context,
-                                                         gint                   x,
-                                                         gint                   y,
-                                                         guint                  time,
-                                                         GimpToolbox           *toolbox);
-static gboolean    gimp_toolbox_drag_drop               (GtkWidget             *widget,
-                                                         GdkDragContext        *context,
-                                                         gint                   x,
-                                                         gint                   y,
-                                                         guint                  time,
-                                                         GimpToolbox           *toolbox);
-static gchar     * gimp_toolbox_get_description         (GimpDock              *dock,
-                                                         gboolean               complete);
-static void        gimp_toolbox_set_host_geometry_hints (GimpDock              *dock,
-                                                         GtkWindow             *window);
-static void        gimp_toolbox_book_added              (GimpDock              *dock,
-                                                         GimpDockbook          *dockbook);
-static void        gimp_toolbox_book_removed            (GimpDock              *dock,
-                                                         GimpDockbook          *dockbook);
-static gboolean    gimp_toolbox_expose_wilber           (GtkWidget             *widget,
-                                                         GdkEventExpose        *event);
-static void        toolbox_create_tools                 (GimpToolbox           *toolbox,
-                                                         GimpContext           *context);
-static GtkWidget * toolbox_create_color_area            (GimpToolbox           *toolbox,
-                                                         GimpContext           *context);
-static GtkWidget * toolbox_create_foo_area              (GimpToolbox           *toolbox,
-                                                         GimpContext           *context);
-static GtkWidget * toolbox_create_image_area            (GimpToolbox           *toolbox,
-                                                         GimpContext           *context);
-static void        toolbox_area_notify                  (GimpGuiConfig         *config,
-                                                         GParamSpec            *pspec,
-                                                         GtkWidget             *area);
-static void        toolbox_wilber_notify                (GimpGuiConfig         *config,
-                                                         GParamSpec            *pspec,
-                                                         GtkWidget             *wilber);
-static void        toolbox_tool_changed                 (GimpContext           *context,
-                                                         GimpToolInfo          *tool_info,
-                                                         GimpToolbox           *toolbox);
-static void        toolbox_tool_reorder                 (GimpContainer         *container,
-                                                         GimpToolInfo          *tool_info,
-                                                         gint                   index,
-                                                         GimpToolbox           *toolbox);
-static void        toolbox_tool_visible_notify          (GimpToolInfo          *tool_info,
-                                                         GParamSpec            *pspec,
-                                                         GtkToolItem           *item);
-static void        toolbox_tool_button_toggled          (GtkWidget             *widget,
-                                                         GimpToolbox           *toolbox);
-static gboolean    toolbox_tool_button_press            (GtkWidget             *widget,
-                                                         GdkEventButton        *bevent,
-                                                         GimpToolbox           *toolbox);
-static gboolean    toolbox_check_device                 (GtkWidget             *widget,
-                                                         GdkEvent              *event,
-                                                         Gimp                  *gimp);
-static void        toolbox_paste_received               (GtkClipboard          *clipboard,
-                                                         const gchar           *text,
-                                                         gpointer               data);
+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);
+static void        gimp_toolbox_style_set               (GtkWidget      *widget,
+                                                         GtkStyle       *previous_style);
+static gboolean    gimp_toolbox_button_press_event      (GtkWidget      *widget,
+                                                         GdkEventButton *event);
+static void        gimp_toolbox_drag_leave              (GtkWidget      *widget,
+                                                         GdkDragContext *context,
+                                                         guint           time,
+                                                         GimpToolbox    *toolbox);
+static gboolean    gimp_toolbox_drag_motion             (GtkWidget      *widget,
+                                                         GdkDragContext *context,
+                                                         gint            x,
+                                                         gint            y,
+                                                         guint           time,
+                                                         GimpToolbox    *toolbox);
+static gboolean    gimp_toolbox_drag_drop               (GtkWidget      *widget,
+                                                         GdkDragContext *context,
+                                                         gint            x,
+                                                         gint            y,
+                                                         guint           time,
+                                                         GimpToolbox    *toolbox);
+static gchar     * gimp_toolbox_get_description         (GimpDock       *dock,
+                                                         gboolean        complete);
+static void        gimp_toolbox_set_host_geometry_hints (GimpDock       *dock,
+                                                         GtkWindow      *window);
+static void        gimp_toolbox_book_added              (GimpDock       *dock,
+                                                         GimpDockbook   *dockbook);
+static void        gimp_toolbox_book_removed            (GimpDock       *dock,
+                                                         GimpDockbook   *dockbook);
+static gboolean    gimp_toolbox_expose_wilber           (GtkWidget      *widget,
+                                                         GdkEventExpose *event);
+static GtkWidget * toolbox_create_color_area            (GimpToolbox    *toolbox,
+                                                         GimpContext    *context);
+static GtkWidget * toolbox_create_foo_area              (GimpToolbox    *toolbox,
+                                                         GimpContext    *context);
+static GtkWidget * toolbox_create_image_area            (GimpToolbox    *toolbox,
+                                                         GimpContext    *context);
+static void        toolbox_area_notify                  (GimpGuiConfig  *config,
+                                                         GParamSpec     *pspec,
+                                                         GtkWidget      *area);
+static void        toolbox_wilber_notify                (GimpGuiConfig  *config,
+                                                         GParamSpec     *pspec,
+                                                         GtkWidget      *wilber);
+static gboolean    toolbox_check_device                 (GtkWidget      *widget,
+                                                         GdkEvent       *event,
+                                                         Gimp           *gimp);
+static void        toolbox_paste_received               (GtkClipboard   *clipboard,
+                                                         const gchar    *text,
+                                                         gpointer        data);
 
 
 G_DEFINE_TYPE (GimpToolbox, gimp_toolbox, GIMP_TYPE_DOCK)
@@ -192,7 +166,7 @@ gimp_toolbox_class_init (GimpToolboxClass *klass)
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
   GimpDockClass  *dock_class   = GIMP_DOCK_CLASS (klass);
 
-  object_class->constructor           = gimp_toolbox_constructor;
+  object_class->constructed           = gimp_toolbox_constructed;
   object_class->dispose               = gimp_toolbox_dispose;
   object_class->set_property          = gimp_toolbox_set_property;
   object_class->get_property          = gimp_toolbox_get_property;
@@ -227,20 +201,6 @@ gimp_toolbox_class_init (GimpToolboxClass *klass)
                                                         GIMP_PARAM_READWRITE |
                                                         G_PARAM_CONSTRUCT_ONLY));
 
-  gtk_widget_class_install_style_property (widget_class,
-                                           g_param_spec_enum ("tool-icon-size",
-                                                              NULL, NULL,
-                                                              GTK_TYPE_ICON_SIZE,
-                                                              DEFAULT_TOOL_ICON_SIZE,
-                                                              GIMP_PARAM_READABLE));
-
-  gtk_widget_class_install_style_property (widget_class,
-                                           g_param_spec_enum ("button-relief",
-                                                              NULL, NULL,
-                                                              GTK_TYPE_RELIEF_STYLE,
-                                                              DEFAULT_BUTTON_RELIEF,
-                                                              GIMP_PARAM_READABLE));
-
   g_type_class_add_private (klass, sizeof (GimpToolboxPrivate));
 }
 
@@ -255,23 +215,16 @@ gimp_toolbox_init (GimpToolbox *toolbox)
                      GIMP_HELP_TOOLBOX, NULL);
 }
 
-static GObject *
-gimp_toolbox_constructor (GType                  type,
-                          guint                  n_params,
-                          GObjectConstructParam *params)
+static void
+gimp_toolbox_constructed (GObject *object)
 {
-  GObject       *object;
-  GimpToolbox   *toolbox;
+  GimpToolbox   *toolbox = GIMP_TOOLBOX (object);
   GimpGuiConfig *config;
   GtkWidget     *main_vbox;
   GdkDisplay    *display;
   GList         *list;
 
-  object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
-
-  toolbox = GIMP_TOOLBOX (object);
-
-  config  = GIMP_GUI_CONFIG (toolbox->p->context->gimp->config);
+  config = GIMP_GUI_CONFIG (toolbox->p->context->gimp->config);
 
   main_vbox = gimp_dock_get_main_vbox (GIMP_DOCK (toolbox));
 
@@ -321,9 +274,11 @@ gimp_toolbox_constructor (GType                  type,
                            G_CALLBACK (toolbox_wilber_notify),
                            toolbox->p->header, 0);
 
-  toolbox->p->tool_palette = gtk_tool_palette_new ();
+  toolbox->p->tool_palette = gimp_tool_palette_new (toolbox->p->context,
+                                                    toolbox->p->ui_manager,
+                                                    toolbox->p->dialog_factory);
   gtk_box_pack_start (GTK_BOX (toolbox->p->vbox), toolbox->p->tool_palette,
-                      TRUE, TRUE, 0);
+                      FALSE, FALSE, 0);
   gtk_widget_show (toolbox->p->tool_palette);
 
   toolbox->p->area_wbox = gtk_hwrap_box_new (FALSE);
@@ -360,8 +315,6 @@ gimp_toolbox_constructor (GType                  type,
                                        GDK_EXTENSION_EVENTS_CURSOR);
     }
 
-  toolbox_create_tools (toolbox, toolbox->p->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,
@@ -393,17 +346,10 @@ gimp_toolbox_constructor (GType                  type,
                            G_CALLBACK (toolbox_area_notify),
                            toolbox->p->image_area, 0);
 
-  g_signal_connect_object (toolbox->p->context, "tool-changed",
-                           G_CALLBACK (toolbox_tool_changed),
-                           toolbox,
-                           0);
-
   gimp_toolbox_dnd_init (GIMP_TOOLBOX (toolbox));
 
   gimp_toolbox_style_set (GTK_WIDGET (toolbox),
                           gtk_widget_get_style (GTK_WIDGET (toolbox)));
-
-  return object;
 }
 
 static void
@@ -496,14 +442,19 @@ static void
 gimp_toolbox_size_allocate (GtkWidget     *widget,
                             GtkAllocation *allocation)
 {
-  GimpToolbox   *toolbox = GIMP_TOOLBOX (widget);
-  Gimp          *gimp;
-  GimpGuiConfig *config;
-  GimpToolInfo  *tool_info;
-  GtkWidget     *tool_button;
-
-  if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
-    GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
+  GimpToolbox    *toolbox = GIMP_TOOLBOX (widget);
+  Gimp           *gimp;
+  GimpGuiConfig  *config;
+  GtkRequisition  color_requisition;
+  GtkRequisition  foo_requisition;
+  GtkRequisition  image_requisition;
+  gint            width;
+  gint            height;
+  gint            n_areas;
+  gint            area_rows;
+  gint            area_columns;
+
+  GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
 
   if (! gimp_toolbox_get_context (toolbox))
     return;
@@ -512,132 +463,44 @@ gimp_toolbox_size_allocate (GtkWidget     *widget,
 
   config = GIMP_GUI_CONFIG (gimp->config);
 
-  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);
+  gtk_widget_size_request (toolbox->p->color_area, &color_requisition);
+  gtk_widget_size_request (toolbox->p->foo_area,   &foo_requisition);
+  gtk_widget_size_request (toolbox->p->image_area, &image_requisition);
 
-  if (tool_button)
-    {
-      GtkRequisition  button_requisition;
-      GList          *list;
-      gint            n_tools;
-      gint            tool_rows;
-      gint            tool_columns;
+  width  = MAX (color_requisition.width,
+                MAX (foo_requisition.width,
+                     image_requisition.width));
+  height = MAX (color_requisition.height,
+                MAX (foo_requisition.height,
+                     image_requisition.height));
 
-      gtk_widget_size_request (tool_button, &button_requisition);
+  n_areas = (config->toolbox_color_area +
+             config->toolbox_foo_area   +
+             config->toolbox_image_area);
 
-      for (list = gimp_get_tool_info_iter (gimp), n_tools = 0;
-           list;
-           list = list->next)
-        {
-          tool_info = list->data;
-
-          if (tool_info->visible)
-            n_tools++;
-        }
+  area_columns = MAX (1, (allocation->width / width));
+  area_rows    = n_areas / area_columns;
 
-      tool_columns = MAX (1, (allocation->width / button_requisition.width));
-      tool_rows    = n_tools / tool_columns;
+  if (n_areas % area_columns)
+    area_rows++;
 
-      if (n_tools % tool_columns)
-        tool_rows++;
-
-      if (toolbox->p->tool_rows    != tool_rows  ||
-          toolbox->p->tool_columns != tool_columns)
-        {
-          toolbox->p->tool_rows    = tool_rows;
-          toolbox->p->tool_columns = tool_columns;
+  if (toolbox->p->area_rows    != area_rows  ||
+      toolbox->p->area_columns != area_columns)
+    {
+      toolbox->p->area_rows    = area_rows;
+      toolbox->p->area_columns = area_columns;
 
-          gtk_widget_set_size_request (toolbox->p->tool_palette, -1,
-                                       tool_rows * button_requisition.height);
-        }
+      gtk_widget_set_size_request (toolbox->p->area_wbox, -1,
+                                   area_rows * height);
     }
-
-  {
-    GtkRequisition  color_requisition;
-    GtkRequisition  foo_requisition;
-    GtkRequisition  image_requisition;
-    gint            width;
-    gint            height;
-    gint            n_areas;
-    gint            area_rows;
-    gint            area_columns;
-
-    gtk_widget_size_request (toolbox->p->color_area, &color_requisition);
-    gtk_widget_size_request (toolbox->p->foo_area,   &foo_requisition);
-    gtk_widget_size_request (toolbox->p->image_area, &image_requisition);
-
-    width  = MAX (color_requisition.width,
-                  MAX (foo_requisition.width,
-                       image_requisition.width));
-    height = MAX (color_requisition.height,
-                  MAX (foo_requisition.height,
-                       image_requisition.height));
-
-    n_areas = (config->toolbox_color_area +
-               config->toolbox_foo_area   +
-               config->toolbox_image_area);
-
-    area_columns = MAX (1, (allocation->width / width));
-    area_rows    = n_areas / area_columns;
-
-    if (n_areas % area_columns)
-      area_rows++;
-
-    if (toolbox->p->area_rows    != area_rows  ||
-        toolbox->p->area_columns != area_columns)
-      {
-        toolbox->p->area_rows    = area_rows;
-        toolbox->p->area_columns = area_columns;
-
-        gtk_widget_set_size_request (toolbox->p->area_wbox, -1,
-                                     area_rows * height);
-      }
-  }
 }
 
 static void
 gimp_toolbox_style_set (GtkWidget *widget,
                         GtkStyle  *previous_style)
 {
-  GimpToolbox    *toolbox = GIMP_TOOLBOX (widget);
-  Gimp           *gimp;
-  GtkIconSize     tool_icon_size;
-  GtkReliefStyle  relief;
-  GList          *list;
-
   GTK_WIDGET_CLASS (parent_class)->style_set (widget, previous_style);
 
-  if (! gimp_toolbox_get_context (toolbox))
-    return;
-
-  gimp = gimp_toolbox_get_context (toolbox)->gimp;
-
-  gtk_widget_style_get (widget,
-                        "tool-icon-size", &tool_icon_size,
-                        "button-relief",  &relief,
-                        NULL);
-
-  gtk_tool_palette_set_icon_size (GTK_TOOL_PALETTE (toolbox->p->tool_palette),
-                                  tool_icon_size);
-
-  for (list = gimp_get_tool_info_iter (gimp);
-       list;
-       list = g_list_next (list))
-    {
-      GimpToolInfo *tool_info = list->data;
-      GtkWidget    *tool_button;
-
-      tool_button = g_object_get_data (G_OBJECT (tool_info),
-                                       TOOL_BUTTON_DATA_KEY);
-
-      if (tool_button)
-        {
-          GtkWidget *button = gtk_bin_get_child (GTK_BIN (tool_button));
-
-          gtk_button_set_relief (GTK_BUTTON (button), relief);
-        }
-    }
-
   gimp_dock_invalidate_geometry (GIMP_DOCK (widget));
 }
 
@@ -726,8 +589,8 @@ gimp_toolbox_drag_drop (GtkWidget      *widget,
         }
     }
 
-  if (handled)	  
-    gtk_drag_finish (context, 
+  if (handled)
+    gtk_drag_finish (context,
                      TRUE /*success*/,
                      (context->action == GDK_ACTION_MOVE) /*del*/,
                      time);
@@ -758,8 +621,8 @@ static void
 gimp_toolbox_book_added (GimpDock     *dock,
                          GimpDockbook *dockbook)
 {
-  if (GIMP_DOCK_CLASS (gimp_toolbox_parent_class)->book_added)
-    GIMP_DOCK_CLASS (gimp_toolbox_parent_class)->book_added (dock, dockbook);
+  if (GIMP_DOCK_CLASS (parent_class)->book_added)
+    GIMP_DOCK_CLASS (parent_class)->book_added (dock, dockbook);
 
   if (g_list_length (gimp_dock_get_dockbooks (dock)) == 1)
     {
@@ -773,8 +636,8 @@ gimp_toolbox_book_removed (GimpDock     *dock,
 {
   GimpToolbox *toolbox = GIMP_TOOLBOX (dock);
 
-  if (GIMP_DOCK_CLASS (gimp_toolbox_parent_class)->book_removed)
-    GIMP_DOCK_CLASS (gimp_toolbox_parent_class)->book_removed (dock, dockbook);
+  if (GIMP_DOCK_CLASS (parent_class)->book_removed)
+    GIMP_DOCK_CLASS (parent_class)->book_removed (dock, dockbook);
 
   if (g_list_length (gimp_dock_get_dockbooks (dock)) == 0 &&
       ! toolbox->p->in_destruction)
@@ -794,7 +657,7 @@ gimp_toolbox_set_host_geometry_hints (GimpDock  *dock,
 
   gimp = gimp_toolbox_get_context (toolbox)->gimp;
 
-  tool_info = gimp_get_tool_info (gimp, "gimp-rect-select-tool");
+  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);
 
   if (tool_button)
@@ -904,89 +767,6 @@ gimp_toolbox_expose_wilber (GtkWidget      *widget,
   return FALSE;
 }
 
-static void
-toolbox_create_tools (GimpToolbox *toolbox,
-                      GimpContext *context)
-{
-  GtkWidget    *group;
-  GimpToolInfo *active_tool;
-  GList        *list;
-  GSList       *item_group = NULL;
-
-  group = gtk_tool_item_group_new (_("Tools"));
-  gtk_tool_item_group_set_label_widget (GTK_TOOL_ITEM_GROUP (group), NULL);
-  gtk_container_add (GTK_CONTAINER (toolbox->p->tool_palette), group);
-  gtk_widget_show (group);
-
-  active_tool = gimp_context_get_tool (context);
-
-  for (list = gimp_get_tool_info_iter (context->gimp);
-       list;
-       list = g_list_next (list))
-    {
-      GimpToolInfo *tool_info = list->data;
-      GtkToolItem  *item;
-      const gchar  *stock_id;
-
-      stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
-
-      item = gtk_radio_tool_button_new_from_stock (item_group, stock_id);
-      item_group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (item));
-      gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
-      gtk_widget_show (GTK_WIDGET (item));
-
-      gtk_tool_item_set_visible_horizontal (item, tool_info->visible);
-      gtk_tool_item_set_visible_vertical   (item, tool_info->visible);
-
-      g_signal_connect_object (tool_info, "notify::visible",
-                               G_CALLBACK (toolbox_tool_visible_notify),
-                               item, 0);
-
-      g_object_set_data (G_OBJECT (tool_info), TOOL_BUTTON_DATA_KEY, item);
-      g_object_set_data (G_OBJECT (item)  ,    TOOL_INFO_DATA_KEY,   tool_info);
-
-      if (tool_info == active_tool)
-        gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (item), TRUE);
-
-      g_signal_connect (item, "toggled",
-                        G_CALLBACK (toolbox_tool_button_toggled),
-                        toolbox);
-
-      g_signal_connect (gtk_bin_get_child (GTK_BIN (item)), "button-press-event",
-                        G_CALLBACK (toolbox_tool_button_press),
-                        toolbox);
-
-
-      if (toolbox->p->ui_manager)
-        {
-          GtkAction   *action     = NULL;
-          const gchar *identifier = NULL;
-          gchar       *tmp        = NULL;
-          gchar       *name       = NULL;
-
-          identifier = gimp_object_get_name (tool_info);
-
-          tmp = g_strndup (identifier + strlen ("gimp-"),
-                           strlen (identifier) - strlen ("gimp--tool"));
-          name = g_strdup_printf ("tools-%s", tmp);
-          g_free (tmp);
-
-          action = gimp_ui_manager_find_action (toolbox->p->ui_manager, "tools", name);
-          g_free (name);
-
-          if (action)
-            gimp_widget_set_accel_help (GTK_WIDGET (item), action);
-          else
-            gimp_help_set_help_data (GTK_WIDGET (item),
-                                     tool_info->help, tool_info->help_id);
-        }
-    }
-
-  g_signal_connect_object (context->gimp->tool_info_list, "reorder",
-                           G_CALLBACK (toolbox_tool_reorder),
-                           toolbox, 0);
-}
-
 static GtkWidget *
 toolbox_create_color_area (GimpToolbox *toolbox,
                            GimpContext *context)
@@ -1060,7 +840,6 @@ toolbox_area_notify (GimpGuiConfig *config,
 
       gtk_widget_show (parent);
 
-      /* FIXME: fix GtkWrapBox child requisition/allocation instead of hacking badly (bug #162500). */
       gtk_widget_size_request (area, &req);
       gtk_widget_set_size_request (parent, req.width, req.height);
     }
@@ -1085,86 +864,6 @@ toolbox_wilber_notify (GimpGuiConfig *config,
   g_object_set (wilber, "visible", visible, NULL);
 }
 
-static void
-toolbox_tool_changed (GimpContext  *context,
-                      GimpToolInfo *tool_info,
-                      GimpToolbox  *toolbox)
-{
-  if (tool_info)
-    {
-      GtkWidget *tool_button = g_object_get_data (G_OBJECT (tool_info),
-                                                  TOOL_BUTTON_DATA_KEY);
-
-      if (tool_button &&
-          ! gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (tool_button)))
-        {
-          g_signal_handlers_block_by_func (tool_button,
-                                           toolbox_tool_button_toggled,
-                                           toolbox);
-
-          gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (tool_button),
-                                             TRUE);
-
-          g_signal_handlers_unblock_by_func (tool_button,
-                                             toolbox_tool_button_toggled,
-                                             toolbox);
-        }
-    }
-}
-
-static void
-toolbox_tool_reorder (GimpContainer *container,
-                      GimpToolInfo  *tool_info,
-                      gint           index,
-                      GimpToolbox   *toolbox)
-{
-  if (tool_info)
-    {
-      GtkWidget *button = g_object_get_data (G_OBJECT (tool_info),
-                                             TOOL_BUTTON_DATA_KEY);
-      GtkWidget *group  = gtk_widget_get_parent (button);
-
-      gtk_tool_item_group_set_item_position (GTK_TOOL_ITEM_GROUP (group),
-                                             GTK_TOOL_ITEM (button), index);
-    }
-}
-
-static void
-toolbox_tool_visible_notify (GimpToolInfo *tool_info,
-                             GParamSpec   *pspec,
-                             GtkToolItem  *item)
-{
-  gtk_tool_item_set_visible_horizontal (item, tool_info->visible);
-  gtk_tool_item_set_visible_vertical   (item, tool_info->visible);
-}
-
-static void
-toolbox_tool_button_toggled (GtkWidget   *widget,
-                             GimpToolbox *toolbox)
-{
-  GimpToolInfo *tool_info = g_object_get_data (G_OBJECT (widget),
-                                               TOOL_INFO_DATA_KEY);
-
-  if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (widget)))
-    gimp_context_set_tool (gimp_toolbox_get_context (toolbox), tool_info);
-}
-
-static gboolean
-toolbox_tool_button_press (GtkWidget      *widget,
-                           GdkEventButton *event,
-                           GimpToolbox    *toolbox)
-{
-  if (event->type == GDK_2BUTTON_PRESS && event->button == 1)
-    {
-      gimp_dialog_factory_dialog_raise (toolbox->p->dialog_factory,
-                                        gtk_widget_get_screen (widget),
-                                        "gimp-tool-options",
-                                        -1);
-    }
-
-  return FALSE;
-}
-
 static gboolean
 toolbox_check_device (GtkWidget *widget,
                       GdkEvent  *event,
diff --git a/app/widgets/gimptoolpalette.c b/app/widgets/gimptoolpalette.c
new file mode 100644
index 0000000..18d784d
--- /dev/null
+++ b/app/widgets/gimptoolpalette.c
@@ -0,0 +1,536 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimptoolpalette.c
+ * Copyright (C) 2010 Michael Natterer <mitch gimp org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "widgets-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpcontext.h"
+#include "core/gimptoolinfo.h"
+
+#include "gimpdialogfactory.h"
+#include "gimptoolpalette.h"
+#include "gimpuimanager.h"
+#include "gimpwidgets-utils.h"
+
+#include "gimp-intl.h"
+
+
+#define DEFAULT_TOOL_ICON_SIZE GTK_ICON_SIZE_BUTTON
+#define DEFAULT_BUTTON_RELIEF  GTK_RELIEF_NONE
+
+#define TOOL_BUTTON_DATA_KEY   "gimp-tool-palette-item"
+#define TOOL_INFO_DATA_KEY     "gimp-tool-info"
+
+
+enum
+{
+  PROP_0,
+  PROP_CONTEXT,
+  PROP_UI_MANAGER,
+  PROP_DIALOG_FACTORY
+};
+
+
+typedef struct _GimpToolPalettePrivate GimpToolPalettePrivate;
+
+struct _GimpToolPalettePrivate
+{
+  GimpContext       *context;
+  GimpUIManager     *ui_manager;
+  GimpDialogFactory *dialog_factory;
+
+  gint               tool_rows;
+  gint               tool_columns;
+};
+
+#define GET_PRIVATE(p) G_TYPE_INSTANCE_GET_PRIVATE (p, \
+                                                    GIMP_TYPE_TOOL_PALETTE, \
+                                                    GimpToolPalettePrivate)
+
+
+static void     gimp_tool_palette_constructed         (GObject         *object);
+static void     gimp_tool_palette_dispose             (GObject         *object);
+static void     gimp_tool_palette_set_property        (GObject         *object,
+                                                       guint            property_id,
+                                                       const GValue    *value,
+                                                       GParamSpec      *pspec);
+static void     gimp_tool_palette_get_property        (GObject         *object,
+                                                       guint            property_id,
+                                                       GValue          *value,
+                                                       GParamSpec      *pspec);
+static void     gimp_tool_palette_size_allocate       (GtkWidget       *widget,
+                                                       GtkAllocation   *allocation);
+static void     gimp_tool_palette_style_set           (GtkWidget       *widget,
+                                                       GtkStyle        *previous_style);
+
+static void     gimp_tool_palette_tool_changed        (GimpContext     *context,
+                                                       GimpToolInfo    *tool_info,
+                                                       GimpToolPalette *palette);
+static void     gimp_tool_palette_tool_reorder        (GimpContainer   *container,
+                                                       GimpToolInfo    *tool_info,
+                                                       gint             index,
+                                                       GimpToolPalette *palette);
+static void     gimp_tool_palette_tool_visible_notify (GimpToolInfo    *tool_info,
+                                                       GParamSpec      *pspec,
+                                                       GtkToolItem     *item);
+static void     gimp_tool_palette_button_toggled      (GtkWidget       *widget,
+                                                       GimpToolPalette *palette);
+static gboolean gimp_tool_palette_button_press        (GtkWidget       *widget,
+                                                       GdkEventButton  *bevent,
+                                                       GimpToolPalette *palette);
+
+
+G_DEFINE_TYPE (GimpToolPalette, gimp_tool_palette, GTK_TYPE_TOOL_PALETTE)
+
+#define parent_class gimp_tool_palette_parent_class
+
+
+static void
+gimp_tool_palette_class_init (GimpToolPaletteClass *klass)
+{
+  GObjectClass   *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->constructed           = gimp_tool_palette_constructed;
+  object_class->dispose               = gimp_tool_palette_dispose;
+  object_class->set_property          = gimp_tool_palette_set_property;
+  object_class->get_property          = gimp_tool_palette_get_property;
+
+  widget_class->size_allocate         = gimp_tool_palette_size_allocate;
+  widget_class->style_set             = gimp_tool_palette_style_set;
+
+  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_UI_MANAGER,
+                                   g_param_spec_object ("ui-manager",
+                                                        NULL, NULL,
+                                                        GIMP_TYPE_UI_MANAGER,
+                                                        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));
+
+  gtk_widget_class_install_style_property (widget_class,
+                                           g_param_spec_enum ("tool-icon-size",
+                                                              NULL, NULL,
+                                                              GTK_TYPE_ICON_SIZE,
+                                                              DEFAULT_TOOL_ICON_SIZE,
+                                                              GIMP_PARAM_READABLE));
+
+  gtk_widget_class_install_style_property (widget_class,
+                                           g_param_spec_enum ("button-relief",
+                                                              NULL, NULL,
+                                                              GTK_TYPE_RELIEF_STYLE,
+                                                              DEFAULT_BUTTON_RELIEF,
+                                                              GIMP_PARAM_READABLE));
+
+  g_type_class_add_private (klass, sizeof (GimpToolPalettePrivate));
+}
+
+static void
+gimp_tool_palette_init (GimpToolPalette *palette)
+{
+}
+
+static void
+gimp_tool_palette_constructed (GObject *object)
+{
+  GimpToolPalettePrivate *private = GET_PRIVATE (object);
+  GtkWidget              *group;
+  GimpToolInfo           *active_tool;
+  GList                  *list;
+  GSList                 *item_group = NULL;
+
+  group = gtk_tool_item_group_new (_("Tools"));
+  gtk_tool_item_group_set_label_widget (GTK_TOOL_ITEM_GROUP (group), NULL);
+  gtk_container_add (GTK_CONTAINER (object), group);
+  gtk_widget_show (group);
+
+  active_tool = gimp_context_get_tool (private->context);
+
+  for (list = gimp_get_tool_info_iter (private->context->gimp);
+       list;
+       list = g_list_next (list))
+    {
+      GimpToolInfo *tool_info = list->data;
+      GtkToolItem  *item;
+      const gchar  *stock_id;
+
+      stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
+
+      item = gtk_radio_tool_button_new_from_stock (item_group, stock_id);
+      item_group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (item));
+      gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
+      gtk_widget_show (GTK_WIDGET (item));
+
+      gtk_tool_item_set_visible_horizontal (item, tool_info->visible);
+      gtk_tool_item_set_visible_vertical   (item, tool_info->visible);
+
+      g_signal_connect_object (tool_info, "notify::visible",
+                               G_CALLBACK (gimp_tool_palette_tool_visible_notify),
+                               item, 0);
+
+      g_object_set_data (G_OBJECT (tool_info), TOOL_BUTTON_DATA_KEY, item);
+      g_object_set_data (G_OBJECT (item)  ,    TOOL_INFO_DATA_KEY,   tool_info);
+
+      if (tool_info == active_tool)
+        gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (item), TRUE);
+
+      g_signal_connect (item, "toggled",
+                        G_CALLBACK (gimp_tool_palette_button_toggled),
+                        object);
+
+      g_signal_connect (gtk_bin_get_child (GTK_BIN (item)), "button-press-event",
+                        G_CALLBACK (gimp_tool_palette_button_press),
+                        object);
+
+      if (private->ui_manager)
+        {
+          GtkAction   *action     = NULL;
+          const gchar *identifier = NULL;
+          gchar       *tmp        = NULL;
+          gchar       *name       = NULL;
+
+          identifier = gimp_object_get_name (tool_info);
+
+          tmp = g_strndup (identifier + strlen ("gimp-"),
+                           strlen (identifier) - strlen ("gimp--tool"));
+          name = g_strdup_printf ("tools-%s", tmp);
+          g_free (tmp);
+
+          action = gimp_ui_manager_find_action (private->ui_manager,
+                                                "tools", name);
+          g_free (name);
+
+          if (action)
+            gimp_widget_set_accel_help (GTK_WIDGET (item), action);
+          else
+            gimp_help_set_help_data (GTK_WIDGET (item),
+                                     tool_info->help, tool_info->help_id);
+        }
+    }
+
+  g_signal_connect_object (private->context->gimp->tool_info_list, "reorder",
+                           G_CALLBACK (gimp_tool_palette_tool_reorder),
+                           object, 0);
+
+  g_signal_connect_object (private->context, "tool-changed",
+                           G_CALLBACK (gimp_tool_palette_tool_changed),
+                           object,
+                           0);
+
+#if 0
+  gimp_tool_palette_dnd_init (GIMP_TOOL_PALETTE (palette));
+#endif
+}
+
+static void
+gimp_tool_palette_dispose (GObject *object)
+{
+  GimpToolPalettePrivate *private = GET_PRIVATE (object);
+
+  if (private->context)
+    {
+      g_object_unref (private->context);
+      private->context = NULL;
+    }
+
+  if (private->ui_manager)
+    {
+      g_object_unref (private->ui_manager);
+      private->ui_manager = NULL;
+    }
+
+  if (private->dialog_factory)
+    {
+      g_object_unref (private->dialog_factory);
+      private->dialog_factory = NULL;
+    }
+
+  G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+gimp_tool_palette_set_property (GObject      *object,
+                                guint         property_id,
+                                const GValue *value,
+                                GParamSpec   *pspec)
+{
+  GimpToolPalettePrivate *private = GET_PRIVATE (object);
+
+  switch (property_id)
+    {
+    case PROP_CONTEXT:
+      private->context = g_value_dup_object (value);
+      break;
+
+    case PROP_UI_MANAGER:
+      private->ui_manager = g_value_dup_object (value);
+      break;
+
+    case PROP_DIALOG_FACTORY:
+      private->dialog_factory = g_value_dup_object (value);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+    }
+}
+
+static void
+gimp_tool_palette_get_property (GObject    *object,
+                                guint       property_id,
+                                GValue     *value,
+                                GParamSpec *pspec)
+{
+  GimpToolPalettePrivate *private = GET_PRIVATE (object);
+
+  switch (property_id)
+    {
+    case PROP_CONTEXT:
+      g_value_set_object (value, private->context);
+      break;
+
+    case PROP_UI_MANAGER:
+      g_value_set_object (value, private->ui_manager);
+      break;
+
+    case PROP_DIALOG_FACTORY:
+      g_value_set_object (value, private->ui_manager);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+    }
+}
+
+static void
+gimp_tool_palette_size_allocate (GtkWidget     *widget,
+                                 GtkAllocation *allocation)
+{
+  GimpToolPalettePrivate *private = GET_PRIVATE (widget);
+  Gimp                   *gimp;
+  GimpToolInfo           *tool_info;
+  GtkWidget              *tool_button;
+
+  GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
+
+  gimp = private->context->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);
+
+  if (tool_button)
+    {
+      GtkRequisition  button_requisition;
+      GList          *list;
+      gint            n_tools;
+      gint            tool_rows;
+      gint            tool_columns;
+
+      gtk_widget_size_request (tool_button, &button_requisition);
+
+      for (list = gimp_get_tool_info_iter (gimp), n_tools = 0;
+           list;
+           list = list->next)
+        {
+          tool_info = list->data;
+
+          if (tool_info->visible)
+            n_tools++;
+        }
+
+      tool_columns = MAX (1, (allocation->width / button_requisition.width));
+      tool_rows    = n_tools / tool_columns;
+
+      if (n_tools % tool_columns)
+        tool_rows++;
+
+      if (private->tool_rows    != tool_rows  ||
+          private->tool_columns != tool_columns)
+        {
+          private->tool_rows    = tool_rows;
+          private->tool_columns = tool_columns;
+
+          gtk_widget_set_size_request (widget, -1,
+                                       tool_rows * button_requisition.height);
+        }
+    }
+}
+
+static void
+gimp_tool_palette_style_set (GtkWidget *widget,
+                             GtkStyle  *previous_style)
+{
+  GimpToolPalettePrivate *private = GET_PRIVATE (widget);
+  Gimp                   *gimp;
+  GtkIconSize             tool_icon_size;
+  GtkReliefStyle          relief;
+  GList                  *list;
+
+  GTK_WIDGET_CLASS (parent_class)->style_set (widget, previous_style);
+
+  if (! private->context)
+    return;
+
+  gimp = private->context->gimp;
+
+  gtk_widget_style_get (widget,
+                        "tool-icon-size", &tool_icon_size,
+                        "button-relief",  &relief,
+                        NULL);
+
+  gtk_tool_palette_set_icon_size (GTK_TOOL_PALETTE (widget), tool_icon_size);
+
+  for (list = gimp_get_tool_info_iter (gimp);
+       list;
+       list = g_list_next (list))
+    {
+      GimpToolInfo *tool_info = list->data;
+      GtkWidget    *tool_button;
+
+      tool_button = g_object_get_data (G_OBJECT (tool_info),
+                                       TOOL_BUTTON_DATA_KEY);
+
+      if (tool_button)
+        {
+          GtkWidget *button = gtk_bin_get_child (GTK_BIN (tool_button));
+
+          gtk_button_set_relief (GTK_BUTTON (button), relief);
+        }
+    }
+}
+
+GtkWidget *
+gimp_tool_palette_new (GimpContext       *context,
+                       GimpUIManager     *ui_manager,
+                       GimpDialogFactory *dialog_factory)
+{
+  return g_object_new (GIMP_TYPE_TOOL_PALETTE,
+                       "context",        context,
+                       "ui-manager",     ui_manager,
+                       "dialog-factory", dialog_factory,
+                       NULL);
+}
+
+
+/*  private functions  */
+
+static void
+gimp_tool_palette_tool_changed (GimpContext      *context,
+                                GimpToolInfo     *tool_info,
+                                GimpToolPalette  *palette)
+{
+  if (tool_info)
+    {
+      GtkWidget *tool_button = g_object_get_data (G_OBJECT (tool_info),
+                                                  TOOL_BUTTON_DATA_KEY);
+
+      if (tool_button &&
+          ! gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (tool_button)))
+        {
+          g_signal_handlers_block_by_func (tool_button,
+                                           gimp_tool_palette_button_toggled,
+                                           palette);
+
+          gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (tool_button),
+                                             TRUE);
+
+          g_signal_handlers_unblock_by_func (tool_button,
+                                             gimp_tool_palette_button_toggled,
+                                             palette);
+        }
+    }
+}
+
+static void
+gimp_tool_palette_tool_reorder (GimpContainer   *container,
+                                GimpToolInfo    *tool_info,
+                                gint             index,
+                                GimpToolPalette *palette)
+{
+  if (tool_info)
+    {
+      GtkWidget *button = g_object_get_data (G_OBJECT (tool_info),
+                                             TOOL_BUTTON_DATA_KEY);
+      GtkWidget *group  = gtk_widget_get_parent (button);
+
+      gtk_tool_item_group_set_item_position (GTK_TOOL_ITEM_GROUP (group),
+                                             GTK_TOOL_ITEM (button), index);
+    }
+}
+
+static void
+gimp_tool_palette_tool_visible_notify (GimpToolInfo *tool_info,
+                                       GParamSpec   *pspec,
+                                       GtkToolItem  *item)
+{
+  gtk_tool_item_set_visible_horizontal (item, tool_info->visible);
+  gtk_tool_item_set_visible_vertical   (item, tool_info->visible);
+}
+
+static void
+gimp_tool_palette_button_toggled (GtkWidget       *widget,
+                                  GimpToolPalette *palette)
+{
+  GimpToolPalettePrivate *private = GET_PRIVATE (palette);
+  GimpToolInfo           *tool_info;
+
+  tool_info = g_object_get_data (G_OBJECT (widget), TOOL_INFO_DATA_KEY);
+
+  if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (widget)))
+    gimp_context_set_tool (private->context, tool_info);
+}
+
+static gboolean
+gimp_tool_palette_button_press (GtkWidget       *widget,
+                                GdkEventButton  *event,
+                                GimpToolPalette *palette)
+{
+  GimpToolPalettePrivate *private = GET_PRIVATE (palette);
+
+  if (event->type == GDK_2BUTTON_PRESS && event->button == 1)
+    {
+      gimp_dialog_factory_dialog_raise (private->dialog_factory,
+                                        gtk_widget_get_screen (widget),
+                                        "gimp-tool-options",
+                                        -1);
+    }
+
+  return FALSE;
+}
diff --git a/app/widgets/gimptoolpalette.h b/app/widgets/gimptoolpalette.h
new file mode 100644
index 0000000..4453b1a
--- /dev/null
+++ b/app/widgets/gimptoolpalette.h
@@ -0,0 +1,53 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimptoolpalette.h
+ * Copyright (C) 2010 Michael Natterer <mitch gimp org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_TOOL_PALETTE_H__
+#define __GIMP_TOOL_PALETTE_H__
+
+
+#define GIMP_TYPE_TOOL_PALETTE            (gimp_tool_palette_get_type ())
+#define GIMP_TOOL_PALETTE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_TOOL_PALETTE, GimpToolPalette))
+#define GIMP_TOOL_PALETTE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_TOOL_PALETTE, GimpToolPaletteClass))
+#define GIMP_IS_TOOL_PALETTE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_TOOL_PALETTE))
+#define GIMP_IS_TOOL_PALETTE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_TOOL_PALETTE))
+#define GIMP_TOOL_PALETTE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_TOOL_PALETTE, GimpToolPaletteClass))
+
+
+typedef struct _GimpToolPaletteClass GimpToolPaletteClass;
+
+struct _GimpToolPalette
+{
+  GtkToolPalette  parent_instance;
+};
+
+struct _GimpToolPaletteClass
+{
+  GtkToolPaletteClass  parent_class;
+};
+
+
+GType       gimp_tool_palette_get_type (void) G_GNUC_CONST;
+
+GtkWidget * gimp_tool_palette_new      (GimpContext       *context,
+                                        GimpUIManager     *ui_manager,
+                                        GimpDialogFactory *dialog_factory);
+
+
+#endif /* __GIMP_TOOL_PALETTE_H__ */
diff --git a/app/widgets/widgets-types.h b/app/widgets/widgets-types.h
index 3479c5b..fcd8af6 100644
--- a/app/widgets/widgets-types.h
+++ b/app/widgets/widgets-types.h
@@ -195,6 +195,7 @@ typedef struct _GimpTagPopup                 GimpTagPopup;
 typedef struct _GimpTemplateEditor           GimpTemplateEditor;
 typedef struct _GimpTextStyleEditor          GimpTextStyleEditor;
 typedef struct _GimpThumbBox                 GimpThumbBox;
+typedef struct _GimpToolPalette              GimpToolPalette;
 typedef struct _GimpTranslationStore         GimpTranslationStore;
 typedef struct _GimpWindow                   GimpWindow;
 
diff --git a/themes/Default/gtkrc b/themes/Default/gtkrc
index 0cfb4b3..f8131bc 100644
--- a/themes/Default/gtkrc
+++ b/themes/Default/gtkrc
@@ -41,8 +41,8 @@ style "gimp-default-style"
   GimpDock::font-scale              = 0.8333
   GimpMenuDock::minimal-width       = 200
   GimpDockWindow::menu-preview-size = button
-  GimpToolbox::tool-icon-size       = button
-  GimpToolbox::button-relief        = none
+  GimpToolPalette::tool-icon-size   = button
+  GimpToolPalette::button-relief    = none
   GimpDockbook::tab-border          = 0
   GimpDockbook::tab-icon-size       = button
   GimpColorNotebook::tab-border     = 0
diff --git a/themes/Small/gtkrc b/themes/Small/gtkrc
index 1232c08..2ac835e 100644
--- a/themes/Small/gtkrc
+++ b/themes/Small/gtkrc
@@ -48,8 +48,8 @@ style "gimp-default-style"
   GimpDock::font-scale              = 0.8333
   GimpMenuDock::minimal-width       = 200
   GimpDockWindow::menu-preview-size = small-toolbar
-  GimpToolbox::tool-icon-size       = menu
-  GimpToolbox::button-relief        = none
+  GimpToolPalette::tool-icon-size   = menu
+  GimpToolPalette::button-relief    = none
   GimpDockbook::tab-border          = 0
   GimpDockbook::tab-icon-size       = menu
   GimpColorNotebook::tab-border     = 0



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