Basics
Guides
API Reference
Basics
Guides
API Reference
[16:7] extends: object
A selection model that allows selecting a single item. Note that the selection is persistent -- if the selected item is removed and re-added in the same [signal@Gio.ListModel::items-changed] emission, it stays selected. In particular, this means that changing the sort order of an underlying sort model will preserve the selection.
SingleSelection (model = null)
Creates a new selection to handle @model.
model is the GListModel to manage.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asObject ()
Wraps this handle as
Object.
A Object object.asListModel ()
Wraps this handle as
ListModel.
A ListModel object.asSectionModel ()
Wraps this handle as
SectionModel.
A SectionModel object.asSelectionModel ()
Wraps this handle as
SelectionModel.
A SelectionModel object.getProperty (string Name)
Reads one generated property by name.
setProperty (string Name, Value)
Writes one generated property by name.
setAutoselect (bool Value)
If the selection will always select an item.
Value is the new property value.None.setCanunselect (bool Value)
If unselecting the selected item is allowed.
Value is the new property value.None.setModel (object Value)
The model being managed.
Value is the new property value.None.setSelected (int Value)
Position of the selected item.
Value is the new property value.None.get_autoselect ()
Checks if autoselect has been enabled or disabled via gtk_single_selection_set_autoselect().
get_can_unselect ()
If %TRUE, gtk_selection_model_unselect_item() is supported and allows unselecting the selected item.
get_model ()
Gets the model that @self is wrapping.
get_selected ()
Gets the position of the selected item. If no item is selected, %GTK_INVALID_LIST_POSITION is returned.
get_selected_item ()
Gets the selected item. If no item is selected, %NULL is returned.
set_autoselect (bool autoselect)
Enables or disables autoselect. If @autoselect is %TRUE, @self will enforce that an item is always selected. It will select a new item when the currently selected item is deleted and it will disallow unselecting the current item.
autoselect is %TRUE to always select an item.None.set_can_unselect (bool can_unselect)
If %TRUE, unselecting the current item via gtk_selection_model_unselect_item() is supported. Note that setting [property@Gtk.SingleSelection:autoselect] will cause unselecting to not work, so it practically makes no sense to set both at the same time.
can_unselect is %TRUE to allow unselecting.None.set_model (object model)
Sets the model that @self should wrap. If @model is %NULL, @self will be empty.
model is A GListModel to wrap.None.set_selected (int position)
Selects the item at the given position. If the list does not have an item at @position or %GTK_INVALID_LIST_POSITION is given, the behavior depends on the value of the [property@Gtk.SingleSelection:autoselect] property: If it is set, no change will occur and the old item will stay selected. If it is unset, the selection will be unset and no item will be selected. This also applies if [property@Gtk.SingleSelection:can-unselect] is set to %FALSE.
position is the item to select or %GTK_INVALID_LIST_POSITION.None.model ()
Returns
get_modelas an Aussom list of wrapper objects. This companion method materializes the full collection up front; useget_model()when lazy or change-notify access is required.
An Aussom list of elements.[332:14] static extends: object
Generated metadata helpers for SingleSelection class surfaces.
properties ()
Returns property metadata for
SingleSelection.
A list.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.