[Glade-devel] I'm back.

Joaquin Cuenca Abela e98cuenc@free.fr
Wed, 25 Jun 2003 00:18:40 +0200


Hi!

Paolo wrote: 
> 
> On Tue, 2003-06-24 at 04:39, Archit Baweja wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > Hey guys
> > 
> > Well with school over for the summers, I've got time on my 
> hands. So 
> > how about some thing to work on. Anything lacking in glade3 
> that might 
> > need attention?
> > 
> 
> Great to have you working on glade3 again!
> 
> Some of the things that come to my mind are:
> 
[snip]
> 
> 3 - handle the placeholder tag properly: IMHO this is biggest 
> problem right now. I think I have understood the problem but 
> fixing it requires quite a bit of changes and I haven't come 
> to a working solution. Explanation of what I found follows 
> for those who want to give it a shot (note however that maybe 
> I'm totally wrong...) The problem is that we don't have 
> placeholders in our main tree structure (the one made of 
> GladeWidget->parent and
> GladeWidget->children) so when we save a file to xml we don't generate
> the <placeholder> tags. This screws various things, first of 
> all the compatibility with glade-2, but also other things: 
> for example try to create a window, add a vbox to it, add a 
> button to the second slot of the vbox, save the file and 
> exit... now reopen glade-3 and open that
> file: the button will be at the wrong place.
> The best solution IMHO is to make GladePlaceholder a 
> GladeWidget and include it in the tree structure instead of 

I don't quite agree.  GladePlaceholder is a GtkWidget, so if you want to
also make GladePlaceholder a GladeWidget, then GladeWidget should also
be GtkWidget, and that doesn't makes sense.

> making it a special case. But how? The more radical solution 
> would be to make GladeWidget a GObject instead of a simple 
> structure, but I'm not sure that it makes sense. In this case 
> GladePlaceholder would be a subclass of GladeWidget. Another 
> approach (the one I tried, without finishing it) is to make 
> glade_placeholder_new return a GladeWidget, something like:

What I was thinking is instead to just change the logic of
glade_widget_write.
Right now, it looks on the list of childrens of the GladeWidget.
Instead, look at the list of children of the GtkWidget with
gtk_container_get_children (only if it's a container), and then for each
children, we have 3 possibilities:

1) it's a widget with an associated GladeWidget
2) it's a placeholder
3) neither of these

In case 1, we just keep with the current logic (redoing
glade_widget_write, etc.), in case 2, we print the <placeholder/>, and
in case 3, we just ignore the widget.

I've coded it & committed.  The only that I'm lacking is printing the
packing properties of the placeholder, I will do it tomorrow if nobody
beats me.  Btw, we should also not print a property if it's equal to the
default value, as right now we're quite verbose.

Cheers,