Adw.SidebarItem

g Adw.SidebarItem Adw.SidebarItem GObject.Object GObject.Object GObject.Object->Adw.SidebarItem

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (title)

get_drag_motion_activate ()

get_enabled ()

get_icon_name ()

get_icon_paintable ()

get_index ()

get_section ()

get_section_index ()

get_subtitle ()

get_suffix ()

get_title ()

get_tooltip ()

get_use_underline ()

get_visible ()

set_drag_motion_activate (drag_motion_activate)

set_enabled (enabled)

set_icon_name (icon_name)

set_icon_paintable (paintable)

set_subtitle (subtitle)

set_suffix (suffix)

set_title (title)

set_tooltip (tooltip)

set_use_underline (use_underline)

set_visible (visible)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

drag-motion-activate

bool

r/w/en

enabled

bool

r/w/en

icon-name

str

r/w/en

icon-paintable

Gdk.Paintable

r/w/en

section

Adw.SidebarSection

r

subtitle

str

r/w/en

suffix

Gtk.Widget

r/w/en

title

str

r/w/en

tooltip

str

r/w/en

use-underline

bool

r/w/en

visible

bool

r/w/en

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Adw.SidebarItem(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Adw.SidebarItemClass

An item within [class`SidebarSection`].

Sidebar items must have a title, set via [property`SidebarItem`:py:data::title<Adw.SidebarItem.props.title>].

Sidebar items should, but are not required to, have an icon. Icons can be set from an icon name, via [property`SidebarItem`:py:data::icon-name<Adw.SidebarItem.props.icon_name>], or a [iface`Gdk`.Paintable], via [property`SidebarItem`:py:data::icon-paintable<Adw.SidebarItem.props.icon_paintable>].

Items can also have subtitles, set with the [property`SidebarItem`:py:data::subtitle<Adw.SidebarItem.props.subtitle>] property. Subtitles should be used sparingly.

To add a tooltip, use [property`SidebarItem`:py:data::tooltip<Adw.SidebarItem.props.tooltip>]. Tooltips always use Pango markup.

Items can have an arbitrary suffix widget, set with the [property`SidebarItem`:py:data::suffix<Adw.SidebarItem.props.suffix>] properties. It will be displayed at the end of its row, or before the arrow in the [enum`Adw`.SidebarMode.page] mode.

To hide or disable the item, use the [property`SidebarItem`:py:data::visible<Adw.SidebarItem.props.visible>] and [property`SidebarItem`:py:data::enabled<Adw.SidebarItem.props.enabled>] properties respectively.

To access the items’s section, use [property`SidebarItem`:py:data::section<Adw.SidebarItem.props.section>].

It’s also possible to access the index of the item in both the section and the sidebar, using [method`SidebarItem`.get_section_index] and [method`SidebarItem`.get_index] respectively.

Dragging content over sidebar items activates them by default. To disable this behavior, set [property`SidebarItem`:py:data::drag-motion-activate<Adw.SidebarItem.props.drag_motion_activate>] to FALSE.

AdwSidebarItem is derivable, and applications that need to associate each page with data can store it in the items themselves this way.

New in version 1.9.

classmethod new(title)
Parameters:

title (str) – the item title

Returns:

the newly created AdwSidebarItem

Return type:

Adw.SidebarItem

Creates a new AdwSidebarItem with title as its title.

New in version 1.9.

get_drag_motion_activate()
Returns:

whether to enable the item on drag motion

Return type:

bool

Gets whether self will be activated on pointer motion during Drag-and-Drop.

New in version 1.9.

get_enabled()
Returns:

whether the item is enabled

Return type:

bool

Gets whether self is enabled.

New in version 1.9.

get_icon_name()
Returns:

the icon name

Return type:

str or None

Gets the icon name for item.

New in version 1.9.

get_icon_paintable()
Returns:

the icon paintable

Return type:

Gdk.Paintable or None

Gets the paintable used as the icon for item.

New in version 1.9.

get_index()
Returns:

the index of self

Return type:

int

Gets index of self within its [class`Sidebar`].

If self is within a section, but that section is not in a sidebar, index will be within the section only.

If self is not within a section, the index will be 0.

The item can later be retrieved by passing this index into [method`Sidebar`.get_item].

New in version 1.9.

get_section()
Returns:

the section of self

Return type:

Adw.SidebarSection or None

Gets the section self is in.

New in version 1.9.

get_section_index()
Returns:

the index of self

Return type:

int

Gets index of self within its [class`SidebarSection`].

If self is not within a section, the index will be 0.

The item can later be retrieved by passing this index into [method`SidebarSection`.get_item].

New in version 1.9.

get_subtitle()
Returns:

the subtitle

Return type:

str or None

Gets the subtitle of self.

New in version 1.9.

get_suffix()
Returns:

the suffix widget

Return type:

Gtk.Widget or None

Gets the suffix widget for self.

New in version 1.9.

get_title()
Returns:

the title

Return type:

str or None

Gets the title of self.

New in version 1.9.

get_tooltip()
Returns:

the tooltip

Return type:

str or None

Gets the tooltip of self.

New in version 1.9.

get_use_underline()
Returns:

whether an underline in the text indicates a mnemonic

Return type:

bool

Gets whether an underline in the title indicates a mnemonic.

New in version 1.9.

get_visible()
Returns:

whether the item is visible

Return type:

bool

Gets whether self is visible.

New in version 1.9.

set_drag_motion_activate(drag_motion_activate)
Parameters:

drag_motion_activate (bool) – whether to enable the item on drag motion

Sets whether to activate self on pointer motion during Drag-and-Drop.

This is needed to be able to drag content into the page the item represents, when the sidebar is used as a page switcher. However, it may be unwanted when dropping content onto the item itself, so it can be disabled.

New in version 1.9.

set_enabled(enabled)
Parameters:

enabled (bool) – whether to enable the item

Sets whether self is enabled.

See [property`Gtk`.Widget:sensitive].

New in version 1.9.

set_icon_name(icon_name)
Parameters:

icon_name (str or None) – the icon name

Sets the icon name for item.

Mutually exclusive with [property`SidebarItem`:py:data::icon-paintable<Adw.SidebarItem.props.icon_paintable>].

New in version 1.9.

set_icon_paintable(paintable)
Parameters:

paintable (Gdk.Paintable or None) – the icon paintable

Sets the paintable to use as the icon for item.

Mutually exclusive with [property`SidebarItem`:py:data::icon-name<Adw.SidebarItem.props.icon_name>].

New in version 1.9.

set_subtitle(subtitle)
Parameters:

subtitle (str or None) – the subtitle

Sets the subtitle of self.

New in version 1.9.

set_suffix(suffix)
Parameters:

suffix (Gtk.Widget or None) – the suffix widget

Sets the suffix widget for self.

Suffix will be shown at the end of the item’s row, or before the arrow in the [enum`Adw`.SidebarMode.page] mode.

New in version 1.9.

set_title(title)
Parameters:

title (str or None) – the title

Sets the title of self.

New in version 1.9.

set_tooltip(tooltip)
Parameters:

tooltip (str or None) – the tooltip

Sets the tooltip of self.

The tooltip can be marked up with the Pango text markup language.

New in version 1.9.

set_use_underline(use_underline)
Parameters:

use_underline (bool) – whether an underline in the text indicates a mnemonic

Sets whether an underline in the title indicates a mnemonic.

The mnemonic can be used to activate the item.

New in version 1.9.

set_visible(visible)
Parameters:

visible (bool) – whether the item is visible

Sets whether self is visible.

New in version 1.9.

Property Details

Adw.SidebarItem.props.drag_motion_activate
Name:

drag-motion-activate

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to activate the item on pointer motion during Drag-and-Drop.

This is needed to be able to drag content into the page the item represents, when the sidebar is used as a page switcher. However, it may be unwanted when dropping content onto the item itself, so it can be disabled.

New in version 1.9.

Adw.SidebarItem.props.enabled
Name:

enabled

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the item is enabled.

See [property`Gtk`.Widget:sensitive].

New in version 1.9.

Adw.SidebarItem.props.icon_name
Name:

icon-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The icon name for this item.

Mutually exclusive with [property`SidebarItem`:py:data::icon-paintable<Adw.SidebarItem.props.icon_paintable>].

New in version 1.9.

Adw.SidebarItem.props.icon_paintable
Name:

icon-paintable

Type:

Gdk.Paintable

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The paintable to use as the icon for this item.

Mutually exclusive with [property`SidebarItem`:py:data::icon-name<Adw.SidebarItem.props.icon_name>].

New in version 1.9.

Adw.SidebarItem.props.section
Name:

section

Type:

Adw.SidebarSection

Default Value:

None

Flags:

READABLE

The section the item is in.

New in version 1.9.

Adw.SidebarItem.props.subtitle
Name:

subtitle

Type:

str

Default Value:

''

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Subtitle of the item.

New in version 1.9.

Adw.SidebarItem.props.suffix
Name:

suffix

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The suffix widget for this item.

Suffix will be shown at the end of the item’s row, or before the arrow in the [enum`Adw`.SidebarMode.page] mode.

New in version 1.9.

Adw.SidebarItem.props.title
Name:

title

Type:

str

Default Value:

''

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Title of the item.

New in version 1.9.

Adw.SidebarItem.props.tooltip
Name:

tooltip

Type:

str

Default Value:

''

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The tooltip of the item.

The tooltip can be marked up with the Pango text markup language.

New in version 1.9.

Adw.SidebarItem.props.use_underline
Name:

use-underline

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether an underline in the title indicates a mnemonic.

The mnemonic can be used to activate the item.

New in version 1.9.

Adw.SidebarItem.props.visible
Name:

visible

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the item is visible.

New in version 1.9.