Examples

Below are several examples of using the Seed GtkBuilder module. For additional resources, consult the examples/ folder of the Seed source

Example 3. 

<interface>
  <object class="GtkDialog" id="dialog1">
    <child internal-child="vbox">
      <object class="GtkVBox" id="vbox1">
        <property name="border-width">10</property>
        <child internal-child="action_area">
          <object class="GtkHButtonBox" id="hbuttonbox1">
            <property name="border-width">20</property>
            <child>
              <object class="GtkButton" id="ok_button">
                <property name="label">gtk-ok</property>
                <property name="use-stock">TRUE</property>
                <signal name="clicked" handler="ok_button_clicked"/>
              </object>
            </child>
          </object>
        </child>
      </object>
    </child>
  </object>
</interface>
#!/usr/local/bin/seed
Gtk = imports.gi.Gtk;
GtkBuilder = imports.gtkbuilder;

handlers = {
    ok_button_clicked: function(button){
	Seed.quit();
    }
};

Gtk.init(Seed.argv);

b = new Gtk.Builder();
b.add_from_file("test.ui");
b.connect_signals(handlers);

d = b.get_object("dialog1");

d.show_all();

Gtk.main();