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:

sidebar-section .

Available since: 1.9

Hierarchy

hierarchy this AdwSidebarSection implements_0 GtkBuildable this--implements_0 ancestor_0 GObject ancestor_0--this

Ancestors

Implements

Constructors

adw_sidebar_section_new

Creates a new AdwSidebarSection.

unstable since: 1.9

Instance methods

adw_sidebar_section_append

Appends item to self.

unstable since: 1.9

adw_sidebar_section_bind_model

Binds model to self.

unstable since: 1.9

adw_sidebar_section_get_item

Gets the item at index within self.

unstable since: 1.9

adw_sidebar_section_get_items

Gets a list model with selfs items.

unstable since: 1.9

adw_sidebar_section_get_menu_model

Gets the context menu model for selfs items.

unstable since: 1.9

adw_sidebar_section_get_sidebar

Gets the sidebar self is in.

unstable since: 1.9

adw_sidebar_section_get_title

Gets the title of self.

unstable since: 1.9

adw_sidebar_section_insert

Inserts item at position to self.

unstable since: 1.9

adw_sidebar_section_prepend

Prepends item to self.

unstable since: 1.9

adw_sidebar_section_remove

Removes item from self.

unstable since: 1.9

adw_sidebar_section_remove_all

Removes all items from self.

unstable since: 1.9

adw_sidebar_section_set_menu_model

Sets the context menu model for selfs items.

unstable since: 1.9

adw_sidebar_section_set_title

Sets the title of self.

unstable since: 1.9

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Methods inherited from GtkBuildable (1)
gtk_buildable_get_buildable_id

Gets the ID of the buildable object.

Properties

Adw.SidebarSection:items

A list model with the section’s items.

unstable since: 1.9

Adw.SidebarSection:menu-model

Context menu model for the section items.

unstable since: 1.9

Adw.SidebarSection:sidebar

The sidebar the section is in.

unstable since: 1.9

Adw.SidebarSection:title

Title of the section.

unstable since: 1.9

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.

Class structure

struct AdwSidebarSectionClass {
  GObjectClass parent_class;
  
}

No description available.

Class members
parent_class: GObjectClass

No description available.