]> rtime.felk.cvut.cz Git - sojka/lightdm.git/commitdiff
Remove old manual way of creating seats. The xdg-seat option and the AddSeat() D...
authorRobert Ancell <robert.ancell@canonical.com>
Wed, 27 Aug 2014 03:44:23 +0000 (15:44 +1200)
committerRobert Ancell <robert.ancell@canonical.com>
Wed, 27 Aug 2014 03:44:23 +0000 (15:44 +1200)
data/lightdm.conf
src/lightdm.c
src/seat.c
src/seat.h

index 6bc0a0b50291a98e03f4aeba7045a4a11e4efbb3..d85f06d6822d252beb60eb7d31704e834939dad1 100644 (file)
@@ -34,7 +34,6 @@
 # Seat defaults
 #
 # type = Seat type (xlocal, xremote)
-# xdg-seat = Seat name to set pam_systemd XDG_SEAT variable and name to pass to X server
 # pam-service = PAM service to use for login
 # pam-autologin-service = PAM service to use for autologin
 # pam-greeter-service = PAM service to use for greeters
@@ -76,7 +75,6 @@
 #
 [SeatDefaults]
 #type=xlocal
-#xdg-seat=seat0
 #pam-service=lightdm
 #pam-autologin-service=lightdm-autologin
 #pam-greeter-service=lightdm-greeter
index ad71d473ddbb8c6666f533055004710c642eaea4..876036ff2a996c6937a377f22c114719116b6c2c 100644 (file)
@@ -207,7 +207,7 @@ display_manager_seat_removed_cb (DisplayManager *display_manager, Seat *seat)
 
         if (!next_seat)
         {
-            next_seat = seat_new (*iter);
+            next_seat = seat_new (*iter, seat_get_name (seat));
             g_string_assign (next_types, *iter);
         }
         else
@@ -221,12 +221,9 @@ display_manager_seat_removed_cb (DisplayManager *display_manager, Seat *seat)
 
     if (next_seat)
     {
-        const gchar *seat_name;
-        gchar *config_section = NULL;
+        gchar *config_section;
 
-        seat_name = seat_get_string_property (seat, "seat-name");
-        if (seat_name)
-            config_section = g_strdup_printf ("Seat:%s", seat_name);
+        config_section = g_strdup_printf ("Seat:%s", seat_get_name (seat));
         set_seat_properties (next_seat, config_section);
         g_free (config_section);
 
@@ -315,49 +312,7 @@ handle_display_manager_call (GDBusConnection       *connection,
                              gpointer               user_data)
 {
     if (g_strcmp0 (method_name, "AddSeat") == 0)
-    {
-        gchar *type;
-        GVariantIter *property_iter;
-        gchar *name, *value;
-        Seat *seat;
-
-        if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(sa(ss))")))
-        {
-            g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "Invalid arguments");
-            return;
-        }
-
-        g_variant_get (parameters, "(&sa(ss))", &type, &property_iter);
-
-        g_debug ("Adding seat of type %s", type);
-
-        seat = seat_new (type);
-        if (seat)
-        {
-            set_seat_properties (seat, NULL);
-            while (g_variant_iter_loop (property_iter, "(&s&s)", &name, &value))
-                seat_set_property (seat, name, value);
-        }
-        g_variant_iter_free (property_iter);
-
-        if (!seat)
-        {
-            // FIXME: Need to make proper error
-            g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "Unable to create seat of type %s", type);
-            return;
-        }
-
-        if (display_manager_add_seat (display_manager, seat))
-        {
-            SeatBusEntry *entry;
-
-            entry = g_hash_table_lookup (seat_bus_entries, seat);
-            g_dbus_method_invocation_return_value (invocation, g_variant_new ("(o)", entry->path));
-        }
-        else// FIXME: Need to make proper error
-            g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "Failed to start seat");
-        g_object_unref (seat);
-    }
+        g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "AddSeat is deprecated");
     else if (g_strcmp0 (method_name, "AddLocalXSeat") == 0)
     {
         gint display_number;
@@ -373,7 +328,7 @@ handle_display_manager_call (GDBusConnection       *connection,
 
         g_debug ("Adding local X seat :%d", display_number);
 
-        seat = seat_new ("xremote");
+        seat = seat_new ("xremote", "xremote0"); // FIXME: What to use for a name?
         if (seat)
         {
             gchar *display_number_string;
@@ -1013,7 +968,7 @@ add_login1_seat (Login1Seat *login1_seat)
     if (!types)
         types = config_get_string_list (config_get_instance (), "SeatDefaults", "type");
     for (type = types; !seat && type && *type; type++)
-        seat = seat_new (*type);
+        seat = seat_new (*type, seat_name);
     g_strfreev (types);
 
     if (seat)
@@ -1029,9 +984,6 @@ add_login1_seat (Login1Seat *login1_seat)
         if (config_section)
             set_seat_properties (seat, config_section);
 
-        seat_set_property (seat, "seat-name", seat_name);
-        seat_set_property (seat, "xdg-seat", seat_name);
-
         if (is_seat0)
             seat_set_property (seat, "exit-on-failure", "true");
     }
@@ -1074,7 +1026,7 @@ main (int argc, char **argv)
     FILE *pid_file;
     GOptionContext *option_context;
     gboolean result;
-    gchar **groups, **i, *dir;
+    gchar *dir;
     gboolean test_mode = FALSE;
     gchar *pid_path = "/var/run/lightdm.pid";
     gchar *log_dir = NULL;
@@ -1419,51 +1371,7 @@ main (int argc, char **argv)
     }
     else
     {
-        gint n_seats = 0;
-
-        /* Load the static display entries */
-        groups = config_get_groups (config_get_instance ());
-        for (i = groups; *i; i++)
-        {
-            gchar *config_section = *i;
-            gchar **types;
-            gchar **type;
-            Seat *seat = NULL;
-            const gchar *const seatpfx = "Seat:";
-
-            if (!g_str_has_prefix (config_section, seatpfx))
-                continue;
-
-            g_debug ("Loading seat %s", config_section);
-            types = config_get_string_list (config_get_instance (), config_section, "type");
-            if (!types)
-                types = config_get_string_list (config_get_instance (), "SeatDefaults", "type");
-            for (type = types; type && *type; type++)
-            {
-                seat = seat_new (*type);
-                if (seat)
-                    break;
-            }
-            g_strfreev (types);
-
-            if (seat)
-            {
-                gchar *seat_name = config_section + strlen (seatpfx);
-
-                seat_set_property (seat, "seat-name", seat_name);
-
-                set_seat_properties (seat, config_section);
-                display_manager_add_seat (display_manager, seat);
-                g_object_unref (seat);
-                n_seats++;
-            }
-            else
-                g_warning ("Failed to create seat %s", config_section);
-        }
-        g_strfreev (groups);
-
-        /* If no seats start a default one */
-        if (n_seats == 0 && config_get_boolean (config_get_instance (), "LightDM", "start-default-seat"))
+        if (config_get_boolean (config_get_instance (), "LightDM", "start-default-seat"))
         {
             gchar **types;
             gchar **type;
@@ -1474,7 +1382,7 @@ main (int argc, char **argv)
             types = config_get_string_list (config_get_instance (), "SeatDefaults", "type");
             for (type = types; type && *type; type++)
             {
-                seat = seat_new (*type);
+                seat = seat_new (*type, "seat0");
                 if (seat)
                     break;
             }
index cca8e6f2549ef72e50065a4667bdf625e1b404ef..c115aa18a597eb8f9bf086e53f2ac5b50dd636fb 100644 (file)
@@ -30,6 +30,9 @@ static guint signals[LAST_SIGNAL] = { 0 };
 
 struct SeatPrivate
 {
+    /* XDG name for this seat */
+    gchar *name;
+
     /* Configuration for this seat */
     GHashTable *properties;
 
@@ -99,7 +102,7 @@ seat_register_module (const gchar *name, GType type)
 }
 
 Seat *
-seat_new (const gchar *module_name)
+seat_new (const gchar *module_name, const gchar *name)
 {
     Seat *seat;
     SeatModule *m = NULL;
@@ -112,6 +115,7 @@ seat_new (const gchar *module_name)
         return NULL;
 
     seat = g_object_new (m->type, NULL);
+    seat->priv->name = g_strdup (name);
 
     return seat;
 }
@@ -155,13 +159,7 @@ seat_get_integer_property (Seat *seat, const gchar *name)
 const gchar *
 seat_get_name (Seat *seat)
 {
-    const gchar *name;
-
-    name = seat_get_string_property (seat, "xdg-seat");
-    if (name)
-        return name;
-
-    return "seat0";
+    return seat->priv->name;
 }
 
 void
@@ -1792,6 +1790,7 @@ seat_finalize (GObject *object)
 
     self = SEAT (object);
 
+    g_free (self->priv->name);
     g_hash_table_unref (self->priv->properties);
     for (link = self->priv->display_servers; link; link = link->next)
     {
@@ -1871,12 +1870,7 @@ seat_class_init (SeatClass *klass)
 static gint
 seat_real_logprefix (Logger *self, gchar *buf, gulong buflen)
 {
-    Seat *seat = SEAT (self);
-    const gchar *name = seat_get_string_property (seat, "seat-name");
-    if (name)
-        return g_snprintf (buf, buflen, "Seat %s: ", name);
-    else
-        return g_snprintf (buf, buflen, "Seat: ");
+    return g_snprintf (buf, buflen, "Seat %s: ", SEAT (self)->priv->name);
 }
 
 static void
index faa4a0a4254203f68c78436d1e7c7846fa4907fd..ef9c8cb0a111e43f435e10e7b19feb01c5063076 100644 (file)
@@ -60,7 +60,7 @@ GType seat_get_type (void);
 
 void seat_register_module (const gchar *name, GType type);
 
-Seat *seat_new (const gchar *module_name);
+Seat *seat_new (const gchar *module_name, const gchar *name);
 
 void seat_set_property (Seat *seat, const gchar *name, const gchar *value);