const ByteArray = imports.byteArray;
const Gtk = imports.gi.Gtk;
const Lang = imports.lang;

const TEMPLATE = ByteArray.fromString('<?xml version="1.0" encoding="UTF-8"?>\
<!-- Generated with glade 3.20.0 -->\
<interface>\
  <requires lib="gtk+" version="3.20"/>\
  <template class="GtkHelloWorld" parent="GtkGrid">\
    <property name="visible">True</property>\
    <property name="can_focus">False</property>\
    <child>\
      <object class="GtkLabel" id="greeting">\
        <property name="visible">True</property>\
        <property name="can_focus">False</property>\
        <property name="label" translatable="yes">Hello</property>\
      </object>\
      <packing>\
        <property name="left_attach">0</property>\
        <property name="top_attach">0</property>\
      </packing>\
    </child>\
    <child>\
      <object class="GtkLabel" id="greetee">\
        <property name="visible">True</property>\
        <property name="can_focus">False</property>\
        <property name="label" translatable="yes">World</property>\
      </object>\
      <packing>\
        <property name="left_attach">0</property>\
        <property name="top_attach">1</property>\
      </packing>\
    </child>\
  </template>\
</interface>');

const GtkHelloWorld = new Lang.Class({
    Name: 'GtkHelloWorld',
    GTypeName: 'GtkHelloWorld',
    Extends: Gtk.Grid,

    Template: TEMPLATE,
    Children: ['greeting', 'greetee'],
});

const GtkGoodbyeWorld = new Lang.Class({
    Name: 'GtkGoodbyeWorld',
    GTypeName: 'GtkGoodbyeWorld',
    Extends: GtkHelloWorld,

    _init: function (props={}) {
        this.parent(props);
        this.greeting.label = 'Goodbye';
    },
});


Gtk.init(null);
let win = new Gtk.Window();
win.add(new GtkGoodbyeWorld());
win.connect('destroy', Gtk.main_quit);
win.show_all();
Gtk.main();
