## PolkitPermission PolkitPermission — PolicyKit GPermission implementation |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

                        PolkitPermission;
    void                polkit_permission_new               (const gchar *action_id,
                                                             PolkitSubject *subject,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    GPermission *       polkit_permission_new_finish        (GAsyncResult *res,
                                                             GError **error);
    GPermission *       polkit_permission_new_sync          (const gchar *action_id,
                                                             PolkitSubject *subject,
                                                             GCancellable *cancellable,
                                                             GError **error);
    const gchar *       polkit_permission_get_action_id     (PolkitPermission *permission);
    PolkitSubject *     polkit_permission_get_subject       (PolkitPermission *permission);

## Object Hierarchy

      GObject
       +----GPermission
             +----PolkitPermission

## Implemented Interfaces

PolkitPermission implements GInitable and GAsyncInitable.

## Properties

      "action-id"                gchar*                : Read / Write / Construct Only
      "subject"                  PolkitSubject*        : Read / Write / Construct Only

## Description

PolkitPermission is a GPermission implementation. It can be used with e.g. GtkLockButton. See the GPermission documentation for more information.

## Details

### PolkitPermission

    typedef struct _PolkitPermission PolkitPermission;

The PolkitPermission struct should not be accessed directly.

### polkit_permission_new ()

    void                polkit_permission_new               (const gchar *action_id,
                                                             PolkitSubject *subject,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Creates a GPermission instance for the PolicyKit action `action_id`.

When the operation is finished, `callback` will be invoked. You can then call `polkit_permission_new_finish()` to get the result of the operation.

This is a asynchronous failable constructor. See `polkit_permission_new_sync()` for the synchronous version.

`action_id` : | The PolicyKit action identifier.
`subject` : | A PolkitSubject or `NULL` for the current process. [allow-none]
`cancellable` : | A GCancellable or `NULL`. [allow-none]
`callback` : | A GAsyncReadyCallback to call when the request is satisfied.
`user_data` : | The data to pass to `callback`.

### polkit_permission_new_finish ()

    GPermission *       polkit_permission_new_finish        (GAsyncResult *res,
                                                             GError **error);

Finishes an operation started with `polkit_permission_new()`.

`res` : | A GAsyncResult obtained from the GAsyncReadyCallback passed to `polkit_permission_new()`.
`error` : | Return location for error or `NULL`. [allow-none]
Returns : | A GPermission or `NULL` if `error` is set.

### polkit_permission_new_sync ()

    GPermission *       polkit_permission_new_sync          (const gchar *action_id,
                                                             PolkitSubject *subject,
                                                             GCancellable *cancellable,
                                                             GError **error);

Creates a GPermission instance for the PolicyKit action `action_id`.

This is a synchronous failable constructor. See `polkit_permission_new()` for the asynchronous version.

`action_id` : | The PolicyKit action identifier.
`subject` : | A PolkitSubject or `NULL` for the current process. [allow-none]
`cancellable` : | A GCancellable or `NULL`. [allow-none]
`error` : | Return location for error or `NULL`. [allow-none]
Returns : | A GPermission or `NULL` if `error` is set.

### polkit_permission_get_action_id ()

    const gchar *       polkit_permission_get_action_id     (PolkitPermission *permission);

Gets the PolicyKit action identifier used for `permission`.

`permission` : | A PolkitPermission.
Returns : | A string owned by `permission`. Do not free.

### polkit_permission_get_subject ()

    PolkitSubject *     polkit_permission_get_subject       (PolkitPermission *permission);

Gets the subject used for `permission`.

`permission` : | A PolkitPermission.
Returns : | An object owned by `permission`. Do not free. [transfer none]

## Property Details

### The `"action-id"` property

      "action-id"                gchar*                : Read / Write / Construct Only

The action identifier to use for the permission.

Default value: NULL

### The `"subject"` property

      "subject"                  PolkitSubject*        : Read / Write / Construct Only

The PolkitSubject to use for the permission. If not set during construction, it will be set to match the current process.