Class LockButton

All Implemented Interfaces:
PointerInterface

public class LockButton extends Button
`GtkLockButton` is a widget to obtain and revoke authorizations
needed to operate the controls.

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

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

https://docs.gtk.org/gtk4/class.LockButton.html

  • Constructor Details

    • LockButton

      public LockButton(PointerContainer pointer)
    • LockButton

      public LockButton(@Nullable Permission permission)
      Creates a new lock button which reflects the @permission.
      Parameters:
      permission - a `GPermission`
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getPermission

      public Permission getPermission()
      Obtains the `GPermission` object that controls @button.
      Returns:
      the `GPermission` of @button
    • setPermission

      public void setPermission(@Nullable Permission permission)
      Sets the `GPermission` object that controls @button.
      Parameters:
      permission - a `GPermission` object
    • asAccessible

      public Accessible asAccessible()
      Implements interface Accessible. Call this to get access to interface functions.
      Overrides:
      asAccessible in class Button
      Returns:
      Accessible
    • asActionable

      public Actionable asActionable()
      Implements interface Actionable. Call this to get access to interface functions.
      Overrides:
      asActionable in class Button
      Returns:
      Actionable
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Overrides:
      asBuildable in class Button
      Returns:
      Buildable
    • asConstraintTarget

      public ConstraintTarget asConstraintTarget()
      Implements interface ConstraintTarget. Call this to get access to interface functions.
      Overrides:
      asConstraintTarget in class Button
      Returns:
      ConstraintTarget
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()