summaryrefslogtreecommitdiffstats
path: root/doc/xml/ref-ck-manager.xml
blob: f964295b77195d84cca481039b29a46022836706 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<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.Stop">Stop</link>                      ()
<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.GetSeats">GetSeats</link>                  (out 'ao'    seats)
<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.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::SystemIdleHintChanged">SystemIdleHintChanged</link> ('b' hint)
</synopsis>
  </refsect1>
  <refsect1 role="impl_interfaces">
    <title role="impl_interfaces.title">Implemented Interfaces</title>
    <para>org.freedesktop.ConsoleKit.Manager implements
    org.freedesktop.DBus.Introspectable,
    org.freedesktop.DBus.Properties
    </para>
  </refsect1>
  <refsect1 role="properties">
    <title role="properties.title">Properties</title>
    <synopsis/>
  </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></refsect2>
          <para>This method initiates a request to restart (ie. reboot) the computer system.</para>
        <variablelist role="params"/><refsect2><title><anchor role="function" id="Manager.Stop"/>Stop ()</title><indexterm><primary>Stop</primary><secondary>Manager</secondary></indexterm><programlisting>Stop ()</programlisting></refsect2>
          <para>This method initiates a request to stop (ie. shutdown) the computer system.</para>
        <variablelist role="params"/><refsect2><title><anchor role="function" id="Manager.OpenSession"/>OpenSession ()</title><indexterm><primary>OpenSession</primary><secondary>Manager</secondary></indexterm><programlisting>OpenSession (out 's' cookie)</programlisting></refsect2>
          <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>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><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></refsect2>
          <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>
        <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><para role="permission">This method is restricted to privileged users by D-Bus policy.</para><para>
See also:
<link linkend="Session">org.freedesktop.ConsoleKit.Session</link></para><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></refsect2>
          <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><title><anchor role="function" id="Manager.GetSeats"/>GetSeats ()</title><indexterm><primary>GetSeats</primary><secondary>Manager</secondary></indexterm><programlisting>GetSeats (out 'ao' seats)</programlisting></refsect2>
          <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><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></refsect2>
          <para>Returns the session ID that is associated with the specified cookie.
          </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><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></refsect2>
          <para>Attempts to determine the session ID for the specified
          POSIX process ID (pid).
          </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><title><anchor role="function" id="Manager.GetCurrentSession"/>GetCurrentSession ()</title><indexterm><primary>GetCurrentSession</primary><secondary>Manager</secondary></indexterm><programlisting>GetCurrentSession (out 'o' ssid)</programlisting></refsect2>
          <para>Attempts to determine the session ID that the caller belongs to.
          </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><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></refsect2>
          <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><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></refsect2>
          <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><title><anchor role="function" id="Manager.GetSystemIdleHint"/>GetSystemIdleHint ()</title><indexterm><primary>GetSystemIdleHint</primary><secondary>Manager</secondary></indexterm><programlisting>GetSystemIdleHint (out 'b' idle_hint)</programlisting></refsect2>
          <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><title><anchor role="function" id="Manager.GetSystemIdleSinceHint"/>GetSystemIdleSinceHint ()</title><indexterm><primary>GetSystemIdleSinceHint</primary><secondary>Manager</secondary></indexterm><programlisting>GetSystemIdleSinceHint (out 's' iso8601_datetime)</programlisting></refsect2>
          <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></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></refsect2>
          <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><title><anchor role="function" id="Manager::SeatRemoved"/>The SeatRemoved signal</title><indexterm><primary>SeatRemoved</primary><secondary>Manager</secondary></indexterm><programlisting>SeatRemoved ('o' sid)</programlisting></refsect2>
          <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><title><anchor role="function" id="Manager::SystemIdleHintChanged"/>The SystemIdleHintChanged signal</title><indexterm><primary>SystemIdleHintChanged</primary><secondary>Manager</secondary></indexterm><programlisting>SystemIdleHintChanged ('b' hint)</programlisting></refsect2>
          <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></refsect1>
  <refsect1 role="property_details">
    <title role="property_details.title">Property Details</title>
  </refsect1>
</refentry>