GtkSignalListItemFactory setup signal

I am trying to use GtkColumnView.

From Gtk.SignalListItemFactory::setup we have

setup (
  GtkSignalListItemFactory* self,
  GObject* object,
  gpointer user_data

But from /usr/share/gir-1.0/Gtk-4.0.gir

      <glib:signal name="setup" when="first">
        <doc xml:space="preserve"
             line="156">Emitted when a new listitem has been created and needs to be setup for use.

It is the first signal emitted for every listitem.

The [signal@Gtk.SignalListItemFactory::teardown] signal is the opposite
of this signal and can be used to undo everything done in this signal.</doc>
        <return-value transfer-ownership="none">
          <type name="none" c:type="void"/>
          <parameter name="listitem" transfer-ownership="none">
            <doc xml:space="preserve"
                 line="159">The `GtkListItem` to set up</doc>
            <type name="ListItem"/>

So from GIR file the parameter type is type name=“ListItem”. Is there a good reason that in the API docs parameter type is just GObject*? At least it was confusing for me.

This is a forward compatible change in recent GTK: before 4.8, GtkListItemFactory implementations returned a GtkListItem; starting from GTK 4.8, GtkListItemFactory implementations can return a GObject. Since GtkListItem is a GObject this is allowed as it’s forward compatible; in other words: you can take code built against GTK pre-4.8, and it will work with GTK 4.8 and later. It’s not fully backward compatible—i.e. you cannot take code written for GTK 4.8 and later, and run it with GTK pre-4.8, but GTK has never made that guarantee in the first place.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.