LockButton


Object Hierarchy:

Gtk.LockButton Gtk.LockButton Gtk.LockButton Gtk.Button Gtk.Button Gtk.Button->Gtk.LockButton Gtk.Widget Gtk.Widget Gtk.Widget->Gtk.Button GLib.InitiallyUnowned GLib.InitiallyUnowned GLib.InitiallyUnowned->Gtk.Widget GLib.Object GLib.Object GLib.Object->GLib.InitiallyUnowned Gtk.Accessible Gtk.Accessible Gtk.Accessible->Gtk.LockButton Gtk.Accessible->Gtk.Button Gtk.Accessible->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.LockButton Gtk.Buildable->Gtk.Button Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget Gtk.ConstraintTarget Gtk.ConstraintTarget->Gtk.LockButton Gtk.ConstraintTarget->Gtk.Button Gtk.ConstraintTarget->Gtk.Widget Gtk.Actionable Gtk.Actionable Gtk.Actionable->Gtk.LockButton Gtk.Actionable->Gtk.Button

Description:

[ CCode ( type_id = "gtk_lock_button_get_type ()" ) ]
[ Version ( deprecated = true , deprecated_since = "4.10" ) ]
public sealed class LockButton : Button, Accessible, Actionable, Buildable, ConstraintTarget

Warning: LockButton is deprecated since 4.10.

`GtkLockButton` is a widget to obtain and revoke authorizations needed to operate the controls.

Note:

This widget will be removed in GTK 5

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


Namespace: Gtk
Package: gtk4

Content:

Properties:

Creation methods:

Methods:

Inherited Members:

All known members inherited from class Gtk.Widget