PolkitUnixSession

PolkitUnixSession — Unix sessions

Synopsis

                    PolkitUnixSession;
PolkitSubject *     polkit_unix_session_new             (const gchar *session_id);
void                polkit_unix_session_new_for_process (gint pid,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
PolkitSubject *     polkit_unix_session_new_for_process_finish
                                                        (GAsyncResult *res,
                                                         GError **error);
PolkitSubject *     polkit_unix_session_new_for_process_sync
                                                        (gint pid,
                                                         GCancellable *cancellable,
                                                         GError **error);
const gchar *       polkit_unix_session_get_session_id  (PolkitUnixSession *session);
void                polkit_unix_session_set_session_id  (PolkitUnixSession *session,
                                                         const gchar *session_id);

Object Hierarchy

  GObject
   +----PolkitUnixSession

Implemented Interfaces

PolkitUnixSession implements PolkitSubject, GInitable and GAsyncInitable.

Properties

  "pid"                      gint                  : Write / Construct Only
  "session-id"               gchar*                : Read / Write / Construct

Description

An object that represents an user session.

The session id is an opaque string obtained from ConsoleKit.

Details

PolkitUnixSession

typedef struct _PolkitUnixSession PolkitUnixSession;

The PolkitUnixSession struct should not be accessed directly.


polkit_unix_session_new ()

PolkitSubject *     polkit_unix_session_new             (const gchar *session_id);

Creates a new PolkitUnixSession for session_id.

session_id :

The session id.

Returns :

A PolkitUnixSession. Free with g_object_unref(). [transfer full]

polkit_unix_session_new_for_process ()

void                polkit_unix_session_new_for_process (gint pid,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);

Asynchronously creates a new PolkitUnixSession object for the process with process id pid.

When the operation is finished, callback will be invoked in the thread-default main loop of the thread you are calling this method from. You can then call polkit_unix_session_new_for_process_finish() to get the result of the operation.

This method constructs the object asynchronously, for the synchronous and blocking version use polkit_unix_session_new_for_process_sync().

pid :

The process id of the process to get the session for.

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_unix_session_new_for_process_finish ()

PolkitSubject *     polkit_unix_session_new_for_process_finish
                                                        (GAsyncResult *res,
                                                         GError **error);

Finishes constructing a PolkitSubject for a process id.

res :

A GAsyncResult obtained from the GAsyncReadyCallback passed to polkit_unix_session_new_for_process().

error :

Return location for error. [allow-none]

Returns :

A PolkitUnixSession for the pid passed to polkit_unix_session_new_for_process() or NULL if error is set. Free with g_object_unref(). [transfer full][allow-none]

polkit_unix_session_new_for_process_sync ()

PolkitSubject *     polkit_unix_session_new_for_process_sync
                                                        (gint pid,
                                                         GCancellable *cancellable,
                                                         GError **error);

Creates a new PolkitUnixSession for the process with process id pid.

This is a synchronous call - the calling thread is blocked until a reply is received. For the asynchronous version, see polkit_unix_session_new_for_process().

pid :

The process id of the process to get the session for.

cancellable :

A GCancellable or NULL. [allow-none]

error :

Return location for error. [allow-none]

Returns :

A PolkitUnixSession for pid or NULL if error is set. Free with g_object_unref(). [allow-none][transfer full]

polkit_unix_session_get_session_id ()

const gchar *       polkit_unix_session_get_session_id  (PolkitUnixSession *session);

Gets the session id for session.

session :

A PolkitUnixSession.

Returns :

The session id for session. Do not free this string, it is owned by session.

polkit_unix_session_set_session_id ()

void                polkit_unix_session_set_session_id  (PolkitUnixSession *session,
                                                         const gchar *session_id);

Sets the session id for session to session_id.

session :

A PolkitUnixSession.

session_id :

The session id.

Property Details

The "pid" property

  "pid"                      gint                  : Write / Construct Only

The UNIX process id to look up the session.

Allowed values: >= 0

Default value: 0


The "session-id" property

  "session-id"               gchar*                : Read / Write / Construct

The UNIX session id.

Default value: NULL