[Glade-devel] [patch, glade3] placeholder.c cleanup

paolo borelli pborelli@katamail.com
29 May 2003 17:37:56 +0200


--=-Y/k/S6T6bOF9uKbCTUx1
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi!

Attached is a trivial patch that moves glade_placeholder_fill_empty ()
to glade-widget.c where it really belongs, as a matter of fact it's only
used there so we can make it static.

By the way, these two quite long functions in placeholder.c
- glade_placeholder_get_from_properties
- glade_placeholder_remove_all
are not used anywhere. Are they just leftovers that can be deleted, or
do you think they may turn useful later? 

ciao
	paolo

--=-Y/k/S6T6bOF9uKbCTUx1
Content-Disposition: attachment; filename=mv_fill_empty.patch
Content-Type: text/x-patch; name=mv_fill_empty.patch; charset=UTF-8
Content-Transfer-Encoding: 7bit

diff -upr gnome2/glade3/ChangeLog glade3/ChangeLog
--- gnome2/glade3/ChangeLog	2003-05-24 17:41:46.000000000 +0200
+++ glade3/ChangeLog	2003-05-29 11:45:23.000000000 +0200
@@ -1,3 +1,9 @@
+2003-05-29  Paolo Borelli  <pborelli@katamail.com>
+
+	* src/glade-placeholder.c: move glade_placeholder_fill_empty to
+	glade-widget.c where it belongs.
+	* src/glade-widget.c: add glade_widget_fill_empty.
+
 2003-05-23  Joaquin Cuenca Abela  <e98cuenc@yahoo.com>
 
 	* src/glade-placeholder.c: Make the placeholder work better on any
diff -upr gnome2/glade3/src/glade-placeholder.c glade3/src/glade-placeholder.c
--- gnome2/glade3/src/glade-placeholder.c	2003-05-24 17:41:46.000000000 +0200
+++ glade3/src/glade-placeholder.c	2003-05-29 11:39:21.000000000 +0200
@@ -595,35 +602,3 @@ glade_placeholder_remove_all (GtkWidget 
 
 }
 
-void
-glade_placeholder_fill_empty (GtkWidget *widget)
-{
-	GList *children;
-	gboolean empty = TRUE;
-
-	if (!GTK_IS_CONTAINER (widget))
-		return;
-	
-	/* fill with placeholders the containers that are inside of this container */
-	children = gtk_container_get_children (GTK_CONTAINER (widget));
-
-	/* loop over the children of this container, and fill them with placeholders */
-	while (children != NULL) {
-		glade_placeholder_fill_empty (GTK_WIDGET (children->data));
-		children = children->next;
-		empty = FALSE;
-	}
-
-	if (empty) {
-		/* retrieve the desired number of placeholders that this widget should hold */
-		int nb_children = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "glade_nb_placeholders"));
-		int i;
-
-		if (nb_children == 0 && GTK_IS_BIN (widget))
-			nb_children = 1;
-
-		for (i = nb_children; i > 0; i--)
-			gtk_container_add (GTK_CONTAINER (widget), glade_placeholder_new ());
-	}
-}
-
diff -upr gnome2/glade3/src/glade-placeholder.h glade3/src/glade-placeholder.h
--- gnome2/glade3/src/glade-placeholder.h	2003-05-24 17:41:46.000000000 +0200
+++ glade3/src/glade-placeholder.h	2003-05-29 11:45:43.000000000 +0200
@@ -30,7 +30,6 @@ gboolean glade_placeholder_is (GtkWidget
 
 void glade_placeholder_remove_all (GtkWidget *widget);
 
-void glade_placeholder_fill_empty (GtkWidget *widget);
 
 G_END_DECLS
 
Binary files gnome2/glade3/src/glade-utils.o and glade3/src/glade-utils.o differ
diff -upr gnome2/glade3/src/glade-widget.c glade3/src/glade-widget.c
--- gnome2/glade3/src/glade-widget.c	2003-05-24 17:41:46.000000000 +0200
+++ glade3/src/glade-widget.c	2003-05-29 11:39:20.000000000 +0200
@@ -793,6 +793,38 @@ glade_widget_new_full (GladeProject *pro
 	return widget;
 }
 
+static void
+glade_widget_fill_empty (GtkWidget *widget)
+{
+	GList *children;
+	gboolean empty = TRUE;
+
+	if (!GTK_IS_CONTAINER (widget))
+		return;
+	
+	/* fill with placeholders the containers that are inside of this container */
+	children = gtk_container_get_children (GTK_CONTAINER (widget));
+
+	/* loop over the children of this container, and fill them with placeholders */
+	while (children != NULL) {
+		glade_widget_fill_empty (GTK_WIDGET (children->data));
+		children = children->next;
+		empty = FALSE;
+	}
+
+	if (empty) {
+		/* retrieve the desired number of placeholders that this widget should hold */
+		int nb_children = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "glade_nb_placeholders"));
+		int i;
+
+		if (nb_children == 0 && GTK_IS_BIN (widget))
+			nb_children = 1;
+
+		for (i = nb_children; i > 0; i--)
+			gtk_container_add (GTK_CONTAINER (widget), glade_placeholder_new ());
+	}
+}
+
 static GtkWidget *
 glade_widget_append_query (GtkWidget *table,
 			   GladePropertyClass *property_class,
@@ -982,7 +1014,7 @@ glade_widget_new_from_class_full (GladeW
 
 	/* If we are a container, add the placeholders */
 	if (g_type_is_a (class->type,  GTK_TYPE_CONTAINER))
-		glade_placeholder_fill_empty (widget->widget);
+		glade_widget_fill_empty (widget->widget);
 	
 	if (result) 
 		glade_property_query_result_destroy (result);
@@ -1515,7 +1548,9 @@ glade_widget_apply_properties_from_hash 
 }
 
 static gboolean
-glade_widget_new_child_from_node (GladeXmlNode *node, GladeProject *project, GladeWidget *parent)
+glade_widget_new_child_from_node (GladeXmlNode *node,
+				  GladeProject *project,
+				  GladeWidget *parent)
 {
 	GladeXmlNode *child_node;
 	GladeXmlNode *child_properties;
@@ -1600,7 +1635,7 @@ glade_widget_new_child_from_node (GladeX
 		g_value_unset (&string_value);
 	}
 	
-	glade_placeholder_fill_empty (parent->widget);
+	glade_widget_fill_empty (parent->widget);
 
 	return TRUE;
 }

--=-Y/k/S6T6bOF9uKbCTUx1--