PolKitGnomeContext

PolKitGnomeContext — Convenience functions for using PolicyKit from GTK+ and GNOME applications.

Functions

Signals

Types and Values

Object Hierarchy

    GObject
    ╰── PolKitGnomeContext

Description

This class provides convenience functions for using PolicyKit from GTK+ and GNOME applications including setting up main loop integration and system bus connections. Rather than using callbacks, GObject signals are provided when external factors change (e.g. the PolicyKit.conf configuration file changes or ConsoleKit reports activity changes).

Actual usage of PolicyKit is still through the main PolicyKit API through the public pk_context and pk_tracker variables.

This class is implemented as a singleton meaning that several callers will share the underlying PolKitContext and PolKitTracker objects. Do not use any of the life cycle methods of these objects; only use them to gather information.

Functions

polkit_gnome_context_get ()

PolKitGnomeContext *
polkit_gnome_context_get (GError **error);

Returns a PolKitGnomeContext object. The context is a global singleton that may be shared with other callers of this function.

This operation can fail if the system message bus is not available.

When done with using this object, call g_object_unref(). This is such that resources can be freed when all callers have unreffed it.

Parameters

error

return location for error

 

Returns

a new PolKitGnomeContext or NULL if error is set


polkit_gnome_context_error_quark ()

GQuark
polkit_gnome_context_error_quark (void);

Returns

Types and Values

POLKIT_GNOME_CONTEXT_ERROR

#define POLKIT_GNOME_CONTEXT_ERROR polkit_gnome_context_error_quark ()

Error domain for using the GNOME PolicyKit context. Errors in this domain will be from the PolKitGnomeContextError enumeration. See GError for information on error domains.


enum PolKitGnomeContextError

Error codes describing how PolKitGnomeContext can fail.

Members

POLKIT_GNOME_CONTEXT_ERROR_FAILED

General error

 

PolKitGnomeContextPrivate

typedef struct _PolKitGnomeContextPrivate PolKitGnomeContextPrivate;


struct PolKitGnomeContext

struct PolKitGnomeContext {
        PolKitContext *pk_context;
        PolKitTracker *pk_tracker;
};

Provide access to PolKitContext and PolKitTracker instances shared among many callers.

Members

PolKitContext *pk_context;

for interfacing with PolicyKit; e.g. typically polkit_context_can_caller_do_action()

 

PolKitTracker *pk_tracker;

this is used for effieciently obtaining PolKitCaller objects

 

Signal Details

The “config-changed” signal

void
user_function (PolKitGnomeContext *context,
               gpointer            user_data)

The ::config-changed signal is emitted when PolicyKit configuration (e.g. /etc/PolicyKit/PolicyKit.conf or .policy files) changes content.

As this is one contributing factor to what answer PolicyKit will return, the caller should act on this signal and query PolicyKit for any actions it cares about.

Parameters

context

the object

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “console-kit-db-changed” signal

void
user_function (PolKitGnomeContext *context,
               gpointer            user_data)

The ::console-kit-db-changed signal is emitted when ConsoleKit configuration changes; e.g. when a session becomes active or inactive.

As this is one contributing factor to what answer PolicyKit will return, the caller should act on this signal and query PolicyKit for any actions it cares about.

Parameters

context

the object

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last