GtkBuilder syntax for property bindings
- From: Denis Washington <denisw online de>
- To: gtk-devel-list gnome org
- Subject: GtkBuilder syntax for property bindings
- Date: Fri, 06 May 2011 13:04:37 +0200
Hello,
My name is Denis Washington, and I was selected as a Google Summer of
Code student this year (yay!). My project is to add support for GObject
property binding (a.k.a. GBinding [1]) to Glade; see [2] for my complete
proposal.
A core component of this work is a new bit of GtkBuilder file syntax to
encode property bindings. I have deliberately not proposed a concrete
syntax in my original proposal as I believe that this is a point that
really needs consensus with the GTK+ community. This is why I would now
like to discuss this with you. I hope we can agree on something
worthwhile before the official coding period starts (May 23).
My initial proposal is to allow <property> tags to contain a new <bind>
element describing a binding to a source property instead of a concrete
value. For instance, the following would make the value of property
"prop" dependent on the "prop2" property value of object "source":
<property name="prop">
<bind source="source" property="property2" />
</property>
If "prop" should have an initial value before the value of source::prop
is changed the first time, that value could be nested inside of <bind>,
with the same semantics as putting it into <property> directly:
<property name="prop">
<bind source="source" property="property2">initial-value</bind>
</property>
The advantage of this syntax is that it fits naturally into the existing
syntax, is right at the target site - which is where a property binding
actually does anything, anyway - and could be extended for other types
of bindings in the future, e.g. GSettings bindings (with <bind
type="settings" ...> or something similar). It is also easy to implement
the way that GTK+'s GtkBuilder parser is written.
The main issue with this approach is what to do with two-way bindings.
One approach would be to make this a property of <bind>, but then,
<bind> wouldn't appear in every property it influences anymore.
Alternatively, the parser could be required to recognize direct cyclic
binding declarations (A binds to B, B binds to A) and collapse them into
a single two-way binding, which retains the
<bind>-only-affects-the-property-it-appears-in property; the parser
would be complicated by this, though.
I would love to hear your feedback on this matter!
Regards,
Denis Washington
[1]
[2] http://www.google-melange.com/gsoc/project/google/gsoc2011/denisw/12001
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]