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 gtk.lock_button.LockButton.textLock, gtk.lock_button.LockButton.textUnlock, gtk.lock_button.LockButton.tooltipLock, gtk.lock_button.LockButton.tooltipUnlock and gtk.lock_button.LockButton.tooltipNotAuthorized properties.

Deprecated

This widget will be removed in GTK 5
Methods
GType _getGType() static nothrow
GType _gType() @property nothrow
LockButton self() nothrowReturns `this`, for use in `with` statements.
LockButtonGidBuilder builder() static nothrowGet builder for [gtk.lock_button.LockButton] Returns: New builder object
gio.permission.Permission permission() @property nothrowGet `permission` property. Returns: The `GPermission object controlling this button.
void permission(gio.permission.Permission propval) @property nothrowSet `permission` property. Params: propval = The `GPermission object controlling this button.
string textLock() @property nothrowGet `textLock` property. Returns: The text to display when prompting the user to lock.
void textLock(string propval) @property nothrowSet `textLock` property. Params: propval = The text to display when prompting the user to lock.
string textUnlock() @property nothrowGet `textUnlock` property. Returns: The text to display when prompting the user to unlock.
void textUnlock(string propval) @property nothrowSet `textUnlock` property. Params: propval = The text to display when prompting the user to unlock.
string tooltipLock() @property nothrowGet `tooltipLock` property. Returns: The tooltip to display when prompting the user to lock.
void tooltipLock(string propval) @property nothrowSet `tooltipLock` property. Params: propval = The tooltip to display when prompting the user to lock.
string tooltipNotAuthorized() @property nothrowGet `tooltipNotAuthorized` property. Returns: The tooltip to display when the user cannot obtain authorization.
void tooltipNotAuthorized(string propval) @property nothrowSet `tooltipNotAuthorized` property. Params: propval = The tooltip to display when the user cannot obtain authorization.
string tooltipUnlock() @property nothrowGet `tooltipUnlock` property. Returns: The tooltip to display when prompting the user to unlock.
void tooltipUnlock(string propval) @property nothrowSet `tooltipUnlock` property. Params: propval = The tooltip to display when prompting the user to unlock.
gio.permission.Permission getPermission() nothrowObtains the [gio.permission.Permission] object that controls button. Returns: the [gio.permission.Permission] of button
void setPermission(gio.permission.Permission permission = null) nothrowSets 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.

Fluent builder implementation template for gtk.lock_button.LockButton

Methods
T permission(gio.permission.Permission propval) nothrowSet `permission` property. Params: propval = The `GPermission object controlling this button. Returns: Builder instance for fluent chaining
T textLock(string propval) nothrowSet `textLock` property. Params: propval = The text to display when prompting the user to lock. Returns: Builder instance for fluent chaining
T textUnlock(string propval) nothrowSet `textUnlock` property. Params: propval = The text to display when prompting the user to unlock. Returns: Builder instance for fluent chaining
T tooltipLock(string propval) nothrowSet `tooltipLock` property. Params: propval = The tooltip to display when prompting the user to lock. Returns: Builder instance for fluent chaining
T tooltipNotAuthorized(string propval) nothrowSet `tooltipNotAuthorized` property. Params: propval = The tooltip to display when the user cannot obtain authorization. Returns: Builder instance for fluent chaining
T tooltipUnlock(string propval) nothrowSet `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
LockButton build() nothrowCreate object from builder. Returns: New object