g_free (path);
}
- static void
- set_seat_properties (Seat *seat, const gchar *config_section)
+ static GList*
+ get_config_sections (const gchar *seat_name)
{
- gchar **keys;
- gint i;
+ gchar **groups, **i;
+ GList *config_sections = NULL;
- keys = config_get_keys (config_get_instance (), "SeatDefaults");
- for (i = 0; keys && keys[i]; i++)
+ config_sections = g_list_append (config_sections, g_strdup ("SeatDefaults"));
+
+ if (!seat_name)
+ return config_sections;
+
+ groups = config_get_groups (config_get_instance ());
+ for (i = groups; *i; i++)
{
- gchar *value = config_get_string (config_get_instance (), "SeatDefaults", keys[i]);
- seat_set_property (seat, keys[i], value);
- g_free (value);
+ 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));
+ }
}
- g_strfreev (keys);
+ g_strfreev (groups);
+
+ return config_sections;
+ }
- if (config_section)
+ static void
+ set_seat_properties (Seat *seat, const gchar *seat_name)
+ {
+ GList *sections, *link;
+ gchar **keys;
+ gint i;
+
+ sections = get_config_sections (seat_name);
+ for (link = sections; link; link = link->next)
{
- keys = config_get_keys (config_get_instance (), config_section);
+ const gchar *section = link->data;
+ g_debug ("Loading properties from config section %s", section);
+ keys = config_get_keys (config_get_instance (), section);
for (i = 0; keys && keys[i]; i++)
{
- gchar *value = config_get_string (config_get_instance (), config_section, keys[i]);
+ gchar *value = config_get_string (config_get_instance (), section, keys[i]);
seat_set_property (seat, keys[i], value);
g_free (value);
}
g_strfreev (keys);
}
+ g_list_free_full (sections, g_free);
}
static void
if (next_seat)
{
- gchar *config_section;
-
- config_section = g_strdup_printf ("Seat:%s", seat_get_name (seat));
- set_seat_properties (next_seat, config_section);
- g_free (config_section);
+ set_seat_properties (next_seat, seat_get_name (seat));
// We set this manually on default seat. Let's port it over if needed.
if (seat_get_boolean_property (seat, "exit-on-failure"))
g_variant_new ("(sa{sv}as)", interface_name, &builder, NULL),
&error))
g_warning ("Failed to emit PropertiesChanged signal: %s", error->message);
- g_clear_error (&error);
+ g_clear_error (&error);
}
static void
g_variant_new ("(o)", object_path),
&error))
g_warning ("Failed to emit %s signal on %s: %s", signal_name, path, error->message);
- g_clear_error (&error);
+ g_clear_error (&error);
}
static void
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;
- 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)
+ config_sections = get_config_sections (seat_name);
+ for (link = g_list_last (config_sections); link; link = link->prev)
{
- g_debug ("Loading properties from config section %s", config_section);
+ gchar *config_section = link->data;
types = config_get_string_list (config_get_instance (), config_section, "type");
+ if (types)
+ break;
}
+ g_list_free_full (config_sections, g_free);
- if (!types)
- types = config_get_string_list (config_get_instance (), "SeatDefaults", "type");
for (type = types; !seat && type && *type; type++)
seat = seat_new (*type, seat_name);
g_strfreev (types);
if (seat)
{
- set_seat_properties (seat, NULL);
+ set_seat_properties (seat, seat_name);
if (!login1_seat_get_can_multi_session (login1_seat))
{
seat_set_property (seat, "allow-user-switching", "false");
}
- 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);
}
- g_free (config_section);
g_object_unref (seat);
-
+
return started;
}
/*
* Copyright (C) 2013 Canonical Ltd.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
unity_system_compositor_set_command (UnitySystemCompositor *compositor, const gchar *command)
{
g_return_if_fail (compositor != NULL);
+ g_return_if_fail (command != NULL);
+
g_free (compositor->priv->command);
compositor->priv->command = g_strdup (command);
}
gsize n_to_read = 0;
guint16 id, payload_length;
/*guint8 *payload;*/
-
+
if (condition == G_IO_HUP)
{
l_debug (compositor, "Compositor closed communication channel");
return TRUE;
}
-
+
static void
unity_system_compositor_stop (DisplayServer *server)
{
{
UnitySystemCompositor *self;
- self = UNITY_SYSTEM_COMPOSITOR (object);
+ self = UNITY_SYSTEM_COMPOSITOR (object);
if (self->priv->process)
{
close (self->priv->from_compositor_pipe[0]);
close (self->priv->from_compositor_pipe[1]);
g_io_channel_unref (self->priv->from_compositor_channel);
- if (self->priv->from_compositor_watch)
+ if (self->priv->from_compositor_watch)
g_source_remove (self->priv->from_compositor_watch);
g_free (self->priv->read_buffer);
if (self->priv->timeout_source)
test-multi-seat-non-graphical-disabled \
test-multi-seat-change-graphical \
test-multi-seat-change-graphical-disabled \
+ test-multi-seat-globbing-config-sections \
test-mir-autologin \
test-mir-greeter \
test-mir-session \
test-unity-login \
test-unity-switch \
test-unity-plymouth \
+ test-unity-script-hooks \
test-unity-mir-autologin \
test-unity-mir-greeter-x-session \
test-unity-mir-greeter-mir-session \
test-unity-mir-lock-seat \
test-unity-mir-session-x-greeter \
test-unity-mir-switch \
- test-unity-mir-switch-to-user-resettable
+ test-unity-mir-switch-to-user-resettable \
+ test-unity-mir-script-hooks
+# test-mir-script-hooks \
# test-session-exit-error
# test-greeter-no-exit
# test-change-password-gobject
scripts/mir-autologin.conf \
scripts/mir-container-session.conf \
scripts/mir-greeter.conf \
+ scripts/mir-script-hooks.conf \
scripts/mir-session.conf \
scripts/mir-session-compositor-crash.conf \
scripts/mir-session-crash.conf \
scripts/multi-seat-non-graphical-disabled.conf \
scripts/multi-seat-seat0-non-graphical.conf \
scripts/multi-seat-seat0-non-graphical-disabled.conf \
+ scripts/multi-seat-globbing-config-sections.conf \
scripts/no-accounts-service.conf \
scripts/no-config.conf \
scripts/no-console-kit.conf \
scripts/unity-mir-greeter-mir-session.conf \
scripts/unity-mir-lock-seat.conf \
scripts/unity-mir-greeter-x-session.conf \
+ scripts/unity-mir-script-hooks.conf \
scripts/unity-mir-session-x-greeter.conf \
scripts/unity-mir-switch.conf \
scripts/unity-mir-switch-to-user-resettable.conf \
scripts/unity-plymouth.conf \
+ scripts/unity-script-hooks.conf \
scripts/unity-switch.conf \
scripts/upstart-autologin.conf \
scripts/upstart-login.conf \