GtkSharp / GtkSharp

.NET wrapper for Gtk and other related libraries
Other
889 stars 99 forks source link

ListBox missing BindModel #77

Open nguyenkien opened 5 years ago

nguyenkien commented 5 years ago

https://valadoc.org/gtk+-3.0/Gtk.ListBox.bind_model.html

awittaker commented 5 years ago

Same for FlowBox... https://developer.gnome.org/gtk3/stable/GtkFlowBox.html#gtk-flow-box-bind-model Indicates since GTK 3.18?

awittaker commented 5 years ago

I had a poke through the source - the ListModel section (used by both GtkFlowBox and GtkListBox) looks a bit weird to me... GioSharp-api.xml#L14033

    <class name="List" cname="GList_">
      <method name="ModelGetItem" cname="g_list_model_get_item" shared="true">
        <return-type type="gpointer" />
        <parameters>
          <parameter type="GListModel*" name="list" />
          <parameter type="guint" name="position" />
        </parameters>
...

I don't fully understand how the .metadata and api.xml files work, but I would expect something like this...

    <class name="ListModel" cname="GListModel">
      <method name="GetItem" cname="g_list_model_get_item" shared="true">

The above section goes on to show all the methods for GListModel (all prepended with 'Model'), but also includes the methods from GListStore (all prepended with 'Store').

GListStore implements GListModel, so it looks like the metadata somehow split at GList instead of GListModel & GListStore. Especially when compared to GMenuModel in GioSharp-api.xml#L8426