Adw.SwitchRow

g Adw.ActionRow Adw.ActionRow Adw.SwitchRow Adw.SwitchRow Adw.ActionRow->Adw.SwitchRow Adw.PreferencesRow Adw.PreferencesRow Adw.PreferencesRow->Adw.ActionRow GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Actionable Gtk.Actionable GObject.GInterface->Gtk.Actionable Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.ListBoxRow Gtk.ListBoxRow Gtk.Actionable->Gtk.ListBoxRow Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.ListBoxRow->Adw.PreferencesRow Gtk.Widget->Gtk.ListBoxRow

Subclasses:

None

Methods

Inherited:

Adw.ActionRow (17), Adw.PreferencesRow (9), Gtk.ListBoxRow (12), Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Gtk.Actionable (5)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new ()

get_active ()

set_active (is_active)

Virtual Methods

Inherited:

Adw.ActionRow (1), Gtk.ListBoxRow (1), Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9), Gtk.Actionable (4)

Properties

Inherited:

Adw.ActionRow (6), Adw.PreferencesRow (4), Gtk.ListBoxRow (3), Gtk.Widget (34), Gtk.Accessible (1), Gtk.Actionable (2)

Name

Type

Flags

Short Description

active

bool

r/w/en

Signals

Inherited:

Adw.ActionRow (1), Gtk.ListBoxRow (1), Gtk.Widget (13), GObject.Object (1)

Fields

Inherited:

Adw.ActionRow (1), Gtk.ListBoxRow (1), Gtk.Widget (13), GObject.Object (1)

Class Details

class Adw.SwitchRow(**kwargs)
Bases:

Adw.ActionRow

Abstract:

No

Structure:

Adw.SwitchRowClass

A [class`Gtk`.ListBoxRow] used to represent two states.

<picture> <source srcset=”switch-row-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”switch-row.png” alt=”switch-row”> </picture>

The AdwSwitchRow widget contains a [class`Gtk`.Switch] that allows the user to select between two states: “on” or “off”. When activated, the row will invert its active state.

The user can control the switch by activating the row or by dragging on the switch handle.

See [class`Gtk`.Switch] for details.

Example of an AdwSwitchRow UI definition: ``xml <object class=”AdwSwitchRow”>

<property name=”title” translatable=”yes”>Switch Row</property> <signal name=”notify::active” handler=”switch_row_notify_active_cb”/>

</object> ``

The [property`SwitchRow`:py:data::active<Adw.SwitchRow.props.active>] property should be connected to in order to monitor changes to the active state.

New in version 1.4.

classmethod new()
Returns:

the newly created AdwSwitchRow

Return type:

Gtk.Widget

Creates a new AdwSwitchRow.

New in version 1.4.

get_active()
Returns:

whether self is active or not

Return type:

bool

Gets whether self is in its “on” or “off” position.

New in version 1.4.

set_active(is_active)
Parameters:

is_active (bool) – whether self should be active

Sets whether self is in its “on” or “off” position

New in version 1.4.

Property Details

Adw.SwitchRow.props.active
Name:

active

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the switch row is in the “on” or “off” position.

New in version 1.4.