Class
AdwSidebarSection
unstable since: 1.9
Description [src]
final class Adw.SidebarSection : GObject.Object
implements Gtk.Buildable {
/* No available fields */
}
A section within AdwSidebar.
AdwSidebarSection contains AdwSidebarItem objects.
Section can optionally have a title, set with the
AdwSidebarSection:title property. If a title is not set, the section
will have a separator in front of it, or just spacing in the
ADW_SIDEBAR_MODE_PAGE mode.
To add items, use adw_sidebar_section_append(),
adw_sidebar_section_prepend() or adw_sidebar_section_insert().
To remove items, use adw_sidebar_section_remove() or
adw_sidebar_section_remove_all().
To inspect the items, use adw_sidebar_section_get_item() or
AdwSidebarSection:items.
To get the sidebar the section is in, useAdwSidebarSection:sidebar.
Binding models
AdwSidebarSection can show items from a provided GListModel,
using adw_sidebar_section_bind_model(). It works the same way as
gtk_list_box_bind_model(), except the provided function creates an
AdwSidebarItem 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 as GtkBuildable
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:
Available since: 1.9
Instance methods
adw_sidebar_section_get_menu_model
Gets the context menu model for self‘s items.
unstable since: 1.9
adw_sidebar_section_set_menu_model
Sets the context menu model for self‘s items.
unstable since: 1.9
Methods inherited from GtkBuildable (1)
gtk_buildable_get_buildable_id
Gets the ID of the buildable object.
Signals
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.