![]() |
![]() |
![]() |
PolicyKit-gnome Library Reference Manual | ![]() |
---|---|---|---|---|
PolKitGnomeContextPolKitGnomeContext — Convenience functions for using PolicyKit from GTK+ and GNOME applications. |
#define POLKIT_GNOME_CONTEXT_ERROR enum PolKitGnomeContextError; PolKitGnomeContextPrivate; PolKitGnomeContext; PolKitGnomeContext* polkit_gnome_context_get (GError **error); GQuark polkit_gnome_context_error_quark (void);
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.
#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.
typedef enum { POLKIT_GNOME_CONTEXT_ERROR_FAILED } PolKitGnomeContextError;
Error codes describing how PolKitGnomeContext can fail.
typedef struct { PolKitContext *pk_context; PolKitTracker *pk_tracker; } PolKitGnomeContext;
Provide access to PolKitContext and PolKitTracker instances shared among many callers.
PolKitContext * |
for interfacing with PolicyKit; e.g. typically polkit_context_can_caller_do_action()
|
PolKitTracker * |
this is used for effieciently obtaining PolKitCaller objects |
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.
|
return location for error |
Returns : |
a new PolKitGnomeContext or NULL if error is set |
"config-changed"
signalvoid user_function (PolKitGnomeContext *context, gpointer user_data) : Run Last
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.
|
the object |
|
user data set when the signal handler was connected. |
"console-kit-db-changed"
signalvoid user_function (PolKitGnomeContext *context, gpointer user_data) : Run Last
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.
|
the object |
|
user data set when the signal handler was connected. |