Gtk.LockButton

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Actionable Gtk.Actionable GObject.GInterface->Gtk.Actionable Gtk.Activatable Gtk.Activatable GObject.GInterface->Gtk.Activatable Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Button Gtk.Button Gtk.Actionable->Gtk.Button Gtk.Activatable->Gtk.Button Gtk.Bin Gtk.Bin Gtk.Bin->Gtk.Button Gtk.Buildable->Gtk.Widget Gtk.LockButton Gtk.LockButton Gtk.Button->Gtk.LockButton Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.Widget->Gtk.Container

Example

../_images/LockButton.png
Subclasses:

None

Methods

Inherited:

Gtk.Button (29), Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Actionable (5), Gtk.Activatable (6)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

class

new (permission)

get_permission ()

set_permission (permission)

Virtual Methods

Inherited:

Gtk.Button (6), Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10), Gtk.Actionable (4), Gtk.Activatable (2)

Properties

Inherited:

Gtk.Button (9), Gtk.Container (3), Gtk.Widget (39), Gtk.Actionable (2), Gtk.Activatable (2)

Name

Type

Flags

Short Description

permission

Gio.Permission

r/w

The Gio.Permission object controlling this button

text-lock

str

r/w/c

The text to display when prompting the user to lock

text-unlock

str

r/w/c

The text to display when prompting the user to unlock

tooltip-lock

str

r/w/c

The tooltip to display when prompting the user to lock

tooltip-not-authorized

str

r/w/c

The tooltip to display when prompting the user cannot obtain authorization

tooltip-unlock

str

r/w/c

The tooltip to display when prompting the user to unlock

Style Properties

Inherited:

Gtk.Button (7), Gtk.Widget (17)

Signals

Inherited:

Gtk.Button (6), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Fields

Inherited:

Gtk.Button (6), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Type

Access

Description

parent

Gtk.Button

r

Class Details

class Gtk.LockButton(*args, **kwargs)
Bases:

Gtk.Button

Abstract:

No

Structure:

Gtk.LockButtonClass

Gtk.LockButton 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:

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 Gtk.LockButton :text-lock, Gtk.LockButton :text-unlock, Gtk.LockButton :tooltip-lock, Gtk.LockButton :tooltip-unlock and Gtk.LockButton :tooltip-not-authorized properties.

classmethod new(permission)[source]
Parameters:

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

Returns:

a new Gtk.LockButton

Return type:

Gtk.Widget

Creates a new lock button which reflects the permission.

New in version 3.2.

get_permission()[source]
Returns:

the Gio.Permission of self

Return type:

Gio.Permission

Obtains the Gio.Permission object that controls self.

New in version 3.2.

set_permission(permission)[source]
Parameters:

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

Sets the Gio.Permission object that controls self.

New in version 3.2.

Property Details

Gtk.LockButton.props.permission
Name:

permission

Type:

Gio.Permission

Default Value:

None

Flags:

READABLE, WRITABLE

The Gio.Permission object controlling this button

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

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

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

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 prompting the user cannot obtain authorization

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