LockButton

GtkLockButton 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 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.

Constructors

this
this(GtkLockButton* gtkLockButton, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(Permission permission)

Creates a new lock button which reflects the @permission.

Members

Functions

getLockButtonStruct
GtkLockButton* getLockButtonStruct(bool transferOwnership)

Get the main Gtk struct

getPermission
Permission getPermission()

Obtains the GPermission object that controls @button.

getStruct
void* getStruct()

the main Gtk struct as a void*

setPermission
void setPermission(Permission permission)

Sets the GPermission object that controls @button.

Static functions

getType
GType getType()

Variables

gtkLockButton
GtkLockButton* gtkLockButton;

the main Gtk struct

Inherited Members

From Button

gtkButton
GtkButton* gtkButton;

the main Gtk struct

getButtonStruct
GtkButton* getButtonStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

__anonymous
mixin ActionableT!(GtkButton)
Undocumented in source.
getType
GType getType()
getChild
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.

setChild
void setChild(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 GtkImage 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.

addOnActivate
gulong addOnActivate(void delegate(Button) dlg, ConnectFlags connectFlags)

Emitted to animate press then release.

addOnClicked
gulong addOnClicked(void delegate(Button) dlg, ConnectFlags connectFlags)

Emitted when the button has been activated (pressed and released).

Meta