diff options
author | Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br> | 2014-08-28 09:58:18 -0300 |
---|---|---|
committer | Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br> | 2014-08-28 09:58:18 -0300 |
commit | d50b2d611db462b0d78d0b1de50aa09108abe7bc (patch) | |
tree | eca9adedf2f579e7d9e62aed58cde90985476290 /src/lightdm.c | |
parent | 8103e2213dca53be93acfef5f8052c64613b544c (diff) | |
download | lightdm-d50b2d611db462b0d78d0b1de50aa09108abe7bc.tar.gz |
Collects all globbing config sections that match a given seat name, not only the first one.
Diffstat (limited to 'src/lightdm.c')
-rw-r--r-- | src/lightdm.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/src/lightdm.c b/src/lightdm.c index b4bcddbe..16a9ff6e 100644 --- a/src/lightdm.c +++ b/src/lightdm.c @@ -145,27 +145,24 @@ log_init (void) g_free (path); } -static gchar* -get_config_section (const gchar *seat_name) +static GList* +get_config_sections (const gchar *seat_name) { gchar **groups, **i; - gchar *config_section = NULL; + GList *config_sections = NULL; groups = config_get_groups (config_get_instance ()); - for (i = groups; !config_section && *i; i++) + 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_section = g_strdup (*i); - break; - } + config_sections = g_list_append (config_sections, g_strdup (*i)); } } g_strfreev (groups); - return config_section; + return config_sections; } static void @@ -244,11 +241,12 @@ display_manager_seat_removed_cb (DisplayManager *display_manager, Seat *seat) if (next_seat) { - gchar *config_section; + GList *config_sections, *link; - config_section = get_config_section (seat_get_name (seat)); - set_seat_properties (next_seat, config_section); - g_free (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); + g_list_free_full (config_sections, g_free); // We set this manually on default seat. Let's port it over if needed. if (seat_get_boolean_property (seat, "exit-on-failure")) @@ -962,16 +960,17 @@ add_login1_seat (Login1Seat *login1_seat) { const gchar *seat_name = login1_seat_get_id (login1_seat); gchar **types = NULL, **type; - gchar *config_section; + 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_section = get_config_section (seat_name); - if (config_section) + config_sections = get_config_sections (seat_name); + for (link = config_sections; link; link = link->next) { + 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"); } @@ -992,8 +991,8 @@ add_login1_seat (Login1Seat *login1_seat) seat_set_property (seat, "allow-user-switching", "false"); } - if (config_section) - set_seat_properties (seat, config_section); + for (link = config_sections; link; link = link->next) + set_seat_properties (seat, (gchar*) link->data); if (is_seat0) seat_set_property (seat, "exit-on-failure", "true"); @@ -1008,7 +1007,7 @@ add_login1_seat (Login1Seat *login1_seat) g_debug ("Failed to start seat: %s", seat_name); } - g_free (config_section); + g_list_free_full (config_sections, g_free); g_object_unref (seat); return started; |