LockButtonRef

public struct LockButtonRef : LockButtonProtocol, GWeakCapturing

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

The LockButtonRef type acts as a lightweight Swift reference to an underlying GtkLockButton instance. It exposes methods that can operate on this data type through LockButtonProtocol conformance. Use LockButtonRef only as an unowned reference to an existing GtkLockButton instance.

  • ptr
    Untyped pointer to the underlying `GtkLockButton` instance.
    

    For type-safe access, use the generated, typed pointer lock_button_ptr property instead.

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

LockButton Class

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafeMutablePointer<GtkLockButton>)
  • Designated initialiser from a constant pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafePointer<GtkLockButton>)
  • Conditional initialiser from an optional pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafeMutablePointer<GtkLockButton>?)
  • Conditional initialiser from an optional, non-mutable pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafePointer<GtkLockButton>?)
  • Conditional initialiser from an optional gpointer

    Declaration

    Swift

    @inlinable
    init!(gpointer g: gpointer?)
  • Conditional initialiser from an optional, non-mutable gconstpointer

    Declaration

    Swift

    @inlinable
    init!(gconstpointer g: gconstpointer?)
  • Reference intialiser for a related type that implements LockButtonProtocol

    Declaration

    Swift

    @inlinable
    init<T>(_ other: T) where T : LockButtonProtocol
  • This factory is syntactic sugar for setting weak pointers wrapped in GWeak<T>

    Declaration

    Swift

    @inlinable
    static func unowned<T>(_ other: T) -> LockButtonRef where T : LockButtonProtocol
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to LockButtonProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(cPointer: UnsafeMutablePointer<T>)
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to LockButtonProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(constPointer: UnsafePointer<T>)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to LockButtonProtocol.

    Declaration

    Swift

    @inlinable
    init(mutating raw: UnsafeRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to LockButtonProtocol.

    Declaration

    Swift

    @inlinable
    init(raw: UnsafeMutableRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to LockButtonProtocol.

    Declaration

    Swift

    @inlinable
    init(opaquePointer: OpaquePointer)
  • Creates a new lock button which reflects the permission.

    Declaration

    Swift

    @inlinable
    init<PermissionT>(permission: PermissionT?) where PermissionT : PermissionProtocol