org.freedesktop.ConsoleKit.Manager

org.freedesktop.ConsoleKit.Manager

Manager interface

# Methods

    Restart()
    CanRestart(out'b'can_restart)
    Stop()
    CanStop(out'b'can_stop)
    OpenSession(out's'cookie)
    OpenSessionWithParameters(in'a(sv)'parameters,
    out's'cookie)
    CloseSession(in's'cookie,
    out'b'result)
    GetSeats(out'ao'seats)
    GetSessions(out'ao'sessions)
    GetSessionForCookie(in's'cookie,
    out'o'ssid)
    GetSessionForUnixProcess(in'u'pid,
    out'o'ssid)
    GetCurrentSession(out'o'ssid)
    GetSessionsForUnixUser(in'u'uid,
    out'ao'sessions)
    GetSessionsForUser(in'u'uid,
    out'ao'sessions)
    GetSystemIdleHint(out'b'idle_hint)
    GetSystemIdleSinceHint(out's'iso8601_datetime)

## Signals

    SeatAdded('o'sid)
    SeatRemoved('o'sid)
    SystemIdleHintChanged('b'hint)

## Implemented Interfaces

Objects implementing org.freedesktop.ConsoleKit.Manager also implements org.freedesktop.DBus.Introspectable, org.freedesktop.DBus.Properties

## Description

## Details

### Restart ()

    Restart ()

This method initiates a request to restart (ie. reboot) the computer system.

### CanRestart ()

    CanRestart (out'b'can_restart)

`can_restart`:

### Stop ()

    Stop ()

This method initiates a request to stop (ie. shutdown) the computer system.

### CanStop ()

    CanStop (out'b'can_stop)

`can_stop`:

### OpenSession ()

    OpenSession (out's'cookie)

This method requests that a new Session be created for the calling process. The properties of this new Session are set automatically from information collected about the calling process.

This new session exists until the calling process disconnects from the system bus or calls `CloseSession()`.

It is the responsibility of the calling process to set the environment variable XDG_SESSION_COOKIE to the value of the returned cookie. This cookie should only be made available to child processes of the caller so that they may be identified as members of this session.

See this simple example:

    	DBusError       error;
    	DBusMessage    *message;
    	DBusMessage    *reply;

    	message = dbus_message_new_method_call ("org.freedesktop.ConsoleKit",
    						"/org/freedesktop/ConsoleKit/Manager",
    						"org.freedesktop.ConsoleKit.Manager",
    						"OpenSession");
    	if (message == NULL) {
    		goto out;
    	}

            dbus_error_init (&error);
            reply = dbus_connection_send_with_reply_and_block (connector->connection,
                                                               message,
                                                               -1,
                                                               &error);
            if (reply == NULL) {
    		goto out;
            }

            dbus_error_init (&error);
            if (! dbus_message_get_args (reply,
                                         &error,
                                         DBUS_TYPE_STRING, &cookie,
                                         DBUS_TYPE_INVALID)) {
    		goto out;
            }

`cookie`:

- The secret cookie that is used to identify the new session

See also: `OpenSessionWithParameters()`

### OpenSessionWithParameters ()

    OpenSessionWithParameters (in'a(sv)'parameters,
    out's'cookie)

This method requests that a new Session be created for the calling process. The properties of this new Session are from the parameters provided.

This new session exists until the calling process disconnects from the system bus or calls `CloseSession()`.

It is the responsibility of the calling process to set the environment variable XDG_SESSION_COOKIE to the value of the returned cookie. This cookie should only be made available to child processes of the caller so that they may be identified as members of this session.

See the Session properties for a list of valid parameters.

`parameters`:

- An array of sets of property names and values

`cookie`:

- The secret cookie that is used to identify the new session

#### Permissions

This method is restricted to privileged users by D-Bus policy.

See also: org.freedesktop.ConsoleKit.Session

### CloseSession ()

    CloseSession (in's'cookie,
    out'b'result)

This method is used to close the session identified by the supplied cookie.

The session can only be closed by the same process that opened the session.

`cookie`:

- The secret cookie that is used to identify the session

`result`:

- Whether the session was successfully closed

### GetSeats ()

    GetSeats (out'ao'seats)

This gets a list of all the Seats that are currently present on the system.

Each Seat ID is an D-Bus object path for the object that implements the Seat interface.

`seats`:

- an array of Seat IDs

See also: org.freedesktop.ConsoleKit.Seat

### GetSessions ()

    GetSessions (out'ao'sessions)

This gets a list of all the Sessions that are currently present on the system.

Each Session ID is an D-Bus object path for the object that implements the Session interface.

`sessions`:

- an array of Session IDs

See also: org.freedesktop.ConsoleKit.Session

### GetSessionForCookie ()

    GetSessionForCookie (in's'cookie,
    out'o'ssid)

Returns the session ID that is associated with the specified cookie.

`cookie`:

- The secret cookie that is used to identify the session

`ssid`:

- The object identifier for the current session

### GetSessionForUnixProcess ()

    GetSessionForUnixProcess (in'u'pid,
    out'o'ssid)

Attempts to determine the session ID for the specified POSIX process ID (pid).

`pid`:

- The POSIX process ID

`ssid`:

- The object identifier for the current session

### GetCurrentSession ()

    GetCurrentSession (out'o'ssid)

Attempts to determine the session ID that the caller belongs to.

See this example of using dbus-send:

      dbus-send --system --dest=org.freedesktop.ConsoleKit \
      --type=method_call --print-reply --reply-timeout=2000 \
      /org/freedesktop/ConsoleKit/Manager \
      org.freedesktop.ConsoleKit.Manager.GetCurrentSession

`ssid`:

- The object identifier for the current session

### GetSessionsForUnixUser ()

    GetSessionsForUnixUser (in'u'uid,
    out'ao'sessions)

This gets a list of all the Sessions that are currently open for the specified user.

Each Session ID is an D-Bus object path for the object that implements the Session interface.

`uid`:

- POSIX User identification

`sessions`:

- an array of Session IDs

### GetSessionsForUser ()

    GetSessionsForUser (in'u'uid,
    out'ao'sessions)

This gets a list of all the Sessions that are currently open for the specified user.

Each Session ID is an D-Bus object path for the object that implements the Session interface.

`uid`:

- User identification

`sessions`:

- an array of Session IDs

`GetSessionsForUser` is deprecated since version 0.1.3 and should not be used in newly-written code. Use `GetSessionsForUnixUser` instead.

### GetSystemIdleHint ()

    GetSystemIdleHint (out'b'idle_hint)

Returns TRUE if the `idle-hint` property of every open session is TRUE or if there are no open sessions.

`idle_hint`:

- The value of the system-idle-hint

### GetSystemIdleSinceHint ()

    GetSystemIdleSinceHint (out's'iso8601_datetime)

Returns an ISO 8601 date-time string that corresponds to the time of the last change of the system-idle-hint.

`iso8601_datetime`:

- An ISO 8601 format date-type string

## Signal Details

### The SeatAdded signal

    SeatAdded ('o'sid)

Emitted when a Seat has been added to the system.

`sid`:

- The Seat ID for the added seat

### The SeatRemoved signal

    SeatRemoved ('o'sid)

Emitted when a Seat has been removed from the system.

`sid`:

- The Seat ID for the removed seat

### The SystemIdleHintChanged signal

    SystemIdleHintChanged ('b'hint)

Emitted when the value of the system-idle-hint has changed.

`hint`:

- The value of the system-idle-hint