summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2014-09-03 17:21:46 +1200
committerRobert Ancell <robert.ancell@canonical.com>2014-09-03 17:21:46 +1200
commit443a3d8c1ff66a9bca1c73f08818b0288fb5af53 (patch)
treea89ea9c079c3db0839d286897a9b7e54f266116b /src
parent0dce92703e16ec3c84d0153c1b655147b15473b1 (diff)
downloadlightdm-443a3d8c1ff66a9bca1c73f08818b0288fb5af53.tar.gz
Revert globbing changes - there are problems with it
Diffstat (limited to 'src')
-rw-r--r--src/lightdm.c57
1 files changed, 22 insertions, 35 deletions
diff --git a/src/lightdm.c b/src/lightdm.c
index 2b2b1458..3193008b 100644
--- a/src/lightdm.c
+++ b/src/lightdm.c
@@ -145,27 +145,6 @@ log_init (void)
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)
{
@@ -242,13 +221,11 @@ display_manager_seat_removed_cb (DisplayManager *display_manager, Seat *seat)
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"))
@@ -961,18 +938,29 @@ static gboolean
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");
}
@@ -993,8 +981,8 @@ add_login1_seat (Login1Seat *login1_seat)
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");
@@ -1009,8 +997,7 @@ add_login1_seat (Login1Seat *login1_seat)
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;