[gimp] devel-docs: undeprecate doc-shooter and add a few more widgets



commit dcbd83cafc1e636691bd95e6892a9564c67788ce
Author: Michael Natterer <mitch gimp org>
Date:   Wed Jul 24 19:17:14 2019 +0200

    devel-docs: undeprecate doc-shooter and add a few more widgets
    
    Doesn't use X11 any longer, just plain GTK and cairo.

 devel-docs/tools/Makefile.am |   7 +-
 devel-docs/tools/shadow.c    |   4 +-
 devel-docs/tools/shooter.c   | 220 +++++-----------------
 devel-docs/tools/widgets.c   | 437 +++++++++++++++++++++++--------------------
 devel-docs/tools/widgets.h   |   4 +-
 5 files changed, 289 insertions(+), 383 deletions(-)
---
diff --git a/devel-docs/tools/Makefile.am b/devel-docs/tools/Makefile.am
index 45548520b2..9668a44d04 100644
--- a/devel-docs/tools/Makefile.am
+++ b/devel-docs/tools/Makefile.am
@@ -15,9 +15,9 @@ libgimpwidgets = $(top_builddir)/libgimpwidgets/libgimpwidgets-$(GIMP_API_VERSIO
 
 
 AM_CPPFLAGS = \
-       $(GTK_CFLAGS)                   \
-        -DTOP_SRCDIR=\"$(top_srcdir)\" \
+       -DTOP_SRCDIR=\"$(top_srcdir)\"  \
        -I$(top_srcdir)                 \
+       $(GTK_CFLAGS)                   \
        $(GEGL_CFLAGS)
 
 AM_LDFLAGS = $(mwindows)
@@ -43,8 +43,7 @@ doc_shooter_LDADD = \
        $(libgimpmath)          \
        $(libgimpcolor)         \
        $(libgimpbase)          \
-       $(GTK_LIBS)             \
-       $(X_LIBS) -lX11 -lXext
+       $(GTK_LIBS)
 
 
 EXTRA_PROGRAMS = doc-shooter
diff --git a/devel-docs/tools/shadow.c b/devel-docs/tools/shadow.c
index cf292c9fac..1ea95bd54d 100644
--- a/devel-docs/tools/shadow.c
+++ b/devel-docs/tools/shadow.c
@@ -98,8 +98,8 @@ create_shadow (GdkPixbuf *src)
                   src_y = -(BLUR_RADIUS + SHADOW_OFFSET) + y - (filter->size >> 1) + i;
                   src_x = -(BLUR_RADIUS + SHADOW_OFFSET) + x - (filter->size >> 1) + j;
 
-                  if (src_y < 0 || src_y > gdk_pixbuf_get_height (src) ||
-                      src_x < 0 || src_x > gdk_pixbuf_get_width (src))
+                  if (src_y < 0 || src_y >= gdk_pixbuf_get_height (src) ||
+                      src_x < 0 || src_x >= gdk_pixbuf_get_width (src))
                     continue;
 
                   sumr += src_pixels [src_y * src_rowstride +
diff --git a/devel-docs/tools/shooter.c b/devel-docs/tools/shooter.c
index efe2cf0012..b273ee9907 100644
--- a/devel-docs/tools/shooter.c
+++ b/devel-docs/tools/shooter.c
@@ -1,18 +1,9 @@
 
 #include "config.h"
 
-#include <stdlib.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
 #include <gegl.h>
-#include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 
-#include <X11/extensions/shape.h>
-
 #include "libgimpbase/gimpbase.h"
 #include "libgimpconfig/gimpconfig.h"
 #include "libgimpmodule/gimpmodule.h"
@@ -24,30 +15,6 @@
 #include "widgets.h"
 
 
-static Window
-find_toplevel_window (Display *display,
-                      Window   xid)
-{
-  Window  root, parent, *children;
-  guint   nchildren;
-
-  do
-    {
-      if (XQueryTree (display, xid,
-                      &root, &parent, &children, &nchildren) == 0)
-        {
-          g_warning ("Couldn't find window manager window");
-          return 0;
-        }
-
-      if (root == parent)
-        return xid;
-
-      xid = parent;
-    }
-  while (TRUE);
-}
-
 static GdkPixbuf *
 add_border_to_shot (GdkPixbuf *pixbuf)
 {
@@ -70,125 +37,48 @@ add_border_to_shot (GdkPixbuf *pixbuf)
 }
 
 static GdkPixbuf *
-remove_shaped_area (GdkPixbuf *pixbuf,
-                    Window     window)
+take_window_shot (GtkWidget *widget)
 {
-  Display    *display;
-  GdkPixbuf  *retval;
-  XRectangle *rectangles;
-  gint        rectangle_count, rectangle_order;
-  gint        i;
-
-  retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
-                           gdk_pixbuf_get_width (pixbuf),
-                           gdk_pixbuf_get_height (pixbuf));
-
-  gdk_pixbuf_fill (retval, 0);
+  GtkAllocation    allocation;
+  cairo_surface_t *surface;
+  cairo_t         *cr;
+  GdkPixbuf       *pixbuf;
 
-  display = gdk_x11_display_get_xdisplay (gdk_display_get_default ());
+  allocation.x = 0;
+  allocation.y = 0;
+  gtk_widget_get_preferred_width  (widget, NULL, &allocation.width);
+  gtk_widget_get_preferred_height (widget, NULL, &allocation.height);
 
-  rectangles = XShapeGetRectangles (display, window, ShapeBounding,
-                                    &rectangle_count, &rectangle_order);
+  gtk_widget_size_allocate (widget, &allocation);
+  gtk_widget_get_allocation (widget, &allocation);
 
-  for (i = 0; i < rectangle_count; i++)
-    {
-      int y, x;
+  surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+                                        allocation.width,
+                                        allocation.height);
+  cr = cairo_create (surface);
+  gtk_widget_draw (widget, cr);
+  cairo_destroy (cr);
 
-      for (y = rectangles[i].y;
-           y < rectangles[i].y + rectangles[i].height;
-           y++)
-        {
-          const guchar *src_pixels;
-          guchar       *dest_pixels;
-
-          src_pixels = gdk_pixbuf_get_pixels (pixbuf) +
-            y * gdk_pixbuf_get_rowstride (pixbuf) +
-            rectangles[i].x * (gdk_pixbuf_get_has_alpha (pixbuf) ? 4 : 3);
-
-          dest_pixels = gdk_pixbuf_get_pixels (retval) +
-            y * gdk_pixbuf_get_rowstride (retval) +
-            rectangles[i].x * 4;
-
-          for (x = rectangles[i].x;
-               x < rectangles[i].x + rectangles[i].width;
-               x++)
-            {
-              *dest_pixels++ = *src_pixels ++;
-              *dest_pixels++ = *src_pixels ++;
-              *dest_pixels++ = *src_pixels ++;
-              *dest_pixels++ = 255;
-
-              if (gdk_pixbuf_get_has_alpha (pixbuf))
-                src_pixels++;
-            }
-        }
-    }
-
-  return retval;
-}
+  pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0,
+                                        allocation.width,
+                                        allocation.height);
 
-static GdkPixbuf *
-take_window_shot (Window   child,
-                  gboolean include_decoration)
-{
-  GdkDisplay *display;
-  GdkScreen  *screen;
-  GdkWindow  *window;
-  Window      xid;
-  gint        x_orig, y_orig;
-  gint        x = 0, y = 0;
-  gint        width, height;
-  GdkPixbuf  *tmp, *tmp2;
-  GdkPixbuf  *retval;
-
-  display = gdk_display_get_default ();
-  screen = gdk_screen_get_default ();
-
-  if (include_decoration)
-    xid = find_toplevel_window (gdk_x11_display_get_xdisplay (display), child);
-  else
-    xid = child;
-
-  window = gdk_x11_window_foreign_new_for_display (display, xid);
-
-  width  = gdk_window_get_width  (window);
-  height = gdk_window_get_height (window);
-  gdk_window_get_origin (window, &x_orig, &y_orig);
-
-  if (x_orig < 0)
-    {
-      x = - x_orig;
-      width = width + x_orig;
-      x_orig = 0;
-    }
+  cairo_surface_destroy (surface);
 
-  if (y_orig < 0)
+  if (GTK_IS_OFFSCREEN_WINDOW (widget))
     {
-      y = - y_orig;
-      height = height + y_orig;
-      y_orig = 0;
-    }
+      GdkPixbuf *tmp;
 
-  if (x_orig + width > gdk_screen_get_width (screen))
-    width = gdk_screen_get_width (screen) - x_orig;
+      tmp = add_border_to_shot (pixbuf);
 
-  if (y_orig + height > gdk_screen_get_height (screen))
-    height = gdk_screen_get_height (screen) - y_orig;
+      g_object_unref (pixbuf);
 
-  tmp = gdk_pixbuf_get_from_window (window,
-                                    x, y, width, height);
+      pixbuf = create_shadowed_pixbuf (tmp);
 
-  if (include_decoration)
-    tmp2 = remove_shaped_area (tmp, xid);
-  else
-    tmp2 = add_border_to_shot (tmp);
-
-  retval = create_shadowed_pixbuf (tmp2);
-
-  g_object_unref (tmp);
-  g_object_unref (tmp2);
+      g_object_unref (tmp);
+    }
 
-  return retval;
+  return pixbuf;
 }
 
 static gboolean
@@ -196,6 +86,7 @@ shooter_get_foreground (GimpRGB *color)
 {
   color->r = color->g = color->b = 0.0;
   color->a = 1.0;
+
   return TRUE;
 }
 
@@ -204,6 +95,7 @@ shooter_get_background (GimpRGB *color)
 {
   color->r = color->g = color->b = 1.0;
   color->a = 1.0;
+
   return TRUE;
 }
 
@@ -232,11 +124,11 @@ shooter_ensure_modules (void)
 }
 
 int
-main (int argc, char **argv)
+main (int    argc,
+      char **argv)
 {
-  GdkPixbuf *screenshot = NULL;
-  GList     *toplevels;
-  GList     *node;
+  GList *toplevels;
+  GList *node;
 
   g_set_application_name ("GIMP documentation shooter");
 
@@ -246,8 +138,6 @@ main (int argc, char **argv)
   if (! gtk_init_check (&argc, &argv))
     return EXIT_SUCCESS;
 
-  gtk_rc_add_default_file (gimp_gtkrc ());
-
   units_init ();
 
   gimp_widgets_init (shooter_standard_help,
@@ -259,39 +149,29 @@ main (int argc, char **argv)
 
   for (node = toplevels; node; node = g_list_next (node))
     {
-      GdkWindow  *window;
-      WidgetInfo *info;
-      XID         xid;
-      gchar      *filename;
-
-      info = node->data;
+      WidgetInfo *info       = node->data;
+      GdkPixbuf  *screenshot = NULL;
 
-      gtk_widget_show (info->window);
-
-      window = gtk_widget_get_window (info->window);
-
-      gtk_widget_show_now (info->window);
-      gtk_widget_queue_draw (info->window);
+      gtk_widget_show (info->widget);
+      gtk_widget_queue_draw (info->widget);
 
       while (gtk_events_pending ())
-        {
-          gtk_main_iteration ();
-        }
-      sleep (1);
+        gtk_main_iteration ();
 
-      while (gtk_events_pending ())
+      screenshot = take_window_shot (info->widget);
+
+      if (screenshot)
         {
-          gtk_main_iteration ();
-        }
+          gchar *filename;
 
-      xid = gdk_x11_window_get_xid (window);
-      screenshot = take_window_shot (xid, info->include_decorations);
+          filename = g_strdup_printf ("%s.png", info->name);
+          gdk_pixbuf_save (screenshot, filename, "png", NULL, NULL);
+          g_free(filename);
 
-      filename = g_strdup_printf ("%s.png", info->name);
-      gdk_pixbuf_save (screenshot, filename, "png", NULL, NULL);
-      g_free(filename);
+          g_object_unref (screenshot);
+        }
 
-      gtk_widget_hide (info->window);
+      gtk_widget_hide (info->widget);
     }
 
   return EXIT_SUCCESS;
diff --git a/devel-docs/tools/widgets.c b/devel-docs/tools/widgets.c
index 682eb14647..af91dcba38 100644
--- a/devel-docs/tools/widgets.c
+++ b/devel-docs/tools/widgets.c
@@ -26,66 +26,10 @@
 #define LARGE_HEIGHT  240
 
 
-#if 0
-static gboolean
-adjust_size_callback (WidgetInfo *info)
-{
-  Window toplevel;
-  Window root;
-  gint   tx;
-  gint   ty;
-  guint  twidth;
-  guint  theight;
-  guint  tborder_width;
-  guint  tdepth;
-  guint  target_width = 0;
-  guint  target_height = 0;
-
-  toplevel = GDK_WINDOW_XWINDOW (gtk_widget_get_window (info->window));
-  XGetGeometry (GDK_WINDOW_XDISPLAY (gtk_widget_get_window (info->window)),
-                toplevel,
-                &root, &tx, &ty, &twidth, &theight, &tborder_width, &tdepth);
-
-  switch (info->size)
-    {
-    case SMALL:
-      target_width = SMALL_WIDTH;
-      target_height = SMALL_HEIGHT;
-      break;
-    case MEDIUM:
-      target_width = MEDIUM_WIDTH;
-      target_height = MEDIUM_HEIGHT;
-      break;
-    case LARGE:
-      target_width = LARGE_WIDTH;
-      target_height = LARGE_HEIGHT;
-      break;
-    case ASIS:
-      target_width = twidth;
-      target_height = theight;
-      break;
-    }
-
-  if (twidth > target_width ||
-      theight > target_height)
-    {
-      gtk_widget_set_size_request (info->window,
-                                   2 + target_width - (twidth - target_width), /* Dunno why I need the +2 
fudge factor; */
-                                   2 + target_height - (theight - target_height));
-    }
-  return FALSE;
-}
-
-static void
-realize_callback (WidgetInfo *info)
-{
-  g_timeout_add (500, (GSourceFunc)adjust_size_callback, info);
-}
-#endif
-
 static WidgetInfo *
 new_widget_info (const char *name,
                  GtkWidget  *widget,
+                 gboolean    show_all,
                  WidgetSize  size)
 {
   WidgetInfo *info;
@@ -93,45 +37,41 @@ new_widget_info (const char *name,
   info = g_new0 (WidgetInfo, 1);
 
   info->name     = g_strdup (name);
+  info->show_all = show_all;
   info->size     = size;
   info->no_focus = TRUE;
 
   if (GTK_IS_WINDOW (widget))
     {
-      info->window = widget;
+      info->widget = widget;
 
-      gtk_window_set_resizable (GTK_WINDOW (info->window), FALSE);
-#if 0
-      g_signal_connect_swapped (info->window, "realize",
-                                G_CALLBACK (realize_callback), info);
-#endif
+      gtk_window_set_resizable (GTK_WINDOW (info->widget), FALSE);
     }
   else
     {
-      info->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
-      gtk_window_set_accept_focus (GTK_WINDOW (info->window), FALSE);
+      info->widget = gtk_offscreen_window_new ();
 
-      gtk_container_set_border_width (GTK_CONTAINER (info->window), 12);
-      gtk_container_add (GTK_CONTAINER (info->window), widget);
-      gtk_widget_show_all (widget);
-   }
+      gtk_container_set_border_width (GTK_CONTAINER (info->widget), 12);
+      gtk_container_add (GTK_CONTAINER (info->widget), widget);
+    }
 
-  gtk_window_set_skip_taskbar_hint (GTK_WINDOW (info->window), TRUE);
+  if (info->show_all)
+    gtk_widget_show_all (widget);
+  else
+    gtk_widget_show (widget);
 
-  gtk_widget_set_app_paintable (info->window, TRUE);
-  g_signal_connect (info->window, "focus", G_CALLBACK (gtk_true), NULL);
+  g_signal_connect (info->widget, "focus", G_CALLBACK (gtk_true), NULL);
 
   switch (size)
     {
     case SMALL:
-      gtk_widget_set_size_request (info->window, SMALL_WIDTH, SMALL_HEIGHT);
+      gtk_widget_set_size_request (info->widget, SMALL_WIDTH, SMALL_HEIGHT);
       break;
     case MEDIUM:
-      gtk_widget_set_size_request (info->window, MEDIUM_WIDTH, MEDIUM_HEIGHT);
+      gtk_widget_set_size_request (info->widget, MEDIUM_WIDTH, MEDIUM_HEIGHT);
       break;
     case LARGE:
-      gtk_widget_set_size_request (info->window, LARGE_WIDTH, LARGE_HEIGHT);
+      gtk_widget_set_size_request (info->widget, LARGE_WIDTH, LARGE_HEIGHT);
       break;
     default:
       break;
@@ -166,75 +106,98 @@ static WidgetInfo *
 create_browser (void)
 {
   GtkWidget *vbox;
-  GtkWidget *align;
   GtkWidget *browser;
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   browser = gimp_browser_new ();
+  gtk_widget_set_size_request (browser, 500, 200);
+  gimp_browser_add_search_types (GIMP_BROWSER (browser),
+                                 "by name", 1,
+                                 NULL);
+  gimp_browser_show_message (GIMP_BROWSER (browser), "Result goes here");
   gtk_box_pack_start (GTK_BOX (gimp_browser_get_left_vbox (GIMP_BROWSER (browser))),
                       gtk_label_new ("TreeView goes here"), TRUE, TRUE, 0);
-  gtk_container_add (GTK_CONTAINER (align), browser);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), browser, TRUE, TRUE, 0);
+
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Browser"), FALSE, FALSE, 0);
 
-  return new_widget_info ("gimp-widget-browser", vbox, MEDIUM);
+  return new_widget_info ("gimp-widget-browser", vbox, TRUE, MEDIUM);
+}
+
+static WidgetInfo *
+create_busy_box (void)
+{
+  GtkWidget *widget;
+
+  widget = gimp_busy_box_new ("Busy Box");
+  gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
+
+  return new_widget_info ("gimp-widget-busy-box", widget, TRUE, SMALL);
 }
 
 static WidgetInfo *
 create_button (void)
 {
   GtkWidget *widget;
-  GtkWidget *align;
 
   widget = gimp_button_new ();
+  gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
+
   gtk_container_add (GTK_CONTAINER (widget),
                      gtk_label_new_with_mnemonic ("_Button"));
-  align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
-  gtk_container_add (GTK_CONTAINER (align), widget);
 
-  return new_widget_info ("gimp-widget-button", align, SMALL);
+  return new_widget_info ("gimp-widget-button", widget, TRUE, SMALL);
 }
 
 static WidgetInfo *
 create_chain_button (void)
 {
   GtkWidget *vbox;
-  GtkWidget *align;
   GtkWidget *grid;
   GtkWidget *label;
   GtkWidget *chain;
   GtkWidget *separator;
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 0.0, 0.8);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   grid = gtk_grid_new ();
+  gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (grid, GTK_ALIGN_CENTER);
   gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
   gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
-  gtk_container_add (GTK_CONTAINER (align), grid);
+  gtk_box_pack_start (GTK_BOX (vbox), grid, TRUE, TRUE, 0);
+
   chain = gimp_chain_button_new (GIMP_CHAIN_LEFT);
   gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain), TRUE);
   gtk_grid_attach (GTK_GRID (grid), chain, 0, 0, 1, 2);
+
   label = gtk_label_new ("Linked ");
   gtk_grid_attach (GTK_GRID (grid), label, 1, 0, 1, 1);
+
   label = gtk_label_new ("Linked ");
   gtk_grid_attach (GTK_GRID (grid), label, 1, 1, 1, 1);
+
   separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
   gtk_grid_attach (GTK_GRID (grid), separator, 2, 0, 1, 2);
+
   label = gtk_label_new (" Unlinked");
   gtk_grid_attach (GTK_GRID (grid), label, 3, 0, 1, 1);
+
   label = gtk_label_new (" Unlinked");
   gtk_grid_attach (GTK_GRID (grid), label, 3, 1, 1, 1);
+
   chain = gimp_chain_button_new (GIMP_CHAIN_RIGHT);
   gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (chain), FALSE);
   gtk_grid_attach (GTK_GRID (grid), chain, 4, 0, 1, 2);
 
   gtk_box_pack_end (GTK_BOX (vbox), gtk_label_new ("Chain Button"),
-                    TRUE, TRUE, 0);
+                    FALSE, FALSE, 0);
 
-  return new_widget_info ("gimp-widget-chain-button", vbox, MEDIUM);
+  return new_widget_info ("gimp-widget-chain-button", vbox, TRUE, MEDIUM);
 }
 
 static WidgetInfo *
@@ -242,22 +205,23 @@ create_color_area (void)
 {
   GtkWidget *vbox;
   GtkWidget *area;
-  GtkWidget *align;
   GimpRGB    color;
 
   color_init (&color);
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 0.5, 1.0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   area = gimp_color_area_new (&color, GIMP_COLOR_AREA_SMALL_CHECKS, 0);
+  gtk_widget_set_halign (area, GTK_ALIGN_FILL);
+  gtk_widget_set_valign (area, GTK_ALIGN_CENTER);
   gimp_color_area_set_draw_border (GIMP_COLOR_AREA (area), TRUE);
   gtk_widget_set_size_request (area, -1, 25);
-  gtk_container_add (GTK_CONTAINER (align), area);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), area, TRUE, TRUE, 0);
+
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Color Area"), FALSE, FALSE, 0);
 
-  return new_widget_info ("gimp-widget-color-area", vbox, SMALL);
+  return new_widget_info ("gimp-widget-color-area", vbox, TRUE, SMALL);
 }
 
 static WidgetInfo *
@@ -265,22 +229,23 @@ create_color_button (void)
 {
   GtkWidget *vbox;
   GtkWidget *button;
-  GtkWidget *align;
   GimpRGB    color;
 
   color_init (&color);
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 0.5, 1.0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   button =  gimp_color_button_new ("Color Button",
                                    80, 20, &color,
                                    GIMP_COLOR_AREA_SMALL_CHECKS);
-  gtk_container_add (GTK_CONTAINER (align), button);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+  gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
+  gtk_container_add (GTK_CONTAINER (vbox), button);
+
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Color Button"), FALSE, FALSE, 0);
 
-  return new_widget_info ("gimp-widget-color-button", vbox, SMALL);
+  return new_widget_info ("gimp-widget-color-button", vbox, TRUE, SMALL);
 }
 
 static WidgetInfo *
@@ -288,21 +253,22 @@ create_color_hex_entry (void)
 {
   GtkWidget *vbox;
   GtkWidget *entry;
-  GtkWidget *align;
   GimpRGB    color;
 
   color_init (&color);
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 0.5, 0.0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   entry = gimp_color_hex_entry_new ();
+  gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (entry, GTK_ALIGN_CENTER);
   gimp_color_hex_entry_set_color (GIMP_COLOR_HEX_ENTRY (entry), &color);
-  gtk_container_add (GTK_CONTAINER (align), entry);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0);
+
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Color Hex Entry"), FALSE, FALSE, 0);
 
-  return new_widget_info ("gimp-widget-color-hex-entry", vbox, SMALL);
+  return new_widget_info ("gimp-widget-color-hex-entry", vbox, TRUE, SMALL);
 }
 
 static WidgetInfo *
@@ -310,21 +276,44 @@ create_color_profile_combo_box (void)
 {
   GtkWidget *vbox;
   GtkWidget *combo;
-  GtkWidget *align;
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 0.5, 0.0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   combo = gimp_color_profile_combo_box_new (gtk_dialog_new (), NULL);
+  gtk_widget_set_halign (combo, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (combo, GTK_ALIGN_CENTER);
   gimp_color_profile_combo_box_add_file (GIMP_COLOR_PROFILE_COMBO_BOX (combo),
                                          NULL, "sRGB");
   gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
-  gtk_container_add (GTK_CONTAINER (align), combo);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), combo, TRUE, TRUE, 0);
+
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Color Profile Combo Box"),
                       FALSE, FALSE, 0);
 
-  return new_widget_info ("gimp-widget-color-profile-combo-box", vbox, SMALL);
+  return new_widget_info ("gimp-widget-color-profile-combo-box", vbox, TRUE, SMALL);
+}
+
+static WidgetInfo *
+create_color_profile_view (void)
+{
+  GtkWidget *vbox;
+  GtkWidget *view;
+
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
+  view = gimp_color_profile_view_new ();
+  gtk_widget_set_halign (view, GTK_ALIGN_FILL);
+  gtk_widget_set_valign (view, GTK_ALIGN_CENTER);
+  gimp_color_profile_view_set_profile (GIMP_COLOR_PROFILE_VIEW (view),
+                                       gimp_color_profile_new_rgb_srgb ());
+  gtk_box_pack_start (GTK_BOX (vbox), view, TRUE, TRUE, 0);
+
+  gtk_box_pack_start (GTK_BOX (vbox),
+                      gtk_label_new ("Color Profile View"),
+                      FALSE, FALSE, 0);
+
+  return new_widget_info ("gimp-widget-color-profile-view", vbox, TRUE, SMALL);
 }
 
 static WidgetInfo *
@@ -332,25 +321,26 @@ create_color_scale (void)
 {
   GtkWidget *vbox;
   GtkWidget *scale;
-  GtkWidget *align;
   GimpRGB    rgb;
   GimpHSV    hsv;
 
   color_init (&rgb);
   gimp_rgb_to_hsv (&rgb, &hsv);
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 0.8, 0.0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   scale = gimp_color_scale_new (GTK_ORIENTATION_HORIZONTAL,
                                 GIMP_COLOR_SELECTOR_HUE);
+  gtk_widget_set_halign (scale, GTK_ALIGN_FILL);
+  gtk_widget_set_valign (scale, GTK_ALIGN_CENTER);
   gimp_color_scale_set_color (GIMP_COLOR_SCALE (scale), &rgb, &hsv);
   gtk_range_set_value (GTK_RANGE (scale), 40);
-  gtk_container_add (GTK_CONTAINER (align), scale);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), scale, TRUE, TRUE, 0);
+
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Color Scale"), FALSE, FALSE, 0);
 
-  return new_widget_info ("gimp-widget-color-scale", vbox, SMALL);
+  return new_widget_info ("gimp-widget-color-scale", vbox, TRUE, SMALL);
 }
 
 static WidgetInfo *
@@ -358,23 +348,27 @@ create_color_selection (void)
 {
   GtkWidget *vbox;
   GtkWidget *selection;
-  GtkWidget *align;
+  GtkWidget *label;
   GimpRGB    color;
 
   color_init (&color);
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   selection = gimp_color_selection_new ();
-  gimp_color_selection_set_show_alpha(GIMP_COLOR_SELECTION (selection), TRUE);
-  gimp_color_selection_set_color  (GIMP_COLOR_SELECTION (selection), &color);
+  gtk_widget_set_halign (selection, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (selection, GTK_ALIGN_CENTER);
   gtk_widget_set_size_request (selection, 400, -1);
-  gtk_container_add (GTK_CONTAINER (align), selection);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (vbox),
-                      gtk_label_new ("Color Selection"), FALSE, FALSE, 0);
+  gimp_color_selection_set_show_alpha (GIMP_COLOR_SELECTION (selection), TRUE);
+  gimp_color_selection_set_color (GIMP_COLOR_SELECTION (selection), &color);
+  gtk_box_pack_start (GTK_BOX (vbox), selection, TRUE, TRUE, 0);
+  gtk_widget_show (selection);
+
+  label = gtk_label_new ("Color Selection");
+  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+  gtk_widget_show (label);
 
-  return new_widget_info ("gimp-widget-color-selection", vbox, ASIS);
+  return new_widget_info ("gimp-widget-color-selection", vbox, FALSE, ASIS);
 }
 
 static WidgetInfo *
@@ -397,8 +391,7 @@ create_dialog (void)
   content = gtk_dialog_get_content_area (GTK_DIALOG (widget));
   gtk_container_add (GTK_CONTAINER (content), label);
   gtk_widget_show (label);
-  info = new_widget_info ("gimp-widget-dialog", widget, MEDIUM);
-  info->include_decorations = TRUE;
+  info = new_widget_info ("gimp-widget-dialog", widget, TRUE, MEDIUM);
 
   return info;
 }
@@ -408,18 +401,19 @@ create_enum_combo_box (void)
 {
   GtkWidget *vbox;
   GtkWidget *combo;
-  GtkWidget *align;
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 0.5, 0.0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   combo = gimp_enum_combo_box_new (GIMP_TYPE_CHANNEL_TYPE);
+  gtk_widget_set_halign (combo, GTK_ALIGN_FILL);
+  gtk_widget_set_valign (combo, GTK_ALIGN_CENTER);
   gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), GIMP_CHANNEL_BLUE);
-  gtk_container_add (GTK_CONTAINER (align), combo);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), combo, TRUE, TRUE, 0);
+
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Enum Combo Box"), FALSE, FALSE, 0);
 
-  return new_widget_info ("gimp-widget-enum-combo-box", vbox, SMALL);
+  return new_widget_info ("gimp-widget-enum-combo-box", vbox, TRUE, SMALL);
 }
 
 static WidgetInfo *
@@ -427,17 +421,18 @@ create_enum_label (void)
 {
   GtkWidget *vbox;
   GtkWidget *label;
-  GtkWidget *align;
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 0.5, 0.0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   label = gimp_enum_label_new (GIMP_TYPE_IMAGE_BASE_TYPE, GIMP_RGB);
-  gtk_container_add (GTK_CONTAINER (align), label);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+  gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
+  gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
+
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Enum Label"), FALSE, FALSE, 0);
 
-  return new_widget_info ("gimp-widget-enum-label", vbox, SMALL);
+  return new_widget_info ("gimp-widget-enum-label", vbox, TRUE, SMALL);
 }
 
 static WidgetInfo *
@@ -445,19 +440,20 @@ create_file_entry (void)
 {
   GtkWidget *vbox;
   GtkWidget *entry;
-  GtkWidget *align;
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 0.5, 0.0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   entry = gimp_file_entry_new ("File Entry",
                                "wilber.png",
                                FALSE, TRUE);
-  gtk_container_add (GTK_CONTAINER (align), entry);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+  gtk_widget_set_halign (entry, GTK_ALIGN_FILL);
+  gtk_widget_set_valign (entry, GTK_ALIGN_CENTER);
+  gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0);
+
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("File Entry"), FALSE, FALSE, 0);
 
-  return new_widget_info ("gimp-widget-file-entry", vbox, SMALL);
+  return new_widget_info ("gimp-widget-file-entry", vbox, TRUE, SMALL);
 }
 
 static WidgetInfo *
@@ -472,7 +468,7 @@ create_frame (void)
   gtk_label_set_yalign (GTK_LABEL (content), 0.0);
   gtk_container_add (GTK_CONTAINER (frame), content);
 
-  return new_widget_info ("gimp-widget-frame", frame, MEDIUM);
+  return new_widget_info ("gimp-widget-frame", frame, TRUE, MEDIUM);
 }
 
 static WidgetInfo *
@@ -480,7 +476,7 @@ create_hint_box (void)
 {
   GtkWidget *box = gimp_hint_box_new ("This is a user hint.");
 
-  return new_widget_info ("gimp-widget-hint-box", box, MEDIUM);
+  return new_widget_info ("gimp-widget-hint-box", box, TRUE, MEDIUM);
 }
 
 static WidgetInfo *
@@ -488,18 +484,19 @@ create_number_pair_entry (void)
 {
   GtkWidget *vbox;
   GtkWidget *entry;
-  GtkWidget *align;
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 0.5, 0.0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   entry =  gimp_number_pair_entry_new (":/", TRUE, 0.001, GIMP_MAX_IMAGE_SIZE);
+  gtk_widget_set_halign (entry, GTK_ALIGN_FILL);
+  gtk_widget_set_valign (entry, GTK_ALIGN_CENTER);
   gimp_number_pair_entry_set_values (GIMP_NUMBER_PAIR_ENTRY (entry), 4, 3);
-  gtk_container_add (GTK_CONTAINER (align), entry);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0);
+
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Number Pair Entry"), FALSE, FALSE, 0);
 
-  return new_widget_info ("gimp-widget-number-pair-entry", vbox, SMALL);
+  return new_widget_info ("gimp-widget-number-pair-entry", vbox, TRUE, SMALL);
 }
 
 static WidgetInfo *
@@ -507,10 +504,9 @@ create_int_combo_box (void)
 {
   GtkWidget *vbox;
   GtkWidget *combo;
-  GtkWidget *align;
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 0.5, 0.0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   combo = gimp_int_combo_box_new ("Sobel",        1,
                                   "Prewitt",      2,
                                   "Gradient",     3,
@@ -518,14 +514,15 @@ create_int_combo_box (void)
                                   "Differential", 5,
                                   "Laplace",      6,
                                   NULL);
+  gtk_widget_set_halign (combo, GTK_ALIGN_FILL);
+  gtk_widget_set_valign (combo, GTK_ALIGN_CENTER);
   gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo), 1);
+  gtk_box_pack_start (GTK_BOX (vbox), combo, TRUE, TRUE, 0);
 
-  gtk_container_add (GTK_CONTAINER (align), combo);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Int Combo Box"), FALSE, FALSE, 0);
 
-  return new_widget_info ("gimp-widget-int-combo-box", vbox, SMALL);
+  return new_widget_info ("gimp-widget-int-combo-box", vbox, TRUE, SMALL);
 }
 
 static WidgetInfo *
@@ -533,18 +530,19 @@ create_memsize_entry (void)
 {
   GtkWidget *vbox;
   GtkWidget *entry;
-  GtkWidget *align;
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   entry = gimp_memsize_entry_new ((3 * 1024 + 512) * 1024,
                                   0, 1024 * 1024 * 1024);
-  gtk_container_add (GTK_CONTAINER (align), entry);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+  gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (entry, GTK_ALIGN_CENTER);
+  gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0);
+
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Memsize Entry"), FALSE, FALSE, 0);
 
-  return new_widget_info ("gimp-widget-memsize-entry", vbox, SMALL);
+  return new_widget_info ("gimp-widget-memsize-entry", vbox, TRUE, SMALL);
 }
 
 static WidgetInfo *
@@ -553,22 +551,24 @@ create_offset_area (void)
   GtkWidget *vbox;
   GtkWidget *frame;
   GtkWidget *area;
-  GtkWidget *align;
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   frame = gtk_frame_new (NULL);
+  gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
-  gtk_container_add (GTK_CONTAINER (align), frame);
+  gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
+
   area = gimp_offset_area_new (100, 100);
   gimp_offset_area_set_size (GIMP_OFFSET_AREA (area), 180, 160);
   gimp_offset_area_set_offsets (GIMP_OFFSET_AREA (area), 30, 30);
   gtk_container_add (GTK_CONTAINER (frame), area);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Offset Area"), FALSE, FALSE, 0);
 
-  return new_widget_info ("gimp-widget-offset-area", vbox, LARGE);
+  return new_widget_info ("gimp-widget-offset-area", vbox, TRUE, LARGE);
 }
 
 static WidgetInfo *
@@ -577,17 +577,18 @@ create_page_selector (void)
   GtkWidget *vbox;
   GtkWidget *selector;
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
   selector = gimp_page_selector_new ();
   gtk_widget_set_size_request (selector, -1, 240);
   gimp_page_selector_set_n_pages (GIMP_PAGE_SELECTOR (selector), 16);
   gimp_page_selector_select_range (GIMP_PAGE_SELECTOR (selector),
                                    "1,3,7-9,12-15");
   gtk_box_pack_start (GTK_BOX (vbox), selector, TRUE, TRUE, 0);
+
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Page Selector"), FALSE, FALSE, 0);
 
-  return new_widget_info ("gimp-widget-page-selector", vbox, ASIS);
+  return new_widget_info ("gimp-widget-page-selector", vbox, TRUE, ASIS);
 }
 
 static WidgetInfo *
@@ -595,23 +596,24 @@ create_path_editor (void)
 {
   GtkWidget *vbox;
   GtkWidget *editor;
-  GtkWidget *align;
   gchar     *config = gimp_config_build_data_path ("patterns");
   gchar     *path   = gimp_config_path_expand (config, TRUE, NULL);
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   editor = gimp_path_editor_new ("Path Editor", path);
+  gtk_widget_set_halign (editor, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (editor, GTK_ALIGN_CENTER);
   gtk_widget_set_size_request (editor, -1, 240);
-  gtk_container_add (GTK_CONTAINER (align), editor);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), editor, TRUE, TRUE, 0);
+
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Path Editor"), FALSE, FALSE, 0);
 
   g_free (path);
   g_free (config);
 
-  return new_widget_info ("gimp-widget-path-editor", vbox, ASIS);
+  return new_widget_info ("gimp-widget-path-editor", vbox, TRUE, ASIS);
 }
 
 static WidgetInfo *
@@ -619,17 +621,18 @@ create_pick_button (void)
 {
   GtkWidget *vbox;
   GtkWidget *button;
-  GtkWidget *align;
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 0.5, 1.0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   button =  gimp_pick_button_new ();
-  gtk_container_add (GTK_CONTAINER (align), button);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+  gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
+  gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
+
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Pick Button"), FALSE, FALSE, 0);
 
-  return new_widget_info ("gimp-widget-pick-button", vbox, SMALL);
+  return new_widget_info ("gimp-widget-pick-button", vbox, TRUE, SMALL);
 }
 
 static gboolean
@@ -654,25 +657,26 @@ create_preview_area (void)
 {
   GtkWidget *vbox;
   GtkWidget *area;
-  GtkWidget *align;
   GdkPixbuf *pixbuf;
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   area =  gimp_preview_area_new ();
+  gtk_widget_set_halign (area, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (area, GTK_ALIGN_CENTER);
   g_signal_connect (area, "realize",
                     G_CALLBACK (area_realize), NULL);
-  gtk_container_add (GTK_CONTAINER (align), area);
   pixbuf = load_image ("wilber-wizard.png");
   gtk_widget_set_size_request (area,
                                gdk_pixbuf_get_width (pixbuf),
                                gdk_pixbuf_get_height (pixbuf));
   g_object_unref (pixbuf);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), area, TRUE, TRUE, 0);
+
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("Preview Area"), FALSE, FALSE, 0);
 
-  return new_widget_info ("gimp-widget-preview-area", vbox, MEDIUM);
+  return new_widget_info ("gimp-widget-preview-area", vbox, TRUE, MEDIUM);
 }
 
 static WidgetInfo *
@@ -680,24 +684,44 @@ create_string_combo_box (void)
 {
   GtkWidget    *vbox;
   GtkWidget    *combo;
-  GtkWidget    *align;
   GtkListStore *store;
 
-  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  align = gtk_alignment_new (0.5, 0.5, 0.5, 0.0);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
   store = gtk_list_store_new (1, G_TYPE_STRING);
   gtk_list_store_insert_with_values (store, NULL, 0, 0, "Foo", -1);
   gtk_list_store_insert_with_values (store, NULL, 1, 0, "Bar", -1);
   combo = gimp_string_combo_box_new (GTK_TREE_MODEL (store), 0, 0);
+  gtk_widget_set_halign (combo, GTK_ALIGN_FILL);
+  gtk_widget_set_valign (combo, GTK_ALIGN_CENTER);
   g_object_unref (store);
   gimp_string_combo_box_set_active (GIMP_STRING_COMBO_BOX (combo), "Foo");
+  gtk_box_pack_start (GTK_BOX (vbox), combo, TRUE, TRUE, 0);
 
-  gtk_container_add (GTK_CONTAINER (align), combo);
-  gtk_box_pack_start (GTK_BOX (vbox), align, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (vbox),
                       gtk_label_new ("String Combo Box"), FALSE, FALSE, 0);
 
-  return new_widget_info ("gimp-widget-string-combo-box", vbox, SMALL);
+  return new_widget_info ("gimp-widget-string-combo-box", vbox, TRUE, SMALL);
+}
+
+static WidgetInfo *
+create_unit_combo_box (void)
+{
+  GtkWidget *vbox;
+  GtkWidget *combo;
+
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
+
+  combo = gimp_unit_combo_box_new ();
+  gtk_widget_set_halign (combo, GTK_ALIGN_FILL);
+  gtk_widget_set_valign (combo, GTK_ALIGN_CENTER);
+  gimp_unit_combo_box_set_active (GIMP_UNIT_COMBO_BOX (combo), GIMP_UNIT_INCH);
+  gtk_box_pack_start (GTK_BOX (vbox), combo, TRUE, TRUE, 0);
+
+  gtk_box_pack_start (GTK_BOX (vbox),
+                      gtk_label_new ("Unit Combo Box"), FALSE, FALSE, 0);
+
+  return new_widget_info ("gimp-widget-unit-combo-box", vbox, TRUE, SMALL);
 }
 
 GList *
@@ -706,12 +730,14 @@ get_all_widgets (void)
   GList *retval = NULL;
 
   retval = g_list_append (retval, create_browser ());
+  retval = g_list_append (retval, create_busy_box ());
   retval = g_list_append (retval, create_button ());
   retval = g_list_append (retval, create_chain_button ());
   retval = g_list_append (retval, create_color_area ());
   retval = g_list_append (retval, create_color_button ());
   retval = g_list_append (retval, create_color_hex_entry ());
   retval = g_list_append (retval, create_color_profile_combo_box ());
+  retval = g_list_append (retval, create_color_profile_view ());
   retval = g_list_append (retval, create_color_scale ());
   retval = g_list_append (retval, create_color_selection ());
   retval = g_list_append (retval, create_dialog ());
@@ -729,6 +755,7 @@ get_all_widgets (void)
   retval = g_list_append (retval, create_pick_button ());
   retval = g_list_append (retval, create_preview_area ());
   retval = g_list_append (retval, create_string_combo_box ());
+  retval = g_list_append (retval, create_unit_combo_box ());
 
   return retval;
 }
diff --git a/devel-docs/tools/widgets.h b/devel-docs/tools/widgets.h
index 53925cb073..1542320e02 100644
--- a/devel-docs/tools/widgets.h
+++ b/devel-docs/tools/widgets.h
@@ -12,10 +12,10 @@ typedef enum
 
 typedef struct WidgetInfo
 {
-  GtkWidget  *window;
+  GtkWidget  *widget;
   gchar      *name;
   gboolean    no_focus;
-  gboolean    include_decorations;
+  gboolean    show_all;
   WidgetSize  size;
 } WidgetInfo;
 



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