PolkitPermission: polkit Reference Manual

## PolkitPermission PolkitPermission — PolicyKit GPermission implementation |

## Stability Level

Stable, unless otherwise indicated

## Functions

void | polkit_permission_new ()
GPermission * | polkit_permission_new_finish ()
GPermission * | polkit_permission_new_sync ()
const gchar * | polkit_permission_get_action_id ()
PolkitSubject * | polkit_permission_get_subject ()

## Properties

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

## Types and Values

| PolkitPermission

## Object Hierarchy

        GObject
        ╰── GPermission
            ╰── PolkitPermission

## Implemented Interfaces

PolkitPermission implements GInitable and GAsyncInitable.

## Description

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

## Functions

### 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.

#### Parameters

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()`.

#### Parameters

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.

#### Parameters

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` .

#### Parameters

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` .

#### Parameters

permission | A PolkitPermission. |

#### Returns

An object owned by `permission` . Do not free.

[transfer none]

## Types and Values

### PolkitPermission

    typedef struct _PolkitPermission PolkitPermission;

The PolkitPermission struct should not be accessed directly.

## Property Details

### The `“action-id”` property

      “action-id”                gchar *

The action identifier to use for the permission.

Flags: Read / Write / Construct Only

Default value: NULL

### The `“subject”` property

      “subject”                  PolkitSubject *

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

Flags: Read / Write / Construct Only