[Vala] Use of Gtk.Builder.connect_signals() on object instance



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();
   }

}

Thanks,
Pawel


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]