Skip to content

Instantly share code, notes, and snippets.

@rmacqueen
Created June 22, 2016 20:21
Show Gist options
  • Save rmacqueen/63352a60a6d954eaa1c17b3e00a54013 to your computer and use it in GitHub Desktop.
Save rmacqueen/63352a60a6d954eaa1c17b3e00a54013 to your computer and use it in GitHub Desktop.
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
Gtk.init(null);
const FirstObject = new Lang.Class({
Name: 'First',
Extends: GObject.Object,
Properties: {
'foo': GObject.ParamSpec.boolean('foo', '',
'',
GObject.ParamFlags.READWRITE, true)
},
});
const SecondObject = new Lang.Class({
Name: 'Second',
Extends: GObject.Object,
Properties: {
'bar': GObject.ParamSpec.boolean('bar', '',
'',
GObject.ParamFlags.READWRITE, true)
},
_init: function (props) {
this.parent(props);
this.first = new FirstObject();
this.bind_property_full('bar', this.first, 'foo', GObject.BindingFlags.SYNC_CREATE, (binding, from_value, to_value) => {
print("calling bind_property_full")
to_value.set_boolean(true);
return true;
}, () => {});
}
});
let second = new SecondObject();
second.bar = true;
// I would expect this to print 'true', but it prints false.
print(second.first.foo);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment