gi-gtk4-4.0.12: Gtk 4.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.LockButton

Contents

- Exported types
- Methods
  - getPermission
  - new
  - setPermission
- Properties
  - permission
  - textLock
  - textUnlock
  - tooltipLock
  - tooltipNotAuthorized
  - tooltipUnlock

Description

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

<picture> <source srcset="lockbutton-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkLockButton" src="lockbutton.png"> </picture>

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:

<picture> <source srcset="lockbutton-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An locked GtkLockButton" src="lockbutton.png"> </picture>

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:

<picture> <source srcset="lockbutton-unlocked-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An unlocked GtkLockButton" src="lockbutton-unlocked.png"> </picture>

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:

<picture> <source srcset="lockbutton-sorry-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An unobtainable GtkLockButton" src="lockbutton-sorry.png"> </picture>

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 LockButton:textLock, LockButton:textUnlock, LockButton:tooltipLock, LockButton:tooltipUnlock and LockButton:tooltipNotAuthorized properties.

Synopsis

- newtype LockButton = LockButton (ManagedPtr LockButton)
- class (GObject o, IsDescendantOf LockButton o) => IsLockButton o
- toLockButton :: (MonadIO m, IsLockButton o) => o -> m LockButton
- lockButtonGetPermission :: (HasCallStack, MonadIO m, IsLockButton a) => a -> m (Maybe Permission)
- lockButtonNew :: (HasCallStack, MonadIO m, IsPermission a) => Maybe a -> m LockButton
- lockButtonSetPermission :: (HasCallStack, MonadIO m, IsLockButton a, IsPermission b) => a -> Maybe b -> m ()
- clearLockButtonPermission :: (MonadIO m, IsLockButton o) => o -> m ()
- constructLockButtonPermission :: (IsLockButton o, MonadIO m, IsPermission a) => a -> m (GValueConstruct o)
- getLockButtonPermission :: (MonadIO m, IsLockButton o) => o -> m (Maybe Permission)
- setLockButtonPermission :: (MonadIO m, IsLockButton o, IsPermission a) => o -> a -> m ()
- clearLockButtonTextLock :: (MonadIO m, IsLockButton o) => o -> m ()
- constructLockButtonTextLock :: (IsLockButton o, MonadIO m) => Text -> m (GValueConstruct o)
- getLockButtonTextLock :: (MonadIO m, IsLockButton o) => o -> m (Maybe Text)
- setLockButtonTextLock :: (MonadIO m, IsLockButton o) => o -> Text -> m ()
- clearLockButtonTextUnlock :: (MonadIO m, IsLockButton o) => o -> m ()
- constructLockButtonTextUnlock :: (IsLockButton o, MonadIO m) => Text -> m (GValueConstruct o)
- getLockButtonTextUnlock :: (MonadIO m, IsLockButton o) => o -> m (Maybe Text)
- setLockButtonTextUnlock :: (MonadIO m, IsLockButton o) => o -> Text -> m ()
- clearLockButtonTooltipLock :: (MonadIO m, IsLockButton o) => o -> m ()
- constructLockButtonTooltipLock :: (IsLockButton o, MonadIO m) => Text -> m (GValueConstruct o)
- getLockButtonTooltipLock :: (MonadIO m, IsLockButton o) => o -> m (Maybe Text)
- setLockButtonTooltipLock :: (MonadIO m, IsLockButton o) => o -> Text -> m ()
- clearLockButtonTooltipNotAuthorized :: (MonadIO m, IsLockButton o) => o -> m ()
- constructLockButtonTooltipNotAuthorized :: (IsLockButton o, MonadIO m) => Text -> m (GValueConstruct o)
- getLockButtonTooltipNotAuthorized :: (MonadIO m, IsLockButton o) => o -> m (Maybe Text)
- setLockButtonTooltipNotAuthorized :: (MonadIO m, IsLockButton o) => o -> Text -> m ()
- clearLockButtonTooltipUnlock :: (MonadIO m, IsLockButton o) => o -> m ()
- constructLockButtonTooltipUnlock :: (IsLockButton o, MonadIO m) => Text -> m (GValueConstruct o)
- getLockButtonTooltipUnlock :: (MonadIO m, IsLockButton o) => o -> m (Maybe Text)
- setLockButtonTooltipUnlock :: (MonadIO m, IsLockButton o) => o -> Text -> m ()

# Exported types

newtype LockButton Source #

Memory-managed wrapper type.

Constructors

LockButton (ManagedPtr LockButton) |

#### Instances

Instances details

Eq LockButton Source # |
Instance details Defined in GI.Gtk.Objects.LockButton Methods (==) :: LockButton -> LockButton -> Bool Source # (/=) :: LockButton -> LockButton -> Bool Source #
GObject LockButton Source # |
Instance details Defined in GI.Gtk.Objects.LockButton
ManagedPtrNewtype LockButton Source # |
Instance details Defined in GI.Gtk.Objects.LockButton Methods toManagedPtr :: LockButton -> ManagedPtr LockButton Source #
TypedObject LockButton Source # |
Instance details Defined in GI.Gtk.Objects.LockButton Methods glibType :: IO GType Source #
HasParentTypes LockButton Source # |
Instance details Defined in GI.Gtk.Objects.LockButton
IsGValue (Maybe LockButton) Source # | Convert `LockButton` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.LockButton Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe LockButton -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe LockButton) Source #
type ParentTypes LockButton Source # |
Instance details Defined in GI.Gtk.Objects.LockButton type ParentTypes LockButton = '[Button, Widget, Object, Accessible, Actionable, Buildable, ConstraintTarget]

class (GObject o, IsDescendantOf LockButton o) => IsLockButton o Source #

Type class for types which can be safely cast to `LockButton`, for instance with `toLockButton`.

#### Instances

Instances details

(GObject o, IsDescendantOf LockButton o) => IsLockButton o Source # |
Instance details Defined in GI.Gtk.Objects.LockButton

toLockButton :: (MonadIO m, IsLockButton o) => o -> m LockButton Source #

Cast to `LockButton`, for types for which this is known to be safe. For general casts, use `castTo`.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

actionSetEnabled, activate, activateAction, activateDefault, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, announce, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, forceFloating, freezeNotify, getv, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFloating, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, notify, notifyByPspec, observeChildren, observeControllers, pick, queueAllocate, queueDraw, queueResize, realize, ref, refSink, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, resetProperty, resetRelation, resetState, runDispose, shouldLayout, show, sizeAllocate, snapshotChild, stealData, stealQdata, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unsetStateFlags, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateState, watchClosure.

#### Getters

getAccessibleId, getAccessibleParent, getAccessibleRole, getActionName, getActionTargetValue, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getAtContext, getBaseline, getBounds, getBuildableId, getCanFocus, getCanShrink, getCanTarget, getChild, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDirection, getDisplay, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasFrame, getHasTooltip, getHeight, getHexpand, getHexpandSet, getIconName, getLabel, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPermission, getPlatformState, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getUseUnderline, getValign, getVexpand, getVexpandSet, getVisible, getWidth.

#### Setters

setAccessibleParent, setActionName, setActionTargetValue, setCanFocus, setCanShrink, setCanTarget, setChild, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDetailedActionName, setDirection, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasFrame, setHasTooltip, setHexpand, setHexpandSet, setIconName, setLabel, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setPermission, setProperty, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipText, setUseUnderline, setValign, setVexpand, setVexpandSet, setVisible.

## getPermission

lockButtonGetPermission Source #

Arguments

:: (HasCallStack, MonadIO m, IsLockButton a) |
=> a | `button`: a `GtkLockButton`
-> m (Maybe Permission) | Returns: the `GPermission` of `button`

Deprecated: (Since version 4.10)This widget will be removed in GTK 5

Obtains the `GPermission` object that controls `button`.

## new

lockButtonNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsPermission a) |
=> Maybe a | `permission`: a `GPermission`
-> m LockButton | Returns: a new `GtkLockButton`

Deprecated: (Since version 4.10)This widget will be removed in GTK 5

Creates a new lock button which reflects the `permission`.

## setPermission

lockButtonSetPermission Source #

Arguments

:: (HasCallStack, MonadIO m, IsLockButton a, IsPermission b) |
=> a | `button`: a `GtkLockButton`
-> Maybe b | `permission`: a `GPermission` object
-> m () |

Deprecated: (Since version 4.10)This widget will be removed in GTK 5

Sets the `GPermission` object that controls `button`.

# Properties

## permission

The `GPermission object controlling this button.

clearLockButtonPermission :: (MonadIO m, IsLockButton o) => o -> m () Source #

Set the value of the “`permission`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #permission

constructLockButtonPermission :: (IsLockButton o, MonadIO m, IsPermission a) => a -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`permission`” property. This is rarely needed directly, but it is used by `new`.

getLockButtonPermission :: (MonadIO m, IsLockButton o) => o -> m (Maybe Permission) Source #

Get the value of the “`permission`” property. When overloading is enabled, this is equivalent to

    get lockButton #permission

setLockButtonPermission :: (MonadIO m, IsLockButton o, IsPermission a) => o -> a -> m () Source #

Set the value of the “`permission`” property. When overloading is enabled, this is equivalent to

    set lockButton [ #permission := value ]

## textLock

The text to display when prompting the user to lock.

clearLockButtonTextLock :: (MonadIO m, IsLockButton o) => o -> m () Source #

Set the value of the “`text-lock`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #textLock

constructLockButtonTextLock :: (IsLockButton o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`text-lock`” property. This is rarely needed directly, but it is used by `new`.

getLockButtonTextLock :: (MonadIO m, IsLockButton o) => o -> m (Maybe Text) Source #

Get the value of the “`text-lock`” property. When overloading is enabled, this is equivalent to

    get lockButton #textLock

setLockButtonTextLock :: (MonadIO m, IsLockButton o) => o -> Text -> m () Source #

Set the value of the “`text-lock`” property. When overloading is enabled, this is equivalent to

    set lockButton [ #textLock := value ]

## textUnlock

The text to display when prompting the user to unlock.

clearLockButtonTextUnlock :: (MonadIO m, IsLockButton o) => o -> m () Source #

Set the value of the “`text-unlock`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #textUnlock

constructLockButtonTextUnlock :: (IsLockButton o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`text-unlock`” property. This is rarely needed directly, but it is used by `new`.

getLockButtonTextUnlock :: (MonadIO m, IsLockButton o) => o -> m (Maybe Text) Source #

Get the value of the “`text-unlock`” property. When overloading is enabled, this is equivalent to

    get lockButton #textUnlock

setLockButtonTextUnlock :: (MonadIO m, IsLockButton o) => o -> Text -> m () Source #

Set the value of the “`text-unlock`” property. When overloading is enabled, this is equivalent to

    set lockButton [ #textUnlock := value ]

## tooltipLock

The tooltip to display when prompting the user to lock.

clearLockButtonTooltipLock :: (MonadIO m, IsLockButton o) => o -> m () Source #

Set the value of the “`tooltip-lock`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #tooltipLock

constructLockButtonTooltipLock :: (IsLockButton o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`tooltip-lock`” property. This is rarely needed directly, but it is used by `new`.

getLockButtonTooltipLock :: (MonadIO m, IsLockButton o) => o -> m (Maybe Text) Source #

Get the value of the “`tooltip-lock`” property. When overloading is enabled, this is equivalent to

    get lockButton #tooltipLock

setLockButtonTooltipLock :: (MonadIO m, IsLockButton o) => o -> Text -> m () Source #

Set the value of the “`tooltip-lock`” property. When overloading is enabled, this is equivalent to

    set lockButton [ #tooltipLock := value ]

## tooltipNotAuthorized

The tooltip to display when the user cannot obtain authorization.

clearLockButtonTooltipNotAuthorized :: (MonadIO m, IsLockButton o) => o -> m () Source #

Set the value of the “`tooltip-not-authorized`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #tooltipNotAuthorized

constructLockButtonTooltipNotAuthorized :: (IsLockButton o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`tooltip-not-authorized`” property. This is rarely needed directly, but it is used by `new`.

getLockButtonTooltipNotAuthorized :: (MonadIO m, IsLockButton o) => o -> m (Maybe Text) Source #

Get the value of the “`tooltip-not-authorized`” property. When overloading is enabled, this is equivalent to

    get lockButton #tooltipNotAuthorized

setLockButtonTooltipNotAuthorized :: (MonadIO m, IsLockButton o) => o -> Text -> m () Source #

Set the value of the “`tooltip-not-authorized`” property. When overloading is enabled, this is equivalent to

    set lockButton [ #tooltipNotAuthorized := value ]

## tooltipUnlock

The tooltip to display when prompting the user to unlock.

clearLockButtonTooltipUnlock :: (MonadIO m, IsLockButton o) => o -> m () Source #

Set the value of the “`tooltip-unlock`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #tooltipUnlock

constructLockButtonTooltipUnlock :: (IsLockButton o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`tooltip-unlock`” property. This is rarely needed directly, but it is used by `new`.

getLockButtonTooltipUnlock :: (MonadIO m, IsLockButton o) => o -> m (Maybe Text) Source #

Get the value of the “`tooltip-unlock`” property. When overloading is enabled, this is equivalent to

    get lockButton #tooltipUnlock

setLockButtonTooltipUnlock :: (MonadIO m, IsLockButton o) => o -> Text -> m () Source #

Set the value of the “`tooltip-unlock`” property. When overloading is enabled, this is equivalent to

    set lockButton [ #tooltipUnlock := value ]