/* Auto generated by gen-vala-gtk-widget-bindings.xslt */ using GLib; using Gtk; public class GladeValaDemo : Gtk.Object { construct { this.xml = new Gtk.Builder (); this.xml.add_from_string(xmldef, (int)xmldef.size()); this.widgets=new window_widgets(); widget_connect(); } private void widget_connect() { weak SList widgets = this.xml.get_objects(); Gtk.Widget **sym; foreach (Gtk.Widget widget in widgets) { int c; for (c=0; widget_info[c].name != null; c++) { if (widget_info[c].name == widget.name) { Gtk.Widget **sym=&(this.widgets.GladeValaDemo) + widget_info[c].index; *sym=widget; break; } } if (widget_info[c].name == null) { stdout.printf ("Symbol not found: %s\n", widget.name); } } } [InstanceLast] protected void connect_signal (Gtk.Builder builder, GLib.Object object, string signal_name, string handler_name, GLib.Object? connect_objectt, GLib.ConnectFlags flags) { void* sym; if (!module.symbol (namespace + handler_name, out sym) && !module.symbol (handler_name, out sym)) { stdout.printf ("Symbol not found: %s => %s\n", signal_name, handler_name); } else { GLib.Signal.connect(object, signal_name, (GLib.Callback) sym, this); } } protected void connect_signals(string namespace) { this.namespace=namespace; if (null!=(this.module = Module.open (null, ModuleFlags.BIND_LAZY))) { this.xml.connect_signals_full(connect_signal); } } protected string namespace; private Module module; protected class window_widgets { protected Gtk.Window GladeValaDemo; /* GtkWindow GladeValaDemo */ protected Gtk.VBox vbox1; /* GtkVBox vbox1 */ protected Gtk.Label label; /* GtkLabel label */ protected Gtk.Button button1; /* GtkButton button1 */ protected Gtk.Statusbar statusbar1; /* GtkStatusbar statusbar1 */ } protected struct window_widget_names { protected int index; protected string class; protected string name; } protected Gtk.Builder xml; protected window_widgets widgets; protected static const window_widget_names[] widget_info = { /* widget name list for runtime binding */ {0, "GtkWindow", "GladeValaDemo"}, {1, "GtkVBox", "vbox1"}, {2, "GtkLabel", "label"}, {3, "GtkButton", "button1"}, {4, "GtkStatusbar", "statusbar1"}, {0, null, null} }; private static const string xmldef="\n \n True\n \n \n \n True\n \n \n True\n Press the button to see not much happen\n \n \n \n \n True\n True\n True\n gtk-ok\n True\n \n \n \n 1\n \n \n \n \n True\n 2\n \n \n False\n 2\n \n \n \n \n \n"; }