Gtk.LockButton
const Gtk = imports.gi.Gtk; let lock_button = new Gtk.LockButton({ permission: value, text_lock: value, text_unlock: value, tooltip_lock: value, tooltip_not_authorized: value, tooltip_unlock: value, });
GtkLockButton is a widget that can be used in control panels or preference dialogs to allow users to obtain and revoke authorizations needed to operate the controls. The required authorization is represented by a Gio.Permission object. Concrete implementations of Gio.Permission may use PolicyKit or some other authorization framework. To obtain a PolicyKit-based 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 <informalexample><inlinegraphic fileref="lockbutton-locked.png"></inlinegraphic></informalexample> 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 <informalexample><inlinegraphic fileref="lockbutton-unlocked.png"></inlinegraphic></informalexample> 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 <informalexample><inlinegraphic fileref="lockbutton-sorry.png"></inlinegraphic></informalexample> 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.text-lock, Gtk.text-unlock, Gtk.tooltip-lock, Gtk.tooltip-unlock and Gtk.tooltip-not-authorized properties.
Hierarchy
-
GObject.Object
-
GObject.InitiallyUnowned
-
Gtk.Widget
-
Gtk.Container
-
Gtk.Bin
-
Gtk.Button
- Gtk.LockButton
-
-
-
-
-