It derives from <GObject>.
A section within Sidebar.
<AdwSidebarSection> contains
SidebarItem objects.
Section can optionally have a title, set with the
SidebarSection:title property. If a title is not set, the
section will have a separator in front of it, or just spacing in the
Adw.SidebarMode.page mode.
To add items, use SidebarSection.append,
SidebarSection.prepend or SidebarSection.insert.
To remove items, use SidebarSection.remove or
SidebarSection.remove_all.
To inspect the items, use SidebarSection.get_item or
SidebarSection:items.
To get the sidebar the section is in, useSidebarSection:sidebar.
<AdwSidebarSection> can show items from a
provided <GListModel>, using
SidebarSection.bind_model. It works the same way as
list-box:bind-model, except the
provided function creates an SidebarItem rather than a
<GtkListBoxRow>.
While a model is bound, adding or removing items manually is not allowed. Inspecting them is still allowed, but discouraged.
<AdwSidebarSection> allows adding items as
children.
Example of an <AdwSidebarSection> UI
definition:
<object class="AdwSidebarSection">
<property name="title" translatable="yes">Places</property>
<child>
<object class="AdwSidebarItem">
<property name="title" translatable="yes">Music</property>
<property name="icon-name">folder-music-symbolic</property>
</object>
</child>
<child>
<object class="AdwSidebarItem">
<property name="title" translatable="yes">Pictures</property>
<property name="icon-name">folder-pictures-symbolic</property>
</object>
</child>
<child>
<object class="AdwSidebarItem">
<property name="title" translatable="yes">Videos</property>
<property name="icon-name">folder-videos-symbolic</property>
</object>
</child>
</object>
Result:
A list model with the section’s items.
This can be used to keep an up-to-date view.
Its value is a <GListModel>, or #f.
It is read only.
Context menu model for the section items.
When a context menu is shown for an item, it will be constructed from
the provided menu model. Use the "setup-menu" signal to set up
the menu actions for the particular item.
If not set, Sidebar:menu-model will be used instead.
Its value is a <GMenuModel>, or #f.
Set it with (set! (sidebar-section:menu-model self) value).
The sidebar the section is in.
Its value is a <AdwSidebar>, or #f.
It is read only.
Title of the section.
If set, it will be displayed instead of the separator before the section.
Its value is a string, or #f.
Set it with (set! (sidebar-section:title self) value).
Appends item to self.
Cannot be used while a model is bound via
SidebarSection.bind_model.
Passed: a <AdwSidebarSection>.
a sidebar section
Passed: a <AdwSidebarItem>.
an item to append
Binds model to self.
If self was already bound to a model, that previous binding is destroyed.
The contents of self are cleared and then filled with items that represent items from model. self is updated whenever model changes.
If model is NULL, self is left empty.
Calling SidebarSection.prepend, SidebarSection.insert,
SidebarSection.append, SidebarSection.remove or
SidebarSection.remove_all while a model is bound is not allowed.
Accessing items and modifying them is allowed, but the changes will be erased whenever that part of the model changes, so it’s not recommended.
Passed: a <AdwSidebarSection>.
a sidebar section
Passed, or left out: a <GListModel>, or
#f.
the model to be bound
Passed, or left out: a procedure, or #f.
a function that creates SidebarItem for model items, or
NULL in case model is also NULL
See
AdwSidebarSectionCreateItemFunc
for how it is called.
Not passed: guile-gi supplies it.
user data passed to create-widget-func
Not passed: guile-gi supplies it.
function for freeing user-data
See GDestroyNotify for how it is
called.
Gets the item at index within self.
The index starts from 0 at the top of the section, and is same as the
one returned by SidebarItem.get_section_index.
Can return NULL if index is larger or equal to the number
of items.
Passed: a <AdwSidebarSection>.
a sidebar section
Passed: an unsigned 32-bit integer.
index of the item
Returned: a <AdwSidebarItem>, or #f.
the item at index
Gets a list model with self’s items.
This can be used to keep an up-to-date view.
Passed: a <AdwSidebarSection>.
a sidebar section
Returned: a <GListModel>.
a model containing the items
Gets the context menu model for self’s items.
Passed: a <AdwSidebarSection>.
a sidebar section
Returned: a <GMenuModel>, or #f.
the context menu model
Gets the sidebar self is in.
Passed: a <AdwSidebarSection>.
a sidebar section
Returned: a <AdwSidebar>, or #f.
the sidebar of self
Gets the title of self.
Passed: a <AdwSidebarSection>.
a sidebar section
Returned: a string, or #f.
the title
Inserts item at position to self.
If position is -1, or larger than the total number of items in self, the item will be appended to the end.
Cannot be used while a model is bound via
SidebarSection.bind_model.
Passed: a <AdwSidebarSection>.
a sidebar section
Passed: a <AdwSidebarItem>.
an item to insert
Passed: a 32-bit integer.
position to insert item at
Creates a new <AdwSidebarSection>.
Returned: a <AdwSidebarSection>.
the newly created <AdwSidebarSection>
Prepends item to self.
Cannot be used while a model is bound via
SidebarSection.bind_model.
Passed: a <AdwSidebarSection>.
a sidebar section
Passed: a <AdwSidebarItem>.
an item to prepend
Removes item from self.
Cannot be used while a model is bound via
SidebarSection.bind_model.
Passed: a <AdwSidebarSection>.
a sidebar section
Passed: a <AdwSidebarItem>.
an item to remove
Removes all items from self.
Cannot be used while a model is bound via
SidebarSection.bind_model.
Passed: a <AdwSidebarSection>.
a sidebar section
Sets the context menu model for self’s items.
When a context menu is shown for an item, it will be constructed from
the provided menu model. Use the "setup-menu" signal to set up
the menu actions for the particular item.
If not set, Sidebar:menu-model will be used instead.
Passed: a <AdwSidebarSection>.
a sidebar section
Passed, or left out: a <GMenuModel>, or
#f.
a menu model
Sets the title of self.
If set, it will be displayed instead of the separator before the section.
Passed: a <AdwSidebarSection>.
a sidebar section
Passed, or left out: a string, or #f.
the title