I'm totally clueless why this error is being thrown. The valadoc shows that this function exist. The append function also works. Here's the code to reproduce it:
class some_object : GLib.Object {
public int val {get; construct;}
public some_object (int val) {
Object (
val: val
);
}
}
class ExampleList : Gtk.ApplicationWindow {
construct {
var dummy = new some_object(0);
var model = new GLib.ListStore (GLib.Type.from_instance (dummy));
model.append (dummy);
uint position;
model.find (dummy, out position);
// ^^^^
}
}
class MyApplication : Gtk.Application {
public MyApplication () {
Object (
application_id: "com.example.listbox"
);
}
public override void activate () {
new ExampleList (). show_all ();
}
}
public static int main (string[] args) {
return new MyApplication (). run (args);
}
To compile I use:
valac --pkg=gtk+-3.0 so.vala
And the error I'm getting is:
so.vala:18.9-18.18: error: The name `find' does not exist in the context of `GLib.ListStore'
model.find (dummy, out position);
^^^^^^^^^^
Compilation failed: 1 error(s), 0 warning(s)
From the reference document you link to:
[ Version ( since = "2.64" ) ]
This GIO version was only released this year: it's likely that you are using an older version that does not include this function.