]> rtime.felk.cvut.cz Git - sojka/lightdm.git/commitdiff
Collects all globbing config sections that match a given seat name, not only the...
authorLaércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
Thu, 28 Aug 2014 12:58:18 +0000 (09:58 -0300)
committerLaércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
Thu, 28 Aug 2014 12:58:18 +0000 (09:58 -0300)
src/lightdm.c

index b4bcddbeb3ac102d5aa9a23527bd7613c06bef69..16a9ff6eeb4b3a4692a17b83eb0e4c2afac24dd1 100644 (file)
@@ -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;