![](asset_files/images/gtk-raku.png)
Gnome::Gtk4::LockButton
Description
Gnome::Gtk4::LockButton is a widget to obtain and revoke authorizations needed to operate the controls.
![No caption](asset_files/images/lock-button.png)
It is typically used in preference dialogs or control panels.
The required authorization is represented by a Gnome::Gio::Permission object. Concrete implementations of Gnome::Gio::Permission may use PolicyKit or some other authorization framework. To obtain a PolicyKit-based Gnome::Gio::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:
![No caption](asset_files/images/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:
![No caption](asset_files/images/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:
![No caption](asset_files/images/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.
Class initialization
Note: The native version of this class is deprecated in gtk4-lib() since version 4.10
new
:native-object
Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.
multi method new ( N-Object :$native-object! )
new-lockbutton
Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10
Creates a new lock button which reflects the $permission
.
method new-lockbutton ( N-Object() $permission --> Gnome::Gtk4::LockButton \)
$permission; a Gnome::Gio::Permission.
Methods
get-permission
Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10
Obtains the Gnome::Gio::Permission object that controls $button
.
method get-permission (--> N-Object )
Return value; the Gnome::Gio::Permission of $button
.
set-permission
Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10
Sets the Gnome::Gio::Permission object that controls $button
.
method set-permission ( N-Object() $permission )
$permission; a Gnome::Gio::Permission object.