using Gtk; /* When button click signal received */ public void on_button1_clicked (Button source) { /* change button label to clicked! */ source.label = "Clicked!"; stderr.printf ("Clicked! --> "); } public void on_window1_destroy (Window source) { /* When window close signal received */ Gtk.main_quit (); } int main (string[] args) { Gtk.init (ref args); var builder = new Builder (); // Custom location: File exec_file = File.new_for_path (Environment.find_program_in_path (args[0])); string settings_dir = Path.build_path (Path.DIR_SEPARATOR_S, exec_file.get_parent().get_parent().get_path(), "share/gtkbuilder-test/ui"); /* Getting the glade file */ builder.add_from_file (settings_dir + "/gtkbuilder-test.glade"); builder.connect_signals (null); var window = builder.get_object ("window1") as Window; var entry = builder.get_object ("entry1") as Entry; var button = builder.get_object ("button1") as Button; /* thats another way to do something when signal received */ button.clicked.connect (() => { stderr.printf ("%s\n", entry.get_text ()); }); window.show_all (); Gtk.main (); return 0; }