Gtk.LockButton

g GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Actionable Gtk.Actionable GObject.GInterface->Gtk.Actionable Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Button Gtk.Button Gtk.Actionable->Gtk.Button Gtk.Buildable->Gtk.Widget Gtk.LockButton Gtk.LockButton Gtk.Button->Gtk.LockButton Gtk.ConstraintTarget->Gtk.Widget Gtk.Widget->Gtk.Button

Example

../_images/LockButton.png
Subclasses:

None

Methods

Inherited:

Gtk.Button (16), Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Gtk.Actionable (5)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new (permission)

get_permission ()

set_permission (permission)

Virtual Methods

Inherited:

Gtk.Button (2), Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9), Gtk.Actionable (4)

Properties

Inherited:

Gtk.Button (6), Gtk.Widget (34), Gtk.Accessible (1), Gtk.Actionable (2)

Name

Type

Flags

Short Description

permission

Gio.Permission

r/w

deprecated

text-lock

str

r/w/c

deprecated

text-unlock

str

r/w/c

deprecated

tooltip-lock

str

r/w/c

deprecated

tooltip-not-authorized

str

r/w/c

deprecated

tooltip-unlock

str

r/w/c

deprecated

Signals

Inherited:

Gtk.Button (2), Gtk.Widget (13), GObject.Object (1)

Fields

Inherited:

Gtk.Button (2), Gtk.Widget (13), GObject.Object (1)

Class Details

class Gtk.LockButton(**kwargs)
Bases:

Gtk.Button

Abstract:

No

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

An example Gtk.LockButton

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:

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:

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:

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.

Deprecated since version 4.10: This widget will be removed in GTK 5

classmethod new(permission)[source]
Parameters:

permission (Gio.Permission or None) – a GPermission

Returns:

a new GtkLockButton

Return type:

Gtk.Widget

Creates a new lock button which reflects the permission.

Deprecated since version 4.10: This widget will be removed in GTK 5

get_permission()[source]
Returns:

the GPermission of self

Return type:

Gio.Permission or None

Obtains the GPermission object that controls self.

Deprecated since version 4.10: This widget will be removed in GTK 5

set_permission(permission)[source]
Parameters:

permission (Gio.Permission or None) – a GPermission object

Sets the GPermission object that controls self.

Deprecated since version 4.10: This widget will be removed in GTK 5

Property Details

Gtk.LockButton.props.permission
Name:

permission

Type:

Gio.Permission

Default Value:

None

Flags:

READABLE, WRITABLE

The `:obj:Gio.Permission object controlling this button.

Deprecated since version 4.10: This widget will be removed in GTK 5

Gtk.LockButton.props.text_lock
Name:

text-lock

Type:

str

Default Value:

'Lock'

Flags:

READABLE, WRITABLE, CONSTRUCT

The text to display when prompting the user to lock.

Deprecated since version 4.10: This widget will be removed in GTK 5

Gtk.LockButton.props.text_unlock
Name:

text-unlock

Type:

str

Default Value:

'Unlock'

Flags:

READABLE, WRITABLE, CONSTRUCT

The text to display when prompting the user to unlock.

Deprecated since version 4.10: This widget will be removed in GTK 5

Gtk.LockButton.props.tooltip_lock
Name:

tooltip-lock

Type:

str

Default Value:

'Dialog is unlocked.\nClick to prevent further changes'

Flags:

READABLE, WRITABLE, CONSTRUCT

The tooltip to display when prompting the user to lock.

Deprecated since version 4.10: This widget will be removed in GTK 5

Gtk.LockButton.props.tooltip_not_authorized
Name:

tooltip-not-authorized

Type:

str

Default Value:

'System policy prevents changes.\nContact your system administrator'

Flags:

READABLE, WRITABLE, CONSTRUCT

The tooltip to display when the user cannot obtain authorization.

Deprecated since version 4.10: This widget will be removed in GTK 5

Gtk.LockButton.props.tooltip_unlock
Name:

tooltip-unlock

Type:

str

Default Value:

'Dialog is locked.\nClick to make changes'

Flags:

READABLE, WRITABLE, CONSTRUCT

The tooltip to display when prompting the user to unlock.

Deprecated since version 4.10: This widget will be removed in GTK 5