## GtkLockButton GtkLockButton — A widget to unlock or lock privileged operations |

## Functions

GtkWidget * | gtk_lock_button_new ()
GPermission * | gtk_lock_button_get_permission ()
void | gtk_lock_button_set_permission ()

## Properties

GPermission * | permission | Read / Write
gchar * | text-lock | Read / Write / Construct
gchar * | text-unlock | Read / Write / Construct
gchar * | tooltip-lock | Read / Write / Construct
gchar * | tooltip-not-authorized | Read / Write / Construct
gchar * | tooltip-unlock | Read / Write / Construct

## Types and Values

struct | GtkLockButton
struct | GtkLockButtonClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── GtkBin
                        ╰── GtkButton
                            ╰── GtkLockButton

## Implemented Interfaces

GtkLockButton implements AtkImplementorIface, GtkBuildable and GtkActionable.

## Includes

    #include <gtk/gtk.h>

## Description

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 “text-lock”, “text-unlock”, “tooltip-lock”, “tooltip-unlock” and “tooltip-not-authorized” properties.

## Functions

### gtk_lock_button_new ()

    GtkWidget *
    gtk_lock_button_new (GPermission *permission);

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

#### Parameters

permission | a GPermission. | [allow-none]

#### Returns

a new GtkLockButton

Since: 3.2

### gtk_lock_button_get_permission ()

    GPermission *
    gtk_lock_button_get_permission (GtkLockButton *button);

Obtains the GPermission object that controls `button` .

#### Parameters

button | a GtkLockButton |

#### Returns

the GPermission of `button` .

[transfer none]

Since: 3.2

### gtk_lock_button_set_permission ()

    void
    gtk_lock_button_set_permission (GtkLockButton *button,
                                    GPermission *permission);

Sets the GPermission object that controls `button` .

#### Parameters

button | a GtkLockButton |
permission | a GPermission object, or `NULL`. | [allow-none]

Since: 3.2

## Types and Values

### struct GtkLockButton

    struct GtkLockButton;

### struct GtkLockButtonClass

    struct GtkLockButtonClass {
      GtkButtonClass parent_class;
    };

#### Members

## Property Details

### The `“permission”` property

      “permission”               GPermission *

The GPermission object controlling this button.

Flags: Read / Write

### The `“text-lock”` property

      “text-lock”                gchar *

The text to display when prompting the user to lock.

Flags: Read / Write / Construct

Default value: "Lock"

### The `“text-unlock”` property

      “text-unlock”              gchar *

The text to display when prompting the user to unlock.

Flags: Read / Write / Construct

Default value: "Unlock"

### The `“tooltip-lock”` property

      “tooltip-lock”             gchar *

The tooltip to display when prompting the user to lock.

Flags: Read / Write / Construct

Default value: "Dialog is unlocked.\nClick to prevent further changes"

### The `“tooltip-not-authorized”` property

      “tooltip-not-authorized”   gchar *

The tooltip to display when prompting the user cannot obtain authorization.

Flags: Read / Write / Construct

Default value: "System policy prevents changes.\nContact your system administrator"

### The `“tooltip-unlock”` property

      “tooltip-unlock”           gchar *

The tooltip to display when prompting the user to unlock.

Flags: Read / Write / Construct

Default value: "Dialog is locked.\nClick to make changes"