LockButton

gtk.lock_button.LockButton is a widget to obtain and revoke authorizations needed to operate the controls.

An example GtkLockButton

It is typically used in preference dialogs or control panels.

The required authorization is represented by a gio.permission.Permission object. Concrete implementations of gio.permission.Permission may use PolicyKit or some other authorization framework. To obtain a PolicyKit-based gio.permission.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 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.

More...

Constructors

this
this(void* ptr, Flag!"Take" take)
this
this(gio.permission.Permission permission)

Creates a new lock button which reflects the permission.

Members

Functions

getPermission
gio.permission.Permission getPermission()

Obtains the gio.permission.Permission object that controls button.

self
LockButton self()

Returns this, for use in with statements.

setPermission
void setPermission(gio.permission.Permission permission)

Sets the gio.permission.Permission object that controls button.

Properties

gType
GType gType [@property getter]
permission
gio.permission.Permission permission [@property getter]

Get permission property.

permission
gio.permission.Permission permission [@property setter]

Set permission property.

textLock
string textLock [@property getter]

Get textLock property.

textLock
string textLock [@property setter]

Set textLock property.

textUnlock
string textUnlock [@property getter]

Get textUnlock property.

textUnlock
string textUnlock [@property setter]

Set textUnlock property.

tooltipLock
string tooltipLock [@property getter]

Get tooltipLock property.

tooltipLock
string tooltipLock [@property setter]

Set tooltipLock property.

tooltipNotAuthorized
string tooltipNotAuthorized [@property getter]

Get tooltipNotAuthorized property.

tooltipNotAuthorized
string tooltipNotAuthorized [@property setter]

Set tooltipNotAuthorized property.

tooltipUnlock
string tooltipUnlock [@property getter]

Get tooltipUnlock property.

tooltipUnlock
string tooltipUnlock [@property setter]

Set tooltipUnlock property.

Static functions

getGType
GType getGType()

Inherited Members

From Button

getGType
GType getGType()
gType
GType gType [@property getter]
self
Button self()

Returns this, for use in with statements.

canShrink
bool canShrink [@property getter]

Get canShrink property.

canShrink
bool canShrink [@property setter]

Set canShrink property.

child
gtk.widget.Widget child [@property getter]

Get child property.

child
gtk.widget.Widget child [@property setter]

Set child property.

hasFrame
bool hasFrame [@property getter]

Get hasFrame property.

hasFrame
bool hasFrame [@property setter]

Set hasFrame property.

iconName
string iconName [@property getter]

Get iconName property.

iconName
string iconName [@property setter]

Set iconName property.

label
string label [@property getter]

Get label property.

label
string label [@property setter]

Set label property.

useUnderline
bool useUnderline [@property getter]

Get useUnderline property.

useUnderline
bool useUnderline [@property setter]

Set useUnderline property.

newFromIconName
gtk.button.Button newFromIconName(string iconName)

Creates a new button containing an icon from the current icon theme.

newWithLabel
gtk.button.Button newWithLabel(string label)

Creates a gtk.button.Button widget with a gtk.label.Label child.

newWithMnemonic
gtk.button.Button newWithMnemonic(string label)

Creates a new gtk.button.Button containing a label.

getCanShrink
bool getCanShrink()

Retrieves whether the button can be smaller than the natural size of its contents.

getChild
gtk.widget.Widget getChild()

Gets the child widget of button.

getHasFrame
bool getHasFrame()

Returns whether the button has a frame.

getIconName
string getIconName()

Returns the icon name of the button.

getLabel
string getLabel()

Fetches the text from the label of the button.

getUseUnderline
bool getUseUnderline()

gets whether underlines are interpreted as mnemonics.

setCanShrink
void setCanShrink(bool canShrink)

Sets whether the button size can be smaller than the natural size of its contents.

setChild
void setChild(gtk.widget.Widget child)

Sets the child widget of button.

setHasFrame
void setHasFrame(bool hasFrame)

Sets the style of the button.

setIconName
void setIconName(string iconName)

Adds a gtk.image.Image with the given icon name as a child.

setLabel
void setLabel(string label)

Sets the text of the label of the button to label.

setUseUnderline
void setUseUnderline(bool useUnderline)

Sets whether to use underlines as mnemonics.

connectActivate
ulong connectActivate(T callback, Flag!"After" after)

Connect to Activate signal.

connectClicked
ulong connectClicked(T callback, Flag!"After" after)

Connect to Clicked signal.

Detailed Description

Deprecated: This widget will be removed in GTK 5