<refentry id="Manager">
  <refmeta>
    <refentrytitle role="top_of_page">org.freedesktop.ConsoleKit.Manager</refentrytitle>
  </refmeta>
  <refnamediv>
    <refname>org.freedesktop.ConsoleKit.Manager</refname>
    <refpurpose>Manager interface</refpurpose>
  </refnamediv>
  <refsynopsisdiv role="synopsis">
    <title role="synopsis.title">Methods</title>
    <synopsis><link linkend="Manager.Restart">Restart</link>                   ()
<link linkend="Manager.CanRestart">CanRestart</link>                (out 'b'         can_restart)
<link linkend="Manager.Stop">Stop</link>                      ()
<link linkend="Manager.CanStop">CanStop</link>                   (out 'b'         can_stop)
<link linkend="Manager.Reboot">Reboot</link>                    (in  'b'         policykit_interactivity)
<link linkend="Manager.CanReboot">CanReboot</link>                 (out 's'         can_reboot)
<link linkend="Manager.PowerOff">PowerOff</link>                  (in  'b'         policykit_interactivity)
<link linkend="Manager.CanPowerOff">CanPowerOff</link>               (out 's'         can_poweroff)
<link linkend="Manager.Suspend">Suspend</link>                   (in  'b'         policykit_interactivity)
<link linkend="Manager.CanSuspend">CanSuspend</link>                (out 's'         can_suspend)
<link linkend="Manager.Hibernate">Hibernate</link>                 (in  'b'         policykit_interactivity)
<link linkend="Manager.CanHibernate">CanHibernate</link>              (out 's'         can_hibernate)
<link linkend="Manager.HybridSleep">HybridSleep</link>               (in  'b'         policykit_interactivity)
<link linkend="Manager.CanHybridSleep">CanHybridSleep</link>            (out 's'         can_hybridsleep)
<link linkend="Manager.Inhibit">Inhibit</link>                   (in  's'         what,
                           in  's'         who,
                           in  's'         why,
                           in  's'         mode,
                           out 'h'         fd)
<link linkend="Manager.ListInhibitors">ListInhibitors</link>            (out 'a(ssssuu)' inhibitors)
<link linkend="Manager.OpenSession">OpenSession</link>               (out 's'         cookie)
<link linkend="Manager.OpenSessionWithParameters">OpenSessionWithParameters</link> (in  'a(sv)'     parameters,
                           out 's'         cookie)
<link linkend="Manager.CloseSession">CloseSession</link>              (in  's'         cookie,
                           out 'b'         result)
<link linkend="Manager.ActivateSession">ActivateSession</link>           (in  's'         session_id)
<link linkend="Manager.ActivateSessionOnSeat">ActivateSessionOnSeat</link>     (in  's'         session_id,
                           in  's'         seat_id)
<link linkend="Manager.LockSession">LockSession</link>               (in  's'         session_id)
<link linkend="Manager.UnlockSession">UnlockSession</link>             (in  's'         session_id)
<link linkend="Manager.ListSeats">ListSeats</link>                 (out 'a(so)'     seats)
<link linkend="Manager.GetSeats">GetSeats</link>                  (out 'ao'        seats)
<link linkend="Manager.GetSessions">GetSessions</link>               (out 'ao'        sessions)
<link linkend="Manager.GetSessionForCookie">GetSessionForCookie</link>       (in  's'         cookie,
                           out 'o'         ssid)
<link linkend="Manager.GetSessionForUnixProcess">GetSessionForUnixProcess</link>  (in  'u'         pid,
                           out 'o'         ssid)
<link linkend="Manager.GetSessionByPID">GetSessionByPID</link>           (in  'u'         pid,
                           out 'o'         ssid)
<link linkend="Manager.GetCurrentSession">GetCurrentSession</link>         (out 'o'         ssid)
<link linkend="Manager.GetSessionsForUnixUser">GetSessionsForUnixUser</link>    (in  'u'         uid,
                           out 'ao'        sessions)
<link linkend="Manager.GetSessionsForUser">GetSessionsForUser</link>        (in  'u'         uid,
                           out 'ao'        sessions)
<link linkend="Manager.GetSystemIdleHint">GetSystemIdleHint</link>         (out 'b'         idle_hint)
<link linkend="Manager.GetSystemIdleSinceHint">GetSystemIdleSinceHint</link>    (out 's'         iso8601_datetime)
</synopsis>
  </refsynopsisdiv>
  <refsect1 role="signal_proto">
    <title role="signal_proto.title">Signals</title>
    <synopsis><link linkend="Manager::SeatAdded">SeatAdded</link>             ('o' sid)
<link linkend="Manager::SeatRemoved">SeatRemoved</link>           ('o' sid)
<link linkend="Manager::SessionNew">SessionNew</link>            ('s' session_id,
                       'o' object_path)
<link linkend="Manager::SessionRemoved">SessionRemoved</link>        ('s' session_id,
                       'o' object_path)
<link linkend="Manager::SystemIdleHintChanged">SystemIdleHintChanged</link> ('b' hint)
<link linkend="Manager::PrepareForShutdown">PrepareForShutdown</link>    ('b' active)
<link linkend="Manager::PrepareForSleep">PrepareForSleep</link>       ('b' active)
</synopsis>
  </refsect1>
  <refsect1 role="impl_interfaces">
    <title role="impl_interfaces.title">Implemented Interfaces</title>
    <para>
    Objects implementing org.freedesktop.ConsoleKit.Manager also implements
    org.freedesktop.DBus.Introspectable,
    org.freedesktop.DBus.Properties
    </para>
  </refsect1>
  <refsect1 role="desc">
    <title role="desc.title">Description</title>
    <para/>
  </refsect1>
  <refsect1 role="details">
    <title role="details.title">Details</title>
    <refsect2><title><anchor role="function" id="Manager.Restart"/>Restart ()</title><indexterm><primary>Restart</primary><secondary>Manager</secondary></indexterm><programlisting>Restart ()</programlisting>
          <para>This method initiates a request to restart (ie. reboot) the computer system.</para>
          <para>May fail with: CK_MANAGER_ERROR_INHIBITED, CK_MANAGER_ERROR_INSUFFICIENT_PERMISSION, CK_MANAGER_ERROR_AUTHORIZATION_REQUIRED,
          CK_MANAGER_ERROR_GENERAL, CK_MANAGER_ERROR_BUSY</para>
        </refsect2>
    <refsect2><title><anchor role="function" id="Manager.CanRestart"/>CanRestart ()</title><indexterm><primary>CanRestart</primary><secondary>Manager</secondary></indexterm><programlisting>CanRestart (out 'b' can_restart)</programlisting>
          <para>This method returns whether the user is authorized to restart the computer system.</para>
          <para>May fail with: CK_MANAGER_ERROR_FAILED if polkit is used and fails checking authorization.</para>
        <variablelist role="params"><varlistentry><term><parameter>can_restart</parameter>:</term><listitem><simpara/></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.Stop"/>Stop ()</title><indexterm><primary>Stop</primary><secondary>Manager</secondary></indexterm><programlisting>Stop ()</programlisting>
          <para>This method initiates a request to stop (ie. shutdown) the computer system.</para>
          <para>May fail with: CK_MANAGER_ERROR_INHIBITED, CK_MANAGER_ERROR_INSUFFICIENT_PERMISSION, CK_MANAGER_ERROR_AUTHORIZATION_REQUIRED,
          CK_MANAGER_ERROR_GENERAL, CK_MANAGER_ERROR_BUSY</para>
        </refsect2>
    <refsect2><title><anchor role="function" id="Manager.CanStop"/>CanStop ()</title><indexterm><primary>CanStop</primary><secondary>Manager</secondary></indexterm><programlisting>CanStop (out 'b' can_stop)</programlisting>
          <para>This method returns whether the user is authorized to shutdown the computer system.</para>
          <para>May fail with: CK_MANAGER_ERROR_FAILED if polkit is used and fails checking authorization.</para>
        <variablelist role="params"><varlistentry><term><parameter>can_stop</parameter>:</term><listitem><simpara/></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.Reboot"/>Reboot ()</title><indexterm><primary>Reboot</primary><secondary>Manager</secondary></indexterm><programlisting>Reboot (in  'b' policykit_interactivity)</programlisting>
          <para>This method emulates the logind implementation. This method initiates a request to reboot the computer system.
          </para>
          <para>May fail with: CK_MANAGER_ERROR_INHIBITED, CK_MANAGER_ERROR_INSUFFICIENT_PERMISSION, CK_MANAGER_ERROR_AUTHORIZATION_REQUIRED,
          CK_MANAGER_ERROR_GENERAL, CK_MANAGER_ERROR_BUSY</para>
          <para>Since 0.9.2</para>
        <variablelist role="params"><varlistentry><term><parameter>policykit_interactivity</parameter>:</term><listitem><simpara>policykit_interactivity determines whether PolicyKit (if enabled) should interactively ask the user for authentication credentials if it needs to.</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.CanReboot"/>CanReboot ()</title><indexterm><primary>CanReboot</primary><secondary>Manager</secondary></indexterm><programlisting>CanReboot (out 's' can_reboot)</programlisting>
          <para>This method emulates the logind implementation.</para>
          <para>Returns whether the system supports rebooting and whether the calling user is eligible to reboot the system.</para>
          <para>Returns one of "na", "yes", "no" or "challenge".</para>
          <para>If "na" is returned rebooting is not available because of hardware support.</para>
          <para>If "yes" is returned rebooting is supported and the user may suspend without further authentication.</para>
          <para>If "no" is returned rebooting is available but the user is not allowed to reboot.</para>
          <para>If "challenge" is returned rebooting is available, but only after authorization.</para>
          <para>May fail with: CK_MANAGER_ERROR_FAILED if polkit is used and fails checking authorization.</para>
          <para>Since 0.9.2</para>
        <variablelist role="params"><varlistentry><term><parameter>can_reboot</parameter>:</term><listitem><simpara/></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.PowerOff"/>PowerOff ()</title><indexterm><primary>PowerOff</primary><secondary>Manager</secondary></indexterm><programlisting>PowerOff (in  'b' policykit_interactivity)</programlisting>
          <para>This method initiates a request to shutdown the computer system.</para>
          <para>May fail with: CK_MANAGER_ERROR_INHIBITED, CK_MANAGER_ERROR_INSUFFICIENT_PERMISSION, CK_MANAGER_ERROR_AUTHORIZATION_REQUIRED,
          CK_MANAGER_ERROR_GENERAL, CK_MANAGER_ERROR_BUSY</para>
          <para>Since 0.9.2</para>
        <variablelist role="params"><varlistentry><term><parameter>policykit_interactivity</parameter>:</term><listitem><simpara>policykit_interactivity determines whether PolicyKit (if enabled) should interactively ask the user for authentication credentials if it needs to.</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.CanPowerOff"/>CanPowerOff ()</title><indexterm><primary>CanPowerOff</primary><secondary>Manager</secondary></indexterm><programlisting>CanPowerOff (out 's' can_poweroff)</programlisting>
          <para>This method emulates the logind implementation.</para>
          <para>Returns whether the system supports shutdown and whether the calling user is eligible to shutdown the system.</para>
          <para>Returns one of "na", "yes", "no" or "challenge".</para>
          <para>If "na" is returned shutdown is not available because of hardware support.</para>
          <para>If "yes" is returned shutdown is supported and the user may hibernate without further authentication.</para>
          <para>If "no" is returned shutdown is available but the user is not allowed to shutdown.</para>
          <para>If "challenge" is returned shutdown is available, but only after authorization.</para>
          <para>May fail with: CK_MANAGER_ERROR_FAILED if polkit is used and fails checking authorization.</para>
          <para>Since 0.9.2</para>
        <variablelist role="params"><varlistentry><term><parameter>can_poweroff</parameter>:</term><listitem><simpara/></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.Suspend"/>Suspend ()</title><indexterm><primary>Suspend</primary><secondary>Manager</secondary></indexterm><programlisting>Suspend (in  'b' policykit_interactivity)</programlisting>
          <para>This method initiates a request to suspend the computer system.</para>
          <para>May fail with: CK_MANAGER_ERROR_INHIBITED, CK_MANAGER_ERROR_INSUFFICIENT_PERMISSION, CK_MANAGER_ERROR_AUTHORIZATION_REQUIRED,
          CK_MANAGER_ERROR_GENERAL, CK_MANAGER_ERROR_BUSY</para>
          <para>Since 0.9.2</para>
        <variablelist role="params"><varlistentry><term><parameter>policykit_interactivity</parameter>:</term><listitem><simpara>policykit_interactivity determines whether PolicyKit (if enabled) should interactively ask the user for authentication credentials if it needs to.</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.CanSuspend"/>CanSuspend ()</title><indexterm><primary>CanSuspend</primary><secondary>Manager</secondary></indexterm><programlisting>CanSuspend (out 's' can_suspend)</programlisting>
          <para>This method emulates the logind implementation.</para>
          <para>Returns whether the system supports suspending and whether the calling user is eligible to hibernate the system.</para>
          <para>Returns one of "na", "yes", "no" or "challenge".</para>
          <para>If "na" is returned suspending is not available because of hardware support.</para>
          <para>If "yes" is returned suspending is supported and the user may suspend without further authentication.</para>
          <para>If "no" is returned suspending is available but the user is not allowed to suspend.</para>
          <para>If "challenge" is returned suspending is available, but only after authorization.</para>
          <para>May fail with: CK_MANAGER_ERROR_FAILED if polkit is used and fails checking authorization.</para>
          <para>Since 0.9.1</para>
        <variablelist role="params"><varlistentry><term><parameter>can_suspend</parameter>:</term><listitem><simpara/></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.Hibernate"/>Hibernate ()</title><indexterm><primary>Hibernate</primary><secondary>Manager</secondary></indexterm><programlisting>Hibernate (in  'b' policykit_interactivity)</programlisting>
          <para>This method initiates a request to hibernate the computer system.</para>
          <para>May fail with: CK_MANAGER_ERROR_INHIBITED, CK_MANAGER_ERROR_INSUFFICIENT_PERMISSION, CK_MANAGER_ERROR_AUTHORIZATION_REQUIRED,
          CK_MANAGER_ERROR_GENERAL, CK_MANAGER_ERROR_BUSY</para>
          <para>Since 0.9.2</para>
        <variablelist role="params"><varlistentry><term><parameter>policykit_interactivity</parameter>:</term><listitem><simpara>policykit_interactivity determines whether PolicyKit (if enabled) should interactively ask the user for authentication credentials if it needs to.</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.CanHibernate"/>CanHibernate ()</title><indexterm><primary>CanHibernate</primary><secondary>Manager</secondary></indexterm><programlisting>CanHibernate (out 's' can_hibernate)</programlisting>
          <para>This method emulates the logind implementation.</para>
          <para>Returns whether the system supports hibernation and whether the calling user is eligible to hibernate the system.</para>
          <para>Returns one of "na", "yes", "no" or "challenge".</para>
          <para>If "na" is returned hibernation is not available because of hardware support.</para>
          <para>If "yes" is returned hibernation is supported and the user may hibernate without further authentication.</para>
          <para>If "no" is returned hibernation is available but the user is not allowed to hibernate.</para>
          <para>If "challenge" is returned hibernation is available, but only after authorization.</para>
          <para>May fail with: CK_MANAGER_ERROR_FAILED if polkit is used and fails checking authorization.</para>
          <para>Since 0.9.1</para>
        <variablelist role="params"><varlistentry><term><parameter>can_hibernate</parameter>:</term><listitem><simpara/></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.HybridSleep"/>HybridSleep ()</title><indexterm><primary>HybridSleep</primary><secondary>Manager</secondary></indexterm><programlisting>HybridSleep (in  'b' policykit_interactivity)</programlisting>
          <para>This method initiates a request to hybrid sleep (suspend + hibernate) the computer system.</para>
          <para>May fail with: CK_MANAGER_ERROR_INHIBITED, CK_MANAGER_ERROR_INSUFFICIENT_PERMISSION, CK_MANAGER_ERROR_AUTHORIZATION_REQUIRED,
          CK_MANAGER_ERROR_GENERAL, CK_MANAGER_ERROR_BUSY</para>
          <para>Since 0.9.2</para>
        <variablelist role="params"><varlistentry><term><parameter>policykit_interactivity</parameter>:</term><listitem><simpara>policykit_interactivity determines whether PolicyKit (if enabled) should interactively ask the user for authentication credentials if it needs to.</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.CanHybridSleep"/>CanHybridSleep ()</title><indexterm><primary>CanHybridSleep</primary><secondary>Manager</secondary></indexterm><programlisting>CanHybridSleep (out 's' can_hybridsleep)</programlisting>
          <para>This method emulates the logind implementation.</para>
          <para>Returns whether the system supports hybrid sleep (suspend + hibernate) and whether the calling user is eligible to hybrid sleep the system.</para>
          <para>Returns one of "na", "yes", "no" or "challenge".</para>
          <para>If "na" is returned hybrid sleeping is not available because of hardware support.</para>
          <para>If "yes" is returned hybrid sleeping is supported and the user may hybrid sleep without further authentication.</para>
          <para>If "no" is returned hybrid sleeping is available but the user is not allowed to hybrid sleep.</para>
          <para>If "challenge" is returned hybrid sleeping is available, but only after authorization.</para>
          <para>May fail with: CK_MANAGER_ERROR_FAILED if polkit is used and fails checking authorization.</para>
          <para>Since 0.9.1</para>
        <variablelist role="params"><varlistentry><term><parameter>can_hybridsleep</parameter>:</term><listitem><simpara/></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.Inhibit"/>Inhibit ()</title><indexterm><primary>Inhibit</primary><secondary>Manager</secondary></indexterm><programlisting>Inhibit (in  's' what,
         in  's' who,
         in  's' why,
         in  's' mode,
         out 'h' fd)</programlisting>
        <para>Inhibit locks are named pipes used by ConsoleKit2 to prevent the system from performing actions such as suspending, restarting, or going idle. There are various reasons and application would like to prevent one or more of these functions such as a movie player preventing the screen saving from activating or a package manager ensuring an application installs before allowing the computer to shutdown.</para>
        <para>Note: Each application can have only one lock open at any given time. Multiple applications can hold locks to the same thing, for example a media player application and a cd burning application can both prevent the system from being marked idle.</para>
        <para>May fail with: CK_MANAGER_ERROR_INVALID_INPUT, CK_MANAGER_ERROR_OOM, CK_MANAGER_ERROR_GENERAL</para>
        <para>Since 0.9.0</para>
        <para>See this simple example:
          <informalexample><programlisting>
    DBusConnection *bus_connection;
    DBusMessage *message = NULL, *reply = NULL;
    DBusError error;
    gint fd = -1;
    const char *what = "shutdown:sleep";
    const char *who = "Xfburn";
    const char *why = "Burning a DVD, interrupting now will ruin the DVD.";
    const char *mode = "block";

    message = dbus_message_new_method_call ("org.freedesktop.ConsoleKit",
                                            "/org/freedesktop/ConsoleKit/Manager",
                                            "org.freedesktop.ConsoleKit.Manager",
                                            "Inhibit");

    if (!message)
    {
        g_warning ("Unable to call Inhibit()");
        return fd;
    }

    if (!dbus_message_append_args (message,
                                   DBUS_TYPE_STRING, &amp;what,
                                   DBUS_TYPE_STRING, &amp;who,
                                   DBUS_TYPE_STRING, &amp;why,
                                   DBUS_TYPE_STRING, &amp;mode,
                                   DBUS_TYPE_INVALID))
    {
        g_warning ("Unable to call Inhibit()");
        dbus_message_unref (message);
        return fd;
    }

    reply = dbus_connection_send_with_reply_and_block (bus_connection, message, -1, &amp;error);
    if (!reply)
    {
        g_warning ("Unable to inhibit: %s", error.message);
        dbus_message_unref (message);
        return fd;
    }

    if (!dbus_message_get_args (reply, &amp;error,
                                DBUS_TYPE_UNIX_FD, &amp;fd,
                                DBUS_TYPE_INVALID))
    {
        g_warning ("Inhibit() reply parsing failed: %s", error.message);
    }

    dbus_message_unref (message);
    dbus_message_unref (reply);
    dbus_error_free (&amp;error);
    return fd;
          </programlisting></informalexample></para>
        <variablelist role="params"><varlistentry><term><parameter>what</parameter>:</term><listitem><simpara>What is a colon-separated list of lock types. The list of lock types are: shutdown, sleep, idle, handle-power-key, handle-suspend-key, handle-hibernate-key. Example: "shutdown:idle"</simpara></listitem></varlistentry><varlistentry><term><parameter>who</parameter>:</term><listitem><simpara>Who is a human-readable, descriptive string of who is taking the lock. Example: "Xfburn"</simpara></listitem></varlistentry><varlistentry><term><parameter>why</parameter>:</term><listitem><simpara>Why is a human-readable, descriptive string of why the program is taking the lock. Example: "Burning a DVD, interrupting now will ruin the DVD."</simpara></listitem></varlistentry><varlistentry><term><parameter>mode</parameter>:</term><listitem><simpara>Mode is either "block" or "delay" which determines if the inhibit lock is mandatory or should just delay the operation to a certain maximum time.</simpara></listitem></varlistentry><varlistentry><term><parameter>fd</parameter>:</term><listitem><simpara>Returns a file descriptor that encapsulates the lock, or -1 on failure. As soon as the file descriptor is closed (and all its duplicates) the lock is automatically released. If the client dies while the lock is taken it is automatically closed and the lock is released.</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.ListInhibitors"/>ListInhibitors ()</title><indexterm><primary>ListInhibitors</primary><secondary>Manager</secondary></indexterm><programlisting>ListInhibitors (out 'a(ssssuu)' inhibitors)</programlisting>
          <para>This method emulates the logind implementation.</para>
          <para>Returns the current list of inhibitors, an array of strings representing the what, who, why, mode, and two unsigned int32 representing the user ID and process ID.</para>
          <para>May fail with: CK_MANAGER_ERROR_GENERAL or CK_MANAGER_ERROR_NOTHING_INHIBITED.</para>
          <para>Since 0.9.5</para>
        <variablelist role="params"><varlistentry><term><parameter>inhibitors</parameter>:</term><listitem><simpara/></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.OpenSession"/>OpenSession ()</title><indexterm><primary>OpenSession</primary><secondary>Manager</secondary></indexterm><programlisting>OpenSession (out 's' cookie)</programlisting>
          <para>This method requests that a new <link linkend="Session">Session</link>
          be created for the calling process.  The properties of this new Session are set automatically
          from information collected about the calling process.
          </para>
          <para>This new session exists until the calling process disconnects from the system bus or
          calls <link linkend="Manager.CloseSession"><function>CloseSession()</function></link>.
          </para>
          <para>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.
          </para>
          <para>May fail with: CK_MANAGER_ERROR_GENERAL</para>
          <para>See this simple example:
          <informalexample><programlisting>
	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 (&amp;error);
        reply = dbus_connection_send_with_reply_and_block (connector-&gt;connection,
                                                           message,
                                                           -1,
                                                           &amp;error);
        if (reply == NULL) {
		goto out;
        }

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

          </programlisting></informalexample></para>
        <variablelist role="params"><varlistentry><term><parameter>cookie</parameter>:</term><listitem><simpara>The secret cookie that is used to identify the new session</simpara></listitem></varlistentry></variablelist><para>
See also:
<link linkend="Manager.OpenSessionWithParameters"><function>OpenSessionWithParameters()</function></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Manager.OpenSessionWithParameters"/>OpenSessionWithParameters ()</title><indexterm><primary>OpenSessionWithParameters</primary><secondary>Manager</secondary></indexterm><programlisting>OpenSessionWithParameters (in  'a(sv)' parameters,
                           out 's'     cookie)</programlisting>
          <para>This method requests that a new <link linkend="Session">Session</link>
          be created for the calling process.  The properties of this new Session are from the
          parameters provided.
          </para>
          <para>This new session exists until the calling process disconnects from the system bus or
          calls <link linkend="Manager.CloseSession"><function>CloseSession()</function></link>.
          </para>
          <para>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.
          </para>
          <para>See the <link linkend="Session">Session</link> properties for a list of valid parameters.</para>
          <para>May fail with: CK_MANAGER_ERROR_GENERAL</para>
        <variablelist role="params"><varlistentry><term><parameter>parameters</parameter>:</term><listitem><simpara>An array of sets of property names and values</simpara></listitem></varlistentry><varlistentry><term><parameter>cookie</parameter>:</term><listitem><simpara>The secret cookie that is used to identify the new session</simpara></listitem></varlistentry></variablelist><note><title>Permissions</title><para role="permission">This method is restricted to privileged users by D-Bus policy.</para></note><para>
See also:
<link linkend="Session">org.freedesktop.ConsoleKit.Session</link></para></refsect2>
    <refsect2><title><anchor role="function" id="Manager.CloseSession"/>CloseSession ()</title><indexterm><primary>CloseSession</primary><secondary>Manager</secondary></indexterm><programlisting>CloseSession (in  's' cookie,
              out 'b' result)</programlisting>
          <para>This method is used to close the session identified by the supplied cookie.
          </para>
          <para>The session can only be closed by the same process that opened the session.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>cookie</parameter>:</term><listitem><simpara>The secret cookie that is used to identify the session</simpara></listitem></varlistentry><varlistentry><term><parameter>result</parameter>:</term><listitem><simpara>Whether the session was successfully closed</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.ActivateSession"/>ActivateSession ()</title><indexterm><primary>ActivateSession</primary><secondary>Manager</secondary></indexterm><programlisting>ActivateSession (in  's' session_id)</programlisting>
          <para>This method is used to activate the specified session.</para>
          <para>May fail with: CK_MANAGER_ERROR_INVALID_INPUT, CK_MANAGER_ERROR_NO_SEATS, CK_MANAGER_ERROR_GENERAL</para>
          <para>Since 1.2.0</para>
        <variablelist role="params"><varlistentry><term><parameter>session_id</parameter>:</term><listitem><simpara>The session to activate</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.ActivateSessionOnSeat"/>ActivateSessionOnSeat ()</title><indexterm><primary>ActivateSessionOnSeat</primary><secondary>Manager</secondary></indexterm><programlisting>ActivateSessionOnSeat (in  's' session_id,
                       in  's' seat_id)</programlisting>
          <para>This method is used to activate the specified session as
          as long as it's on the seat_id.</para>
          <para>May fail with: CK_MANAGER_ERROR_INVALID_INPUT, CK_MANAGER_ERROR_GENERAL</para>
          <para>Since 1.2.0</para>
        <variablelist role="params"><varlistentry><term><parameter>session_id</parameter>:</term><listitem><simpara>The session to activate</simpara></listitem></varlistentry><varlistentry><term><parameter>seat_id</parameter>:</term><listitem><simpara>The seat to activate the session on</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.LockSession"/>LockSession ()</title><indexterm><primary>LockSession</primary><secondary>Manager</secondary></indexterm><programlisting>LockSession (in  's' session_id)</programlisting>
          <para>This will cause a <link linkend="Session::Lock"><literal>Lock</literal></link>
          signal to be emitted for this session.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>session_id</parameter>:</term><listitem><simpara>The session to lock</simpara></listitem></varlistentry></variablelist><note><title>Permissions</title><para role="permission">This method is restricted to privileged users by D-Bus policy.</para></note><para>
See also:
<link linkend="Session::Lock"><literal>Lock signal</literal></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Manager.UnlockSession"/>UnlockSession ()</title><indexterm><primary>UnlockSession</primary><secondary>Manager</secondary></indexterm><programlisting>UnlockSession (in  's' session_id)</programlisting>
          <para>This will cause an <link linkend="Session::Unlock"><literal>Unlock</literal></link>
          signal to be emitted for this session.
          </para>
          <para>This can be used by login managers to unlock a session before it is
          re-activated during fast-user-switching.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>session_id</parameter>:</term><listitem><simpara>The session to unlock</simpara></listitem></varlistentry></variablelist><note><title>Permissions</title><para role="permission">This method is restricted to privileged users by D-Bus policy.</para></note><para>
See also:
<link linkend="Session::Unlock"><literal>Unlock signal</literal></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Manager.ListSeats"/>ListSeats ()</title><indexterm><primary>ListSeats</primary><secondary>Manager</secondary></indexterm><programlisting>ListSeats (out 'a(so)' seats)</programlisting>
          <para>Retrieves a list of all <link linkend="Seat">Seats</link>
          that are present on the system.</para>
          <para>Like the logind method of the same name, this returns both the seat's name
          (such as "seat0") and the D-Bus object path for the seat object that implements the
          <link linkend="Seat">Seat</link> interface.</para>
        <variablelist role="params"><varlistentry><term><parameter>seats</parameter>:</term><listitem><simpara>an array of seat names and IDs</simpara></listitem></varlistentry></variablelist><para>
See also:
<link linkend="Manager.GetSeats"><function>GetSeats()</function></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Manager.GetSeats"/>GetSeats ()</title><indexterm><primary>GetSeats</primary><secondary>Manager</secondary></indexterm><programlisting>GetSeats (out 'ao' seats)</programlisting>
          <para>This gets a list of all the <link linkend="Seat">Seats</link>
          that are currently present on the system.</para>
          <para>Each Seat ID is an D-Bus object path for the object that implements the
          <link linkend="Seat">Seat</link> interface.</para>
        <variablelist role="params"><varlistentry><term><parameter>seats</parameter>:</term><listitem><simpara>an array of Seat IDs</simpara></listitem></varlistentry></variablelist><para>
See also:
<link linkend="Seat">org.freedesktop.ConsoleKit.Seat</link></para></refsect2>
    <refsect2><title><anchor role="function" id="Manager.GetSessions"/>GetSessions ()</title><indexterm><primary>GetSessions</primary><secondary>Manager</secondary></indexterm><programlisting>GetSessions (out 'ao' sessions)</programlisting>
          <para>This gets a list of all the <link linkend="Session">Sessions</link>
          that are currently present on the system.</para>
          <para>Each Session ID is an D-Bus object path for the object that implements the
          <link linkend="Session">Session</link> interface.</para>
        <variablelist role="params"><varlistentry><term><parameter>sessions</parameter>:</term><listitem><simpara>an array of Session IDs</simpara></listitem></varlistentry></variablelist><para>
See also:
<link linkend="Session">org.freedesktop.ConsoleKit.Session</link></para></refsect2>
    <refsect2><title><anchor role="function" id="Manager.GetSessionForCookie"/>GetSessionForCookie ()</title><indexterm><primary>GetSessionForCookie</primary><secondary>Manager</secondary></indexterm><programlisting>GetSessionForCookie (in  's' cookie,
                     out 'o' ssid)</programlisting>
          <para>Returns the session ID that is associated with the specified cookie.
          </para>
          <para>May fail with: CK_MANAGER_ERROR_GENERAL</para>
        <variablelist role="params"><varlistentry><term><parameter>cookie</parameter>:</term><listitem><simpara>The secret cookie that is used to identify the session</simpara></listitem></varlistentry><varlistentry><term><parameter>ssid</parameter>:</term><listitem><simpara>The object identifier for the current session</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.GetSessionForUnixProcess"/>GetSessionForUnixProcess ()</title><indexterm><primary>GetSessionForUnixProcess</primary><secondary>Manager</secondary></indexterm><programlisting>GetSessionForUnixProcess (in  'u' pid,
                          out 'o' ssid)</programlisting>
          <para>Attempts to determine the session ID for the specified
          POSIX process ID (pid).
          </para>
          <para>May fail with: CK_MANAGER_ERROR_GENERAL</para>
        <variablelist role="params"><varlistentry><term><parameter>pid</parameter>:</term><listitem><simpara>The POSIX process ID</simpara></listitem></varlistentry><varlistentry><term><parameter>ssid</parameter>:</term><listitem><simpara>The object identifier for the current session</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.GetSessionByPID"/>GetSessionByPID ()</title><indexterm><primary>GetSessionByPID</primary><secondary>Manager</secondary></indexterm><programlisting>GetSessionByPID (in  'u' pid,
                 out 'o' ssid)</programlisting>
          <para>Attempts to determine the session ID for the specified
          POSIX process ID (pid).
          </para>
          <para>May fail with: CK_MANAGER_ERROR_GENERAL</para>
          <para>Since 1.1.1</para>
        <variablelist role="params"><varlistentry><term><parameter>pid</parameter>:</term><listitem><simpara>The POSIX process ID</simpara></listitem></varlistentry><varlistentry><term><parameter>ssid</parameter>:</term><listitem><simpara>The object identifier for the current session</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.GetCurrentSession"/>GetCurrentSession ()</title><indexterm><primary>GetCurrentSession</primary><secondary>Manager</secondary></indexterm><programlisting>GetCurrentSession (out 'o' ssid)</programlisting>
          <para>Attempts to determine the session ID that the caller belongs to.
          </para>
          <para>May fail with: CK_MANAGER_ERROR_GENERAL</para>
          <para>See this example of using dbus-send:
          <informalexample><programlisting>
  dbus-send --system --dest=org.freedesktop.ConsoleKit \
  --type=method_call --print-reply --reply-timeout=2000 \
  /org/freedesktop/ConsoleKit/Manager \
  org.freedesktop.ConsoleKit.Manager.GetCurrentSession
          </programlisting></informalexample></para>
        <variablelist role="params"><varlistentry><term><parameter>ssid</parameter>:</term><listitem><simpara>The object identifier for the current session</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.GetSessionsForUnixUser"/>GetSessionsForUnixUser ()</title><indexterm><primary>GetSessionsForUnixUser</primary><secondary>Manager</secondary></indexterm><programlisting>GetSessionsForUnixUser (in  'u'  uid,
                        out 'ao' sessions)</programlisting>
          <para>This gets a list of all the <link linkend="Session">Sessions</link>
          that are currently open for the specified user.</para>
          <para>Each Session ID is an D-Bus object path for the object that implements the
          <link linkend="Session">Session</link> interface.</para>
        <variablelist role="params"><varlistentry><term><parameter>uid</parameter>:</term><listitem><simpara>POSIX User identification</simpara></listitem></varlistentry><varlistentry><term><parameter>sessions</parameter>:</term><listitem><simpara>an array of Session IDs</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.GetSessionsForUser"/>GetSessionsForUser ()</title><indexterm><primary>GetSessionsForUser</primary><secondary>Manager</secondary></indexterm><programlisting>GetSessionsForUser (in  'u'  uid,
                    out 'ao' sessions)</programlisting>
          <para>This gets a list of all the <link linkend="Session">Sessions</link>
          that are currently open for the specified user.</para>
          <para>Each Session ID is an D-Bus object path for the object that implements the
          <link linkend="Session">Session</link> interface.</para>
        <variablelist role="params"><varlistentry><term><parameter>uid</parameter>:</term><listitem><simpara>User identification</simpara></listitem></varlistentry><varlistentry><term><parameter>sessions</parameter>:</term><listitem><simpara>an array of Session IDs</simpara></listitem></varlistentry></variablelist><para role="deprecated"><warning><para><literal>GetSessionsForUser</literal> is deprecated since version 0.1.3 and should not be used in newly-written code. Use

  <link linkend="Manager.GetSessionsForUnixUser"><function>GetSessionsForUnixUser</function></link>
instead.</para></warning></para></refsect2>
    <refsect2><title><anchor role="function" id="Manager.GetSystemIdleHint"/>GetSystemIdleHint ()</title><indexterm><primary>GetSystemIdleHint</primary><secondary>Manager</secondary></indexterm><programlisting>GetSystemIdleHint (out 'b' idle_hint)</programlisting>
          <para>Returns TRUE if the <link linkend="Session:idle-hint"><literal>idle-hint</literal></link>
          property of every open session is TRUE or if there are no open sessions.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>idle_hint</parameter>:</term><listitem><simpara>The value of the system-idle-hint</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager.GetSystemIdleSinceHint"/>GetSystemIdleSinceHint ()</title><indexterm><primary>GetSystemIdleSinceHint</primary><secondary>Manager</secondary></indexterm><programlisting>GetSystemIdleSinceHint (out 's' iso8601_datetime)</programlisting>
          <para>Returns an ISO 8601 date-time string that corresponds to
          the time of the last change of the system-idle-hint.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>iso8601_datetime</parameter>:</term><listitem><simpara>An ISO 8601 format date-type string</simpara></listitem></varlistentry></variablelist></refsect2>
  </refsect1>
  <refsect1 role="signals">
    <title role="signals.title">Signal Details</title>
    <refsect2><title><anchor role="function" id="Manager::SeatAdded"/>The SeatAdded signal</title><indexterm><primary>SeatAdded</primary><secondary>Manager</secondary></indexterm><programlisting>SeatAdded ('o' sid)</programlisting>
          <para>Emitted when a Seat has been added to the system.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>sid</parameter>:</term><listitem><simpara>The Seat ID for the added seat</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager::SeatRemoved"/>The SeatRemoved signal</title><indexterm><primary>SeatRemoved</primary><secondary>Manager</secondary></indexterm><programlisting>SeatRemoved ('o' sid)</programlisting>
          <para>Emitted when a Seat has been removed from the system.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>sid</parameter>:</term><listitem><simpara>The Seat ID for the removed seat</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager::SessionNew"/>The SessionNew signal</title><indexterm><primary>SessionNew</primary><secondary>Manager</secondary></indexterm><programlisting>SessionNew ('s' session_id,
            'o' object_path)</programlisting>
          <para>Emitted when a session has been added to the system.
          </para>
          <para>Since 1.1.1</para>
        <variablelist role="params"><varlistentry><term><parameter>session_id</parameter>:</term><listitem><simpara>The Session ID for the added session</simpara></listitem></varlistentry><varlistentry><term><parameter>object_path</parameter>:</term><listitem><simpara>The object path for the added session</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager::SessionRemoved"/>The SessionRemoved signal</title><indexterm><primary>SessionRemoved</primary><secondary>Manager</secondary></indexterm><programlisting>SessionRemoved ('s' session_id,
                'o' object_path)</programlisting>
          <para>Emitted when a session has been removed from the system.
          </para>
          <para>Since 1.1.1</para>
        <variablelist role="params"><varlistentry><term><parameter>session_id</parameter>:</term><listitem><simpara>The Session ID for the removed session</simpara></listitem></varlistentry><varlistentry><term><parameter>object_path</parameter>:</term><listitem><simpara>The object path for the removed session</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager::SystemIdleHintChanged"/>The SystemIdleHintChanged signal</title><indexterm><primary>SystemIdleHintChanged</primary><secondary>Manager</secondary></indexterm><programlisting>SystemIdleHintChanged ('b' hint)</programlisting>
          <para>Emitted when the value of the system-idle-hint has changed.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>hint</parameter>:</term><listitem><simpara>The value of the system-idle-hint</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager::PrepareForShutdown"/>The PrepareForShutdown signal</title><indexterm><primary>PrepareForShutdown</primary><secondary>Manager</secondary></indexterm><programlisting>PrepareForShutdown ('b' active)</programlisting>
          <para>Emitted when the system is halting (active = TRUE). If
                    successful there will not be a FALSE signal emitted since
                    the system will poweroff or reboot. It will emit a FALSE
                    signal if the shutdown operation failed.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>active</parameter>:</term><listitem><simpara>TRUE when the system is starting to halt.</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Manager::PrepareForSleep"/>The PrepareForSleep signal</title><indexterm><primary>PrepareForSleep</primary><secondary>Manager</secondary></indexterm><programlisting>PrepareForSleep ('b' active)</programlisting>
          <para>Emitted when the system is starting the sleep process.
                    It will emit with an active = FALSE when resuming from sleep
                    or if the sleep operation failed.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>active</parameter>:</term><listitem><simpara>TRUE when starting to sleep.</simpara></listitem></varlistentry></variablelist></refsect2>
  </refsect1>
</refentry>
