On Sat, 2014-12-20 at 00:51 -0200, Flavio Danesse wrote: > Another thing that does not work as expected is: > > this.get_toplevel () > > This should return the main application window, or one Gtk.Window, but > returns a Gtk.Widget
Because that's what the C function does. The documentation describes when the return value will *not* be a Gtk.Window. See https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-get-toplevel > 2014-12-20 0:32 GMT-02:00 Flavio Danesse <fdane...@gmail.com>: > > > I understand, but it is logical that a get back what is asked, things like > > that are not logical fol: > > > > error: invocation of void method not allowed as expression > > this.get_property("type"); Not sure where you're getting that error from—trying to call GLib.Object.get_property like that here results in: error: 1 missing arguments for `void GLib.Object.get_property (string property_name, ref GLib.Value value)' As for why it returns void instead of GLib.Value, look at the C function: https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#g-object-get-property > > > > In the initial example: > > this.get_allocation() > > does not work, though: > > this.get_allocated_width() > > if it works. This is a more interesting example, but again it's a reflection of the C API: https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-get-allocation https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-get-allocated-width For this function it would actually be possible to alter the bindings to public Gtk.Allocation get_allocation (); Actually, these days it is generated like that by default, but we have a line in our metadata file to change it back to avoid breaking backwards compatibility. Also, we have to be careful changing out params to return values like that since in the future the C API may change to include a return value (which isn't an API break for the C API). That happened recently in GtkSourceview and it broke several Vala programs. See https://bugzilla.gnome.org/show_bug.cgi?id=738896 _______________________________________________ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list