About my projects, examples and tutorials
Gnome::Gtk4::LockButton

Gnome::Gtk4::LockButton

Description§

Gnome::Gtk4::LockButton is a widget to obtain and revoke authorizations needed to operate the controls.

UNKNOWN image§

=for image :class<inline> :src<asset_files/images/lock-button.png> :width<30\%>

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:

UNKNOWN image§

=for image :class<inline> :src<asset_files/images/lockbutton-locked.png> :width<30\%>

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:

UNKNOWN image§

=for image :class<inline> :src<asset_files/images/lockbutton-unlocked.png> :width<30\%>

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:

UNKNOWN image§

=for image :class<inline> :src<asset_files/images/lockbutton-sorry.png> :width<30\%>

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.

Uml Diagram§

UNKNOWN image§

=for image :class<inline> :src<asset_files/images/plantuml/LockButton.png> :width<70\%>

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 an object of the same type found elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object() :$native-object! )
Code

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 )
Code

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 )
Code

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 )
Code