On Sun, Apr 10, 2011 at 01:02:32AM +0200, [email protected] wrote: > Hi, > > can anyone explain me how does the Gtk.Builder.connect_signals() method > works? > You can read in guide (http://live.gnome.org/Vala/GTKSample) that when we > want to connect signals with method of instanced object then we have to > annotate the method with [CCode (instance_pos = -1)] and pass pointer to the > object to connect_signal(pointer). > Ok, that works, but why it works as well when I neither annotate my method > nor pass the pointer? > > The code below actually works but according to all guides it shouldn't. Why? > > class TestApp { > > public TestApp() { > try { > this.builder = new Gtk.Builder (); > builder.add_from_file("../ui/interface.glade"); > builder.connect_signals(null); > } catch (Error e) { > stderr.printf("Could not load UI: %s\n", e.message); > } > } > > public void on_close() { > stdout.printf("Quit application\n"); > Gtk.main_quit(); > } > > }
Because you are not using "this" inside on_close. Your on_close is used like a static method. -- http://www.debian.org - The Universal Operating System
signature.asc
Description: Digital signature
_______________________________________________ vala-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/vala-list
