LockButton

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

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 #GPermission object that controls button.

self
LockButton self()

Returns this, for use in with statements.

setPermission
void setPermission(gio.permission.Permission permission)

Sets the #GPermission object that controls button.

Properties

_gType
GType _gType [@property getter]
permission
gio.permission.Permission permission [@property getter]
permission
gio.permission.Permission permission [@property setter]
textLock
string textLock [@property getter]
textLock
string textLock [@property setter]
textUnlock
string textUnlock [@property getter]
textUnlock
string textUnlock [@property setter]
tooltipLock
string tooltipLock [@property getter]
tooltipLock
string tooltipLock [@property setter]
tooltipNotAuthorized
string tooltipNotAuthorized [@property getter]
tooltipNotAuthorized
string tooltipNotAuthorized [@property setter]
tooltipUnlock
string tooltipUnlock [@property getter]
tooltipUnlock
string tooltipUnlock [@property setter]

Static functions

_getGType
GType _getGType()
builder
LockButtonGidBuilder builder()

Get builder for gtk.lock_button.LockButton

Inherited Members

From Button

_getGType
GType _getGType()
_gType
GType _gType [@property getter]
self
Button self()

Returns this, for use in with statements.

builder
ButtonGidBuilder builder()

Get builder for gtk.button.Button

alwaysShowImage
bool alwaysShowImage [@property getter]

Get alwaysShowImage property.

alwaysShowImage
bool alwaysShowImage [@property setter]

Set alwaysShowImage property.

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

Get image property.

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

Set image property.

imagePosition
gtk.types.PositionType imagePosition [@property getter]

Get imagePosition property.

imagePosition
gtk.types.PositionType imagePosition [@property setter]

Set imagePosition property.

label
string label [@property getter]
label
string label [@property setter]
relief
gtk.types.ReliefStyle relief [@property getter]
relief
gtk.types.ReliefStyle relief [@property setter]
useStock
bool useStock [@property getter]
useStock
bool useStock [@property setter]
useUnderline
bool useUnderline [@property getter]
useUnderline
bool useUnderline [@property setter]
xalign
float xalign [@property getter]

Get xalign property.

xalign
float xalign [@property setter]

Set xalign property.

yalign
float yalign [@property getter]

Get yalign property.

yalign
float yalign [@property setter]

Set yalign property.

newFromIconName
gtk.button.Button newFromIconName(string iconName, gtk.types.IconSize size)

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

newFromStock
gtk.button.Button newFromStock(string stockId)

Creates a new #GtkButton containing the image and text from a [stock item]gtkstock. Some stock ids have preprocessor macros like #GTK_STOCK_OK and #GTK_STOCK_APPLY.

newWithLabel
gtk.button.Button newWithLabel(string label)

Creates a #GtkButton widget with a #GtkLabel child containing the given text.

newWithMnemonic
gtk.button.Button newWithMnemonic(string label)

Creates a new #GtkButton containing a label. If characters in label are preceded by an underscore, they are underlined. If you need a literal underscore character in a label, use “__” (two underscores). The first underlined character represents a keyboard accelerator called a mnemonic. Pressing Alt and that key activates the button.

clicked
void clicked()

Emits a #GtkButton::clicked signal to the given #GtkButton.

enter
void enter()

Emits a #GtkButton::enter signal to the given #GtkButton.

getAlignment
void getAlignment(float xalign, float yalign)

Gets the alignment of the child in the button.

getAlwaysShowImage
bool getAlwaysShowImage()

Returns whether the button will ignore the #GtkSettings:gtk-button-images setting and always show the image, if available.

getEventWindow
gdk.window.Window getEventWindow()

Returns the button’s event window if it is realized, null otherwise. This function should be rarely needed.

getFocusOnClick
bool getFocusOnClick()

Returns whether the button grabs focus when it is clicked with the mouse. See gtk.button.Button.setFocusOnClick.

getImage
gtk.widget.Widget getImage()

Gets the widget that is currenty set as the image of button. This may have been explicitly set by gtk.button.Button.setImage or constructed by gtk.button.Button.newFromStock.

getImagePosition
gtk.types.PositionType getImagePosition()

Gets the position of the image relative to the text inside the button.

getLabel
string getLabel()

Fetches the text from the label of the button, as set by gtk.button.Button.setLabel. If the label text has not been set the return value will be null. This will be the case if you create an empty button with gtk.button.Button.new_ to use as a container.

getRelief
gtk.types.ReliefStyle getRelief()

Returns the current relief style of the given #GtkButton.

getUseStock
bool getUseStock()

Returns whether the button label is a stock item.

getUseUnderline
bool getUseUnderline()

Returns whether an embedded underline in the button label indicates a mnemonic. See gtk_button_set_use_underline ().

leave
void leave()

Emits a #GtkButton::leave signal to the given #GtkButton.

pressed
void pressed()

Emits a #GtkButton::pressed signal to the given #GtkButton.

released
void released()

Emits a #GtkButton::released signal to the given #GtkButton.

setAlignment
void setAlignment(float xalign, float yalign)

Sets the alignment of the child. This property has no effect unless the child is a #GtkMisc or a #GtkAlignment.

setAlwaysShowImage
void setAlwaysShowImage(bool alwaysShow)

If true, the button will ignore the #GtkSettings:gtk-button-images setting and always show the image, if available.

setFocusOnClick
void setFocusOnClick(bool focusOnClick)

Sets whether the button will grab focus when it is clicked with the mouse. Making mouse clicks not grab focus is useful in places like toolbars where you don’t want the keyboard focus removed from the main area of the application.

setImage
void setImage(gtk.widget.Widget image)

Set the image of button to the given widget. The image will be displayed if the label text is null or if #GtkButton:always-show-image is true. You don’t have to call gtk.widget.Widget.show on image yourself.

setImagePosition
void setImagePosition(gtk.types.PositionType position)

Sets the position of the image relative to the text inside the button.

setLabel
void setLabel(string label)

Sets the text of the label of the button to str. This text is also used to select the stock item if gtk.button.Button.setUseStock is used.

setRelief
void setRelief(gtk.types.ReliefStyle relief)

Sets the relief style of the edges of the given #GtkButton widget. Two styles exist, gtk.types.ReliefStyle.Normal and gtk.types.ReliefStyle.None. The default style is, as one can guess, gtk.types.ReliefStyle.Normal. The deprecated value gtk.types.ReliefStyle.Half behaves the same as gtk.types.ReliefStyle.Normal.

setUseStock
void setUseStock(bool useStock)

If true, the label set on the button is used as a stock id to select the stock item for the button.

setUseUnderline
void setUseUnderline(bool useUnderline)

If true, an underline in the text of the button label indicates the next character should be used for the mnemonic accelerator key.

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

Connect to Activate signal.

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

Connect to Clicked signal.

connectEnter
gulong connectEnter(T callback, Flag!"After" after)

Connect to Enter signal.

connectLeave
gulong connectLeave(T callback, Flag!"After" after)

Connect to Leave signal.

connectPressed
gulong connectPressed(T callback, Flag!"After" after)

Connect to Pressed signal.

connectReleased
gulong connectReleased(T callback, Flag!"After" after)

Connect to Released signal.