[Glade-devel] [glade 3] Dont save packing when not needed [PATCH]

Shane Butler shane_b@users.sourceforge.net
Sun, 16 May 2004 15:50:26 +1000


--=-za5IogOlGclJCL2085Ki
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi all,

I have attached a patch that stops Glade 3 from saving the empty
<packing/> tag for widgets where it is not needed :)

Regards, Shane
-- 
Shane Butler <shane_b@users.sourceforge.net>

--=-za5IogOlGclJCL2085Ki
Content-Disposition: attachment; filename=simple.glade
Content-Type: text/xml; name=simple.glade; charset=
Content-Transfer-Encoding: 7bit

<?xml version="1.0"?>
<glade-interface>
  <widget class="GtkWindow" id="window1">
    <property name="tooltip"></property>
    <child>
      <widget class="GtkButton" id="button1">
        <property name="tooltip"></property>
      </widget>
      <packing/>
    </child>
  </widget>
</glade-interface>

--=-za5IogOlGclJCL2085Ki
Content-Disposition: attachment; filename=glade3-dontsaveemptypacking.patch
Content-Type: text/x-patch; name=glade3-dontsaveemptypacking.patch; charset=
Content-Transfer-Encoding: 7bit

? glade3/g.patch
Index: glade3/ChangeLog
===================================================================
RCS file: /cvs/gnome/glade3/ChangeLog,v
retrieving revision 1.292
diff -u -r1.292 ChangeLog
--- a/glade3/ChangeLog	10 May 2004 17:30:56 -0000	1.292
+++ b/glade3/ChangeLog	16 May 2004 05:50:54 -0000
@@ -1,3 +1,7 @@
+2004-05-16  Shane Butler  <shane_b@users.sourceforge.net>
+
+	* src/glade-widget.c (glade_widget_write_child): don't save empty packing tag.
+
 2004-05-10  Joaquin Cuenca Abela  <e98cuenc@yahoo.com>
 
 	* src/glade-widget-class.c, glade-widget-class.c: fix the build
Index: glade3/src/glade-widget.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-widget.c,v
retrieving revision 1.108
diff -u -r1.108 glade-widget.c
--- a/glade3/src/glade-widget.c	9 May 2004 19:17:30 -0000	1.108
+++ b/glade3/src/glade-widget.c	16 May 2004 05:51:02 -0000
@@ -1132,18 +1132,20 @@
 	glade_xml_node_append_child (child_tag, child);
 
 	/* Append the packing properties */
-	packing = glade_xml_node_new (context, GLADE_XML_TAG_PACKING);
-	glade_xml_node_append_child (child_tag, packing);
-	list = child_widget->packing_properties;
-	for (; list; list = list->next) {
-		GladeProperty *property;
-		GladeXmlNode *packing_property;
-		property = list->data;
-		g_assert (property->class->packing == TRUE);
-		packing_property = glade_property_write (context, property);
-		if (!packing_property)
-			continue;
-		glade_xml_node_append_child (packing, packing_property);
+	if (child_widget->packing_properties != NULL) {
+		packing = glade_xml_node_new (context, GLADE_XML_TAG_PACKING);
+		glade_xml_node_append_child (child_tag, packing);
+		list = child_widget->packing_properties;
+		for (; list; list = list->next) {
+			GladeProperty *property;
+			GladeXmlNode *packing_property;
+			property = list->data;
+			g_assert (property->class->packing == TRUE);
+			packing_property = glade_property_write (context, property);
+			if (!packing_property)
+				continue;
+			glade_xml_node_append_child (packing, packing_property);
+		}
 	}
 
 	return child_tag;

--=-za5IogOlGclJCL2085Ki--