Polkit.UnixSession

g GObject.GInterface GObject.GInterface Gio.AsyncInitable Gio.AsyncInitable GObject.GInterface->Gio.AsyncInitable Gio.Initable Gio.Initable GObject.GInterface->Gio.Initable Polkit.Subject Polkit.Subject GObject.GInterface->Polkit.Subject GObject.Object GObject.Object Polkit.UnixSession Polkit.UnixSession GObject.Object->Polkit.UnixSession Gio.AsyncInitable->Polkit.UnixSession Gio.Initable->Polkit.UnixSession Polkit.Subject->Polkit.UnixSession

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gio.AsyncInitable (4), Gio.Initable (2), Polkit.Subject (7)

Structs:

GObject.ObjectClass (5)

class

new (session_id)

class

new_for_process (pid, cancellable, callback, *user_data)

class

new_for_process_finish (res)

class

new_for_process_sync (pid, cancellable)

get_session_id ()

set_session_id (session_id)

Virtual Methods

Inherited:

GObject.Object (7), Gio.AsyncInitable (2), Gio.Initable (1), Polkit.Subject (6)

Properties

Name

Type

Flags

Short Description

pid

int

w/co

Process ID to use for looking up the session

session-id

str

r/w/c

The UNIX session ID

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Polkit.UnixSession(**kwargs)
Bases:

GObject.Object, Gio.AsyncInitable, Gio.Initable, Polkit.Subject

Abstract:

No

Structure:

Polkit.UnixSessionClass

An object that represents an user session.

The session id is an opaque string obtained from ConsoleKit.

classmethod new(session_id)
Parameters:

session_id (str) – The session id.

Returns:

A Polkit.UnixSession. Free with GObject.Object.unref().

Return type:

Polkit.Subject

Creates a new Polkit.UnixSession for session_id.

classmethod new_for_process(pid, cancellable, callback, *user_data)
Parameters:

Asynchronously creates a new Polkit.UnixSession 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.UnixSession.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.UnixSession.new_for_process_sync().

classmethod new_for_process_finish(res)
Parameters:

res (Gio.AsyncResult) – A Gio.AsyncResult obtained from the Gio.AsyncReadyCallback passed to Polkit.UnixSession.new_for_process().

Raises:

GLib.Error

Returns:

A Polkit.UnixSession for the pid passed to Polkit.UnixSession.new_for_process() or None if error is set. Free with GObject.Object.unref().

Return type:

Polkit.Subject or None

Finishes constructing a Polkit.Subject for a process id.

classmethod new_for_process_sync(pid, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

A Polkit.UnixSession for pid or None if error is set. Free with GObject.Object.unref().

Return type:

Polkit.Subject or None

Creates a new Polkit.UnixSession 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.UnixSession.new_for_process().

get_session_id()
Returns:

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

Return type:

str

Gets the session id for self.

set_session_id(session_id)
Parameters:

session_id (str) – The session id.

Sets the session id for self to session_id.

Property Details

Polkit.UnixSession.props.pid
Name:

pid

Type:

int

Default Value:

0

Flags:

WRITABLE, CONSTRUCT_ONLY

The UNIX process id to look up the session.

Polkit.UnixSession.props.session_id
Name:

session-id

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT

The UNIX session id.