The
gtk:signal-list-item-factory object is a
gtk:list-item-factory object that emits signals to to manage
list items.
Signals are emitted for every list item in the same order:
- The "setup" signal is emitted to set up permanent things on
the list item. This usually means constructing the widgets used in the row and adding them to the list item.
- The "bind" signal is emitted to bind the item passed via the item property to the widgets that have been created
in step 1 or to add item specific widgets. Signals are connected to listen
to changes - both to changes in the item to update the widgets or to
changes in the widgets to update the item. After this signal has been called, the list item may be shown in a list widget.
- The "unbind" signal is emitted to undo everything done in
step 2. Usually this means disconnecting signal handlers. Once this signal has been called, the list item will no longer be used in a list widget.
- The "bind" and "unbind" signals may be emitted
multiple times again to bind the list item for use with new items. By
reusing list items, potentially costly setup can be avoided. However, it
means code needs to make sure to properly clean up the list item in step 3 so that no information from the previous use leaks into the next use.
- The "teardown" signal is emitted to allow undoing the effects of the "setup" signal. After this signal was emitted on a list item, the list item will be destroyed and not be used again.
Note that during the signal emissions, changing properties on the list items
passed will not trigger notify signals as the list item’s notifications are frozen. See the
g:object-freeze-notify function for details.
For tracking changes in other properties in the list item, the
"::notify" signal is recommended. The signal can be connected in the
"setup" signal and removed again during the
"teardown"
signal.
Signal Details
The "bind" signal
lambda (factory item) :run-first
- factory
- The gtk:signal-list-item-factory object.
- item
- The gtk:list-item object to bind.
The signal is emitted when a new item has been set on the list item and
should be bound for use. After this signal was emitted, the list item might be shown in a
gtk:list-view widget or other list widget. The
"unbind" signal is the opposite of this signal and can be used to undo everything done in this signal.
The "setup" signal
lambda (factory item) :run-first
- factory
- The gtk:signal-list-item-factory object.
- item
- The gtk:list-item object to set up.
The signal is emitted when a new list item has been created and needs to
be setup for use. It is the first signal emitted for every list item. The
"teardown" signal is the opposite of this signal and can be used to undo everything done in this signal.
The "teardown" signal
lambda (factory item) :run-first
- factory
- The gtk:signal-list-item-factory object.
- item
- The gtk:list-item object to teardown.
The
"teardown" signal is emitted when a list item is about to be
destroyed. It is the last signal ever emitted for this list item. This signal is the opposite of the
"setup" signal and should be used to undo everything done in that signal.
The "unbind" signal
lambda (factory item) :run-first
- factory
- The gtk:signal-list-item-factory object.
- item
- The gtk:list-item object to unbind.
The signal is emitted when a list item has been removed from use in a list
widget and its new item is about to be unset. This signal is the opposite of the
"bind" signal and should be used to undo everything done
in that signal.