Index: gtk/gtktypeutils.c
===================================================================
--- gtk/gtktypeutils.c	(revision 135)
+++ gtk/gtktypeutils.c	(working copy)
@@ -28,12 +28,15 @@
 
 #include <config.h>
 #include <string.h> /* strcmp */
-
+#include <stdlib.h> /* strtol, strtoul */
+#include <gdk/gdkcolor.h>
 #include "gtktypeutils.h"
+#include "gtkadjustment.h"
+#include "gtkwidget.h"
 #include "gtkobject.h"
 #include "gtkintl.h"
 #include "gtkalias.h"
-
+#include "gtk.h"
 
 /* --- functions --- */
 GtkType
@@ -199,6 +202,261 @@ gtk_type_flags_find_value (GtkType      
   return value;
 }
 
+/**
+ * gtk_enum_from_string
+ * @type: the GType for this enum type.
+ * @string: the string representation of the enum value.
+ *
+ * Returns: the integer value for this enumeration, or 0 if it couldn't be
+ * found.
+ */
+gint
+gtk_enum_from_string (GType type, const char *string)
+{
+  GEnumClass *eclass;
+  GEnumValue *ev;
+  gchar *endptr;
+  gint ret = 0;
+
+  ret = strtoul (string, &endptr, 0);
+  if (endptr != string) /* parsed a number */
+    return ret;
+
+  eclass = g_type_class_ref (type);
+  ev = g_enum_get_value_by_name (eclass, string);
+  if (!ev)
+    ev = g_enum_get_value_by_nick (eclass, string);
+  
+  if (ev)
+    ret = ev->value;
+
+  g_type_class_unref (eclass);
+
+  return ret;
+}
+
+/**
+ * gtk_flags_from_string
+ * @type: the GType for this flags type.
+ * @string: the string representation of the flags value.
+ *
+ * The string is composed of string names or nicknames for various
+ * flags separated by '|'.
+ *
+ * Returns: the integer value for this flags string
+ */
+guint
+gtk_flags_from_string (GType type, const char *string)
+{
+  GFlagsClass *fclass;
+  gchar *endptr, *prevptr;
+  guint i, j, ret;
+  char *flagstr;
+  GFlagsValue *fv;
+  const char  *flag;
+  gunichar ch;
+  gboolean eos;
+
+  ret = strtoul (string, &endptr, 0);
+  if (endptr != string) /* parsed a number */
+    return ret;
+
+  fclass = g_type_class_ref (type);
+
+  flagstr = g_strdup (string);
+  for (ret = i = j = 0; ; i++)
+    {
+      
+      eos = flagstr[i] == '\0';
+      
+      if (!eos && flagstr[i] != '|')
+	continue;
+    
+      flag = &flagstr[j];
+      endptr = &flagstr[i];
+    
+      if (!eos)
+	{
+	  flagstr[i++] = '\0';
+	  j = i;
+	}
+
+      /* trim spaces */
+      for (;;)
+	{
+	  ch = g_utf8_get_char (flag);
+	  if (!g_unichar_isspace (ch))
+	    break;
+	  flag = g_utf8_next_char (flag);
+	}
+
+      while (endptr > flag)
+	{
+	  prevptr = g_utf8_prev_char (endptr);
+	  ch = g_utf8_get_char (prevptr);
+	  if (!g_unichar_isspace (ch))
+	    break;
+	  endptr = prevptr;
+	}
+
+      if (endptr > flag)
+	{
+	  *endptr = '\0';
+	  fv = g_flags_get_value_by_name (fclass, flag);
+	
+	  if (!fv)
+	    fv = g_flags_get_value_by_nick (fclass, flag);
+	
+	  if (fv)
+	    ret |= fv->value;
+	  else
+	    g_warning ("Unknown flag: '%s'", flag);
+	}
+    
+      if (eos)
+	break;
+    }
+
+  g_free (flagstr);
+
+  g_type_class_unref (fclass);
+  
+  return ret;
+}
+
+static GHashTable* type_table;
+
+typedef struct {
+  gchar *name;
+  GTypeGetFunc func;
+} GtkTypeEntry;
+
+static const GtkTypeEntry infos[] = {
+  { "GdkPixbuf", gdk_pixbuf_get_type },
+  { "GtkAboutDialog", gtk_about_dialog_get_type },
+  { "GtkAccelLabel", gtk_accel_label_get_type },
+  { "GtkAction", gtk_action_get_type },
+  { "GtkActionGroup", gtk_action_group_get_type },
+  { "GtkAdjustment", gtk_adjustment_get_type },
+  { "GtkAlignment", gtk_alignment_get_type },
+  { "GtkArrow", gtk_arrow_get_type },
+  { "GtkAspectFrame", gtk_aspect_frame_get_type },
+  { "GtkAssistant", gtk_assistant_get_type },
+  { "GtkButton", gtk_button_get_type },
+  { "GtkCalendar", gtk_calendar_get_type },
+  { "GtkCheckButton", gtk_check_button_get_type },
+  { "GtkCellRenderer", gtk_cell_renderer_get_type },
+  { "GtkCellRendererText", gtk_cell_renderer_text_get_type },
+  { "GtkCellView", gtk_cell_view_get_type },
+  { "GtkColorButton", gtk_color_button_get_type },
+  { "GtkColorSelection", gtk_color_selection_get_type },
+  { "GtkColorSelectionDialog", gtk_color_selection_dialog_get_type },
+  { "GtkComboBox", gtk_combo_box_get_type },
+  { "GtkComboBoxEntry", gtk_combo_box_entry_get_type },
+  { "GtkCurve", gtk_curve_get_type },
+  { "GtkDialog", gtk_dialog_get_type },
+  { "GtkDrawingArea", gtk_drawing_area_get_type },
+  { "GtkEventBox", gtk_event_box_get_type },
+  { "GtkEntry", gtk_entry_get_type },
+  { "GtkEntryCompletion", gtk_entry_completion_get_type },
+  { "GtkFileChooser", gtk_file_chooser_get_type },
+  { "GtkFileChooserDialog", gtk_file_chooser_dialog_get_type },
+  { "GtkFileChooserButton", gtk_file_chooser_button_get_type },
+  { "GtkFileSelection", gtk_file_selection_get_type },
+  { "GtkFixed", gtk_fixed_get_type },
+  { "GtkFontSelection", gtk_font_selection_get_type },
+  { "GtkFontSelectionDialog", gtk_font_selection_dialog_get_type },
+  { "GtkFrame", gtk_frame_get_type },
+  { "GtkExpander", gtk_expander_get_type },
+  { "GtkFontButton", gtk_font_button_get_type },
+  { "GtkGammaCurve", gtk_gamma_curve_get_type },
+  { "GtkHandleBox", gtk_handle_box_get_type },
+  { "GtkHButtonBox", gtk_hbutton_box_get_type },
+  { "GtkHBox", gtk_hbox_get_type },
+  { "GtkHPaned", gtk_hpaned_get_type },
+  { "GtkHRuler", gtk_hruler_get_type },
+  { "GtkHScale", gtk_hscale_get_type },
+  { "GtkHScrollbar", gtk_hscrollbar_get_type },
+  { "GtkHSeparator", gtk_hseparator_get_type },
+  { "GtkIconView", gtk_icon_view_get_type },
+  { "GtkImage", gtk_image_get_type },
+  { "GtkInputDialog ", gtk_input_dialog_get_type },
+  { "GtkLabel", gtk_label_get_type },
+  { "GtkLayout", gtk_layout_get_type },
+  { "GtkLinkButton", gtk_link_button_get_type },
+  { "GtkListStore", gtk_list_store_get_type },
+  { "GtkMenu", gtk_menu_get_type },
+  { "GtkMenuBar", gtk_menu_bar_get_type },
+  { "GtkMessageDialog", gtk_message_dialog_get_type },
+  { "GtkNotebook", gtk_notebook_get_type },
+  { "GtkProgressBar", gtk_progress_bar_get_type },
+  { "GtkRadioAction", gtk_radio_action_get_type },
+  { "GtkRadioButton", gtk_radio_button_get_type },
+  { "GtkRecentChooserDialog", gtk_recent_chooser_dialog_get_type },
+  { "GtkSizeGroup", gtk_size_group_get_type },
+  { "GtkScrolledWindow", gtk_scrolled_window_get_type },
+  { "GtkSpinButton", gtk_spin_button_get_type },
+  { "GtkStatusbar", gtk_statusbar_get_type },
+  { "GtkTextBuffer", gtk_text_buffer_get_type },
+  { "GtkTextView", gtk_text_view_get_type },
+  { "GtkToggleAction", gtk_toggle_action_get_type },
+  { "GtkToggleButton", gtk_toggle_button_get_type },
+  { "GtkToolbar", gtk_toolbar_get_type },
+  { "GtkTooltips", gtk_tooltips_get_type },
+  { "GtkTreeModelFilter", gtk_tree_model_filter_get_type },
+  { "GtkTreeModelSort", gtk_tree_model_sort_get_type },
+  { "GtkTreeStore", gtk_tree_store_get_type },
+  { "GtkTreeView", gtk_tree_view_get_type },
+  { "GtkTreeViewColumn", gtk_tree_view_column_get_type },
+  { "GtkTable", gtk_table_get_type },
+  { "GtkVBox", gtk_vbox_get_type },
+  { "GtkVButtonBox", gtk_vbutton_box_get_type },
+  { "GtkVScrollbar", gtk_vscrollbar_get_type },
+  { "GtkVSeparator", gtk_vseparator_get_type },
+  { "GtkViewport", gtk_viewport_get_type },
+  { "GtkVRuler", gtk_vruler_get_type },
+  { "GtkVPaned", gtk_vpaned_get_type },
+  { "GtkVScale", gtk_vscale_get_type },
+  { "GtkWindow", gtk_window_get_type },
+  { "GtkUIManager", gtk_ui_manager_get_type },
+  { NULL, NULL }
+};
+
+GType
+gtk_lazy_type_from_name (const gchar *name)
+{
+  GType gtype;
+  
+  gtype = g_type_from_name (name);
+  
+  if (gtype == G_TYPE_INVALID)
+    {
+      GTypeGetFunc func = g_hash_table_lookup (type_table, name);
+      if (func)
+	gtype = func ();
+    }
+  
+  return gtype;
+}
+
+void
+gtk_type_register (const gchar *name, GTypeGetFunc func)
+{
+  g_return_if_fail (g_hash_table_lookup (type_table, name) == NULL);
+    
+  g_hash_table_insert (type_table, name, func);
+}
+			 
+void
+_gtk_type_table_init (void)
+{
+  int i;
+  
+  type_table = g_hash_table_new (g_str_hash, g_str_equal);
+  
+  for (i = 0; infos[i].name; i++)
+    g_hash_table_insert (type_table, infos[i].name, infos[i].func);
+}
 
 #define __GTK_TYPE_UTILS_C__
 #include "gtkaliasdef.c"
Index: gtk/gtktypeutils.h
===================================================================
--- gtk/gtktypeutils.h	(revision 135)
+++ gtk/gtktypeutils.h	(working copy)
@@ -229,8 +229,19 @@
 
 #endif /* GTK_DISABLE_DEPRECATED */
 
+typedef GType (*GTypeGetFunc) (void);
+
 gpointer	gtk_type_class	(GtkType	 type);
 
+void            _gtk_type_table_init    (void);
+void            gtk_type_register       (const gchar  *name,
+					 GTypeGetFunc  func);
+GType           gtk_lazy_type_from_name (const gchar  *name);
+guint           gtk_flags_from_string   (GType         type,
+				         const char   *string);
+gint            gtk_enum_from_string    (GType         type,
+				         const char   *string);
+
 #ifndef GTK_DISABLE_DEPRECATED
 
 GtkType		gtk_type_unique	(GtkType	   parent_type,
Index: gtk/gtkmain.c
===================================================================
--- gtk/gtkmain.c	(revision 135)
+++ gtk/gtkmain.c	(working copy)
@@ -159,7 +159,8 @@ static const GDebugKey gtk_debug_keys[] 
   {"multihead", GTK_DEBUG_MULTIHEAD},
   {"modules", GTK_DEBUG_MODULES},
   {"geometry", GTK_DEBUG_GEOMETRY},
-  {"icontheme", GTK_DEBUG_ICONTHEME}
+  {"icontheme", GTK_DEBUG_ICONTHEME},
+  {"builder", GTK_DEBUG_BUILDER}
 };
 #endif /* G_ENABLE_DEBUG */
 
@@ -503,6 +504,7 @@ do_post_parse_initialization (int    *ar
   }
 
   gtk_type_init (0);
+  _gtk_type_table_init ();
   _gtk_accel_map_init ();  
   _gtk_rc_init ();
 
