Search code examples
gtkvalagobject

Why does vala complain about a missing property when there is such prop


I am developing a GUI app with gtk 3 and vala. This is my source code from MainWindow::MainWindow()

    var menu = new MenuModel();
    var app = this.application;
    app.menubar = menu;

valac gives this errors :

ewns_viewer.vala:54.9-54.19: error: The name `menubar' does not exist in the context of `Gtk.Application'
        app.menubar = menu;
        ^^^^^^^^^^^

Looking at this, says otherwise. I also tried

var obj_class = (ObjectClass) typeof (Gtk.Application).class_ref ();
var properties = obj_class.list_properties ();
foreach (var prop in properties) 
{
    stdout.printf ("%s\n", prop.name);
}

That gives this output :

application-id
flags
is-registered
is-remote
inactivity-timeout
action-group
register-session
app-menu
menubar

If I get it right Gtk.Application has all that properties,so why does valac give me this error?

I am using valac 0.14.2.Ubuntu 12.04.


Solution

  • The binding in /usr/share/vala-0.14/vapi/gtk+-3.0.vapi is out of date for Vala 0.14 on Ubuntu. If you install Vala 0.16, this binding will be available.