Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/glade3/ChangeLog,v
retrieving revision 1.312
diff -u -p -r1.312 ChangeLog
--- ChangeLog	27 Oct 2004 18:35:21 -0000	1.312
+++ ChangeLog	28 Oct 2004 17:19:36 -0000
@@ -1,3 +1,57 @@
+2004-10-28  Tristan Van Berkom  <tristan.van.berkom@gmail.com>
+
+	* src/glade-editor.[ch]: Implemented glade_editor_query_popup(), also obsoleted
+	  common & packing booleans for a more convenient GladeEditorTableType field.
+
+	* src/glade-gtk.c: 
+	  - Refitted and integrated Mickael Cornet's patch to bug 153823
+	  - glade_gtk_table_set_n_common() now refuses to shrink when it involves
+	    orhpaning widgets, Its also been improved to fill in all the blanks.
+	  - Removed all dialogs.
+	  - Fixed children are now born with size-request properties enabled.
+	  - Removed some `#if 0' code that I trust we dont need.
+	  - glade_gtk_box_set_size() Adjusted to match gtk_table behaviour
+	
+	* src/glade-plugin.h:
+	  - Added a header to the batch.
+
+	* src/glade-popup.c: glade_popup_copy_cb() now duplicates the
+	  widget in question with glade_widget_dup().
+
+	* src/glade-property-class.[ch]: glade_property_class_update_from_node() now
+	  flags properties that need a pupop dialog at creation time.
+
+	* src/glade-property.[ch]: Implemented glade_property_sync() (Sychronizes
+	  the object with its glade_property), glade_property_set() now calls
+	  glade_property_sync().
+
+	* src/glade-widget.[ch]:
+	  - Implemented glade_widget_dup().
+	  - Added call to glade_property_sync on appropriate properties that
+	    need to be synchronized after a glade_widget_rebuild().
+	  - Added a call to glade_editor_query_popup() in the appropriate situation.
+	  - glade_widget_build_object() now takes into account property_class default values
+	  - glade_widget_new() now calls new function glade_widget_sync_query_props() in
+	    popup cases (If properties dont change from there default, a synchronization is
+	    needed at this point).
+	
+	* widgets/gtkbox.xml:
+	  - Removed reference to obsoleted post_create function.
+	  - Changed `ignore' to `empty' for the fill_empty funciton.
+	  - Tagged "Size" property as type "Query".
+	  - Added Default size 3
+	
+	* widgets/gtknotebook.xml:
+	  - Tagged "pages" property as type "Query".
+	  - Removed obsolete (or never implemented) Query section.
+
+	* widgets/gtktable.xml:
+	  - Tagged "n-rows" and "n-columns" properties as type "Query".
+	  - Removed obsolete (or never implemented) Query section.
+
+	* widgets/gtklabel.xml: Added default "" value for pattern property, this
+	  works around gtk+ bug 156720 which was causing us segfaults.
+	
 2004-10-27  David Hoover <karma@deadmoose.com>
 
 	* src/Makefile.am: Fix up dependency issues with automatically generated
Index: src/glade-editor.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-editor.c,v
retrieving revision 1.58
diff -u -p -r1.58 glade-editor.c
--- src/glade-editor.c	26 Oct 2004 16:25:26 -0000	1.58
+++ src/glade-editor.c	28 Oct 2004 17:19:36 -0000
@@ -63,7 +63,7 @@ static GtkNotebookClass *parent_class = 
 static gboolean glade_editor_table_append_items (GladeEditorTable *table,
 						 GladeWidgetClass *class,
 						 GList **list,
-						 gboolean common);
+						 GladeEditorTableType type);
 
 
 static void glade_editor_property_load_flags (GladeEditorProperty *property);
@@ -839,7 +839,7 @@ glade_editor_create_input_object (GladeE
 	g_return_val_if_fail (GLADE_IS_EDITOR_PROPERTY (property), NULL);
 
 	glade_editor_table_append_items (table, property->class->child,
-					 &property->children, FALSE);
+					 &property->children, TABLE_TYPE_GENERAL);
 
 	return NULL;
 }
@@ -1004,7 +1004,7 @@ static gboolean
 glade_editor_table_append_items (GladeEditorTable *table,
 				 GladeWidgetClass *class,
 				 GList **list_,
-				 gboolean common)
+				 GladeEditorTableType type)
 {
 	GladeEditorProperty *property;
 	GladePropertyClass *property_class;
@@ -1018,17 +1018,20 @@ glade_editor_table_append_items (GladeEd
 	for (; list != NULL; list = list->next)
 	{
 		property_class = (GladePropertyClass *) list->data;
+
 		if (!glade_property_class_is_visible (property_class, class))
 			continue;
-		if (common != property_class->common)
+		if (type == TABLE_TYPE_QUERY && property_class->query == FALSE)
+			continue;
+		else if (type == TABLE_TYPE_COMMON && property_class->common == FALSE)
 			continue;
+
 		property = glade_editor_table_append_item (table, property_class);
 		if (property != NULL)
 			new_list = g_list_prepend (new_list, property);
 	}
 
 	*list_ = new_list;
-	
 	return TRUE;
 }
 
@@ -1068,13 +1071,15 @@ glade_editor_table_new (void)
 	gtk_table_set_row_spacings (GTK_TABLE (table->table_widget),
 				    GLADE_PROPERY_TABLE_ROW_SPACING);
 
+	g_object_ref (G_OBJECT(table->table_widget));
+	
 	return table;
 }
 
 static GladeEditorTable *
 glade_editor_table_create (GladeEditor *editor,
 			   GladeWidgetClass *class,
-			   gboolean common)
+			   GladeEditorTableType type)
 {
 	GladeEditorTable *table;
 
@@ -1084,15 +1089,16 @@ glade_editor_table_create (GladeEditor *
 	table = glade_editor_table_new ();
 	table->editor = editor;
 	table->glade_widget_class = class;
-	table->common = common;
-	if (!common)
+	table->type = type;
+	if (type == TABLE_TYPE_GENERAL)
 		glade_editor_table_append_standard_fields (table);
-	if (!glade_editor_table_append_items (table, class, &table->properties, common))
+	if (!glade_editor_table_append_items (table, class,
+					      &table->properties, type))
 		return NULL;
 
 	/* Hack: We don't have currently a way to put a "Edit Menus..." button through the
 	 * xml files. */
-	if (!common && !strcmp (class->name, "GtkMenuBar")) {
+	if (type == TABLE_TYPE_GENERAL && !strcmp (class->name, "GtkMenuBar")) {
 		GtkWidget *edit_menu_button = gtk_button_new_with_label (_("Edit Menus..."));
 
 		g_signal_connect (G_OBJECT (edit_menu_button), "clicked",
@@ -1104,7 +1110,6 @@ glade_editor_table_create (GladeEditor *
 	}
 
 	gtk_widget_show_all (table->table_widget);
-	editor->widget_tables = g_list_prepend (editor->widget_tables, table);
 
 	return table;
 }
@@ -1112,7 +1117,7 @@ glade_editor_table_create (GladeEditor *
 static GladeEditorTable *
 glade_editor_get_table_from_class (GladeEditor *editor,
 				   GladeWidgetClass *class,
-				   gboolean common)
+				   GladeEditorTableType type)
 {
 	GladeEditorTable *table;
 	GList *list;
@@ -1120,15 +1125,17 @@ glade_editor_get_table_from_class (Glade
 	for (list = editor->widget_tables; list; list = list->next)
 	{
 		table = list->data;
-		if (common != table->common)
+		if (type != table->type)
 			continue;
 		if (table->glade_widget_class == class)
 			return table;
 	}
 
-	table = glade_editor_table_create (editor, class, common);
+	table = glade_editor_table_create (editor, class, type);
 	g_return_val_if_fail (table != NULL, NULL);
 
+	editor->widget_tables = g_list_prepend (editor->widget_tables, table);
+
 	return table;
 }
 
@@ -1601,15 +1608,15 @@ glade_editor_load_packing_page (GladeEdi
 	/* Now add the new properties */
 	table = glade_editor_table_new ();
 	table->editor = editor;
-	table->common = FALSE;
-	table->packing = TRUE;
-
+	table->type   = TABLE_TYPE_PACKING;
+	
 	for (ancestor = parent; ancestor != NULL; ancestor = glade_widget_get_parent (ancestor))
 	{
  		for (list = ancestor->widget_class->child_properties; list; list = list->next)
 		{
 			property_class = list->data; 
-			if (!ancestor->widget_class->child_property_applies (ancestor->widget, widget->widget, property_class->id))
+			if (!ancestor->widget_class->child_property_applies
+			    (ancestor->widget, widget->widget, property_class->id))
 				continue;
 
 			g_assert (property_class->packing == TRUE);
@@ -1715,3 +1722,44 @@ glade_editor_add_signal (GladeEditor *ed
 		       glade_editor_signals [ADD_SIGNAL], 0,
 		       widget_name, widget_type, signal_id, callback_name);
 }
+
+
+void
+glade_editor_query_popup (GladeEditor *editor, GladeWidget *widget)
+{
+	GtkWidget           *dialog;
+	GladeEditorTable    *table;
+	gchar               *title;
+	GList               *list;
+	GladeEditorProperty *property;
+
+	title = g_strdup_printf ("%s %s", _("Create a"), widget->widget_class->name);
+
+	dialog = gtk_dialog_new_with_buttons
+		(title, NULL,
+		 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT |
+		 GTK_DIALOG_NO_SEPARATOR, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
+	g_free (title);
+
+	table = glade_editor_get_table_from_class (editor,
+						   widget->widget_class,
+						   TABLE_TYPE_QUERY);
+
+	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), table->table_widget,
+			    TRUE, TRUE, 4);
+	
+	for (list = table->properties; list; list = list->next)
+	{
+		property = list->data;
+		glade_editor_property_load (property, widget);
+	}
+
+	gtk_window_set_default_size (GTK_WINDOW(dialog), 300, -1);
+
+	gtk_dialog_run (GTK_DIALOG (dialog));
+
+	gtk_container_remove (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
+			      table->table_widget);
+	
+	gtk_widget_destroy (dialog);
+}
Index: src/glade-editor.h
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-editor.h,v
retrieving revision 1.15
diff -u -p -r1.15 glade-editor.h
--- src/glade-editor.h	13 Jun 2003 16:43:20 -0000	1.15
+++ src/glade-editor.h	28 Oct 2004 17:19:36 -0000
@@ -17,11 +17,20 @@ G_BEGIN_DECLS
 #define GLADE_EDITOR_PROPERTY(p)    ((GladeEditorProperty *)p)
 #define GLADE_IS_EDITOR_PROPERTY(p) (p != NULL)
 
-typedef struct _GladeEditorClass    GladeEditorClass;
-typedef struct _GladeEditorTable    GladeEditorTable;
-typedef struct _GladeEditorProperty GladeEditorProperty;
+typedef struct _GladeEditorClass     GladeEditorClass;
+typedef struct _GladeEditorTable     GladeEditorTable;
+typedef struct _GladeEditorProperty  GladeEditorProperty;
+typedef enum   _GladeEditorTableType GladeEditorTableType;
 
 
+enum _GladeEditorTableType
+{
+	TABLE_TYPE_GENERAL,
+	TABLE_TYPE_COMMON,
+	TABLE_TYPE_PACKING,
+	TABLE_TYPE_QUERY
+};
+
 /* The GladeEditor is a window that is used to display and modify widget
  * properties. The glade editor contains the details of the selected
  * widget for the selected project
@@ -141,10 +150,9 @@ struct _GladeEditorTable
 			    * corrsponding GladeEditorProperty struct.
 			    */
 
-	gboolean common; /* Is this table to be used in the common tab ?
-			  * or the general tab ?
-			  */
-	gboolean packing;
+	GladeEditorTableType type; /* Is this table to be used in the common tab, ?
+				    * the general tab, a packing tab or the query popup ?
+				    */
 	
 	gint rows;
 };
@@ -192,6 +200,7 @@ GladeEditor *glade_editor_new (void);
 void glade_editor_load_widget (GladeEditor *editor, GladeWidget *widget);
 void glade_editor_add_signal (GladeEditor *editor, guint id_signal, const char *callback_name);
 void glade_editor_update_widget_name (GladeEditor *editor);
+void glade_editor_query_popup (GladeEditor *editor, GladeWidget *widget);
 
 
 G_END_DECLS
Index: src/glade-gtk.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-gtk.c,v
retrieving revision 1.56
diff -u -p -r1.56 glade-gtk.c
--- src/glade-gtk.c	26 Oct 2004 17:40:07 -0000	1.56
+++ src/glade-gtk.c	28 Oct 2004 17:19:36 -0000
@@ -313,8 +313,8 @@ glade_gtk_box_set_size (GObject *object,
 {
 	GladeWidget *widget;
 	GtkBox *box;
-	gint new_size;
-	gint old_size;
+	GList *child;
+	gint new_size, old_size, i;
 
 	box = GTK_BOX (object);
 	g_return_if_fail (GTK_IS_BOX (box));
@@ -325,44 +325,31 @@ glade_gtk_box_set_size (GObject *object,
 	old_size = g_list_length (box->children);
 	new_size = g_value_get_int (value);
 
-	if (new_size == old_size)
-		return;
-
-	if (new_size > old_size)
+	/* Ensure placeholders first...
+	 */
+	for (i = 0; i < new_size; i++)
 	{
-		/* The box has grown. Add placeholders */
-		while (new_size > old_size)
-		{
-			GladePlaceholder *placeholder =
-				GLADE_PLACEHOLDER (glade_placeholder_new ());
-			gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (placeholder));
-			old_size++;
-		}
+		if (i + 1 < g_list_length(box->children))
+			continue;
+		gtk_container_add (GTK_CONTAINER (box),
+				   GTK_WIDGET (glade_placeholder_new ()));
 	}
-	else
-	{
-		/* new_size < old_size */
-		/* The box has shrunk. Remove the widgets that are on those slots */
-		GList *child = g_list_last (box->children);
 
-		while (child && old_size > new_size)
-		{
-			GtkWidget *child_widget = ((GtkBoxChild *) (child->data))->widget;
-			GladeWidget *glade_widget;
-
-			glade_widget = glade_widget_get_from_gtk_widget (child_widget);
-			if (glade_widget) /* it may be NULL, e.g a placeholder */
-				glade_project_remove_widget
-					(glade_widget->project, child_widget);
+	/* The box has shrunk. Remove the widgets that are on those slots */
+	for (child = g_list_last (box->children);
+	     child && old_size > new_size;
+	     child = g_list_last (box->children), old_size--)
+	{
+		GtkWidget *child_widget = ((GtkBoxChild *) (child->data))->widget;
+		GladeWidget *glade_widget;
 
-			gtk_container_remove (GTK_CONTAINER (box), child_widget);
+		glade_widget = glade_widget_get_from_gtk_widget (child_widget);
+		if (glade_widget)
+			/* In this case, refuse to shrink */
+			break;
 
-			child = g_list_last (box->children);
-			old_size--;
-		}
+		gtk_container_remove (GTK_CONTAINER (box), child_widget);
 	}
-
-	g_object_set_data (object, "glade_nb_placeholders", GINT_TO_POINTER (new_size));
 }
 
 /**
@@ -524,6 +511,44 @@ glade_gtk_notebook_set_n_pages (GObject 
 	}
 }
 
+
+static gboolean
+glade_gtk_table_has_child (GtkTable *table,
+			   guint left_attach,
+			   guint right_attach,
+			   guint top_attach,
+			   guint bottom_attach)
+{
+	GList *list;
+
+	for (list = table->children; list && list->data; list = list->next)
+	{
+		GtkTableChild *child = list->data;
+
+		if (child->left_attach   == left_attach &&
+		    child->right_attach  == right_attach &&
+		    child->top_attach    == top_attach &&
+		    child->bottom_attach == bottom_attach)
+			return TRUE;
+	}
+	return FALSE;
+}
+
+static gboolean
+glade_gtk_table_widget_exceeds_bounds (GtkTable *table, gint n_rows, gint n_cols)
+{
+	GList *list;
+	for (list = table->children; list && list->data; list = list->next)
+	{
+		GtkTableChild *child = list->data;
+		if (GLADE_IS_PLACEHOLDER(child->widget) == FALSE &&
+		    (child->right_attach  > n_cols ||
+		     child->bottom_attach > n_rows))
+			return TRUE;
+	}
+	return FALSE;
+}
+
 /**
  * glade_gtk_notebook_set_n_common:
  * @object:
@@ -546,46 +571,48 @@ glade_gtk_table_set_n_common (GObject *o
 	new_size = g_value_get_int (value);
 	old_size = for_rows ? table->nrows : table->ncols;
 
-	if (new_size == old_size)
-		return;
 	if (new_size < 1)
 		return;
 
+	if (glade_gtk_table_widget_exceeds_bounds
+	    (table,
+	     for_rows ? new_size : table->nrows,
+	     for_rows ? table->ncols : new_size))
+		/* Refuse to shrink if it means orphaning widgets */
+		return;
+
 	widget = glade_widget_get_from_gtk_widget (GTK_WIDGET (table));
 	g_return_if_fail (widget != NULL);
 
-	if (new_size > old_size) {
-		if (for_rows) {
-			gtk_table_resize (table, new_size, table->ncols);
+	if (for_rows)
+		gtk_table_resize (table, new_size, table->ncols);
+	else
+		gtk_table_resize (table, table->nrows, new_size);
 
-			for (i = 0; i < table->ncols; i++)
-				for (j = old_size; j < table->nrows; j++)
-					gtk_table_attach_defaults
-						(table, glade_placeholder_new (),
-								   i, i + 1, j, j + 1);
-		} else {
-			gtk_table_resize (table, table->nrows, new_size);
-
-			for (i = old_size; i < table->ncols; i++)
-				for (j = 0; j < table->nrows; j++)
-					gtk_table_attach_defaults
-						(table, glade_placeholder_new (),
-								   i, i + 1, j, j + 1);
-		}
-	} else {
+	for (i = 0; i < table->ncols; i++)
+		for (j = 0; j < table->nrows; j++)
+			if (glade_gtk_table_has_child
+			    (table, i, i + 1, j, j + 1) == FALSE)
+				gtk_table_attach_defaults
+					(table, glade_placeholder_new (),
+					 i, i + 1, j, j + 1);
+
+	if (new_size < old_size)
+	{
 		/* Remove from the bottom up */
-		GList *list = g_list_reverse
-			(g_list_copy (gtk_container_get_children (GTK_CONTAINER (table))));
-		GList *freeme = list;
-		for (; list; list = list->next) {
+		GList *list;
+		GList *list_to_free = NULL;
+
+		for (list = table->children; list && list->data; list = list->next)
+		{
 			GtkTableChild *child = list->data;
 			gint start = for_rows ? child->top_attach : child->left_attach;
 			gint end = for_rows ? child->bottom_attach : child->right_attach;
 
 			/* We need to completely remove it */
-			if (start >= new_size) {
-				gtk_container_remove (GTK_CONTAINER (table),
-						      child->widget);
+			if (start >= new_size)
+			{
+				list_to_free = g_list_prepend (list_to_free, child->widget);
 				continue;
 			}
 
@@ -596,17 +623,23 @@ glade_gtk_table_set_n_common (GObject *o
 					(GTK_CONTAINER (table), GTK_WIDGET (child),
 					 for_rows ? "bottom_attach" : "right_attach",
 					 new_size, NULL);
-			
 		}
-		g_list_free (freeme);
+
+		if (list_to_free)
+		{
+			for (list = g_list_first(list_to_free);
+			     list && list->data;
+			     list = list->next)
+			{
+				gtk_container_remove (GTK_CONTAINER (table),
+						      GTK_WIDGET(list->data));
+			}
+			g_list_free (list_to_free);
+		}
 		gtk_table_resize (table,
 				  for_rows ? new_size : table->nrows,
 				  for_rows ? table->ncols : new_size);
 	}
-
-	g_object_set_data (object, "glade_nb_placeholders",
-			   GINT_TO_POINTER
-			   (new_size * (for_rows ? table->ncols : table->nrows)));
 }
 
 /**
@@ -780,17 +813,6 @@ ignore (GObject *object, GValue *value)
  * rows/columns expect * the GtkTable to hold this number of placeholders, so 
  * we should add it 
  */
-/**
- * glade_gtk_table_pre_create:
- * @object:
- *
- * TODO: write me
- */
-void GLADEGTK_API
-glade_gtk_table_pre_create (GObject *object)
-{
-	gtk_table_attach_defaults (GTK_TABLE (object), glade_placeholder_new (), 0, 1, 0, 1);
-}
 
 /**
  * glade_gtk_tree_pre_create:
@@ -821,82 +843,6 @@ glade_gtk_tree_view_pre_create (GObject 
 }
 
 /* ------------------------- Post Create functions ------------------------- */
-static gint
-ask_for_number (const gchar *title, const gchar *name, gint min, gint max, gint def)
-{
-	gint number;
-	GtkWidget *dialog = gtk_dialog_new_with_buttons
-		(title, NULL,
-		 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
-		 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
-	GtkWidget *label = gtk_label_new (name);
-	GtkWidget *spin_button = gtk_spin_button_new_with_range ((double) min, (double) max, 1.0);
-	GtkWidget *hbox = gtk_hbox_new (FALSE, 4);
-
-	gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
-
-	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-
-	gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spin_button), 0);
-	gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_button), FALSE);
-	gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin_button), (double) def);
-
-	gtk_box_pack_end (GTK_BOX (hbox), spin_button, TRUE, TRUE, 0);
-	gtk_box_pack_end (GTK_BOX (hbox), label, TRUE, TRUE, 0);
-
-	gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
-
-	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 4);
-
-	gtk_widget_show_all (hbox);
-
-	/* even if the user destroys the dialog box, we retrieve the number and we accept it.
-	 * I.e., this function never fails */
-	gtk_dialog_run (GTK_DIALOG (dialog));
-
-	number = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin_button));
-
-	gtk_widget_destroy (dialog);
-
-	return number;
-}
-
-/**
- * glade_gtk_box_post_create:
- * @object:
- *
- * TODO: write me
- */
-void GLADEGTK_API
-glade_gtk_box_post_create (GObject *object)
-{
-	GladeProperty *property =
-		glade_widget_get_property
-		(glade_widget_get_from_gtk_widget (object), "size");
-	GValue value = {0,};
-
-	g_value_init (&value, G_TYPE_INT);
-	g_value_set_int (&value, ask_for_number(_("Create a box"),
-						_("Number of items:"), 0, 10000, 3));
-
-	glade_property_set (property, &value);
-}
-
-/**
- * glade_gtk_notebook_post_create:
- * @object:
- *
- * TODO: write me
- */
-void GLADEGTK_API
-glade_gtk_notebook_post_create (GObject *object)
-{
-	GValue value = {0,};
-	g_value_init (&value, G_TYPE_INT);
-	g_value_set_int (&value, ask_for_number(_("Create a notebook"),
-						_("Number of pages:"), 0, 100, 3));
-}
-
 static gboolean
 glade_gtk_fixed_button_press (GtkWidget       *widget,
 			      GdkEventButton  *event,
@@ -909,8 +855,13 @@ glade_gtk_fixed_button_press (GtkWidget 
 		gpw = glade_project_window_get ();
 		if (gpw->add_class != NULL)
 		{
-			GtkWidget *placeholder = glade_placeholder_new ();
-			GList     *selection;
+			GtkWidget     *placeholder = glade_placeholder_new ();
+			GtkWidget     *new_widget;
+			GladeWidget   *new_gwidget;
+			GladeProperty *property;
+			GList         *selection;
+			GValue         value = { 0, };
+
 			/* A widget type is selected in the palette.
 			 * Create a placeholder at the mouse position and
 			 * add a new widget of that type with a default
@@ -924,10 +875,26 @@ glade_gtk_fixed_button_press (GtkWidget 
 
 			selection = glade_project_selection_get
 				(glade_project_window_get_active_project(gpw));
-			gtk_widget_set_size_request(GTK_WIDGET(selection->data),
-						    FIXED_DEFAULT_CHILD_WIDTH,
-						    FIXED_DEFAULT_CHILD_HEIGHT);
 
+			new_widget  = GTK_WIDGET(selection->data);
+			new_gwidget = glade_widget_get_from_gtk_widget(new_widget);
+			
+			g_value_init (&value, G_TYPE_INT);
+
+			property = glade_widget_get_property (new_gwidget, "width-request");
+			property->enabled = TRUE;
+			g_value_set_int (&value, FIXED_DEFAULT_CHILD_WIDTH);
+			glade_property_set (property, &value);
+
+			property = glade_widget_get_property (new_gwidget, "height-request");
+			property->enabled = TRUE;
+			g_value_set_int (&value, FIXED_DEFAULT_CHILD_HEIGHT);
+			glade_property_set (property, &value);
+
+			/* We need to resync the editor so that width-request/height-request
+			 * are actualy enabled in the editor
+			 */
+			glade_editor_load_widget (gpw->editor, gpw->editor->loaded_widget);
 			
 		}
 		return TRUE;
@@ -972,74 +939,6 @@ glade_gtk_fixed_post_create (GObject *ob
 }
 
 /**
- * glade_gtk_table_post_create:
- * @object:
- *
- * TODO: write me
- */
-void GLADEGTK_API
-glade_gtk_table_post_create (GObject *object)
-{
-	GladeWidget *widget = glade_widget_get_from_gtk_widget (object);
-	GladeProperty *property_rows = glade_widget_get_property (widget, "n-rows");
-	GladeProperty *property_cols = glade_widget_get_property (widget, "n-columns");
-	GValue gvrows = {0,};
-	GValue gvcols = {0,};
-	GtkWidget *dialog =
-		gtk_dialog_new_with_buttons (_("Create a table"), NULL,
-					     GTK_DIALOG_MODAL |
-					     GTK_DIALOG_DESTROY_WITH_PARENT |
-					     GTK_DIALOG_NO_SEPARATOR,
-					     GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
-	GtkWidget *label_rows = gtk_label_new (_("Number of rows:"));
-	GtkWidget *label_cols = gtk_label_new (_("Number of columns:"));
-	GtkWidget *spin_button_rows = gtk_spin_button_new_with_range (0.0, 10000.0, 1.0);
-	GtkWidget *spin_button_cols = gtk_spin_button_new_with_range (0.0, 10000.0, 1.0);
-	GtkWidget *table = gtk_table_new (2, 2, TRUE);
-
-	gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
-
-	g_value_init (&gvrows, G_TYPE_INT);
-	g_value_init (&gvcols, G_TYPE_INT);
-
-	gtk_misc_set_alignment (GTK_MISC (label_rows), 0.0, 0.5);
-	gtk_misc_set_alignment (GTK_MISC (label_cols), 0.0, 0.5);
-
-	gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spin_button_rows), 0);
-	gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_button_rows), FALSE);
-	gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin_button_rows), 3.0);
-
-	gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spin_button_cols), 0);
-	gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_button_cols), FALSE);
-	gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin_button_cols), 3.0);
-
-	gtk_table_attach_defaults (GTK_TABLE (table), label_rows, 0, 1, 0, 1);
-	gtk_table_attach_defaults (GTK_TABLE (table), spin_button_rows, 1, 2, 0, 1);
-	gtk_table_attach_defaults (GTK_TABLE (table), label_cols, 0, 1, 1, 2);
-	gtk_table_attach_defaults (GTK_TABLE (table), spin_button_cols, 1, 2, 1, 2);
-
-	gtk_table_set_col_spacings (GTK_TABLE (table), 4);
-	gtk_container_set_border_width (GTK_CONTAINER (table), 12);
-
-	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), table, TRUE, TRUE, 0);
-
-	gtk_widget_show_all (table);
-	/* even if the user destroys the dialog box, we retrieve the number and we accept it.
-	 * I.e., this function never fails */
-	gtk_dialog_run (GTK_DIALOG (dialog));
-
-	g_value_set_int (&gvrows, gtk_spin_button_get_value_as_int
-			 (GTK_SPIN_BUTTON (spin_button_rows)));
-	g_value_set_int (&gvcols, gtk_spin_button_get_value_as_int
-			 (GTK_SPIN_BUTTON (spin_button_cols)));
-
-	glade_property_set (property_rows, &gvrows);
-	glade_property_set (property_cols, &gvcols);
-
-	gtk_widget_destroy (dialog);
-}
-
-/**
  * glade_gtk_window_post_create:
  * @object:
  *
@@ -1093,6 +992,7 @@ glade_gtk_dialog_post_create (GObject *o
 			    GTK_WIDGET (glade_placeholder_new ()), TRUE, TRUE, 0);
 	gtk_box_pack_start (GTK_BOX (dialog->action_area),
 			    GTK_WIDGET (glade_placeholder_new ()), TRUE, TRUE, 0);
+
 	actionarea_widget =
 		glade_widget_new_for_internal_child
 		(child_class, vbox_widget, dialog->action_area, "action_area");
@@ -1151,30 +1051,6 @@ glade_gtk_message_dialog_post_create (GO
 }
 
 
-#if 0
-void GLADEGTK_API
-glade_gtk_table_post_create (GObject *object)
-{
-	GtkTable *table = GTK_TABLE (object);
-	GList *list;
-
-	g_return_if_fail (GTK_IS_TABLE (table));
-	list = table->children;
-
-	/* When we create a table and we are loading from disk a glade
-	 * file, we need to add a placeholder because the size can't be
-	 * 0 so gtk+ adds a widget that we don't want there.
-	 * GtkBox does not have this problem because
-	 * a size of 0x0 is the default one. Check if the size is 0
-	 * and that we don't have a children.
-	 */
-	if (g_list_length (list) == 0) {
-		gtk_container_add (GTK_CONTAINER (table),
-				   glade_placeholder_new ());
-	}
-}
-#endif
-
 /* ------------------------ Replace child functions ------------------------ */
 /**
  * glade_gtk_container_replace_child:
Index: src/glade-plugin.h
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-plugin.h,v
retrieving revision 1.2
diff -u -p -r1.2 glade-plugin.h
--- src/glade-plugin.h	22 Oct 2004 16:19:39 -0000	1.2
+++ src/glade-plugin.h	28 Oct 2004 17:19:36 -0000
@@ -7,6 +7,7 @@
 #include "glade-project.h"
 #include "glade-project-window.h"
 #include "glade-command.h"
+#include "glade-editor.h"
 #include "glade-property.h"
 #include "glade-property-class.h"
 #include "glade-choice.h"
Index: src/glade-popup.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-popup.c,v
retrieving revision 1.15
diff -u -p -r1.15 glade-popup.c
--- src/glade-popup.c	22 Oct 2004 16:19:39 -0000	1.15
+++ src/glade-popup.c	28 Oct 2004 17:19:36 -0000
@@ -47,9 +47,11 @@ static void
 glade_popup_copy_cb (GtkMenuItem *item, GladeWidget *widget)
 {
 	GladeProjectWindow *gpw;
+	GladeWidget        *dupped;
+	gpw     = glade_project_window_get ();
+	dupped  = glade_widget_dup (widget);
 
-	gpw = glade_project_window_get ();
-	glade_clipboard_add (gpw->clipboard, widget);
+	glade_clipboard_add (gpw->clipboard, dupped);
 }
 
 static void
Index: src/glade-property-class.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-property-class.c,v
retrieving revision 1.60
diff -u -p -r1.60 glade-property-class.c
--- src/glade-property-class.c	6 Oct 2004 20:08:52 -0000	1.60
+++ src/glade-property-class.c	28 Oct 2004 17:19:36 -0000
@@ -855,6 +855,8 @@ glade_property_class_update_from_node (G
 	/* common, optional, etc */
 	class->common   = glade_xml_get_property_boolean (node, GLADE_TAG_COMMON,  FALSE);
 	class->optional = glade_xml_get_property_boolean (node, GLADE_TAG_OPTIONAL, FALSE);
+	class->query    = glade_xml_get_property_boolean (node, GLADE_TAG_QUERY, FALSE);
+
 	if (class->optional)
 		class->optional_default = glade_xml_get_property_boolean (node, GLADE_TAG_OPTIONAL_DEFAULT, FALSE);
 
Index: src/glade-property-class.h
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-property-class.h,v
retrieving revision 1.32
diff -u -p -r1.32 glade-property-class.h
--- src/glade-property-class.h	22 Oct 2004 16:19:39 -0000	1.32
+++ src/glade-property-class.h	28 Oct 2004 17:19:36 -0000
@@ -127,25 +127,32 @@ struct _GladePropertyClass
 			    * a spin button entry. Also the default choice
 			    * for a type == CHOICE
 			    */
+
 	GList *choices;    /* list of GladeChoice items. This is only used
 			    * for propeties of type GLADE_PROPERTY_TYPE_CHOICE
 			    * and is NULL for other poperties.
 			    * [See glade-choice.h]
 			    */
+
 	GType enum_type;   /* If it is GLADE_PROPERTY_TYPE_ENUM or
 			    * GLADE_PROPERTY_TYPE_FLAGS, this holds
 			    * the GType of the enum or flags, otherwise it's 0.
 			    */
+	gboolean query; /* Whether we should explicitly ask the user about this property
+			 * when instantiating a widget with this property (through a popup
+			 * dialog).
+			 */
 
 	gboolean optional; /* Some properties are optional by nature like
 			    * default width. It can be set or not set. A
 			    * default property has a check box in the
 			    * left that enables/disables de input
 			    */
-	gboolean optional_default; /* For optional values, what the default is */
 
+	gboolean optional_default; /* For optional values, what the default is */
 	gboolean construct_only; /* Whether this property is G_PARAM_CONSTRUCT_ONLY or not */
 	
+	
 	GladeWidgetClass *child; /* A  GladeWidgetClass pointer of objects
 				  * that we need to set for this widget
 				  * for example : GtkSpinButton has a Adjustment inside
Index: src/glade-property.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-property.c,v
retrieving revision 1.52
diff -u -p -r1.52 glade-property.c
--- src/glade-property.c	26 Oct 2004 17:40:07 -0000	1.52
+++ src/glade-property.c	28 Oct 2004 17:19:36 -0000
@@ -171,6 +171,26 @@ glade_property_set (GladeProperty *prope
 		return;
 	}
 
+	/* Assign property first so that; if the object need be
+	 * rebuilt, it will reflect the new value
+	 */
+	g_value_reset (property->value);
+	g_value_copy (value, property->value);
+
+	glade_property_sync(property);
+}
+
+/**
+ * glade_property_sync:
+ * @property: a #GladeProperty
+ *
+ * TODO: write me
+ */
+void
+glade_property_sync (GladeProperty *property)
+{
+	g_return_if_fail (GLADE_IS_PROPERTY (property));
+
 	if (!property->enabled)
 		return;
 
@@ -179,15 +199,10 @@ glade_property_set (GladeProperty *prope
 
 	property->loading = TRUE;
 
-	/* Assign property first so that; if the object need be
-	 * rebuilt, it will reflect the new value
-	 */
-	g_value_reset (property->value);
-	g_value_copy (value, property->value);
-
 	if (property->class->set_function)
 		/* if there is a custom set_property, use it */
-		(*property->class->set_function) (G_OBJECT (property->widget->widget), value);
+		(*property->class->set_function) (G_OBJECT (property->widget->widget),
+						  property->value);
 	else if (property->class->construct_only)
 	{
 		/* In the case of construct_only, the widget must be rebuilt, here we
@@ -224,7 +239,7 @@ glade_property_set (GladeProperty *prope
 		}
 	}
 	else
-		glade_property_set_property (property, value);
+		glade_property_set_property (property, property->value);
 
 	property->loading = FALSE;
 }
Index: src/glade-property.h
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-property.h,v
retrieving revision 1.28
diff -u -p -r1.28 glade-property.h
--- src/glade-property.h	10 May 2004 17:30:56 -0000	1.28
+++ src/glade-property.h	28 Oct 2004 17:19:36 -0000
@@ -46,6 +46,8 @@ void glade_property_free (GladeProperty 
 
 void glade_property_set (GladeProperty *property, const GValue *value);
 
+void glade_property_sync (GladeProperty *property);
+
 GladeXmlNode *glade_property_write (GladeXmlContext *context, GladeProperty *property);
 
 
Index: src/glade-widget-class.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-widget-class.c,v
retrieving revision 1.62
diff -u -p -r1.62 glade-widget-class.c
--- src/glade-widget-class.c	22 Oct 2004 16:19:39 -0000	1.62
+++ src/glade-widget-class.c	28 Oct 2004 17:19:36 -0000
@@ -785,14 +785,15 @@ glade_widget_class_get_type (GladeWidget
 }
 
 /**
- * glade_widget_class_has_property:
+ * glade_widget_class_get_property_class:
  * @class: a #GladeWidgetClass
  * @name: a string
  *
- * Returns: %TRUE if @class has a property named @name, %FALSE otherwise
+ * Returns: The #GladePropertyClass object if there is one associated to this widget
+ *          class.
  */
-gboolean
-glade_widget_class_has_property (GladeWidgetClass *class, const gchar *name)
+GladePropertyClass *
+glade_widget_class_get_property_class (GladeWidgetClass *class, const gchar *name)
 {
 	GList *list;
 	GladePropertyClass *pclass;
@@ -801,10 +802,9 @@ glade_widget_class_has_property (GladeWi
 	{
 		pclass = list->data;
 		if (strcmp (pclass->id, name) == 0)
-			return TRUE;
+			return pclass;
 	}
-
-	return FALSE;
+	return NULL;
 }
 
 /**
Index: src/glade-widget-class.h
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-widget-class.h,v
retrieving revision 1.34
diff -u -p -r1.34 glade-widget-class.h
--- src/glade-widget-class.h	22 Oct 2004 16:19:39 -0000	1.34
+++ src/glade-widget-class.h	28 Oct 2004 17:19:36 -0000
@@ -119,7 +119,8 @@ gboolean     glade_widget_class_has_quer
 gboolean     glade_widget_class_is (GladeWidgetClass *class, const char *name);
 
 void        glade_widget_class_dump_param_specs (GladeWidgetClass *class);
-gboolean    glade_widget_class_has_property (GladeWidgetClass *class, const gchar *name);
+GladePropertyClass *glade_widget_class_get_property_class (GladeWidgetClass *class,
+							   const gchar *name);
 
 
 G_END_DECLS
Index: src/glade-widget.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-widget.c,v
retrieving revision 1.118
diff -u -p -r1.118 glade-widget.c
--- src/glade-widget.c	26 Oct 2004 17:40:07 -0000	1.118
+++ src/glade-widget.c	28 Oct 2004 17:19:36 -0000
@@ -34,6 +34,8 @@
 #include "glade-placeholder.h"
 #include "glade-signal.h"
 #include "glade-popup.h"
+#include "glade-editor.h"
+#include "glade-project-window.h"
 #include <glib.h>
 #include <gdk/gdkkeysyms.h>
 
@@ -280,6 +282,64 @@ glade_widget_debug (GladeWidget *widget)
 	glade_widget_debug_real (widget, 0);
 }
 
+static void
+glade_widget_copy_packing_props (GladeWidget *parent,
+				 GladeWidget *child,
+				 GladeWidget *template)
+{
+	GList *l;
+	glade_widget_set_packing_properties (child, parent);
+
+	for (l = child->packing_properties; l && l->data; l = l->next)
+	{
+		GladeProperty *dup_prop  = GLADE_PROPERTY(l->data);
+		GladeProperty *orig_prop =
+			glade_widget_get_property (template, dup_prop->class->id);
+		glade_property_set (dup_prop, orig_prop->value);
+	}
+}
+
+static void
+glade_widget_copy_custom_props (GladeWidget *widget,
+				GladeWidget *template)
+{
+	GList *l;
+	for (l = widget->properties; l && l->data; l = l->next)
+	{
+		GladeProperty *dup_prop  = GLADE_PROPERTY(l->data);
+		GladeProperty *orig_prop;
+		if (dup_prop->class->set_function)
+		{
+			orig_prop = glade_widget_get_property (template, dup_prop->class->id);
+			
+			glade_property_set (dup_prop, orig_prop->value);
+		}
+	}
+}
+
+static void
+glade_widget_sync_custom_props (GladeWidget *widget)
+{
+	GList *l;
+	for (l = widget->properties; l && l->data; l = l->next)
+	{
+		GladeProperty *prop  = GLADE_PROPERTY(l->data);
+		if (prop->class->set_function)
+			glade_property_sync (prop);
+	}
+}
+
+static void
+glade_widget_sync_query_props (GladeWidget *widget)
+{
+	GList *l;
+	for (l = widget->properties; l && l->data; l = l->next)
+	{
+		GladeProperty *prop  = GLADE_PROPERTY(l->data);
+		if (prop->class->query)
+			glade_property_sync (prop);
+	}
+}
 
 /**
  * glade_widget_build_object:
@@ -295,12 +355,13 @@ glade_widget_debug (GladeWidget *widget)
 static GObject *
 glade_widget_build_object (GladeWidgetClass *klass, GladeWidget *widget)
 {
-	GArray         *params;
-	GObjectClass   *oclass;
-	GParamSpec    **pspec;
-	GladeProperty  *glade_property;
-	GObject        *object;
-	gint            n_props, i;
+	GArray              *params;
+	GObjectClass        *oclass;
+	GParamSpec         **pspec;
+	GladeProperty       *glade_property;
+	GladePropertyClass  *glade_property_class;
+	GObject             *object;
+	gint                 n_props, i;
 
 	/* As a slight optimization, we never unref the class
 	 */
@@ -312,7 +373,7 @@ glade_widget_build_object (GladeWidgetCl
 	{
 		GParameter parameter = { 0, };
 
-		if (!glade_widget_class_has_property(klass, pspec[i]->name))
+		if (glade_widget_class_get_property_class (klass, pspec[i]->name) == NULL)
 			/* Ignore properties that are not accounted for
 			 * by the GladeWidgetClass
 			 */
@@ -335,7 +396,23 @@ glade_widget_build_object (GladeWidgetCl
 			else
 			{
 				g_critical("Type mismatch on %s property of %s",
-					   parameter.name, widget->widget_class->name);
+					   parameter.name, klass->name);
+				continue;
+			}
+		}
+		/* If the class has a default, use it.
+		 */
+		else if ((glade_property_class =
+			  glade_widget_class_get_property_class(klass, pspec[i]->name)) &&
+			 glade_property_class->def != NULL)
+		{
+			if (g_value_type_compatible(G_VALUE_TYPE(glade_property_class->def),
+						    G_VALUE_TYPE(&parameter.value)))
+				g_value_copy(glade_property_class->def, &parameter.value);
+			else
+			{
+				g_critical("Type mismatch on %s property of %s",
+					   parameter.name, klass->name);
 				continue;
 			}
 		}
@@ -364,23 +441,14 @@ glade_widget_build_object (GladeWidgetCl
 	return object;
 }
 
-/**
- * glade_widget_new:
- * @klass: a #GladeWidgetClass
- * @project: a #GladeProject
- *
- * TODO: write me
- *
- * Returns:
- */
-GladeWidget *
-glade_widget_new (GladeWidgetClass *klass, GladeProject *project)
+static GladeWidget *
+glade_widget_internal_new (GladeWidgetClass *klass, GladeProject *project, GladeWidget *template)
 {
 	GObject *widget;
 	GObject *glade_widget;
 	gchar *widget_name;
 
-	widget = glade_widget_build_object(klass, NULL);
+	widget = glade_widget_build_object(klass, template);
 	
 	if (klass->pre_create_function)
 		klass->pre_create_function (G_OBJECT (widget));
@@ -397,6 +465,82 @@ glade_widget_new (GladeWidgetClass *klas
 	return (GladeWidget *) glade_widget;
 }
 
+/**
+ * glade_widget_new:
+ * @klass: a #GladeWidgetClass
+ * @project: a #GladeProject
+ *
+ * TODO: write me
+ *
+ * Returns:
+ */
+GladeWidget *
+glade_widget_new (GladeWidgetClass *klass, GladeProject *project)
+{
+	GladeWidget *widget;
+
+	if ((widget = glade_widget_internal_new (klass, project, NULL)) != NULL &&
+	    widget->query_user)
+	{
+		GladeProjectWindow *gpw = glade_project_window_get ();
+		glade_editor_query_popup (gpw->editor, widget);
+
+		/* The glade editor code only sets properties if they change,
+		 * this is just in case they dont.
+		 */
+		glade_widget_sync_query_props (widget);
+	}
+	return widget;
+}
+
+/**
+ * glade_widget_dup:
+ * @widget: a #GladeWidget
+ *
+ * TODO: write me
+ *
+ * Returns:
+ */
+GladeWidget *
+glade_widget_dup (GladeWidget *template)
+{
+	GladeWidget *gwidget;
+	GList       *l, *children;
+	
+	g_return_val_if_fail (template != NULL && GLADE_IS_WIDGET(template), NULL);
+	gwidget = glade_widget_internal_new (template->widget_class,
+					     template->project,
+					     template);
+
+	if (GTK_IS_CONTAINER(template->widget))
+	{
+		children = gtk_container_get_children(GTK_CONTAINER(template->widget));
+		for (l = children; l && l->data; l = l->next)
+		{
+			GtkWidget   *child_widget = GTK_WIDGET(l->data);
+			GladeWidget *child_gwidget;
+			if ((child_gwidget =
+			     glade_widget_get_from_gtk_widget(child_widget)) != NULL)
+			{
+				GladeWidget *child_dup =
+					glade_widget_dup(child_gwidget);
+
+				gtk_container_add(GTK_CONTAINER(gwidget->widget),
+						  child_dup->widget);
+
+				glade_widget_copy_packing_props (gwidget,
+								 child_dup,
+								 child_gwidget);
+
+			}
+		}
+	}
+	gtk_widget_show_all (gwidget->widget);
+
+	glade_widget_copy_custom_props (gwidget, template);
+
+	return gwidget;
+}
 
 /**
  * glade_widget_rebuild:
@@ -421,6 +565,11 @@ glade_widget_rebuild (GladeWidget *glade
 
 	glade_widget_set_widget(glade_widget, new_widget);
 
+	/* Custom properties aren't transfered in build_object, since build_object
+	 * is only concerned with object creation.
+	 */
+	glade_widget_sync_custom_props (glade_widget);
+	
 	/* Must use gtk_widget_destroy here for cases like dialogs and toplevels
 	 * (otherwise I'd prefer g_object_unref() )
 	 */
@@ -455,6 +604,7 @@ glade_widget_new_for_internal_child (Gla
 					      "internal", internal_name,
 					      "widget", internal_widget, NULL);
 	g_free (widget_name);
+	glade_widget_set_packing_properties (widget, parent);
 	return widget;
 }
 
@@ -469,6 +619,12 @@ glade_widget_finalize (GObject *object)
 	g_free (widget->internal);
 	g_hash_table_destroy (widget->signals);
 
+	g_list_foreach (widget->properties, (GFunc)glade_property_free, NULL);
+	g_list_free (widget->properties);
+
+	g_list_foreach (widget->packing_properties, (GFunc)glade_property_free, NULL);
+	g_list_free (widget->packing_properties);
+	
 	G_OBJECT_CLASS(parent_class)->finalize(object);
 }
 
@@ -692,7 +848,7 @@ glade_widget_set_class (GladeWidget *wid
 {
 	GladePropertyClass *property_class;
 	GladeProperty *property;
-	GList *list = klass->properties;
+	GList *list;
 
 	g_return_if_fail (GLADE_IS_WIDGET (widget));
 	g_return_if_fail (GLADE_IS_WIDGET_CLASS (klass));
@@ -702,9 +858,9 @@ glade_widget_set_class (GladeWidget *wid
 	// g_object_ref (klass); TODO, GladeWidgetClass is not a GObject
 	widget->widget_class = klass;
 
-	for (; list; list = list->next)
+	for (list = klass->properties; list; list = list->next)
 	{
-		property_class = list->data;
+		property_class = GLADE_PROPERTY_CLASS(list->data);
 		property = glade_property_new (property_class, widget);
 		if (!property) {
 			g_print ("Failed to create [%s] property.\n",
@@ -713,9 +869,10 @@ glade_widget_set_class (GladeWidget *wid
 		}
 
 		widget->properties = g_list_prepend (widget->properties, property);
-	}
+		if (property_class->query) widget->query_user = TRUE;
 
-	widget->properties = g_list_reverse (widget->properties);
+	}
+	widget->properties       = g_list_reverse (widget->properties);
 }
 
 /**
@@ -1064,7 +1221,8 @@ glade_widget_update_parent(GladeWidget *
 					(old_widget, new_widget,
 					 glade_widget_get_widget (parent));
 
-			glade_widget_set_packing_properties (gwidget, parent);
+			if (GLADE_IS_PLACEHOLDER(new_widget) == FALSE)
+				glade_widget_set_packing_properties (gwidget, parent);
 		}
 		else
 			g_warning ("Unable to set packing properties on new instance: replace "
@@ -1122,7 +1280,6 @@ glade_widget_set_widget (GladeWidget *gw
 				  G_CALLBACK (glade_widget_key_press), NULL);
 
 		glade_widget_connect_signal_handlers (new_widget, NULL);
-
 	
 		/* Take care of reparenting and packing.
 		 */
Index: src/glade-widget.h
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-widget.h,v
retrieving revision 1.35
diff -u -p -r1.35 glade-widget.h
--- src/glade-widget.h	22 Oct 2004 16:19:39 -0000	1.35
+++ src/glade-widget.h	28 Oct 2004 17:19:36 -0000
@@ -59,6 +59,10 @@ struct _GladeWidget
 				    * GladeWidgetClass.
 				    */
 
+	gboolean   query_user; /* Whether the user should be prompted for some initial
+				* values with a dialog popup upon creation.
+				*/
+	
 	GHashTable *signals; /* A table with a GPtrArray of GladeSignals (signal handlers),
 			      * indexed by its name */
 };
@@ -109,6 +113,7 @@ GladeWidget *		glade_widget_read			(Glad
 GladeWidget *		glade_widget_get_parent			(GladeWidget *widget);
 
 void                    glade_widget_rebuild                    (GladeWidget *widget);
+GladeWidget *           glade_widget_dup                        (GladeWidget *widget);
 
 G_END_DECLS
 
Index: widgets/gtkbox.xml
===================================================================
RCS file: /cvs/gnome/glade3/widgets/gtkbox.xml,v
retrieving revision 1.10
diff -u -p -r1.10 gtkbox.xml
--- widgets/gtkbox.xml	26 Jul 2004 10:37:23 -0000	1.10
+++ widgets/gtkbox.xml	28 Oct 2004 17:19:36 -0000
@@ -1,15 +1,14 @@
 <GladeWidgetClass>
 
-  <PostCreateFunction>glade_gtk_box_post_create</PostCreateFunction>
-  <FillEmptyFunction>ignore</FillEmptyFunction>
+  <FillEmptyFunction>empty</FillEmptyFunction>
 
   <Properties>
 
-    <Property Id="size" Name="Size">
+    <Property Id="size" Name="Number of items" Query="TRUE" Default="3">
       <Type>Integer</Type>
       <Tooltip>The number of items in the box</Tooltip>
       <Parameters>
-        <Parameter Key="Min" Value="1"/>
+        <Parameter Key="Min" Value="2"/>
         <Parameter Key="Max" Value="10000"/>
         <Parameter Key="StepIncrement" Value="1"/>
         <Parameter Key="PageIncrement" Value="10"/>
Index: widgets/gtklabel.xml
===================================================================
RCS file: /cvs/gnome/glade3/widgets/gtklabel.xml,v
retrieving revision 1.12
diff -u -p -r1.12 gtklabel.xml
--- widgets/gtklabel.xml	21 Apr 2004 21:03:40 -0000	1.12
+++ widgets/gtklabel.xml	28 Oct 2004 17:19:36 -0000
@@ -2,6 +2,7 @@
 
   <Properties>
     <Property Id="label" Default="label"/>
+    <Property Id="pattern" Default=""/>
   </Properties>
 
 </GladeWidgetClass>
\ No newline at end of file
Index: widgets/gtknotebook.xml
===================================================================
RCS file: /cvs/gnome/glade3/widgets/gtknotebook.xml,v
retrieving revision 1.11
diff -u -p -r1.11 gtknotebook.xml
--- widgets/gtknotebook.xml	20 Oct 2003 18:16:34 -0000	1.11
+++ widgets/gtknotebook.xml	28 Oct 2004 17:19:36 -0000
@@ -4,7 +4,7 @@
 
   <Properties>
 
-    <Property Id="pages" Name="Number of pages" Default="3">
+    <Property Id="pages" Name="Number of pages" Default="3" Query="TRUE">
       <Type>Integer</Type>
       <Tooltip>The number of pages in the notebook</Tooltip>
       <Parameters>
@@ -14,9 +14,6 @@
         <Parameter Key="PageIncrement" Value="1"/>
         <Parameter Key="ClibmRate" Value="1"/>
       </Parameters>
-      <Query>
-        <Question>Number of pages</Question>
-      </Query>
       <SetFunction>glade_gtk_notebook_set_n_pages</SetFunction>
       <GetFunction>glade_gtk_notebook_get_n_pages</GetFunction>
     </Property>
Index: widgets/gtktable.xml
===================================================================
RCS file: /cvs/gnome/glade3/widgets/gtktable.xml,v
retrieving revision 1.19
diff -u -p -r1.19 gtktable.xml
--- widgets/gtktable.xml	1 May 2004 22:05:31 -0000	1.19
+++ widgets/gtktable.xml	28 Oct 2004 17:19:36 -0000
@@ -1,36 +1,27 @@
 <GladeWidgetClass>
-  <PreCreateFunction>glade_gtk_table_pre_create</PreCreateFunction>
-  <PostCreateFunction>glade_gtk_table_post_create</PostCreateFunction>
   <FillEmptyFunction>ignore</FillEmptyFunction>
 
   <Properties>
 
-    <Property Id="n-rows" Default="3">
+    <Property Id="n-rows" Default="3" Query="TRUE">
 	 <Parameters>
-	   <Parameter Key="Min" Value="0"/>
+	   <Parameter Key="Min" Value="1"/>
 	   <Parameter Key="Max" Value="10000"/>
 	   <Parameter Key="StepIncrement" Value="1"/>
 	   <Parameter Key="PageIncrement" Value="10"/>
 	   <Parameter Key="ClimbRate" Value="1"/>
 	 </Parameters>
-      <Query>
-        <Question>Number of rows</Question>
-      </Query>
       <SetFunction>glade_gtk_table_set_n_rows</SetFunction>
     </Property>
 
-    <Property Id="n-columns" Default="3">
+    <Property Id="n-columns" Default="3" Query="TRUE">
 	 <Parameters>
-	   <Parameter Key="Min" Value="0"/>
+	   <Parameter Key="Min" Value="1"/>
 	   <Parameter Key="Max" Value="10000"/>
 	   <Parameter Key="StepIncrement" Value="1"/>
 	   <Parameter Key="PageIncrement" Value="10"/>
 	   <Parameter Key="ClibmRate" Value="1"/>
 	 </Parameters>
-      <Query>
-        <WindowTitle>New table</WindowTitle>
-        <Question>Number of columns</Question>
-      </Query>
       <SetFunction>glade_gtk_table_set_n_columns</SetFunction>
     </Property>
 
