const Atspi = imports.gi.Atspi;
const Gtk = imports.gi.Gtk;
const Lang = imports.lang;


Gtk.init(null, null);
Atspi.init();
Atspi.set_timeout(250, 250);

let w = new Gtk.Window();
w.resize(200, 200);

let b = Gtk.Box.new(Gtk.Orientation.VERTICAL, 10);
w.add(b);

let entry = new Gtk.Entry();
b.pack_start(entry, false, false, 0);
entry = new Gtk.Entry();
b.pack_start(entry, false, false, 0);

let listener = Atspi.EventListener.new(Lang.bind(this, function(event) {
    log('listener changed');
    log(event.source);
    log(event.source.get_component_iface());
}));
listener.register('object:state-changed:focused');
listener.register('object:state-changed:selected');

w.show_all();

Gtk.main();
