Adw.PreferencesWindow

g Adw.PreferencesWindow Adw.PreferencesWindow Adw.Window Adw.Window Adw.Window->Adw.PreferencesWindow GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget Gtk.Native Gtk.Native GObject.GInterface->Gtk.Native Gtk.Root Gtk.Root GObject.GInterface->Gtk.Root Gtk.ShortcutManager Gtk.ShortcutManager GObject.GInterface->Gtk.ShortcutManager 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.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.Window Gtk.Window Gtk.Native->Gtk.Window Gtk.Root->Gtk.Window Gtk.ShortcutManager->Gtk.Window Gtk.Widget->Gtk.Window Gtk.Window->Adw.Window

Subclasses:

None

Methods

Inherited:

Adw.Window (7), Gtk.Window (62), Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Gtk.Native (6), Gtk.Root (3)

Structs:

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

class

new ()

add (page)

add_toast (toast)

close_subpage ()

get_can_navigate_back ()

get_search_enabled ()

get_visible_page ()

get_visible_page_name ()

pop_subpage ()

present_subpage (subpage)

push_subpage (page)

remove (page)

set_can_navigate_back (can_navigate_back)

set_search_enabled (search_enabled)

set_visible_page (page)

set_visible_page_name (name)

Virtual Methods

Inherited:

Gtk.Window (5), Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9), Gtk.ShortcutManager (2)

Properties

Inherited:

Adw.Window (4), Gtk.Window (25), Gtk.Widget (34), Gtk.Accessible (1)

Name

Type

Flags

Short Description

can-navigate-back

bool

d/r/w/en

deprecated

search-enabled

bool

r/w/en

visible-page

Gtk.Widget

r/w/en

visible-page-name

str

r/w/en

Signals

Inherited:

Gtk.Window (5), Gtk.Widget (13), GObject.Object (1)

Fields

Inherited:

Gtk.Window (5), Gtk.Widget (13), GObject.Object (1)

Name

Type

Access

Description

parent_instance

Adw.Window

r

Class Details

class Adw.PreferencesWindow(*args, **kwargs)
Bases:

Adw.Window

Abstract:

No

Structure:

Adw.PreferencesWindowClass

A window to present an application’s preferences.

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

The AdwPreferencesWindow widget presents an application’s preferences gathered into pages and groups. The preferences are searchable by the user.

CSS nodes

AdwPreferencesWindow has a main CSS node with the name window and the style class .preferences.

classmethod new()
Returns:

the newly created AdwPreferencesWindow

Return type:

Gtk.Widget

Creates a new AdwPreferencesWindow.

add(page)
Parameters:

page (Adw.PreferencesPage) – the page to add

Adds a preferences page to self.

add_toast(toast)
Parameters:

toast (Adw.Toast) – a toast

Displays toast.

See [method`ToastOverlay`.add_toast].

close_subpage()

Closes the current subpage.

If there is no presented subpage, this does nothing.

Deprecated since version 1.4: Use [method`PreferencesWindow`.pop_subpage] instead.

get_can_navigate_back()
Returns:

whether gestures and shortcuts are enabled.

Return type:

bool

Gets whether gestures and shortcuts for closing subpages are enabled.

Deprecated since version 1.4: Use [method`NavigationPage`.get_can_pop] instead.

get_search_enabled()
Returns:

whether search is enabled for self.

Return type:

bool

Gets whether search is enabled for self.

get_visible_page()
Returns:

the visible page

Return type:

Adw.PreferencesPage or None

Gets the currently visible page of self.

get_visible_page_name()
Returns:

the name of the visible page

Return type:

str or None

Gets the name of currently visible page of self.

pop_subpage()
Returns:

TRUE if a page has been popped

Return type:

bool

Pop the visible page from the subpage stack of self.

New in version 1.4.

present_subpage(subpage)
Parameters:

subpage (Gtk.Widget) – the subpage

Sets subpage as the window’s subpage and opens it.

The transition can be cancelled by the user, in which case visible child will change back to the previously visible child.

Deprecated since version 1.4: Use [method`PreferencesWindow`.push_subpage] instead.

push_subpage(page)
Parameters:

page (Adw.NavigationPage) – the subpage

Pushes page onto the subpage stack of self.

The page will be automatically removed when popped.

New in version 1.4.

remove(page)
Parameters:

page (Adw.PreferencesPage) – the page to remove

Removes a page from self.

set_can_navigate_back(can_navigate_back)
Parameters:

can_navigate_back (bool) – the new value

Sets whether gestures and shortcuts for closing subpages are enabled.

The supported gestures are:

  • One-finger swipe on touchscreens

  • Horizontal scrolling on touchpads (usually two-finger swipe)

  • Back mouse button

The keyboard back key is also supported, as well as the <kbd>Alt</kbd>+<kbd>←</kbd> shortcut.

For right-to-left locales, gestures and shortcuts are reversed.

Deprecated since version 1.4: Use [method`NavigationPage`.set_can_pop] instead. Has no effect for subpages added with [method`PreferencesWindow`.push_subpage].

set_search_enabled(search_enabled)
Parameters:

search_enabled (bool) – whether search is enabled

Sets whether search is enabled for self.

set_visible_page(page)
Parameters:

page (Adw.PreferencesPage) – a page of self

Makes page the visible page of self.

set_visible_page_name(name)
Parameters:

name (str) – the name of the page to make visible

Makes the page with the given name visible.

See [property`PreferencesWindow`:py:data::visible-page<Adw.PreferencesWindow.props.visible_page>].

Property Details

Adw.PreferencesWindow.props.can_navigate_back
Name:

can-navigate-back

Type:

bool

Default Value:

False

Flags:

DEPRECATED, READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether gestures and shortcuts for closing subpages are enabled.

The supported gestures are:

  • One-finger swipe on touchscreens

  • Horizontal scrolling on touchpads (usually two-finger swipe)

  • Back mouse button

The keyboard back key is also supported, as well as the <kbd>Alt</kbd>+<kbd>←</kbd> shortcut.

For right-to-left locales, gestures and shortcuts are reversed.

Deprecated since version 1.4: Use [property`NavigationPage`:can-pop] instead. Has no effect for subpages added with [method`PreferencesWindow`.push_subpage].

Adw.PreferencesWindow.props.search_enabled
Name:

search-enabled

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether search is enabled.

Adw.PreferencesWindow.props.visible_page
Name:

visible-page

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The currently visible page.

Adw.PreferencesWindow.props.visible_page_name
Name:

visible-page-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The name of the currently visible page.

See [property`PreferencesWindow`:py:data::visible-page<Adw.PreferencesWindow.props.visible_page>].