← Back to team overview

ubuntu-multiseat team mailing list archive

[Merge] lp:~ubuntu-multiseat/lightdm/remove-remaining-xdg-seat-stuff into lp:lightdm

 

Laércio de Sousa has proposed merging lp:~ubuntu-multiseat/lightdm/remove-remaining-xdg-seat-stuff into lp:lightdm.

Requested reviews:
  LightDM Development Team (lightdm-team)

For more details, see:
https://code.launchpad.net/~ubuntu-multiseat/lightdm/remove-remaining-xdg-seat-stuff/+merge/232572

Remove remaining xdg-seat test files.
-- 
https://code.launchpad.net/~ubuntu-multiseat/lightdm/remove-remaining-xdg-seat-stuff/+merge/232572
Your team Ubuntu Multiseat is subscribed to branch lp:~ubuntu-multiseat/lightdm/remove-remaining-xdg-seat-stuff.
=== modified file 'src/lightdm.c'
--- src/lightdm.c	2014-08-28 00:11:30 +0000
+++ src/lightdm.c	2014-08-28 14:22:47 +0000
@@ -145,6 +145,40 @@
     g_free (path);
 }
 
+static gchar*
+get_config_section (const gchar *seat_name)
+{
+    gchar **groups, **i;
+    gchar *config_section = NULL;
+
+    groups = config_get_groups (config_get_instance ());
+    for (i = groups; !config_section && *i; i++)
+    {
+        if (g_str_has_prefix (*i, "Seat:"))
+        {
+            const gchar *seat_name_suffix = *i + strlen ("Seat:");
+            gchar *seat_name_globbing;
+            gboolean matches;
+
+            if (g_str_has_suffix (seat_name_suffix, "*"))
+                seat_name_globbing = g_strndup (seat_name_suffix, strlen (seat_name_suffix) - 1);
+            else
+                seat_name_globbing = g_strdup (seat_name_suffix);
+            
+            matches = g_str_has_prefix (seat_name, seat_name_globbing);
+            g_free (seat_name_globbing);
+
+            if (matches)
+            {
+                config_section = g_strdup (*i);
+                break;
+            }
+        }
+    }
+    g_strfreev (groups);
+    return config_section;
+}
+
 static void
 set_seat_properties (Seat *seat, const gchar *config_section)
 {
@@ -223,7 +257,7 @@
     {
         gchar *config_section;
 
-        config_section = g_strdup_printf ("Seat:%s", seat_get_name (seat));
+        config_section = get_config_section (seat_get_name (seat));
         set_seat_properties (next_seat, config_section);
         g_free (config_section);
 
@@ -938,27 +972,15 @@
 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;
+    gchar *config_section;
     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);
-
+    config_section = get_config_section (seat_name);
     if (config_section)
     {
         g_debug ("Loading properties from config section %s", config_section);

=== removed file 'tests/test-unity-xdg-seat'
--- tests/test-unity-xdg-seat	2013-08-27 08:16:43 +0000
+++ tests/test-unity-xdg-seat	1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
-#!/bin/sh
-./src/dbus-env ./src/test-runner unity-xdg-seat test-gobject-greeter

=== removed file 'tests/test-xdg-seat'
--- tests/test-xdg-seat	2013-08-27 08:16:43 +0000
+++ tests/test-xdg-seat	1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
-#!/bin/sh
-./src/dbus-env ./src/test-runner xdg-seat test-gobject-greeter