LockButton#

Deprecated since version 4.10: This widget will be removed in GTK 5

class LockButton(**properties: Any)#

Superclasses: Button, Widget, InitiallyUnowned, Object

Implemented Interfaces: Accessible, Actionable, Buildable, ConstraintTarget

GtkLockButton is a widget to obtain and revoke authorizations needed to operate the controls.

https://docs.gtk.org/gtk4/lock-button.png

It is typically used in preference dialogs or control panels.

The required authorization is represented by a GPermission object. Concrete implementations of GPermission may use PolicyKit or some other authorization framework. To obtain a PolicyKit-based GPermission, use polkit_permission_new().

If the user is not currently allowed to perform the action, but can obtain the permission, the widget looks like this:

https://docs.gtk.org/gtk4/lockbutton-locked.png

and the user can click the button to request the permission. Depending on the platform, this may pop up an authentication dialog or ask the user to authenticate in some other way. Once the user has obtained the permission, the widget changes to this:

https://docs.gtk.org/gtk4/lockbutton-unlocked.png

and the permission can be dropped again by clicking the button. If the user is not able to obtain the permission at all, the widget looks like this:

https://docs.gtk.org/gtk4/lockbutton-sorry.png

If the user has the permission and cannot drop it, the button is hidden.

The text (and tooltips) that are shown in the various cases can be adjusted with the text_lock, text_unlock, tooltip_lock, tooltip_unlock and tooltip_not_authorized properties.

Constructors#

class LockButton
classmethod new(permission: Permission | None = None) Widget#

Creates a new lock button which reflects the permission.

Deprecated since version 4.10: This widget will be removed in GTK 5

Parameters:

permission – a GPermission

Methods#

class LockButton
get_permission() Permission | None#

Obtains the GPermission object that controls button.

Deprecated since version 4.10: This widget will be removed in GTK 5

set_permission(permission: Permission | None = None) None#

Sets the GPermission object that controls button.

Deprecated since version 4.10: This widget will be removed in GTK 5

Parameters:

permission – a GPermission object

Properties#

class LockButton
props.permission: Permission#

The type of the None singleton.

Deprecated since version 4.10: This widget will be removed in GTK 5

props.text_lock: str#

The type of the None singleton.

Deprecated since version 4.10: This widget will be removed in GTK 5

props.text_unlock: str#

The type of the None singleton.

Deprecated since version 4.10: This widget will be removed in GTK 5

props.tooltip_lock: str#

The type of the None singleton.

Deprecated since version 4.10: This widget will be removed in GTK 5

props.tooltip_not_authorized: str#

The type of the None singleton.

Deprecated since version 4.10: This widget will be removed in GTK 5

props.tooltip_unlock: str#

The type of the None singleton.

Deprecated since version 4.10: This widget will be removed in GTK 5