:right-sidebar: True LockButton =================================================================== .. currentmodule:: gi.repository.Gtk .. deprecated:: 4.10 This widget will be removed in GTK 5 .. class:: LockButton(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Button`, :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Actionable`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget` ``GtkLockButton`` is a widget to obtain and revoke authorizations needed to operate the controls. .. image:: https://docs.gtk.org/gtk4/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: .. image:: https://docs.gtk.org/gtk4/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: .. image:: https://docs.gtk.org/gtk4/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: .. image:: https://docs.gtk.org/gtk4/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 :obj:`~gi.repository.Gtk.LockButton.props.text_lock`\, :obj:`~gi.repository.Gtk.LockButton.props.text_unlock`\, :obj:`~gi.repository.Gtk.LockButton.props.tooltip_lock`\, :obj:`~gi.repository.Gtk.LockButton.props.tooltip_unlock` and :obj:`~gi.repository.Gtk.LockButton.props.tooltip_not_authorized` properties. Constructors ------------ .. rst-class:: interim-class .. class:: LockButton :no-index: .. classmethod:: new(permission: ~gi.repository.Gio.Permission | None = None) -> ~gi.repository.Gtk.Widget Creates a new lock button which reflects the ``permission``\. .. deprecated:: 4.10 This widget will be removed in GTK 5 :param permission: a ``GPermission`` Methods ------- .. rst-class:: interim-class .. class:: LockButton :no-index: .. method:: get_permission() -> ~gi.repository.Gio.Permission | None Obtains the ``GPermission`` object that controls ``button``\. .. deprecated:: 4.10 This widget will be removed in GTK 5 .. method:: set_permission(permission: ~gi.repository.Gio.Permission | None = None) -> None Sets the ``GPermission`` object that controls ``button``\. .. deprecated:: 4.10 This widget will be removed in GTK 5 :param permission: a ``GPermission`` object Properties ---------- .. rst-class:: interim-class .. class:: LockButton :no-index: .. attribute:: props.permission :type: ~gi.repository.Gio.Permission The type of the None singleton. .. deprecated:: 4.10 This widget will be removed in GTK 5 .. attribute:: props.text_lock :type: str The type of the None singleton. .. deprecated:: 4.10 This widget will be removed in GTK 5 .. attribute:: props.text_unlock :type: str The type of the None singleton. .. deprecated:: 4.10 This widget will be removed in GTK 5 .. attribute:: props.tooltip_lock :type: str The type of the None singleton. .. deprecated:: 4.10 This widget will be removed in GTK 5 .. attribute:: props.tooltip_not_authorized :type: str The type of the None singleton. .. deprecated:: 4.10 This widget will be removed in GTK 5 .. attribute:: props.tooltip_unlock :type: str The type of the None singleton. .. deprecated:: 4.10 This widget will be removed in GTK 5