Re: GtkBuilder syntax for property bindings

On Fri, 2011-05-06 at 18:48 -0400, Matthew Barnes wrote:
> On Fri, 2011-05-06 at 12:42 -0700, Christian Hergert wrote: 
> > Since GBinding, is itself, an object, why not just have the GBinding
> > instance represented in the GtkBuilder XML. The normal object syntax
> > might work as well:
> > 
> >   <object class"GBinding" id="some_binding">
> >     <property name="source">object1</property>
> >     <property name="target">object2</property>
> >   </object>
> > 
> > I think this would mean the majority of work is how to make it easy to
> > manage from within Glade.

Exactly, this is why we discussed augmenting the GtkBuilder format to
add some way setup bindings as an attribute of the property itself.

My preference still at the moment is to separate <bindings> from
<properties>, i.e.

    <property ... />
    <binding ... />

The main incentive to specifically *not* go with:

<object class"GBinding" id="some_binding">     
  <property name="source">object1</property>
  <property name="target">object2</property>

... is because while setting up bindings from the
GtkBuilder is easy to do, managing the association
of bindings to properties and ensuring the user
makes meaningful choices, is not easy to do.

The work is significantly reduced by the fact
that Glade does not have to run around and parse
the GBindings separately and associate them to
their relevant properties (and then do the same
at save time).

The reason why Glade should not simply let the
user manage a list of GBindings separately from
the rest of the objects in Glade (as that would
be the obvious thing to do), is that it makes it
near impossible for Glade to guide the user in
any reliable way.

What I mean by "guide the user" here is, for instance
some properties are not relevant in some configurations
of widgets, take a GtkButton for instance that is
registered to get it's text from it's related
GtkAction, in this case Glade should not let you
assign the value source of the button text to
both a GBinding *and* an action.

In general, it's better for Glade to manage bindings
as metadata of properties, for this reason it makes
more sense to add some builder sugar than to go
working around the problem in Glade.


> +1, and don't forget GBindingFlags.
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org

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