Seed Reference Manual |
---|
API Reference
The GtkBuilder extends Gtk.GtkBuilder.prototype to implement a custom automatic signal connection function, which is useful in Seed. It does not provide any methods or types, so there is no need to save it's namespace, as of such it can be imported as follows.
imports.gtkbuilder;
builder.connect_signals (object, user_data)
Connects the signals present in the GtkBuilder to the functions present in object
. That is to say, a signal with handler name, 'ok_button_clicked' will be connected to the 'ok_button_clicked' property of object.
|
undefined |
|
undefined |
Examples
Below are several examples of using the Seed GtkBuilder module. For additional resources, consult the examples/ folder of the Seed source
Example 16.
<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();