gtk.lock_button

Module for [LockButton] class

Types 3

[gtk.lock_button.LockButton] is a widget to obtain and revoke authorizations needed to operate the controls.

!An example GtkLockButton

It is typically used in preference dialogs or control panels.

The required authorization is represented by a [gio.permission.Permission] object. Concrete implementations of [gio.permission.Permission] may use PolicyKit or some other authorization framework. To obtain a PolicyKit-based [gio.permission.Permission], 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:

![](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:

![](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:

![](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 property@Gtk.LockButton:text-lock, property@Gtk.LockButton:text-unlock, property@Gtk.LockButton:tooltip-lock, property@Gtk.LockButton:tooltip-unlock and property@Gtk.LockButton:tooltip-not-authorized properties.

Deprecated

This widget will be removed in GTK 5
Methods
GType _gType() @property
LockButton self()Returns `this`, for use in `with` statements.
LockButtonGidBuilder builder()Get builder for [gtk.lock_button.LockButton] Returns: New builder object
gio.permission.Permission permission() @propertyGet `permission` property. Returns: The `GPermission object controlling this button.
void permission(gio.permission.Permission propval) @propertySet `permission` property. Params: propval = The `GPermission object controlling this button.
string textLock() @propertyGet `textLock` property. Returns: The text to display when prompting the user to lock.
void textLock(string propval) @propertySet `textLock` property. Params: propval = The text to display when prompting the user to lock.
string textUnlock() @propertyGet `textUnlock` property. Returns: The text to display when prompting the user to unlock.
void textUnlock(string propval) @propertySet `textUnlock` property. Params: propval = The text to display when prompting the user to unlock.
string tooltipLock() @propertyGet `tooltipLock` property. Returns: The tooltip to display when prompting the user to lock.
void tooltipLock(string propval) @propertySet `tooltipLock` property. Params: propval = The tooltip to display when prompting the user to lock.
string tooltipNotAuthorized() @propertyGet `tooltipNotAuthorized` property. Returns: The tooltip to display when the user cannot obtain authorization.
void tooltipNotAuthorized(string propval) @propertySet `tooltipNotAuthorized` property. Params: propval = The tooltip to display when the user cannot obtain authorization.
string tooltipUnlock() @propertyGet `tooltipUnlock` property. Returns: The tooltip to display when prompting the user to unlock.
void tooltipUnlock(string propval) @propertySet `tooltipUnlock` property. Params: propval = The tooltip to display when prompting the user to unlock.
gio.permission.Permission getPermission()Obtains the [gio.permission.Permission] object that controls button. Returns: the [gio.permission.Permission] of button
void setPermission(gio.permission.Permission permission = null)Sets the [gio.permission.Permission] object that controls button.
Constructors
this(void * ptr, Flag!"Take" take)
this(gio.permission.Permission permission = null)Creates a new lock button which reflects the permission.
Methods
T permission(gio.permission.Permission propval)Set `permission` property. Params: propval = The `GPermission object controlling this button. Returns: Builder instance for fluent chaining
T textLock(string propval)Set `textLock` property. Params: propval = The text to display when prompting the user to lock. Returns: Builder instance for fluent chaining
T textUnlock(string propval)Set `textUnlock` property. Params: propval = The text to display when prompting the user to unlock. Returns: Builder instance for fluent chaining
T tooltipLock(string propval)Set `tooltipLock` property. Params: propval = The tooltip to display when prompting the user to lock. Returns: Builder instance for fluent chaining
T tooltipNotAuthorized(string propval)Set `tooltipNotAuthorized` property. Params: propval = The tooltip to display when the user cannot obtain authorization. Returns: Builder instance for fluent chaining
T tooltipUnlock(string propval)Set `tooltipUnlock` property. Params: propval = The tooltip to display when prompting the user to unlock. Returns: Builder instance for fluent chaining

Fluent builder for [gtk.lock_button.LockButton]

Methods