[Vala] direct field access when field not documented?



Hello list,

while continuing to learn Gtk+ and Vala, I struggled with the following problem:
I had a TreeViewColumn that I used with a sortable TreeModel, and the DevHelp documentation mentioned that calling:

tree_view_column_set_sort_column_id (GtkTreeViewColumn *widget, int sort_column_id)

would enable the header to sort/resort/reset sort on that sort column.

What I wrote in Vala was: treeViewColumn.sort_column_id = 0;

After two days of playing with and debugging my tree model, it occurred to me that tree_view_column_set_sort_column_id () never got called.
I opened the generated C file and here's what I saw:

treeViewModel->sort_column_id = 0;

So the explanation is that there was also a field with that value, and setting the field never did what the set () function did.

Now, from what I saw, that field does not even have a property associated: modifiying the Gtk vapi to use it as a property yielded runtime errors.

Question: aren't these direct field access supposed to be deprecated in Gtk? (at least that field didn't show up in the docs)
How can one change the vapi binding to call set_sort_column_id on setting the sort_column_id property, given that there is no corresponding GObject property?

Thank you,
Vlad


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