g_free (path);
}
-static GList*
-get_config_sections (const gchar *seat_name)
-{
- gchar **groups, **i;
- GList *config_sections = NULL;
-
- groups = config_get_groups (config_get_instance ());
- for (i = groups; *i; i++)
- {
- if (g_str_has_prefix (*i, "Seat:"))
- {
- const gchar *seat_name_glob = *i + strlen ("Seat:");
- if (g_pattern_match_simple (seat_name_glob, seat_name))
- config_sections = g_list_append (config_sections, g_strdup (*i));
- }
- }
- if (groups)
- g_strfreev (groups);
- return config_sections;
-}
-
static void
set_seat_properties (Seat *seat, const gchar *config_section)
{
if (next_seat)
{
- GList *config_sections, *link;
+ gchar *config_section;
- config_sections = get_config_sections (seat_get_name (seat));
- for (link = config_sections; link; link = link->next)
- set_seat_properties (next_seat, (gchar*) link->data);
- if (config_sections)
- g_list_free_full (config_sections, g_free);
+ config_section = g_strdup_printf ("Seat:%s", seat_get_name (seat));
+ set_seat_properties (next_seat, config_section);
+ g_free (config_section);
// We set this manually on default seat. Let's port it over if needed.
if (seat_get_boolean_property (seat, "exit-on-failure"))
add_login1_seat (Login1Seat *login1_seat)
{
const gchar *seat_name = login1_seat_get_id (login1_seat);
+ gchar **groups, **i;
+ gchar *config_section = NULL;
gchar **types = NULL, **type;
- GList *config_sections = NULL, *link;
Seat *seat = NULL;
gboolean is_seat0, started = FALSE;
g_debug ("New seat added from logind: %s", seat_name);
is_seat0 = strcmp (seat_name, "seat0") == 0;
- config_sections = get_config_sections (seat_name);
- for (link = config_sections; link; link = link->next)
+ groups = config_get_groups (config_get_instance ());
+ for (i = groups; !config_section && *i; i++)
+ {
+ if (g_str_has_prefix (*i, "Seat:") &&
+ g_str_has_suffix (*i, seat_name))
+ {
+ config_section = g_strdup (*i);
+ break;
+ }
+ }
+ g_strfreev (groups);
+
+ if (config_section)
{
- gchar *config_section = link->data;
g_debug ("Loading properties from config section %s", config_section);
types = config_get_string_list (config_get_instance (), config_section, "type");
}
seat_set_property (seat, "allow-user-switching", "false");
}
- for (link = config_sections; link; link = link->next)
- set_seat_properties (seat, (gchar*) link->data);
+ if (config_section)
+ set_seat_properties (seat, config_section);
if (is_seat0)
seat_set_property (seat, "exit-on-failure", "true");
g_debug ("Failed to start seat: %s", seat_name);
}
- if (config_sections)
- g_list_free_full (config_sections, g_free);
+ g_free (config_section);
g_object_unref (seat);
return started;
test-multi-seat \
test-multi-seat-non-graphical \
test-multi-seat-change-graphical \
- test-multi-seat-with-globbing-config-sections \
test-mir-autologin \
test-mir-greeter \
test-mir-session \
scripts/multi-seat.conf \
scripts/multi-seat-non-graphical.conf \
scripts/multi-seat-change-graphical.conf \
- scripts/multi-seat-with-globbing-config-sections.conf \
scripts/no-accounts-service.conf \
scripts/no-config.conf \
scripts/no-console-kit.conf \
+++ /dev/null
-#
-# Check can set globbing config sections matching different seats
-#
-
-[Seat:*]
-autologin-user=have-password1
-user-session=default
-
-[Seat:seat*Foo]
-autologin-user=have-password2
-
-[Seat:seat-AAA-Foo]
-autologin-user=have-password3
-
-[Seat:seat-BBB*]
-autologin-user=have-password4
-
-#?*START-DAEMON
-#?RUNNER DAEMON-START
-
-# seat0 starts
-#?XSERVER-0 START VT=7 SEAT=seat0
-#?*XSERVER-0 INDICATE-READY
-#?XSERVER-0 INDICATE-READY
-#?XSERVER-0 ACCEPT-CONNECT
-
-# Session starts for configured user
-#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/have-password1 XDG_SESSION_TYPE=x11 XDG_SESSION_DESKTOP=default USER=have-password1
-#?LOGIN1 ACTIVATE-SESSION SESSION=c0
-#?XSERVER-0 ACCEPT-CONNECT
-#?SESSION-X-0 CONNECT-XSERVER
-
-# Add seat-AAA-Foo
-#?*ADD-SEAT ID=seat-AAA-Foo
-
-# seat-AAA-Foo starts
-#?XSERVER-1 START SEAT=seat-AAA-Foo SHAREVTS=TRUE
-#?*XSERVER-1 INDICATE-READY
-#?XSERVER-1 INDICATE-READY
-#?XSERVER-1 ACCEPT-CONNECT
-
-# Session starts for configured user
-#?SESSION-X-1 START XDG_SEAT=seat-AAA-Foo XDG_GREETER_DATA_DIR=.*/have-password3 XDG_SESSION_TYPE=x11 XDG_SESSION_DESKTOP=default USER=have-password3
-#?LOGIN1 ACTIVATE-SESSION SESSION=c1
-#?XSERVER-1 ACCEPT-CONNECT
-#?SESSION-X-1 CONNECT-XSERVER
-
-# Add seat-BBB-Foo
-#?*ADD-SEAT ID=seat-BBB-Foo
-
-# seat-BBB-Foo starts
-#?XSERVER-2 START SEAT=seat-BBB-Foo SHAREVTS=TRUE
-#?*XSERVER-2 INDICATE-READY
-#?XSERVER-2 INDICATE-READY
-#?XSERVER-2 ACCEPT-CONNECT
-
-# Session starts for configured user
-#?SESSION-X-2 START XDG_SEAT=seat-BBB-Foo XDG_GREETER_DATA_DIR=.*/have-password4 XDG_SESSION_TYPE=x11 XDG_SESSION_DESKTOP=default USER=have-password4
-#?LOGIN1 ACTIVATE-SESSION SESSION=c2
-#?XSERVER-2 ACCEPT-CONNECT
-#?SESSION-X-2 CONNECT-XSERVER
-
-# Cleanup
-#?*STOP-DAEMON
-#?XSERVER-0 TERMINATE SIGNAL=15
-#?SESSION-X-0 TERMINATE SIGNAL=15
-#?XSERVER-1 TERMINATE SIGNAL=15
-#?SESSION-X-1 TERMINATE SIGNAL=15
-#?XSERVER-2 TERMINATE SIGNAL=15
-#?SESSION-X-2 TERMINATE SIGNAL=15
-#?RUNNER DAEMON-EXIT STATUS=0
return NULL;
}
-static gchar *
-escape_seat_id (const gchar *id)
-{
- GString *s;
- int i;
-
- s = g_string_new ("");
- for (i = 0; id[i]; i++)
- {
- if (isalnum (id[i]) || id[i] == '_')
- g_string_append_c (s, id[i]);
- else
- g_string_append_printf (s, "_%02x", id[i]);
- }
-
- return g_string_free (s, FALSE);
-}
-
static Login1Seat *
add_login1_seat (GDBusConnection *connection, const gchar *id, gboolean emit_signal)
{
Login1Seat *seat;
- gchar *escaped_id;
GError *error = NULL;
GDBusNodeInfo *login1_seat_info;
handle_login1_seat_get_property,
};
+ seat = g_malloc0 (sizeof (Login1Seat));
+ login1_seats = g_list_append (login1_seats, seat);
+ seat->id = g_strdup (id);
+ seat->path = g_strdup_printf ("/org/freedesktop/login1/seat/%s", seat->id);
+ seat->can_graphical = TRUE;
+ seat->can_multi_session = TRUE;
+
login1_seat_info = g_dbus_node_info_new_for_xml (login1_seat_interface, &error);
if (error)
g_warning ("Failed to parse login1 seat D-Bus interface: %s", error->message);
if (!login1_seat_info)
return NULL;
- seat = g_malloc0 (sizeof (Login1Seat));
- login1_seats = g_list_append (login1_seats, seat);
- seat->id = g_strdup (id);
- escaped_id = escape_seat_id (seat->id);
- seat->path = g_strdup_printf ("/org/freedesktop/login1/seat/%s", escaped_id);
- g_free (escaped_id);
- seat->can_graphical = TRUE;
- seat->can_multi_session = TRUE;
-
g_dbus_connection_register_object (connection,
seat->path,
login1_seat_info->interfaces[0],
+++ /dev/null
-#!/bin/sh
-./src/dbus-env ./src/test-runner multi-seat-with-globbing-config-sections test-gobject-greeter