diff options
| -rw-r--r-- | src/Makefile.am | 66 | ||||
| -rw-r--r-- | src/dialog.c | 36 | ||||
| -rw-r--r-- | src/gtk-logout-helper.c | 30 | ||||
| -rw-r--r-- | src/org.freedesktop.ConsoleKit.Manager.xml | 353 | ||||
| -rw-r--r-- | src/org.freedesktop.ConsoleKit.Seat.xml | 164 | ||||
| -rw-r--r-- | src/org.freedesktop.ConsoleKit.Session.xml | 435 | ||||
| -rw-r--r-- | src/org.freedesktop.login1.Manager.xml | 199 | ||||
| -rw-r--r-- | src/org.freedesktop.login1.Seat.xml | 21 | ||||
| -rw-r--r-- | src/org.freedesktop.login1.Session.xml | 49 | ||||
| -rw-r--r-- | src/org.freedesktop.login1.User.xml | 56 | ||||
| -rw-r--r-- | src/session-menu-mgr.c | 136 | ||||
| -rw-r--r-- | src/upower.xml | 309 | ||||
| -rw-r--r-- | src/users-service-dbus.c | 354 | ||||
| -rw-r--r-- | src/users-service-dbus.h | 5 | 
14 files changed, 610 insertions, 1603 deletions
| diff --git a/src/Makefile.am b/src/Makefile.am index bcc8652..1ab9b9b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -43,34 +43,34 @@ $(dbus_display_manager_sources): display-manager.xml  	    --generate-c-code dbus-display-manager \  	    $^ -dbus_consolekit_manager_sources = \ -	dbus-consolekit-manager.c \ -	dbus-consolekit-manager.h +dbus_login1_manager_sources = \ +	dbus-login1-manager.c \ +	dbus-login1-manager.h -$(dbus_consolekit_manager_sources): org.freedesktop.ConsoleKit.Manager.xml +$(dbus_login1_manager_sources):	org.freedesktop.login1.Manager.xml  	$(AM_V_GEN) gdbus-codegen \  	    --interface-prefix org.freedesktop \ -	    --generate-c-code dbus-consolekit-manager \ +	    --generate-c-code dbus-login1-manager \  	    $^ -dbus_consolekit_seat_sources = \ -	dbus-consolekit-seat.c \ -	dbus-consolekit-seat.h +dbus_login1_session_sources = \ +	dbus-login1-session.c \ +	dbus-login1-session.h -$(dbus_consolekit_seat_sources): org.freedesktop.ConsoleKit.Seat.xml +$(dbus_login1_session_sources):	org.freedesktop.login1.Session.xml  	$(AM_V_GEN) gdbus-codegen \  	    --interface-prefix org.freedesktop \ -	    --generate-c-code dbus-consolekit-seat \ +	    --generate-c-code dbus-login1-session \  	    $^ -dbus_consolekit_session_sources = \ -	dbus-consolekit-session.c \ -	dbus-consolekit-session.h +dbus_login1_user_sources = \ +	dbus-login1-user.c \ +	dbus-login1-user.h -$(dbus_consolekit_session_sources): org.freedesktop.ConsoleKit.Session.xml +$(dbus_login1_user_sources):	org.freedesktop.login1.User.xml  	$(AM_V_GEN) gdbus-codegen \  	    --interface-prefix org.freedesktop \ -	    --generate-c-code dbus-consolekit-session \ +	    --generate-c-code dbus-login1-user \  	    $^  dbus_accounts_sources = \ @@ -92,17 +92,6 @@ $(dbus_user_sources): org.freedesktop.Accounts.User.xml  	    --interface-prefix org.freedesktop \  	    --generate-c-code dbus-user \  	    $^ -	 -dbus_upower_sources = \ -        dbus-upower.c \ -        dbus-upower.h - -$(dbus_upower_sources): upower.xml -	$(AM_V_GEN) gdbus-codegen \ -	    --interface-prefix org.freedesktop \ -	    --generate-c-code dbus-upower \ -	    --c-namespace DBus \ -	    $^  gen-%.xml.c: %.xml  	@echo "Building $@ from $<" @@ -120,11 +109,10 @@ gen-%.xml.h: %.xml  indicator_session_service_SOURCES = \  	$(dbus_accounts_sources) \ -	$(dbus_consolekit_manager_sources) \ -	$(dbus_consolekit_seat_sources) \ -	$(dbus_consolekit_session_sources) \ +	$(dbus_login1_manager_sources) \ +	$(dbus_login1_user_sources) \ +	$(dbus_login1_session_sources) \  	$(dbus_display_manager_sources) \ -	$(dbus_upower_sources) \  	$(dbus_user_sources) \  	session-service.c \  	session-dbus.c \ @@ -156,7 +144,7 @@ indicator_session_service_LDFLAGS = \  if BUILD_GTKLOGOUTHELPER  gtk_logout_helper_SOURCES = \ -	$(dbus_consolekit_manager_sources) \ +	$(dbus_login1_manager_sources) \  	gtk-logout-helper.c \  	dialog.c \  	dialog.h @@ -185,11 +173,10 @@ endif  BUILT_SOURCES = \  	$(dbus_accounts_sources) \ -	$(dbus_consolekit_manager_sources) \ -	$(dbus_consolekit_seat_sources) \ -	$(dbus_consolekit_session_sources) \ +	$(dbus_login1_manager_sources) \ +	$(dbus_login1_user_sources) \ +	$(dbus_login1_session_sources) \  	$(dbus_display_manager_sources) \ -	$(dbus_upower_sources) \  	$(dbus_user_sources) \  	gen-session-dbus.xml.c \  	gen-session-dbus.xml.h @@ -198,10 +185,9 @@ EXTRA_DIST += \  	display-manager.xml \  	org.freedesktop.Accounts.User.xml \  	org.freedesktop.Accounts.xml \ -	org.freedesktop.ConsoleKit.Manager.xml \ -	org.freedesktop.ConsoleKit.Seat.xml \ -	org.freedesktop.ConsoleKit.Session.xml \ -	session-dbus.xml \ -	upower.xml +	org.freedesktop.login1.Manager.xml \ +	org.freedesktop.login1.Session.xml \ +	org.freedesktop.login1.User.xml \ +	session-dbus.xml  CLEANFILES += $(BUILT_SOURCES) diff --git a/src/dialog.c b/src/dialog.c index eb91f57..f97475e 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -26,7 +26,7 @@ with this program.  If not, see <http://www.gnu.org/licenses/>.  #include <glib/gi18n.h> -#include "dbus-consolekit-manager.h" +#include "dbus-login1-manager.h"  #include "dialog.h"  /* Strings */ @@ -133,35 +133,35 @@ check_restart_required (void)  	return g_file_test("/var/run/reboot-required", G_FILE_TEST_EXISTS);  } -/* Checks with console kit to see if we can do what we want */ +/* Checks with logind to see if we can do what we want */  static gboolean -ck_check_allowed (LogoutDialogType type) +logind_check_allowed (LogoutDialogType type)  { -	gboolean allowed = TRUE; - -	ConsoleKitManager * ck_proxy = console_kit_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, -	                                                                           G_DBUS_PROXY_FLAGS_NONE, -	                                                                           "org.freedesktop.ConsoleKit", -	                                                                           "/org/freedesktop/ConsoleKit/Manager", -	                                                                           NULL, -	                                                                           NULL); -	if (ck_proxy != NULL) +	gchar * allowed = NULL; + +	Login1Manager * manager_proxy = login1_manager_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, +	                                                                       G_DBUS_PROXY_FLAGS_NONE, +	                                                                       "org.freedesktop.login1", +	                                                                       "/org/freedesktop/login1", +	                                                                       NULL, +	                                                                       NULL); +	if (manager_proxy != NULL)  	{  		switch (type) {  		case LOGOUT_DIALOG_TYPE_RESTART: -			console_kit_manager_call_can_restart_sync (ck_proxy, &allowed, NULL, NULL); +			login1_manager_call_can_reboot_sync (manager_proxy, &allowed, NULL, NULL);  			break;  		case LOGOUT_DIALOG_TYPE_SHUTDOWN: -			console_kit_manager_call_can_stop_sync (ck_proxy, &allowed, NULL, NULL); +			login1_manager_call_can_power_off_sync (manager_proxy, &allowed, NULL, NULL);  			break;  		default:  			break;  		} -		g_object_unref(ck_proxy); +		g_object_unref(manager_proxy);  	} -	return allowed; +	return g_strcmp0 (allowed, "yes") == 0;  }  LogoutDialog * @@ -188,9 +188,9 @@ logout_dialog_new (LogoutDialogType type)  	gboolean allowed = FALSE;  	if (type == LOGOUT_DIALOG_TYPE_LOG_OUT) { -		allowed = ck_check_allowed(LOGOUT_DIALOG_TYPE_RESTART); +		allowed = logind_check_allowed(LOGOUT_DIALOG_TYPE_RESTART);  	} else { -		allowed = ck_check_allowed(type); +		allowed = logind_check_allowed(type);  	}  	gboolean restart_required = FALSE; diff --git a/src/gtk-logout-helper.c b/src/gtk-logout-helper.c index 55db630..12f2198 100644 --- a/src/gtk-logout-helper.c +++ b/src/gtk-logout-helper.c @@ -31,7 +31,7 @@ with this program.  If not, see <http://www.gnu.org/licenses/>.  #include "shared-names.h"  static GVariant * -call_console_kit (const gchar *method, GVariant *parameters, GError **error) +call_logind (const gchar *method, GVariant *parameters, GError **error)  {  	GDBusConnection * bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, error);  	if (!bus) @@ -41,9 +41,9 @@ call_console_kit (const gchar *method, GVariant *parameters, GError **error)  	}  	GVariant *result = g_dbus_connection_call_sync(bus, -	                                               "org.freedesktop.ConsoleKit", -	                                               "/org/freedesktop/ConsoleKit/Manager", -	                                               "org.freedesktop.ConsoleKit.Manager", +	                                               "org.freedesktop.login1", +	                                               "/org/freedesktop/login1", +	                                               "org.freedesktop.login1.Manager",  	                                               method,  	                                               parameters,  	                                               NULL, @@ -57,24 +57,24 @@ call_console_kit (const gchar *method, GVariant *parameters, GError **error)  }  static void -consolekit_fallback (LogoutDialogType action) +logind_fallback (LogoutDialogType action)  {  	GError * error = NULL;  	GVariant *result = NULL; -	g_debug("Falling back to using ConsoleKit for action"); +	g_debug("Falling back to using logind for action");  	switch (action) {  		case LOGOUT_DIALOG_TYPE_LOG_OUT: -			g_warning("Unable to fallback to ConsoleKit for logout as it's a session issue.  We need some sort of session handler."); +			g_warning("Unable to fallback to logind for logout as it's a session issue.  We need some sort of session handler.");  			break;  		case LOGOUT_DIALOG_TYPE_SHUTDOWN: -			g_debug("Telling ConsoleKit to 'Stop'"); -			result = call_console_kit ("Stop", g_variant_new ("()"), &error); +			g_debug("Telling logind to 'PowerOff'"); +			result = call_logind ("PowerOff", g_variant_new ("(b)", FALSE), &error);  			break;  		case LOGOUT_DIALOG_TYPE_RESTART: -			g_debug("Telling ConsoleKit to 'Restart'"); -			result = call_console_kit ("Restart", g_variant_new ("()"), &error); +			g_debug("Telling logind to 'Reboot'"); +			result = call_logind ("Reboot", g_variant_new ("(b)", FALSE), &error);  			break;  		default:  			g_warning("Unknown action"); @@ -83,12 +83,10 @@ consolekit_fallback (LogoutDialogType action)  	if (!result) {  		if (error != NULL) { -			g_warning ("ConsoleKit action failed: %s", error->message); +			g_warning ("logind action failed: %s", error->message);  		} else { -			g_warning ("ConsoleKit action failed: unknown error"); +			g_warning ("logind action failed: unknown error");  		} - -		consolekit_fallback(action);  	}  	else  		g_variant_unref (result); @@ -149,7 +147,7 @@ session_action (LogoutDialogType action)  			g_warning ("SessionManager action failed: unknown error");  		} -		consolekit_fallback(action); +		logind_fallback(action);  	}  	else  		g_variant_unref (result); diff --git a/src/org.freedesktop.ConsoleKit.Manager.xml b/src/org.freedesktop.ConsoleKit.Manager.xml deleted file mode 100644 index f903b55..0000000 --- a/src/org.freedesktop.ConsoleKit.Manager.xml +++ /dev/null @@ -1,353 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<node name="/org/freedesktop/ConsoleKit/Manager" -  xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd" -> - -  <interface name="org.freedesktop.ConsoleKit.Manager"> -    <method name="Restart"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <doc:doc> -        <doc:description> -          <doc:para>This method initiates a request to restart (ie. reboot) the computer system.</doc:para> -        </doc:description> -      </doc:doc> -    </method> - -    <method name="CanRestart"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <arg name="can_restart" type="b" direction="out"/> -    </method> - -    <method name="Stop"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <doc:doc> -        <doc:description> -          <doc:para>This method initiates a request to stop (ie. shutdown) the computer system.</doc:para> -        </doc:description> -      </doc:doc> -    </method> - -    <method name="CanStop"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <arg name="can_stop" type="b" direction="out"/> -    </method> - -    <method name="OpenSession"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <arg name="cookie" direction="out" type="s"> -        <doc:doc> -          <doc:summary>The secret cookie that is used to identify the new session</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>This method requests that a new <doc:ref type="interface" to="Session">Session</doc:ref> -          be created for the calling process.  The properties of this new Session are set automatically -          from information collected about the calling process. -          </doc:para> -          <doc:para>This new session exists until the calling process disconnects from the system bus or -          calls <doc:ref type="method" to="Manager.CloseSession">CloseSession()</doc:ref>. -          </doc:para> -          <doc: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. -          </doc:para> -          <doc:para>See this simple example: -          <doc:example language="c" title="simple example"><doc:code> -	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; -        } - -          </doc:code></doc:example></doc:para> -        </doc:description> -        <doc:seealso><doc:ref type="method" to="Manager.OpenSessionWithParameters">OpenSessionWithParameters()</doc:ref></doc:seealso> -      </doc:doc> -    </method> -    <method name="OpenSessionWithParameters"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <arg name="parameters" direction="in" type="a(sv)"> -        <doc:doc> -          <doc:summary>An array of sets of property names and values</doc:summary> -        </doc:doc> -      </arg> -      <arg name="cookie" direction="out" type="s"> -        <doc:doc> -          <doc:summary>The secret cookie that is used to identify the new session</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>This method requests that a new <doc:ref type="interface" to="Session">Session</doc:ref> -          be created for the calling process.  The properties of this new Session are from the -          parameters provided. -          </doc:para> -          <doc:para>This new session exists until the calling process disconnects from the system bus or -          calls <doc:ref type="method" to="Manager.CloseSession">CloseSession()</doc:ref>. -          </doc:para> -          <doc: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. -          </doc:para> -          <doc:para>See the <doc:ref type="interface" to="Session">Session</doc:ref> properties for a list of valid parameters.</doc:para> -        </doc:description> -        <doc:seealso><doc:ref type="interface" to="Session">org.freedesktop.ConsoleKit.Session</doc:ref></doc:seealso> -        <doc:permission>This method is restricted to privileged users by D-Bus policy.</doc:permission> -      </doc:doc> -    </method> -    <method name="CloseSession"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <arg name="cookie" direction="in" type="s"> -        <doc:doc> -          <doc:summary>The secret cookie that is used to identify the session</doc:summary> -        </doc:doc> -      </arg> -      <arg name="result" direction="out" type="b"> -        <doc:doc> -          <doc:summary>Whether the session was successfully closed</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>This method is used to close the session identified by the supplied cookie. -          </doc:para> -          <doc:para>The session can only be closed by the same process that opened the session. -          </doc:para> -        </doc:description> -      </doc:doc> -    </method> - -    <method name="GetSeats"> -      <arg name="seats" direction="out" type="ao"> -        <doc:doc> -          <doc:summary>an array of Seat IDs</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>This gets a list of all the <doc:ref type="interface" to="Seat">Seats</doc:ref> -          that are currently present on the system.</doc:para> -          <doc:para>Each Seat ID is an D-Bus object path for the object that implements the -          <doc:ref type="interface" to="Seat">Seat</doc:ref> interface.</doc:para> -        </doc:description> -        <doc:seealso><doc:ref type="interface" to="Seat">org.freedesktop.ConsoleKit.Seat</doc:ref></doc:seealso> -      </doc:doc> -    </method> - -    <method name="GetSessions"> -      <arg name="sessions" direction="out" type="ao"> -        <doc:doc> -          <doc:summary>an array of Session IDs</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>This gets a list of all the <doc:ref type="interface" to="Session">Sessions</doc:ref> -          that are currently present on the system.</doc:para> -          <doc:para>Each Session ID is an D-Bus object path for the object that implements the -          <doc:ref type="interface" to="Session">Session</doc:ref> interface.</doc:para> -        </doc:description> -        <doc:seealso><doc:ref type="interface" to="Session">org.freedesktop.ConsoleKit.Session</doc:ref></doc:seealso> -      </doc:doc> -    </method> - -    <method name="GetSessionForCookie"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <arg name="cookie" direction="in" type="s"> -        <doc:doc> -          <doc:summary>The secret cookie that is used to identify the session</doc:summary> -        </doc:doc> -      </arg> -      <arg name="ssid" direction="out" type="o"> -        <doc:doc> -          <doc:summary>The object identifier for the current session</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Returns the session ID that is associated with the specified cookie. -          </doc:para> -        </doc:description> -      </doc:doc> -    </method> -    <method name="GetSessionForUnixProcess"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <arg name="pid" direction="in" type="u"> -        <doc:doc> -          <doc:summary>The POSIX process ID</doc:summary> -        </doc:doc> -      </arg> -      <arg name="ssid" direction="out" type="o"> -        <doc:doc> -          <doc:summary>The object identifier for the current session</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Attempts to determine the session ID for the specified -          POSIX process ID (pid). -          </doc:para> -        </doc:description> -      </doc:doc> -    </method> -    <method name="GetCurrentSession"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <arg name="ssid" direction="out" type="o"> -        <doc:doc> -          <doc:summary>The object identifier for the current session</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Attempts to determine the session ID that the caller belongs to. -          </doc:para> -          <doc:para>See this example of using dbus-send: -          <doc:example language="shell" title="shell example"><doc:code> -  dbus-send --system --dest=org.freedesktop.ConsoleKit \ -  --type=method_call --print-reply --reply-timeout=2000 \ -  /org/freedesktop/ConsoleKit/Manager \ -  org.freedesktop.ConsoleKit.Manager.GetCurrentSession -          </doc:code></doc:example></doc:para> -        </doc:description> -      </doc:doc> -    </method> -    <method name="GetSessionsForUnixUser"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <arg name="uid" direction="in" type="u"> -         <doc:doc> -          <doc:summary>POSIX User identification</doc:summary> -        </doc:doc> -     </arg> -      <arg name="sessions" direction="out" type="ao"> -        <doc:doc> -          <doc:summary>an array of Session IDs</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>This gets a list of all the <doc:ref type="interface" to="Session">Sessions</doc:ref> -          that are currently open for the specified user.</doc:para> -          <doc:para>Each Session ID is an D-Bus object path for the object that implements the -          <doc:ref type="interface" to="Session">Session</doc:ref> interface.</doc:para> -        </doc:description> -      </doc:doc> -    </method> -    <method name="GetSessionsForUser"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <arg name="uid" direction="in" type="u"> -         <doc:doc> -          <doc:summary>User identification</doc:summary> -        </doc:doc> -     </arg> -      <arg name="sessions" direction="out" type="ao"> -        <doc:doc> -          <doc:summary>an array of Session IDs</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>This gets a list of all the <doc:ref type="interface" to="Session">Sessions</doc:ref> -          that are currently open for the specified user.</doc:para> -          <doc:para>Each Session ID is an D-Bus object path for the object that implements the -          <doc:ref type="interface" to="Session">Session</doc:ref> interface.</doc:para> -        </doc:description> -        <doc:deprecated version="0.1.3" instead="GetSessionsForUnixUser"/> -      </doc:doc> -    </method> - -    <method name="GetSystemIdleHint"> -      <arg name="idle_hint" type="b" direction="out"> -        <doc:doc> -          <doc:summary>The value of the system-idle-hint</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Returns TRUE if the <doc:ref type="property" to="Session:idle-hint">idle-hint</doc:ref> -          property of every open session is TRUE or if there are no open sessions. -          </doc:para> -        </doc:description> -      </doc:doc> -    </method> -    <method name="GetSystemIdleSinceHint"> -      <arg name="iso8601_datetime" type="s" direction="out"> -        <doc:doc> -          <doc:summary>An ISO 8601 format date-type string</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Returns an ISO 8601 date-time string that corresponds to -          the time of the last change of the system-idle-hint. -          </doc:para> -        </doc:description> -      </doc:doc> -    </method> - -    <signal name="SeatAdded"> -      <arg name="sid" type="o"> -        <doc:doc> -          <doc:summary>The Seat ID for the added seat</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Emitted when a Seat has been added to the system. -          </doc:para> -        </doc:description> -      </doc:doc> -    </signal> -    <signal name="SeatRemoved"> -      <arg name="sid" type="o"> -        <doc:doc> -          <doc:summary>The Seat ID for the removed seat</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Emitted when a Seat has been removed from the system. -          </doc:para> -        </doc:description> -      </doc:doc> -    </signal> -    <signal name="SystemIdleHintChanged"> -      <arg name="hint" type="b"> -        <doc:doc> -          <doc:summary>The value of the system-idle-hint</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Emitted when the value of the system-idle-hint has changed. -          </doc:para> -        </doc:description> -      </doc:doc> -    </signal> -  </interface> -</node> diff --git a/src/org.freedesktop.ConsoleKit.Seat.xml b/src/org.freedesktop.ConsoleKit.Seat.xml deleted file mode 100644 index 58c2ce7..0000000 --- a/src/org.freedesktop.ConsoleKit.Seat.xml +++ /dev/null @@ -1,164 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<node xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd"> - -  <interface name="org.freedesktop.ConsoleKit.Seat"> -    <doc:doc> -      <doc:description> -        <doc:para>A seat is a collection of sessions and a set of hardware (usually at -least a keyboard and mouse).  Only one session may be active on a -seat at a time.</doc:para> -      </doc:description> -    </doc:doc> - -    <method name="GetId"> -      <arg name="sid" direction="out" type="o"> -        <doc:doc> -          <doc:summary>Seat ID</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Returns the ID for Seat.</doc:para> -        </doc:description> -      </doc:doc> -    </method> - -    <method name="GetSessions"> -      <arg name="sessions" direction="out" type="ao"> -        <doc:doc> -          <doc:summary>an array of Session IDs</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>This gets a list of all the <doc:ref type="interface" to="Session">Sessions</doc:ref> -          that are currently attached to this seat.</doc:para> -          <doc:para>Each Session ID is an D-Bus object path for the object that implements the -          <doc:ref type="interface" to="Session">Session</doc:ref> interface.</doc:para> -        </doc:description> -      </doc:doc> -    </method> - -    <method name="GetDevices"> -      <arg name="devices" direction="out" type="a(ss)"> -        <doc:doc> -          <doc:summary>an array of devices</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>This gets a list of all the devices -          that are currently associated with this seat.</doc:para> -          <doc:para>Each device is an D-Bus structure that represents -          the device type and the device id. -          </doc:para> -        </doc:description> -      </doc:doc> -    </method> - -    <method name="GetActiveSession"> -      <arg name="ssid" direction="out" type="o"> -        <doc:doc> -          <doc:summary>Session ID</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Gets the Session ID that is currently active on this Seat.</doc:para> -          <doc:para>Returns NULL if there is no active session.</doc:para> -        </doc:description> -      </doc:doc> -    </method> - -    <method name="CanActivateSessions"> -      <arg name="can_activate" direction="out" type="b"> -        <doc:doc> -          <doc:summary>TRUE if seat supports session activation</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description><doc:para>Used to determine whether the seat supports session activation.</doc:para> -        </doc:description> -      </doc:doc> -    </method> - -    <method name="ActivateSession"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <arg name="ssid" direction="in" type="o"> -        <doc:doc> -          <doc:summary>Session ID</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Attempt to activate the specified session.  In most -          cases, if successful, this will cause the session to -          become visible and take control of the hardware that is -          associated with this seat.</doc:para> -        </doc:description> -        <doc:seealso><doc:ref type="method" to="Session.Activate">Activate()</doc:ref></doc:seealso> -      </doc:doc> -    </method> - -    <signal name="ActiveSessionChanged"> -      <arg name="ssid" type="s"> -        <doc:doc> -          <doc:summary>Session ID</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Emitted when the active session has changed.</doc:para> -        </doc:description> -      </doc:doc> -    </signal> -    <signal name="SessionAdded"> -      <arg name="ssid" type="o"> -        <doc:doc> -          <doc:summary>Session ID</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Emitted when a session has been added to the seat.</doc:para> -        </doc:description> -      </doc:doc> -    </signal> -    <signal name="SessionRemoved"> -      <arg name="ssid" type="o"> -        <doc:doc> -          <doc:summary>Session ID</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Emitted when a session has been removed from the seat.</doc:para> -        </doc:description> -      </doc:doc> -    </signal> -    <signal name="DeviceAdded"> -      <arg name="device" type="(ss)"> -        <doc:doc> -          <doc:summary>Device structure</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Emitted when a device has been associated with the seat.</doc:para> -        </doc:description> -      </doc:doc> -    </signal> -    <signal name="DeviceRemoved"> -      <arg name="device" type="(ss)"> -        <doc:doc> -          <doc:summary>Device structure</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Emitted when a device has been dissociated from the seat.</doc:para> -        </doc:description> -      </doc:doc> -    </signal> -  </interface> -</node> diff --git a/src/org.freedesktop.ConsoleKit.Session.xml b/src/org.freedesktop.ConsoleKit.Session.xml deleted file mode 100644 index b6e1cdb..0000000 --- a/src/org.freedesktop.ConsoleKit.Session.xml +++ /dev/null @@ -1,435 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<node xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd"> - -  <interface name="org.freedesktop.ConsoleKit.Session"> -    <doc:doc> -      <doc:description> -        <doc:para>Session objects represent and store information -        related to a user session. -        </doc:para> -        <doc:para>The properties associated with the Session -        specifically refer to the properties of the "session leader". -        </doc:para> -      </doc:description> -    </doc:doc> -    <method name="GetId"> -      <arg name="ssid" direction="out" type="o"> -        <doc:doc> -          <doc:summary>Session ID</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description><doc:para>Returns the ID for Session.</doc:para> -        </doc:description> -      </doc:doc> -    </method> -    <method name="GetSeatId"> -      <arg name="sid" direction="out" type="o"> -        <doc:doc> -          <doc:summary>Seat ID</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description><doc:para>Returns the ID for the Seat the Session is -        attached to.</doc:para> -        </doc:description> -        <doc:seealso><doc:ref type="interface" to="Seat">org.freedesktop.ConsoleKit.Seat</doc:ref></doc:seealso> -      </doc:doc> -    </method> -    <method name="GetSessionType"> -      <arg name="type" direction="out" type="s"> -        <doc:doc> -          <doc:summary>Session type</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Returns the type of the session.</doc:para> -          <doc:para>Warning: we haven't yet defined the allowed values for this property. -          It is probably best to avoid this until we do. -          </doc:para> -        </doc:description> -        <doc:seealso><doc:ref type="property" to="Session:session-type">session-type</doc:ref></doc:seealso> -      </doc:doc> -    </method> -    <method name="GetUser"> -      <arg name="uid" direction="out" type="u"> -        <doc:doc> -          <doc:summary>User ID</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description><doc:para>Returns the user that the session belongs to.</doc:para> -        </doc:description> -        <doc:deprecated version="0.1.3" instead="GetUnixUser"/> -        <doc:seealso><doc:ref type="property" to="Session:user">user</doc:ref></doc:seealso> -      </doc:doc> -    </method> -    <method name="GetUnixUser"> -      <arg name="uid" direction="out" type="u"> -        <doc:doc> -          <doc:summary>POSIX User ID</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description><doc:para>Returns the POSIX user ID that the session belongs to.</doc:para> -        </doc:description> -        <doc:seealso><doc:ref type="property" to="Session:unix-user">unix-user</doc:ref></doc:seealso> -      </doc:doc> -    </method> -    <method name="GetX11Display"> -      <arg name="display" direction="out" type="s"> -        <doc:doc> -          <doc:summary>The value of the X11 display</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description><doc:para>Returns the value of the X11 DISPLAY for this session -        if one is present.</doc:para> -        </doc:description> -        <doc:seealso><doc:ref type="property" to="Session:x11-display">x11-display</doc:ref></doc:seealso> -      </doc:doc> -    </method> -    <method name="GetX11DisplayDevice"> -       <arg name="x11_display_device" direction="out" type="s"> -        <doc:doc> -          <doc:summary>The value of the X11 display device</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description><doc:para>Returns the value of the display device (aka TTY) that the -        X11 display for the session is connected to.  If there is no x11-display set then this value -        is undefined.</doc:para> -        </doc:description> -        <doc:seealso><doc:ref type="property" to="Session:x11-display-device">x11-display-device</doc:ref></doc:seealso> -      </doc:doc> -    </method> -    <method name="GetDisplayDevice"> -      <arg name="display_device" direction="out" type="s"> -        <doc:doc> -          <doc:summary>The value of the display device</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description><doc:para>Returns the value of the display device (aka TTY) that the -        session is connected to.</doc:para> -        </doc:description> -        <doc:seealso><doc:ref type="property" to="Session:display-device">display-device</doc:ref></doc:seealso> -      </doc:doc> -    </method> -    <method name="GetRemoteHostName"> -      <arg name="remote_host_name" direction="out" type="s"> -        <doc:doc> -          <doc:summary>The remote host name</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description><doc:para>Returns the value of the remote host name for the session. -        </doc:para> -        </doc:description> -        <doc:seealso><doc:ref type="property" to="Session:remote-host-name">remote-host-name</doc:ref></doc:seealso> -      </doc:doc> -    </method> -    <method name="GetLoginSessionId"> -       <arg name="login_session_id" direction="out" type="s"> -        <doc:doc> -          <doc:summary>The value of the native system login session ID</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description><doc:para>Returns the value of the login session ID that the -        underlying system uses to enforce session boundaries.  If there is no login session ID -        set then this value is an empty string.</doc:para> -        </doc:description> -      </doc:doc> -    </method> -    <method name="IsActive"> -      <arg name="active" direction="out" type="b"> -        <doc:doc> -          <doc:summary>TRUE if the session is active, otherwise FALSE</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description><doc:para>Returns whether the session is active on the Seat that -        it is attached to.</doc:para> -        <doc:para>If the session is not attached to a seat this value is undefined. -        </doc:para> -        </doc:description> -        <doc:seealso><doc:ref type="property" to="Session:active">active</doc:ref></doc:seealso> -      </doc:doc> -    </method> -    <method name="IsLocal"> -      <arg name="local" direction="out" type="b"> -        <doc:doc> -          <doc:summary>TRUE if the session is local, otherwise FALSE</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description><doc:para>Returns whether the session is local</doc:para> -        <doc:para>FIXME: we need to come up with a concrete definition for this value. -        It was originally used as a way to identify XDMCP sessions that originate -        from a remote system. -        </doc:para> -        </doc:description> -        <doc:seealso><doc:ref type="property" to="Session:is-local">is-local</doc:ref></doc:seealso> -      </doc:doc> -    </method> -    <method name="GetCreationTime"> -      <arg name="iso8601_datetime" type="s" direction="out"> -        <doc:doc> -          <doc:summary>An ISO 8601 format date-type string</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Returns an ISO 8601 date-time string that corresponds to -          the time that the session was opened. -          </doc:para> -        </doc:description> -      </doc:doc> -    </method> - -    <method name="Activate"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <doc:doc> -        <doc:description> -          <doc:para>Attempt to activate the this session.  In most -          cases, if successful, this will cause the session to -          become visible and become active on the seat that it -          is attached to.</doc:para> -        </doc:description> -        <doc:seealso><doc:ref type="method" to="Seat.ActivateSession">Seat.ActivateSession()</doc:ref></doc:seealso> -      </doc:doc> -    </method> -    <method name="Lock"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <doc:doc> -        <doc:description> -          <doc:para>This will cause a <doc:ref type="signal" to="Session::Lock">Lock</doc:ref> -          signal to be emitted for this session. -          </doc:para> -        </doc:description> -        <doc:permission>This method is restricted to privileged users by D-Bus policy.</doc:permission> -        <doc:seealso><doc:ref type="signal" to="Session::Lock">Lock signal</doc:ref></doc:seealso> -      </doc:doc> -    </method> -    <method name="Unlock"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <doc:doc> -        <doc:description> -          <doc:para>This will cause an <doc:ref type="signal" to="Session::Unlock">Unlock</doc:ref> -          signal to be emitted for this session. -          </doc:para> -          <doc:para>This can be used by login managers to unlock a session before it is -          re-activated during fast-user-switching. -          </doc:para> -        </doc:description> -        <doc:permission>This method is restricted to privileged users by D-Bus policy.</doc:permission> -        <doc:seealso><doc:ref type="signal" to="Session::Unlock">Unlock signal</doc:ref></doc:seealso> -      </doc:doc> -    </method> - -    <method name="GetIdleHint"> -      <arg name="idle_hint" type="b" direction="out"> -        <doc:doc> -          <doc:summary>The value of the idle-hint</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Gets the value of the <doc:ref type="property" to="Session:idle-hint">idle-hint</doc:ref> -          property. -          </doc:para> -        </doc:description> -        <doc:seealso><doc:ref type="property" to="Session:idle-hint">idle-hint</doc:ref></doc:seealso> -      </doc:doc> -    </method> -    <method name="GetIdleSinceHint"> -      <arg name="iso8601_datetime" type="s" direction="out"> -        <doc:doc> -          <doc:summary>An ISO 8601 format date-type string</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Returns an ISO 8601 date-time string that corresponds to -          the time of the last change of the idle-hint. -          </doc:para> -        </doc:description> -      </doc:doc> -    </method> -    <method name="SetIdleHint"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <arg name="idle_hint" type="b" direction="in"> -        <doc:doc> -          <doc:summary>boolean value to set the idle-hint to</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>This may be used by the session to indicate that -          it is idle. -          </doc:para> -          <doc:para>Use of this method is restricted to the user -          that owns the session.</doc:para> -        </doc:description> -      </doc:doc> -    </method> - -    <signal name="ActiveChanged"> -      <arg name="is_active" type="b"> -        <doc:doc> -          <doc:summary>TRUE if the session is active, otherwise FALSE</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Emitted when the active property has changed.</doc:para> -        </doc:description> -      </doc:doc> -    </signal> -    <signal name="IdleHintChanged"> -      <arg name="hint" type="b"> -        <doc:doc> -          <doc:summary>the new value of idle-hint</doc:summary> -        </doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para>Emitted when the idle-hint property has changed.</doc:para> -        </doc:description> -      </doc:doc> -    </signal> -    <signal name="Lock"> -      <doc:doc> -        <doc:description> -          <doc:para>Emitted in response to a call to the <doc:ref type="method" to="Session.Lock">Lock()</doc:ref> method.</doc:para> -          <doc:para>It is intended that the screensaver for the session should lock the screen in response to this signal.</doc:para> -        </doc:description> -      </doc:doc> -    </signal> -    <signal name="Unlock"> -      <doc:doc> -        <doc:description> -          <doc:para>Emitted in response to a call to the <doc:ref type="method" to="Session.Unlock">Unlock()</doc:ref> method.</doc:para> -          <doc:para>It is intended that the screensaver for the session should unlock the screen in response to this signal.</doc:para> -        </doc:description> -      </doc:doc> -    </signal> - -    <property name="unix-user" type="u" access="readwrite"> -      <doc:doc> -        <doc:description> -          <doc:para>The user assigned to the session.</doc:para> -        </doc:description> -      </doc:doc> -    </property> -    <property name="user" type="u" access="readwrite"> -      <doc:doc> -        <doc:description> -          <doc:para>The user assigned to the session.</doc:para> -        </doc:description> -        <doc:deprecated version="0.1.3" instead="unix-user"/> -      </doc:doc> -    </property> -    <property name="session-type" type="s" access="readwrite"> -      <doc:doc> -        <doc:description> -          <doc:para>The type of the session.</doc:para> -          <doc:para>Warning: we haven't yet defined the allowed values for this property. -          It is probably best to avoid this until we do. -          </doc:para> -        </doc:description> -      </doc:doc> -    </property> -    <property name="remote-host-name" type="s" access="readwrite"> -      <doc:doc> -        <doc:description> -          <doc:para>The remote host name for the session. -          </doc:para> -          <doc:para>This will be set in situations where the session is -          opened and controlled from a remote system. -          </doc:para> -          <doc:para>For example, this value will be set when the -          session is created from an SSH or XDMCP connection. -          </doc:para> -        </doc:description> -      </doc:doc> -    </property> -    <property name="display-device" type="s" access="readwrite"> -      <doc:doc> -        <doc:description> -          <doc:para>The display device (aka TTY) that the -          session is connected to. -          </doc:para> -        </doc:description> -      </doc:doc> -    </property> -    <property name="x11-display" type="s" access="readwrite"> -      <doc:doc> -        <doc:description> -          <doc:para>Value of the X11 DISPLAY for this session -          if one is present. -          </doc:para> -        </doc:description> -      </doc:doc> -    </property> -    <property name="x11-display-device" type="s" access="readwrite"> -      <doc:doc> -        <doc:description> -          <doc:para> -          The display device (aka TTY) that the X11 display for the -          session is connected to.  If there is no x11-display set then -          this value is undefined. -          </doc:para> -        </doc:description> -      </doc:doc> -    </property> -    <property name="active" type="b" access="readwrite"> -      <doc:doc> -        <doc:description> -          <doc:para> -          Whether the session is active on the Seat that -          it is attached to.</doc:para> -          <doc:para>If the session is not attached to a seat this value is undefined. -          </doc:para> -        </doc:description> -      </doc:doc> -    </property> -    <property name="is-local" type="b" access="readwrite"> -      <doc:doc> -        <doc:description> -          <doc:para> -          Whether the session is local</doc:para> -          <doc:para>FIXME: we need to come up with a concrete definition for this value. -          It was originally used as a way to identify XDMCP sessions that originate -          from a remote system. -          </doc:para> -        </doc:description> -      </doc:doc> -    </property> -    <property name="idle-hint" type="b" access="readwrite"> -      <doc:doc> -        <doc:description> -          <doc:para> -          This is a hint used to indicate that the session may be idle. -          </doc:para> -          <doc:para> -          For sessions with a <doc:ref type="property" to="Session:x11-display">x11-display</doc:ref> set (ie. graphical -          sessions), it is up to each session to delegate the -          responsibility for updating this value.  Typically, the -          screensaver will set this. -          </doc:para> -          <doc:para>However, for non-graphical sessions with a <doc:ref type="property" to="Session:display-device">display-device</doc:ref> set -          the Session object itself will periodically update this value based -          on the activity detected on the display-device itself. -          </doc:para> -          <doc:para> -          This should not be considered authoritative. -          </doc:para> -        </doc:description> -      </doc:doc> -    </property> - -  </interface> -</node> diff --git a/src/org.freedesktop.login1.Manager.xml b/src/org.freedesktop.login1.Manager.xml new file mode 100644 index 0000000..91da5f2 --- /dev/null +++ b/src/org.freedesktop.login1.Manager.xml @@ -0,0 +1,199 @@ +<?xml version="1.0"?> +<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> +<node> +  <interface name="org.freedesktop.login1.Manager"> +    <method name="GetSession"> +      <arg name="id" type="s" direction="in"/> +      <arg name="session" type="o" direction="out"/> +    </method> +    <method name="GetSessionByPID"> +      <arg name="pid" type="u" direction="in"/> +      <arg name="session" type="o" direction="out"/> +    </method> +    <method name="GetUser"> +      <arg name="uid" type="u" direction="in"/> +      <arg name="user" type="o" direction="out"/> +    </method> +    <method name="GetSeat"> +      <arg name="id" type="s" direction="in"/> +      <arg name="seat" type="o" direction="out"/> +    </method> +    <method name="ListSessions"> +      <arg name="sessions" type="a(susso)" direction="out"/> +      <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="SessionObjectList"/> +    </method> +    <method name="ListUsers"> +      <arg name="users" type="a(uso)" direction="out"/> +      <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="UintStringPathList"/> +    </method> +    <method name="ListSeats"> +      <arg name="seats" type="a(so)" direction="out"/> +      <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="StringPathList"/> +    </method> +    <method name="CreateSession"> +      <arg name="uid" type="u" direction="in"/> +      <arg name="leader" type="u" direction="in"/> +      <arg name="sevice" type="s" direction="in"/> +      <arg name="type" type="s" direction="in"/> +      <arg name="klass" type="s" direction="in"/> +      <arg name="seat" type="s" direction="in"/> +      <arg name="vtnr" type="u" direction="in"/> +      <arg name="tty" type="s" direction="in"/> +      <arg name="display" type="s" direction="in"/> +      <arg name="remote" type="b" direction="in"/> +      <arg name="remote_user" type="s" direction="in"/> +      <arg name="remote_host" type="s" direction="in"/> +      <arg name="controllers" type="as" direction="in"/> +      <arg name="reset_controllers" type="as" direction="in"/> +      <arg name="kill_processes" type="b" direction="in"/> +      <arg name="id" type="s" direction="out"/> +      <arg name="path" type="o" direction="out"/> +      <arg name="runtime_path" type="o" direction="out"/> +      <arg name="fd" type="h" direction="out"/> +      <arg name="seat" type="s" direction="out"/> +      <arg name="vtnr" type="u" direction="out"/> +      <arg name="existing" type="b" direction="out"/> +    </method> +    <method name="ReleaseSession"> +      <arg name="id" type="s" direction="in"/> +    </method> +    <method name="ActivateSession"> +      <arg name="id" type="s" direction="in"/> +    </method> +    <method name="ActivateSessionOnSeat"> +      <arg name="id" type="s" direction="in"/> +      <arg name="seat" type="s" direction="in"/> +    </method> +    <method name="LockSession"> +      <arg name="id" type="s" direction="in"/> +    </method> +    <method name="UnlockSession"> +      <arg name="id" type="s" direction="in"/> +    </method> +    <method name="LockSessions"/> +    <method name="KillSession"> +      <arg name="id" type="s" direction="in"/> +      <arg name="who" type="s" direction="in"/> +      <arg name="signal" type="s" direction="in"/> +    </method> +    <method name="KillUser"> +      <arg name="uid" type="u" direction="in"/> +      <arg name="signal" type="s" direction="in"/> +    </method> +    <method name="TerminateSession"> +      <arg name="id" type="s" direction="in"/> +    </method> +    <method name="TerminateUser"> +      <arg name="uid" type="u" direction="in"/> +    </method> +    <method name="TerminateSeat"> +      <arg name="id" type="s" direction="in"/> +    </method> +    <method name="SetUserLinger"> +      <arg name="uid" type="u" direction="in"/> +      <arg name="b" type="b" direction="in"/> +      <arg name="interactive" type="b" direction="in"/> +    </method> +    <method name="AttachDevice"> +      <arg name="seat" type="s" direction="in"/> +      <arg name="sysfs" type="s" direction="in"/> +      <arg name="interactive" type="b" direction="in"/> +    </method> +    <method name="FlushDevices"> +      <arg name="interactive" type="b" direction="in"/> +    </method> +    <method name="PowerOff"> +      <arg name="interactive" type="b" direction="in"/> +    </method> +    <method name="Reboot"> +      <arg name="interactive" type="b" direction="in"/> +    </method> +    <method name="Suspend"> +      <arg name="interactive" type="b" direction="in"/> +    </method> +    <method name="Hibernate"> +      <arg name="interactive" type="b" direction="in"/> +    </method> +    <method name="HybridSleep"> +      <arg name="interactive" type="b" direction="in"/> +    </method> +    <method name="CanPowerOff"> +      <arg name="result" type="s" direction="out"/> +    </method> +    <method name="CanReboot"> +      <arg name="result" type="s" direction="out"/> +    </method> +    <method name="CanSuspend"> +      <arg name="result" type="s" direction="out"/> +    </method> +    <method name="CanHibernate"> +      <arg name="result" type="s" direction="out"/> +    </method> +    <method name="CanHybridSleep"> +      <arg name="result" type="s" direction="out"/> +    </method> +    <method name="Inhibit"> +      <arg name="what" type="s" direction="in"/> +      <arg name="who" type="s" direction="in"/> +      <arg name="why" type="s" direction="in"/> +      <arg name="mode" type="s" direction="in"/> +      <arg name="fd" type="h" direction="out"/> +    </method> +    <method name="ListInhibitors"> +      <arg name="inhibitors" type="a(ssssuu)" direction="out"/> +      <!-- TODO: Create an appropriate type --> +      <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantList"/> +    </method> +    <signal name="SessionNew"> +      <arg name="id" type="s"/> +      <arg name="path" type="o"/> +    </signal> +    <signal name="SessionRemoved"> +      <arg name="id" type="s"/> +      <arg name="path" type="o"/> +    </signal> +    <signal name="UserNew"> +      <arg name="uid" type="u"/> +      <arg name="path" type="o"/> +    </signal> +    <signal name="UserRemoved"> +      <arg name="uid" type="u"/> +      <arg name="path" type="o"/> +    </signal> +    <signal name="SeatNew"> +      <arg name="id" type="s"/> +      <arg name="path" type="o"/> +    </signal> +    <signal name="SeatRemoved"> +      <arg name="id" type="s"/> +      <arg name="path" type="o"/> +    </signal> +    <signal name="PrepareForShutdown"> +      <arg name="active" type="b"/> +    </signal> +    <signal name="PrepareForSleep"> +      <arg name="active" type="b"/> +    </signal> +    <property name="ControlGroupHierarchy" type="s" access="read"/> +    <property name="Controllers" type="as" access="read"/> +    <property name="ResetControllers" type="as" access="read"/> +    <property name="NAutoVTs" type="u" access="read"/> +    <property name="KillOnlyUsers" type="as" access="read"/> +    <property name="KillExcludeUsers" type="as" access="read"/> +    <property name="KillUserProcesses" type="b" access="read"/> +    <property name="IdleHint" type="b" access="read"/> +    <property name="IdleSinceHint" type="t" access="read"/> +    <property name="IdleSinceHintMonotonic" type="t" access="read"/> +    <property name="BlockInhibited" type="s" access="read"/> +    <property name="DelayInhibited" type="s" access="read"/> +    <property name="InhibitDelayMaxUSec" type="t" access="read"/> +    <property name="HandlePowerKey" type="s" access="read"/> +    <property name="HandleSuspendKey" type="s" access="read"/> +    <property name="HandleHibernateKey" type="s" access="read"/> +    <property name="HandleLidSwitch" type="s" access="read"/> +    <property name="IdleAction" type="s" access="read"/> +    <property name="IdleActionUSec" type="t" access="read"/> +    <property name="PreparingForShutdown" type="b" access="read"/> +    <property name="PreparingForSleep" type="b" access="read"/> +  </interface> +</node> diff --git a/src/org.freedesktop.login1.Seat.xml b/src/org.freedesktop.login1.Seat.xml new file mode 100644 index 0000000..92b62dd --- /dev/null +++ b/src/org.freedesktop.login1.Seat.xml @@ -0,0 +1,21 @@ +<?xml version="1.0"?> +<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> +<node> +  <interface name="org.freedesktop.login1.Seat"> +    <method name="Terminate"/> +    <method name="ActivateSession"> +      <arg name="id" type="s"/> +    </method> +    <property name="Id" type="s" access="read"/> +    <property name="ActiveSession" type="so" access="read"/> +    <property name="CanMultiSession" type="b" access="read"/> +    <property name="CanTTY" type="b" access="read"/> +    <property name="CanGraphical" type="b" access="read"/> +    <property name="Sessions" type="a(so)" access="read"> +      <annotation name="org.qtproject.QtDBus.QtTypeName" value="StringPathList"/> +    </property> +    <property name="IdleHint" type="b" access="read"/> +    <property name="IdleSinceHint" type="t" access="read"/> +    <property name="IdleSinceHintMonotonic" type="t" access="read"/> +  </interface> +</node> diff --git a/src/org.freedesktop.login1.Session.xml b/src/org.freedesktop.login1.Session.xml new file mode 100644 index 0000000..24a6fac --- /dev/null +++ b/src/org.freedesktop.login1.Session.xml @@ -0,0 +1,49 @@ +<?xml version="1.0"?> +<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> +<node> +  <interface name="org.freedesktop.login1.Session"> +    <method name="Terminate"/> +    <method name="Activate"/> +    <method name="Lock"/> +    <method name="Unlock"/> +    <method name="SetIdleHint"> +      <arg name="b" direction="in" type="b"/> +    </method> +    <method name="Kill"> +      <arg name="who" direction="in" type="s"/> +      <arg name="signal" direction="in" type="s"/> +    </method> +    <signal name="Lock"/> +    <signal name="Unlock"/> +    <property name="Id" type="s" access="read"/> +    <property name="User" type="(uo)" access="read"> +      <annotation name="org.qtproject.QtDBus.QtTypeName" value="UintPath"/> +    </property> +    <property name="Name" type="s" access="read"/> +    <property name="Timestamp" type="t" access="read"/> +    <property name="TimestampMonotonic" type="t" access="read"/> +    <property name="DefaultControlGroup" type="s" access="read"/> +    <property name="VTNr" type="u" access="read"/> +    <property name="Seat" type="(so)" access="read"> +      <annotation name="org.qtproject.QtDBus.QtTypeName" value="StringPath"/> +    </property> +    <property name="TTY" type="s" access="read"/> +    <property name="Display" type="s" access="read"/> +    <property name="Remote" type="b" access="read"/> +    <property name="RemoteHost" type="s" access="read"/> +    <property name="RemoteUser" type="s" access="read"/> +    <property name="Service" type="s" access="read"/> +    <property name="Leader" type="u" access="read"/> +    <property name="Audit" type="u" access="read"/> +    <property name="Type" type="s" access="read"/> +    <property name="Class" type="s" access="read"/> +    <property name="Active" type="b" access="read"/> +    <property name="State" type="s" access="read"/> +    <property name="Controllers" type="as" access="read"/> +    <property name="ResetControllers" type="as" access="read"/> +    <property name="KillProcesses" type="b" access="read"/> +    <property name="IdleHint" type="b" access="read"/> +    <property name="IdleSinceHint" type="t" access="read"/> +    <property name="IdleSinceHintMonotonic" type="t" access="read"/> +  </interface> +</node> diff --git a/src/org.freedesktop.login1.User.xml b/src/org.freedesktop.login1.User.xml new file mode 100644 index 0000000..8253706 --- /dev/null +++ b/src/org.freedesktop.login1.User.xml @@ -0,0 +1,56 @@ +<?xml version="1.0"?> +<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> +<node> + <interface name="org.freedesktop.login1.User"> +  <method name="Terminate"/> +  <method name="Kill"> +   <arg name="signal" direction="in" type="s"/> +  </method> +  <property name="UID" type="u" access="read"/> +  <property name="GID" type="u" access="read"/> +  <property name="Name" type="s" access="read"/> +  <property name="Timestamp" type="t" access="read"/> +  <property name="TimestampMonotonic" type="t" access="read"/> +  <property name="RuntimePath" type="s" access="read"/> +  <property name="DefaultControlGroup" type="s" access="read"/> +  <property name="Service" type="s" access="read"/> +  <property name="Display" type="(so)" access="read"/> +  <property name="State" type="s" access="read"/> +  <property name="Sessions" type="a(so)" access="read"/> +  <property name="IdleHint" type="b" access="read"/> +  <property name="IdleSinceHint" type="t" access="read"/> +  <property name="IdleSinceHintMonotonic" type="t" access="read"/> + </interface> + <interface name="org.freedesktop.DBus.Properties"> +  <method name="Get"> +   <arg name="interface" direction="in" type="s"/> +   <arg name="property" direction="in" type="s"/> +   <arg name="value" direction="out" type="v"/> +  </method> +  <method name="GetAll"> +   <arg name="interface" direction="in" type="s"/> +   <arg name="properties" direction="out" type="a{sv}"/> +  </method> +  <method name="Set"> +   <arg name="interface" direction="in" type="s"/> +   <arg name="property" direction="in" type="s"/> +   <arg name="value" direction="in" type="v"/> +  </method> +  <signal name="PropertiesChanged"> +   <arg type="s" name="interface"/> +   <arg type="a{sv}" name="changed_properties"/> +   <arg type="as" name="invalidated_properties"/> +  </signal> + </interface> +<interface name="org.freedesktop.DBus.Peer"> + <method name="Ping"/> + <method name="GetMachineId"> +  <arg type="s" name="machine_uuid" direction="out"/> + </method> +</interface> + <interface name="org.freedesktop.DBus.Introspectable"> +  <method name="Introspect"> +   <arg name="data" type="s" direction="out"/> +  </method> + </interface> +</node> diff --git a/src/session-menu-mgr.c b/src/session-menu-mgr.c index c7556bc..22f70e5 100644 --- a/src/session-menu-mgr.c +++ b/src/session-menu-mgr.c @@ -29,7 +29,7 @@ with this program.  If not, see <http://www.gnu.org/licenses/>.  #include <libdbusmenu-glib/client.h>  #include <libdbusmenu-gtk/menuitem.h> -#include "dbus-upower.h" +#include "dbus-login1-manager.h"  #include "session-menu-mgr.h"  #include "shared-names.h"  #include "users-service-dbus.h" @@ -37,8 +37,8 @@ with this program.  If not, see <http://www.gnu.org/licenses/>.  #define DEBUG_SHOW_ALL FALSE -#define UPOWER_ADDRESS    "org.freedesktop.UPower" -#define UPOWER_PATH       "/org/freedesktop/UPower" +#define LOGIN1_MANAGER_ADDRESS    "org.freedesktop.login1" +#define LOGIN1_MANAGER_PATH       "/org/freedesktop/login1"  #define CMD_HELP            "yelp"  #define CMD_INFO            "gnome-control-center info" @@ -77,7 +77,7 @@ SwitcherMode;   * This is a pretty straightforward class: it creates the menumodel   * and listens for events that can affect the model's properties.   * - * Simple event sources, such as GSettings and a UPower DBus proxy, + * Simple event sources, such as GSettings and a logind DBus proxy,   * are handled here. More involved event sources are delegated to the   * UsersServiceDBus facade class.   */ @@ -104,18 +104,16 @@ struct _SessionMenuMgr    GSettings * indicator_settings;    GSettings * keybinding_settings; -  /* cached settings taken from the upower proxy */ +  /* cached settings taken from the logind proxy */    gboolean can_hibernate;    gboolean can_suspend; -  gboolean allow_hibernate; -  gboolean allow_suspend;    gboolean shell_mode;    gboolean greeter_mode;    guint shell_name_watcher;    GCancellable * cancellable; -  DBusUPower * upower_proxy; +  Login1Manager * login1_manager_proxy;    SessionDbus * session_dbus;    UsersServiceDbus * users_dbus_facade;    OnlineAccountsMgr * online_accounts_mgr; @@ -123,7 +121,7 @@ struct _SessionMenuMgr  static SwitcherMode get_switcher_mode         (SessionMenuMgr *); -static void init_upower_proxy                 (SessionMenuMgr *); +static void init_login1_proxy                 (SessionMenuMgr *);  static void init_shell_watcher                (SessionMenuMgr *);  static void update_screensaver_shortcut       (SessionMenuMgr *); @@ -203,7 +201,7 @@ session_menu_mgr_init (SessionMenuMgr *mgr)    g_signal_connect (mgr->users_dbus_facade, "guest-logged-in-changed",                      G_CALLBACK(on_guest_logged_in_changed), mgr); -  init_upower_proxy (mgr); +  init_login1_proxy (mgr);    init_shell_watcher (mgr);    /* Online accounts menu item */ @@ -224,7 +222,7 @@ session_menu_mgr_dispose (GObject *object)    g_clear_object (&mgr->indicator_settings);    g_clear_object (&mgr->lockdown_settings);    g_clear_object (&mgr->keybinding_settings); -  g_clear_object (&mgr->upower_proxy); +  g_clear_object (&mgr->login1_manager_proxy);    g_clear_object (&mgr->users_dbus_facade);    g_clear_object (&mgr->top_mi);    g_clear_object (&mgr->session_dbus); @@ -248,97 +246,67 @@ session_menu_mgr_class_init (SessionMenuMgrClass * klass)    object_class->dispose = session_menu_mgr_dispose;  } -/*** -****  UPower Proxy: -**** -****  1. While bootstrapping, we invoke the AllowSuspend and AllowHibernate -****     methods to find out whether or not those features are allowed. -****  2. While bootstrapping, we get the CanSuspend and CanHibernate properties -****     and also listen for property changes. -****  3. These four values are used to set suspend and hibernate's visibility. -**** -***/ - -static void -on_upower_properties_changed (SessionMenuMgr * mgr) +static gboolean +can_perform_operation (gchar * permission)  { -  gboolean need_refresh = FALSE; - -  if (mgr->upower_proxy != NULL) -    { -      gboolean b; - -      /* suspend */ -      b = dbus_upower_get_can_suspend (mgr->upower_proxy); -      if (mgr->can_suspend != b) -        { -          mgr->can_suspend = b; -          need_refresh = TRUE; -        } - -      /* hibernate */ -      b = dbus_upower_get_can_hibernate (mgr->upower_proxy); -      if (mgr->can_hibernate != b) -        { -          mgr->can_hibernate = b; -          need_refresh = TRUE; -        } -    } - -  if (need_refresh) -    { -      update_session_menuitems (mgr); -    } +  return g_strcmp0 ("yes", permission) == 0;  }  static void -init_upower_proxy (SessionMenuMgr * mgr) +init_login1_proxy (SessionMenuMgr * mgr)  {    /* default values */    mgr->can_suspend = TRUE;    mgr->can_hibernate = TRUE; -  mgr->allow_suspend = TRUE; -  mgr->allow_hibernate = TRUE; + +  gchar * can_suspend; +  gchar * can_hibernate;    mgr->cancellable = g_cancellable_new ();    GError * error = NULL; -  mgr->upower_proxy = dbus_upower_proxy_new_for_bus_sync ( +  mgr->login1_manager_proxy = login1_manager_proxy_new_for_bus_sync (                           G_BUS_TYPE_SYSTEM,                           G_DBUS_PROXY_FLAGS_NONE, -                         UPOWER_ADDRESS, -                         UPOWER_PATH, +                         LOGIN1_MANAGER_ADDRESS, +                         LOGIN1_MANAGER_PATH,                           NULL,                           &error);    if (error != NULL)      { -      g_warning ("Error creating upower proxy: %s", error->message); +      g_warning ("Error creating logind proxy: %s", error->message);        g_clear_error (&error);      }    else      { -      dbus_upower_call_suspend_allowed_sync (mgr->upower_proxy, -                                             &mgr->allow_suspend, -                                             NULL, -                                             &error); +      login1_manager_call_can_suspend_sync (mgr->login1_manager_proxy, +					    &can_suspend, +					    NULL, +					    &error);        if (error != NULL)          {            g_warning ("%s: %s", G_STRFUNC, error->message);            g_clear_error (&error);          } - -      dbus_upower_call_hibernate_allowed_sync (mgr->upower_proxy, -                                               &mgr->allow_hibernate, -                                               NULL, -                                               &error); +      else +	{ +	  mgr->can_suspend = can_perform_operation (can_suspend); +	} + +      login1_manager_call_can_hibernate_sync (mgr->login1_manager_proxy, +					    &can_hibernate, +					    NULL, +					    &error);        if (error != NULL)          {            g_warning ("%s: %s", G_STRFUNC, error->message);            g_clear_error (&error);          } +      else +	{ +	  mgr->can_hibernate = can_perform_operation (can_hibernate); +	} -      g_signal_connect_swapped (mgr->upower_proxy, "changed", -                                G_CALLBACK(on_upower_properties_changed), mgr);      }  } @@ -505,13 +473,9 @@ update_session_menuitems (SessionMenuMgr * mgr)     && !g_settings_get_boolean (s, "suppress-logout-menuitem");    mi_set_visible (mgr->logout_mi, v); -  v = mgr->can_suspend -   && mgr->allow_suspend; -  mi_set_visible (mgr->suspend_mi, v); +  mi_set_visible (mgr->suspend_mi, mgr->can_suspend); -  v = mgr->can_hibernate -   && mgr->allow_hibernate; -  mi_set_visible (mgr->hibernate_mi, v); +  mi_set_visible (mgr->hibernate_mi, mgr->can_hibernate);    v = (!mgr->shell_mode || g_settings_get_boolean (s, "suppress-logout-restart-shutdown"))     && (HAVE_RESTART_CMD || mgr->shell_mode) @@ -878,10 +842,6 @@ is_user_switching_allowed (SessionMenuMgr * mgr)      }    /* maybe the seat doesn't support activation */ -  if (!users_service_dbus_can_activate_session (mgr->users_dbus_facade)) -    { -      return FALSE; -    }    return TRUE;  } @@ -1147,9 +1107,10 @@ action_func_suspend (SessionMenuMgr * mgr)  {    GError * error = NULL; -  dbus_upower_call_suspend_sync (mgr->upower_proxy, -                                 mgr->cancellable, -                                 &error); +  login1_manager_call_suspend_sync (mgr->login1_manager_proxy, +				    TRUE, +				    mgr->cancellable, +				    &error);    if (error != NULL)      { @@ -1163,9 +1124,10 @@ action_func_hibernate (SessionMenuMgr * mgr)  {    GError * error = NULL; -  dbus_upower_call_hibernate_sync (mgr->upower_proxy, -                                   mgr->cancellable, -                                   &error); +  login1_manager_call_hibernate_sync (mgr->login1_manager_proxy, +				      TRUE, +				      mgr->cancellable, +				      &error);    if (error != NULL)      { @@ -1350,10 +1312,6 @@ session_menu_mgr_new (SessionDbus  * session_dbus,    update_user_menuitems (mgr);    build_session_menuitems (mgr); -  /* After we have the session menu items built we can look to -     align them with UPower */ -  on_upower_properties_changed (mgr); -    return mgr;  } diff --git a/src/upower.xml b/src/upower.xml deleted file mode 100644 index 18d5fbd..0000000 --- a/src/upower.xml +++ /dev/null @@ -1,309 +0,0 @@ -<!DOCTYPE node PUBLIC -"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" -"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> -<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd"> - -  <interface name="org.freedesktop.UPower"> -    <doc:doc> -      <doc:description> -        <doc:para> -          The DeviceKit-power service is available via the system message -          bus. To access the service, use -          the <doc:tt>org.freedesktop.UPower</doc:tt> interface on -          the <doc:tt>/org/freedesktop/UPower</doc:tt> object on -          the D-Bus system bus service with the well-known -          name <doc:tt>org.freedesktop.UPower</doc:tt>. -        </doc:para> -        <doc:para> -          <doc:example language="shell" title="simple example"> -            <doc:code> -$ dbus-send --print-reply \ -            --system \ -            --dest=org.freedesktop.UPower \ -            /org/freedesktop/UPower \ -            org.freedesktop.UPower.EnumerateDevices - -method return sender=:1.386 -> dest=:1.451 reply_serial=2 -   array [ -      object path "/org/freedesktop/UPower/devices/line_power_AC" -      object path "/org/freedesktop/UPower/devices/battery_BAT0" -   ] -            </doc:code> -          </doc:example> -        </doc:para> -      </doc:description> -    </doc:doc> - -    <!-- ************************************************************ --> - -    <method name="EnumerateDevices"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <arg name="devices" direction="out" type="ao"> -        <doc:doc><doc:summary>An array of object paths for devices.</doc:summary></doc:doc> -      </arg> - -      <doc:doc> -        <doc:description> -          <doc:para> -            Enumerate all power objects on the system. -          </doc:para> -        </doc:description> -      </doc:doc> -    </method> - -    <!-- ************************************************************ --> - -    <signal name="DeviceAdded"> -      <arg name="device" type="o"> -        <doc:doc><doc:summary>Object path of device that was added.</doc:summary></doc:doc> -      </arg> - -      <doc:doc> -        <doc:description> -          <doc:para> -            Emitted when a device is added. -          </doc:para> -        </doc:description> -      </doc:doc> -    </signal> - -    <!-- ************************************************************ --> - -    <signal name="DeviceRemoved"> -      <arg name="device" type="o"> -        <doc:doc><doc:summary>Object path of device that was removed.</doc:summary></doc:doc> -      </arg> - -      <doc:doc> -        <doc:description> -          <doc:para> -            Emitted when a device is removed. -          </doc:para> -        </doc:description> -      </doc:doc> -    </signal> - -    <!-- ************************************************************ --> - -    <signal name="DeviceChanged"> -      <arg name="device" type="s"> -        <doc:doc><doc:summary>Object path of device that was changed.</doc:summary></doc:doc> -      </arg> - -      <doc:doc> -        <doc:description> -          <doc:para> -            Emitted when a device changed. -          </doc:para> -        </doc:description> -      </doc:doc> -    </signal> - -    <!-- ************************************************************ --> - -    <signal name="Changed"> -      <doc:doc> -        <doc:description> -          <doc:para> -            Emitted when one or more properties on the object changes. -          </doc:para> -        </doc:description> -      </doc:doc> -    </signal> - -    <!-- ************************************************************ --> - -    <signal name="Sleeping"> -      <doc:doc> -        <doc:description> -          <doc:para> -            This signal is sent when the session is about to be suspended or -            hibernated. -            Session and system programs have one second to do anything required -            before the sleep action is taken (such as sending out Avahi or -            Jabber messages). -          </doc:para> -        </doc:description> -      </doc:doc> -    </signal> - -    <!-- ************************************************************ --> - -    <signal name="Resuming"> -      <doc:doc> -        <doc:description> -          <doc:para> -            This signal is sent when the session has just returned from -            Suspend() or Hibernate(). -            Session and system programs can then do anything required (such as -            sending out Avahi or Jabber messages). -          </doc:para> -        </doc:description> -      </doc:doc> -    </signal> - -    <!-- ************************************************************ --> - -    <method name="AboutToSleep"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <doc:doc> -        <doc:description> -          <doc:para> -            This method tells UPower that the Suspend() or Hibernate() method -            is about to be called. -            This allows UPower to emit the Suspending signal whilst -            session activities are happening that have to be done before the -            suspend process is started. -          </doc:para> -          <doc:para> -            This method would typically be called by the session power -            management daemon, before it locks the screen and waits for the -            screen to fade to black. -            The session power management component would then call Suspend() or -            Hibernate() when these syncronous tasks have completed. -          </doc:para> -          <doc:para> -            If this method is not called than nothing bad will happen and -            Suspend() or Hibernate() will block for the required second. -          </doc:para> -        </doc:description> -      </doc:doc> -    </method> - -    <!-- ************************************************************ --> - -    <method name="Suspend"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <doc:doc> -        <doc:description> -          <doc:para> -            Suspends the computer into a low power state. -            System state is not preserved if the power is lost. -          </doc:para> -          <doc:para> -            If AboutToRequestSleep() has not been called then UPower will send -            the Sleeping() signal and block for one second. -          </doc:para> -          <doc:para> -            If AboutToRequestSleep() has been called less than one second -            before this method is called then UPower will block for the -            remaining time to complete one second of delay. -          </doc:para> -        </doc:description> -      </doc:doc> -    </method> - -    <!-- ************************************************************ --> - -    <method name="SuspendAllowed"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <arg name="allowed" direction="out" type="b"> -        <doc:doc><doc:summary>TRUE if allowed, otherwise FALSE</doc:summary></doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para> -            Check if the caller has (or can get) the PolicyKit privilege to call -            <doc:ref type="method" to="Power.Suspend">Suspend</doc:ref>. -          </doc:para> -        </doc:description> -      </doc:doc> -    </method> - -    <!-- ************************************************************ --> - -    <method name="Hibernate"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <doc:doc> -        <doc:description> -          <doc:para> -            Hibernates the computer into a low power state. -            System state is preserved if the power is lost. -          </doc:para> -          <doc:para> -            If AboutToRequestSleep() has not been called then UPower will send -            the Sleeping() signal and block for one second. -          </doc:para> -          <doc:para> -            If AboutToRequestSleep() has been called less than one second -            before this method is called then UPower will block for the -            remaining time to complete one second of delay. -          </doc:para> -        </doc:description> -      </doc:doc> -    </method> - -    <!-- ************************************************************ --> - -    <method name="HibernateAllowed"> -      <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> -      <arg name="allowed" direction="out" type="b"> -        <doc:doc><doc:summary>TRUE if allowed, otherwise FALSE</doc:summary></doc:doc> -      </arg> -      <doc:doc> -        <doc:description> -          <doc:para> -            Check if the caller has (or can get) the PolicyKit privilege to call -            <doc:ref type="method" to="Power.Hibernate">Hibernate</doc:ref>. -          </doc:para> -        </doc:description> -      </doc:doc> -    </method> - -    <!-- ************************************************************ --> - -    <property name="DaemonVersion" type="s" access="read"> -      <doc:doc><doc:description><doc:para> -            Version of the running daemon, e.g. <doc:tt>002</doc:tt>. -      </doc:para></doc:description></doc:doc> -    </property> - -    <property name="CanSuspend" type="b" access="read"> -      <doc:doc><doc:description><doc:para> -            Whether the system is able to suspend. -      </doc:para></doc:description></doc:doc> -    </property> - -    <property name="CanHibernate" type="b" access="read"> -      <doc:doc><doc:description><doc:para> -            Whether the system is able to hibernate. -      </doc:para></doc:description></doc:doc> -    </property> - -    <property name="OnBattery" type="b" access="read"> -      <doc:doc><doc:description><doc:para> -            Indicates whether the system is running on battery power. -            This property is provided for convenience. -      </doc:para></doc:description></doc:doc> -    </property> - -    <property name="OnLowBattery" type="b" access="read"> -      <doc:doc><doc:description><doc:para> -            Indicates whether the system is running on battery power and if the battery is critically low. -            This property is provided for convenience. -      </doc:para></doc:description></doc:doc> -    </property> - -    <property name="LidIsClosed" type="b" access="read"> -      <doc:doc> -        <doc:description> -          <doc:para> -            Indicates if the laptop lid is closed where the display cannot be seen. -          </doc:para> -        </doc:description> -      </doc:doc> -    </property> - -    <property name="LidIsPresent" type="b" access="read"> -      <doc:doc> -        <doc:description> -          <doc:para> -            If the system has a lid device. -          </doc:para> -        </doc:description> -      </doc:doc> -    </property> - -  </interface> - -</node> diff --git a/src/users-service-dbus.c b/src/users-service-dbus.c index f12f47c..00836de 100644 --- a/src/users-service-dbus.c +++ b/src/users-service-dbus.c @@ -30,16 +30,15 @@  #include <pwd.h> /* getpwuid() */  #include "dbus-accounts.h" -#include "dbus-consolekit-manager.h" -#include "dbus-consolekit-seat.h" -#include "dbus-consolekit-session.h" +#include "dbus-login1-manager.h" +#include "dbus-login1-session.h" +#include "dbus-login1-user.h"  #include "dbus-display-manager.h"  #include "dbus-user.h"  #include "shared-names.h"  #include "users-service-dbus.h" -#define CK_ADDR             "org.freedesktop.ConsoleKit" -#define CK_SESSION_IFACE    "org.freedesktop.ConsoleKit.Session" +#define LOGIND_ADDR             "org.freedesktop.login1"  /**  *** @@ -57,17 +56,19 @@ static void     on_user_deleted      (Accounts          * o,                                        const gchar       * user_object_path,                                        UsersServiceDbus  * service); -static void     on_session_added     (ConsoleKitSeat    * seat, -                                      const gchar       * ssid, -                                      UsersServiceDbus  * service); +static void     on_session_added     (Login1Manager      * proxy, +                                      const gchar        * ssid, +                                      const gchar        * path, +                                      UsersServiceDbus   * service); -static void     on_session_removed   (ConsoleKitSeat    * seat, -                                      const gchar       * ssid, -                                      UsersServiceDbus  * service); +static void     on_session_removed   (Login1Manager      * proxy, +                                      const gchar        * ssid, +                                      const gchar        * path, +                                      UsersServiceDbus   * service); -static void     on_session_list      (ConsoleKitSeat    * seat, -                                      GAsyncResult      * result, -                                      UsersServiceDbus  * service); +static void     on_session_list      (Login1Manager      * proxy, +                                      GAsyncResult       * result, +                                      UsersServiceDbus   * service);  /***  ****  Priv Struct @@ -85,8 +86,7 @@ struct _UsersServiceDbusPrivate    GHashTable * users;    GCancellable * cancellable; -  ConsoleKitSeat * seat_proxy; -  ConsoleKitManager * ck_manager_proxy; +  Login1Manager * manager_proxy;    Accounts * accounts_proxy;  }; @@ -112,8 +112,7 @@ users_service_dbus_dispose (GObject *object)    UsersServiceDbusPrivate * priv = USERS_SERVICE_DBUS(object)->priv;    g_clear_object (&priv->accounts_proxy); -  g_clear_object (&priv->seat_proxy); -  g_clear_object (&priv->ck_manager_proxy); +  g_clear_object (&priv->manager_proxy);    if (priv->cancellable != NULL)      { @@ -211,14 +210,14 @@ users_service_dbus_init (UsersServiceDbus *self)                                      g_object_unref);    /** -  ***  create the consolekit manager proxy... +  ***  create the logind manager proxy...    **/ -  p->ck_manager_proxy = console_kit_manager_proxy_new_for_bus_sync ( +  p->manager_proxy = login1_manager_proxy_new_for_bus_sync (                               G_BUS_TYPE_SYSTEM,                               G_DBUS_PROXY_FLAGS_NONE, -                             "org.freedesktop.ConsoleKit", -                             "/org/freedesktop/ConsoleKit/Manager", +                             "org.freedesktop.login1", +                             "/org/freedesktop/login1",                               NULL,                               &error);    if (error != NULL) @@ -229,36 +228,13 @@ users_service_dbus_init (UsersServiceDbus *self)    p->seat = get_seat (self); -  /** -  ***  create the consolekit seat proxy... -  **/ +  g_signal_connect (p->manager_proxy, "session-new", +                    G_CALLBACK (on_session_added), self); +  g_signal_connect (p->manager_proxy, "session-removed", +                    G_CALLBACK (on_session_removed), self); -  if (p->seat != NULL) -    { -      ConsoleKitSeat * proxy = console_kit_seat_proxy_new_for_bus_sync ( -                                 G_BUS_TYPE_SYSTEM, -                                 G_DBUS_PROXY_FLAGS_NONE, -                                 "org.freedesktop.ConsoleKit", -                                 p->seat, -                                 NULL, -                                 &error); - -      if (error != NULL) -        { -          g_warning ("Failed to connect to the ConsoleKit seat: %s", error->message); -          g_clear_error (&error); -        } -      else -        { -          g_signal_connect (proxy, "session-added", -                            G_CALLBACK (on_session_added), self); -          g_signal_connect (proxy, "session-removed", -                            G_CALLBACK (on_session_removed), self); -          console_kit_seat_call_get_sessions (proxy, p->cancellable, -                            (GAsyncReadyCallback)on_session_list, self); -          p->seat_proxy = proxy; -        } -    } +  login1_manager_call_list_sessions (p->manager_proxy, p->cancellable, +                    (GAsyncReadyCallback) on_session_list, self);    /**    ***  create the accounts manager proxy... @@ -311,16 +287,17 @@ emit_guest_login_changed (UsersServiceDbus * self)  ****  ***/ -static ConsoleKitSession* -create_consolekit_session_proxy (const char * ssid) +static Login1User* +create_login1_user_proxy (const char * path)  { +      GError * error = NULL; -  ConsoleKitSession * p = console_kit_session_proxy_new_for_bus_sync ( +  Login1User * p = login1_user_proxy_new_for_bus_sync (                              G_BUS_TYPE_SYSTEM,                              G_DBUS_PROXY_FLAGS_NONE, -                            CK_ADDR, -                            ssid, +                            LOGIND_ADDR, +                            path,                              NULL,                              &error);    if (error != NULL) @@ -332,54 +309,107 @@ create_consolekit_session_proxy (const char * ssid)    return p;  } -static gchar * -get_seat_from_session_proxy (ConsoleKitSession * session_proxy) +static Login1User * +create_login1_user_proxy_from_uid (UsersServiceDbus * self, +                                   guint64 uid)  { -  gchar * seat = NULL; +  Login1Manager * manager = self->priv->manager_proxy; +  Login1User * user_proxy = NULL; +  gchar * user_object_path = NULL; +  GError * error = NULL; + +  login1_manager_call_get_user_sync (manager, uid, &user_object_path, NULL, +      &error); + +  if (error != NULL) +    { +      g_warning ("%s: %s", G_STRLOC, error->message); +      g_error_free (error); +    } + +  if (user_object_path != NULL) +    user_proxy = create_login1_user_proxy (user_object_path); + +  return user_proxy; +} + +static Login1Session * +create_login1_session_proxy (const char * path) +{    GError * error = NULL; -  console_kit_session_call_get_seat_id_sync (session_proxy, -                                             &seat, -                                             NULL, -                                             &error); + +  Login1Session * p = login1_session_proxy_new_for_bus_sync ( +                            G_BUS_TYPE_SYSTEM, +                            G_DBUS_PROXY_FLAGS_NONE, +                            LOGIND_ADDR, +                            path, +                            NULL, +                            &error);    if (error != NULL)      { -      g_debug ("%s: %s", G_STRLOC, error->message); +      g_warning ("%s: %s", G_STRLOC, error->message);        g_error_free (error);      } +  return p; +} + + +static gchar * +get_seat_from_session_proxy (Login1Session * session_proxy) +{ +  gchar * seat; +  GVariant * seatobj = login1_session_get_seat (session_proxy); + +  g_variant_get (seatobj, "(so)", &seat, NULL); +    return seat;  } +static const gchar * +get_display_from_session_proxy (Login1Session * session_proxy) +{ +  const gchar * display; +  display = login1_session_get_display (session_proxy); +  return display; +} +  static gchar *  get_seat (UsersServiceDbus *service)  {    gchar * seat = NULL; -  gchar * ssid = NULL; +  gchar * path = NULL;    GError * error = NULL;    UsersServiceDbusPrivate * priv = service->priv; +  Login1Session * session_proxy = NULL; +  pid_t pid = getpid(); + +  login1_manager_call_get_session_by_pid_sync (priv->manager_proxy, +                                               pid, +                                               &path, +                                               NULL, +                                               &error); -  console_kit_manager_call_get_current_session_sync (priv->ck_manager_proxy, -                                                     &ssid, -                                                     NULL, -                                                     &error);    if (error != NULL)      {        g_debug ("%s: %s", G_STRLOC, error->message);        g_error_free (error); +      goto out;      } -  else -    { -      ConsoleKitSession * session = create_consolekit_session_proxy (ssid); -      if (session != NULL) -        { -          seat = get_seat_from_session_proxy (session); -          g_object_unref (session); -        } +  session_proxy = create_login1_session_proxy (path); + +  if (!session_proxy) +    { +      g_debug ("%s: Could't get session proxy object", G_STRLOC);      } +  seat = get_seat_from_session_proxy (session_proxy); + +out: +  g_object_unref (session_proxy);    return seat;  } @@ -434,9 +464,10 @@ user_count_sessions (AccountsUser * user)  static void  add_user_session (UsersServiceDbus  * service,                    AccountsUser      * user, -                  const gchar       * ssid) +                  const gchar       * ssid, +                  const gchar       * path)  { -  ConsoleKitSession * session_proxy = create_consolekit_session_proxy (ssid); +  Login1Session * session_proxy = create_login1_session_proxy (path);    if (session_proxy != NULL)      {        UsersServiceDbusPrivate * priv = service->priv; @@ -446,12 +477,8 @@ add_user_session (UsersServiceDbus  * service,        if (seat && priv->seat && !g_strcmp0 (seat, priv->seat))          {            /* does this session have a display? */ -          gchar * display = NULL; -          console_kit_session_call_get_x11_display_sync (session_proxy, -                                                         &display, -                                                         NULL, NULL); -          const gboolean has_display = display && *display; -          g_free (display); +          const gchar * display = get_display_from_session_proxy (session_proxy); +          const gboolean has_display = g_strcmp0 ("", display) != 0;            if (has_display)              { @@ -480,33 +507,30 @@ add_user_sessions (UsersServiceDbus *self, AccountsUser * user)    const char * username = accounts_user_get_user_name (user);    g_debug ("%s adding %s (%i)", G_STRLOC, username, (int)uid); -  GError * error = NULL; -  gchar ** sessions = NULL; -  console_kit_manager_call_get_sessions_for_unix_user_sync ( -                                              self->priv->ck_manager_proxy, -                                              uid, -                                              &sessions, -                                              NULL, -                                              &error); +  GVariant * sessions = NULL; -  if (error != NULL) +  Login1User * user_proxy = create_login1_user_proxy_from_uid (self, uid); + +  if (user_proxy != NULL)      { -      g_debug ("%s: %s", G_STRLOC, error->message); -      g_error_free (error); +      sessions = login1_user_get_sessions (user_proxy);      } -  else if (sessions != NULL) + +  if (sessions != NULL)      { -      int i; +      GVariantIter iter; +      g_variant_iter_init (&iter, sessions); +      gchar * id; +      gchar * object_path; -      for (i=0; sessions[i]; i++) +      while (g_variant_iter_loop (&iter, "(so)", &id, &object_path))          { -          const char * const ssid = sessions[i]; -          g_debug ("%s adding %s's session %s", G_STRLOC, username, ssid); -          add_user_session (self, user, ssid); +          g_debug ("%s adding %s's session %s", G_STRLOC, username, id); +          add_user_session (self, user, id, object_path);          } - -      g_strfreev (sessions);      } + +  g_object_unref (user_proxy);  }  /* returns true if this property is one we use */ @@ -723,9 +747,10 @@ find_user_from_username (UsersServiceDbus  * self,  ***/  static void -on_session_removed (ConsoleKitSeat   * seat_proxy, -                    const gchar      * ssid, -                    UsersServiceDbus * service) +on_session_removed (Login1Manager * proxy, +                    const gchar        * ssid, +                    const gchar        * path, +                    UsersServiceDbus   * service)  {    g_return_if_fail (IS_USERS_SERVICE_DBUS (service)); @@ -757,42 +782,25 @@ on_session_removed (ConsoleKitSeat   * seat_proxy,  }  static gchar* -get_unix_username_from_ssid (UsersServiceDbus * self, -                             const gchar      * ssid) +get_unix_username_from_path (UsersServiceDbus * self, +                             const gchar      * path)  { -  gchar * username = NULL; -  ConsoleKitSession * session_proxy = create_consolekit_session_proxy (ssid); +  Login1Session * session_proxy = create_login1_session_proxy (path);    if (session_proxy != NULL)      { -      guint uid = 0; -      GError * error = NULL; -      console_kit_session_call_get_unix_user_sync (session_proxy, -                                                   &uid, -                                                   NULL, &error); -      if (error != NULL) -        { -          g_warning ("%s: %s", G_STRLOC, error->message); -          g_clear_error (&error); -        } -      else -        { -          errno = 0; -          const struct passwd * pwent = getpwuid (uid); -          if (pwent == NULL) -            { -              g_warning ("Failed to lookup user id %d: %s", (int)uid, g_strerror(errno)); -            } -          else -            { -              username = g_strdup (pwent->pw_name); -            } -        } +      gchar * username = g_strdup (login1_session_get_name (session_proxy)); + +      g_debug ("%s Getting username for %s: %s", G_STRLOC, path, username);        g_object_unref (session_proxy); -    } -  return username; +      return username; +    }  +      else  +    { +      return NULL; +    }  }  static gboolean @@ -810,13 +818,14 @@ is_guest_username (const char * username)  /* If the new session belongs to 'guest', update our guest_ssid.     Otherwise, call add_user_session() to update our session tables */  static void -on_session_added (ConsoleKitSeat   * seat_proxy G_GNUC_UNUSED, -                  const gchar      * ssid, -                  UsersServiceDbus * service) +on_session_added (Login1Manager * proxy G_GNUC_UNUSED, +                  const gchar        * ssid, +                  const gchar        * path, +                  UsersServiceDbus   * service)  {    g_return_if_fail (IS_USERS_SERVICE_DBUS(service)); -  gchar * username = get_unix_username_from_ssid (service, ssid); +  gchar * username = get_unix_username_from_path (service, path);    g_debug ("%s %s() username %s has new session %s", G_STRLOC, G_STRFUNC, username, ssid);    if (is_guest_username (username)) @@ -834,45 +843,59 @@ on_session_added (ConsoleKitSeat   * seat_proxy G_GNUC_UNUSED,        if (user != NULL)          { -          add_user_session (service, user, ssid); +          add_user_session (service, user, ssid, path);            emit_user_login_changed (service, user);          }      } -  g_free (username);  }  /* Receives a list of sessions and calls on_session_added() for each of them */  static void -on_session_list (ConsoleKitSeat   * seat_proxy, +on_session_list (Login1Manager    * proxy,                   GAsyncResult     * result,                   UsersServiceDbus * self)  {    GError * error = NULL; -  gchar ** sessions = NULL; +  GVariant * sessions;    g_debug ("%s bootstrapping the session list", G_STRLOC); -  console_kit_seat_call_get_sessions_finish (seat_proxy, -                                             &sessions, -                                             result, -                                             &error); +  login1_manager_call_list_sessions_finish (proxy, +                                            &sessions, +                                            result, +                                            &error);    if (error != NULL)      {        g_debug ("%s: %s", G_STRLOC, error->message);        g_error_free (error);      } -  else if (sessions != NULL) +  else      { -      int i; - -      for (i=0; sessions[i]; i++) +      GVariantIter * iter; +      gchar * seat; +      gchar * path; + +      g_variant_get (sessions, "a(susso)", &iter); + +      while (g_variant_iter_loop (iter,  +                  "(susso)", +                  NULL, +                  NULL, +                  NULL, +                  &seat, +                  &path))          { -          g_debug ("%s adding initial session '%s'", G_STRLOC, sessions[i]); -          on_session_added (seat_proxy, sessions[i], self); +          if (g_strcmp0 (seat, self->priv->seat) == 0) +            { +              g_debug ("%s adding initial session '%s'", G_STRLOC, path); +              on_session_added (proxy, seat, path, self); +            }          } -      g_strfreev (sessions); +      g_variant_iter_free (iter); +      g_variant_unref (sessions); +      }    g_debug ("%s done bootstrapping the session list", G_STRLOC); @@ -1005,27 +1028,6 @@ users_service_dbus_guest_session_enabled (UsersServiceDbus * self)  }  gboolean -users_service_dbus_can_activate_session (UsersServiceDbus * self) -{ -  gboolean can_activate = FALSE; - -  g_return_val_if_fail (IS_USERS_SERVICE_DBUS(self), can_activate); - -  GError * error = NULL; -  console_kit_seat_call_can_activate_sessions_sync (self->priv->seat_proxy, -                                                    &can_activate, -                                                    NULL, -                                                    &error); -  if (error != NULL) -    { -      g_warning ("%s: %s", G_STRLOC, error->message); -      g_error_free (error); -    } - -  return can_activate; -} - -gboolean  users_service_dbus_is_guest_logged_in (UsersServiceDbus * self)  {    g_return_val_if_fail (IS_USERS_SERVICE_DBUS(self), FALSE); diff --git a/src/users-service-dbus.h b/src/users-service-dbus.h index 0f082c3..3e5252d 100644 --- a/src/users-service-dbus.h +++ b/src/users-service-dbus.h @@ -52,8 +52,8 @@ typedef struct _UsersServiceDbusPrivate UsersServiceDbusPrivate;   *  2. Track which users currently have X sessions.   *     This is used for the menuitems' USER_ITEM_PROP_LOGGED_IN property.   * - *     We initially build this list by calling org.freedesktop.ConsoleKit.Seat's - *     GetDevices method. We also monitor the seat for SessionAdded and + *     We initially build this list by calling org.freedesktop.login1's + *     ListSessions method. We also monitor the seat for SessionNew and   *     SessionRemoved and update the list accordingly.   *   *  3. Provide an API for user switching and guest sessions. @@ -87,7 +87,6 @@ gboolean  users_service_dbus_is_user_logged_in      (UsersServiceDbus * self,  void      users_service_dbus_show_greeter           (UsersServiceDbus * self);  gboolean  users_service_dbus_guest_session_enabled  (UsersServiceDbus * self); -gboolean  users_service_dbus_can_activate_session   (UsersServiceDbus * self);  void      users_service_dbus_activate_guest_session (UsersServiceDbus * self);  void      users_service_dbus_activate_user_session  (UsersServiceDbus * self,                                                       AccountsUser     * user); | 
