[Glade-devel] Trivial patch for glade-widget.c commited.



--=-=-=

Hi

paolo borelli <pborelli katamail com> writes:

Not that it matters much, but I couldn't find you bug in bugzilla...
Anyway if you track the bug down it would be great; as a random gues I
would look at glade_gtk_box_set_size() into glade-gtk.c.
 
ciao
      paolo

Upon further investigation I found it to be a problem with not only Gtk[HV]Box
but also with GtkNotebook and I'm guessing with all such containers (*such* as
in how many children a container it has). Thing when glade3 loads up a file
it first sets properties, then children. So when glade_gtk_box_set_size is 
called, it has 0 children (which is stored in var old_size). and the variable
new_size has 3 ([1] something I want to come back to later). So it adds 3
placeholders as per the tag <property name="size">3</property> and then adds
the children (3 as per the .glade file) later. So we get 6.

One approach is to add children first and set properties for containers later.
I'm not sure if thats the right thing to do because some properties of
containers might be required to be set before adding children. Anyways I append
the patch below making properties set after children have been added. A small
test run doesn't seem to show any wierd things.

[1] Regarding that new size 3. I have noticed that no matter how many placeholders I specify for boxes, or 
pages for gtknotebooks, it puts only 3. And in the
property editor I cannot increase/decrease the size of a GtkBox or GtkNotebook.

Give me go ahead to commit previous patch after review.

Regards,
Archit Baweja


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
  filename=glade3-extra-children-fix.patch
Content-Description: Fix

? autom4te-2.53.cache
? bah.glade3
? glade-3.desktop
? stamp-h1
? src/bah.glade3
? src/glade-3
? src/go.glade3
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/glade3/ChangeLog,v
retrieving revision 1.178
diff -u -r1.178 ChangeLog
--- ChangeLog   3 Aug 2003 22:31:21 -0000       1.178
+++ ChangeLog   4 Aug 2003 21:00:38 -0000
@@ -1,3 +1,8 @@
+2003-08-05  Archit Baweja  <bighead users sourceforge net>
+
+       * src/glade-widget.c (glade_widget_new_from_node_real): set properties
+       after setting children.
+
 2003-08-04  Archit Baweja  <bighead users sourceforge net>
 
        * src/glade-widget.c (glade_widget_query_properties): have the buttons
Index: src/glade-widget.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-widget.c,v
retrieving revision 1.62
diff -u -r1.62 glade-widget.c
--- src/glade-widget.c  3 Aug 2003 22:31:23 -0000       1.62
+++ src/glade-widget.c  4 Aug 2003 21:00:50 -0000
@@ -1277,6 +1277,7 @@
 
        class_name = glade_xml_get_property_string_required (node, GLADE_XML_TAG_CLASS, NULL);
        widget_name = glade_xml_get_property_string_required (node, GLADE_XML_TAG_ID, NULL);
+
        if (!class_name || !widget_name)
                return NULL;
        class = glade_widget_class_get_by_name (class_name);
@@ -1287,17 +1288,6 @@
                return NULL;
        glade_widget_set_name (widget, widget_name);
 
-       /* Properties */
-       child = glade_xml_node_get_children (node);
-       for (; child; child = glade_xml_node_next (child)) {
-               if (!glade_xml_node_verify_silent (child, GLADE_XML_TAG_PROPERTY))
-                       continue;
-
-               if (!glade_widget_apply_property_from_node (child, widget)) {
-                       return NULL;
-               }
-       }
-
        /* Signals */
        child = glade_xml_node_get_children (node);
        for (; child; child = glade_xml_node_next (child)) {
@@ -1317,6 +1307,17 @@
                        continue;
 
                if (!glade_widget_new_child_from_node (child, project, widget)) {
+                       return NULL;
+               }
+       }
+
+       /* Properties */
+       child = glade_xml_node_get_children (node);
+       for (; child; child = glade_xml_node_next (child)) {
+               if (!glade_xml_node_verify_silent (child, GLADE_XML_TAG_PROPERTY))
+                       continue;
+
+               if (!glade_widget_apply_property_from_node (child, widget)) {
                        return NULL;
                }
        }

--=-=-=--




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