142
set_seat_properties (Seat *seat, const gchar *config_section)
147
keys = config_get_keys (config_get_instance (), "SeatDefaults");
148
for (i = 0; keys[i]; i++)
150
gchar *value = config_get_string (config_get_instance (), "SeatDefaults", keys[i]);
151
seat_set_property (seat, keys[i], value);
158
keys = config_get_keys (config_get_instance (), config_section);
159
for (i = 0; keys[i]; i++)
161
gchar *value = config_get_string (config_get_instance (), config_section, keys[i]);
162
seat_set_property (seat, keys[i], value);
142
170
signal_cb (Process *process, int signum)
144
172
g_debug ("Caught %s signal, shutting down", g_strsignal (signum));
157
185
display_manager_seat_removed_cb (DisplayManager *display_manager, Seat *seat)
159
if (seat_get_boolean_property (seat, "exit-on-failure"))
189
Seat *next_seat = NULL;
192
/* If we have fallback types registered for the seat, let's try them
194
types = seat_get_string_list_property (seat, "type");
195
next_types = g_string_new ("");
196
for (iter = types; iter && *iter; iter++)
199
continue; // skip first one, that is our current seat type
203
next_seat = seat_new (*iter);
204
g_string_assign (next_types, *iter);
208
// Build up list of types to try next time
209
g_string_append_c (next_types, ';');
210
g_string_append (next_types, *iter);
217
const gchar *seat_name;
218
gchar *config_section = NULL;
220
seat_name = seat_get_string_property (seat, "seat-name");
222
config_section = g_strdup_printf ("Seat:%s", seat_name);
223
set_seat_properties (next_seat, config_section);
224
g_free (config_section);
226
// We set this manually on default seat. Let's port it over if needed.
227
if (seat_get_boolean_property (seat, "exit-on-failure"))
228
seat_set_property (next_seat, "exit-on-failure", "true");
230
seat_set_property (next_seat, "type", next_types->str);
232
display_manager_add_seat (display_manager, next_seat);
233
g_object_unref (next_seat);
235
else if (seat_get_boolean_property (seat, "exit-on-failure"))
161
237
g_debug ("Required seat has stopped");
162
238
exit_code = EXIT_FAILURE;
163
239
display_manager_stop (display_manager);
242
g_string_free (next_types, TRUE);
167
245
static GVariant *
215
set_seat_properties (Seat *seat, const gchar *config_section)
220
keys = config_get_keys (config_get_instance (), "SeatDefaults");
221
for (i = 0; keys[i]; i++)
223
gchar *value = config_get_string (config_get_instance (), "SeatDefaults", keys[i]);
224
seat_set_property (seat, keys[i], value);
231
keys = config_get_keys (config_get_instance (), config_section);
232
for (i = 0; keys[i]; i++)
234
gchar *value = config_get_string (config_get_instance (), config_section, keys[i]);
235
seat_set_property (seat, keys[i], value);
243
293
handle_display_manager_call (GDBusConnection *connection,
244
294
const gchar *sender,
245
295
const gchar *object_path,
1199
1249
for (i = groups; *i; i++)
1201
1251
gchar *config_section = *i;
1204
1255
const gchar *const seatpfx = "Seat:";
1206
1257
if (!g_str_has_prefix (config_section, seatpfx))
1209
1260
g_debug ("Loading seat %s", config_section);
1210
type = config_get_string (config_get_instance (), config_section, "type");
1212
type = config_get_string (config_get_instance (), "SeatDefaults", "type");
1213
seat = seat_new (type);
1261
types = config_get_string_list (config_get_instance (), config_section, "type");
1263
types = config_get_string_list (config_get_instance (), "SeatDefaults", "type");
1264
for (type = types; type && *type; type++)
1266
seat = seat_new (*type);
1217
1273
const gsize seatpfxlen = strlen(seatpfx);
1232
1288
/* If no seats start a default one */
1233
1289
if (n_seats == 0 && config_get_boolean (config_get_instance (), "LightDM", "start-default-seat"))
1238
1295
g_debug ("Adding default seat");
1240
type = config_get_string (config_get_instance (), "SeatDefaults", "type");
1241
seat = seat_new (type);
1297
types = config_get_string_list (config_get_instance (), "SeatDefaults", "type");
1298
for (type = types; type && *type; type++)
1300
seat = seat_new (*type);
1245
1307
set_seat_properties (seat, NULL);