[gnome-flashback] screensaver: stop using CanMultiSession property



commit f9254f5b10fe40de1960b5c58e05cd4f05a42da5
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Sep 4 18:12:56 2020 +0300

    screensaver: stop using CanMultiSession property
    
    All seats supports multiple sessions:
    https://github.com/systemd/systemd/pull/15337
    https://github.com/systemd/systemd/pull/15459
    
    sd_seat_can_multi_session function has been deprecated and always
    returns true with systemd 246 or newer.
    
    Also CanMultiSession property no longer appears in D-Bus
    introspection data. This might have revealed bug somewhere as
    now generated gf_login_seat_gen_get_can_multi_session function
    returns false but property is supposed to be always true.
    
    Above causes user switch button to be hidden. As all seats should
    support multiple session remove can_multi_session check to restore
    user switch button in unlock dialog.

 dbus/Makefile.am                                  |  9 ---
 dbus/org.freedesktop.login1.Seat.xml              | 11 ----
 gnome-flashback/libscreensaver/gf-unlock-dialog.c | 68 -----------------------
 3 files changed, 88 deletions(-)
---
diff --git a/dbus/Makefile.am b/dbus/Makefile.am
index c047a2e6..d1225d35 100644
--- a/dbus/Makefile.am
+++ b/dbus/Makefile.am
@@ -99,12 +99,6 @@ gf-login-manager-gen.c: org.freedesktop.login1.Manager.xml
                --generate-c-code gf-login-manager-gen \
                $(srcdir)/org.freedesktop.login1.Manager.xml
 
-gf-login-seat-gen.h:
-gf-login-seat-gen.c: org.freedesktop.login1.Seat.xml
-       $(AM_V_GEN) $(GDBUS_CODEGEN) --c-namespace Gf \
-               --generate-c-code gf-login-seat-gen \
-               $(srcdir)/org.freedesktop.login1.Seat.xml
-
 gf-login-session-gen.h:
 gf-login-session-gen.c: org.freedesktop.login1.Session.xml
        $(AM_V_GEN) $(GDBUS_CODEGEN) --c-namespace Gf \
@@ -208,8 +202,6 @@ BUILT_SOURCES = \
        gf-input-sources-gen.h \
        gf-login-manager-gen.c \
        gf-login-manager-gen.h \
-       gf-login-seat-gen.c \
-       gf-login-seat-gen.h \
        gf-login-session-gen.c \
        gf-login-session-gen.h \
        gf-nautilus2-gen.c \
@@ -246,7 +238,6 @@ EXTRA_DIST = \
        org.freedesktop.DisplayManager.Seat.xml \
        org.freedesktop.FileManager1.xml \
        org.freedesktop.login1.Manager.xml \
-       org.freedesktop.login1.Seat.xml \
        org.freedesktop.login1.Session.xml \
        org.freedesktop.Notifications.xml \
        org.freedesktop.UPower.Device.xml \
diff --git a/gnome-flashback/libscreensaver/gf-unlock-dialog.c 
b/gnome-flashback/libscreensaver/gf-unlock-dialog.c
index c13380e4..6d4d4113 100644
--- a/gnome-flashback/libscreensaver/gf-unlock-dialog.c
+++ b/gnome-flashback/libscreensaver/gf-unlock-dialog.c
@@ -22,14 +22,11 @@
 
 #include <gdm/gdm-user-switching.h>
 #include <glib/gi18n.h>
-#include <systemd/sd-login.h>
 
 #include "dbus/gf-dm-seat-gen.h"
-#include "dbus/gf-login-seat-gen.h"
 #include "gf-auth.h"
 #include "gf-user-image.h"
 #include "gf-screensaver-enum-types.h"
-#include "gf-screensaver-utils.h"
 
 #define DIALOG_TIMEOUT_MSEC 60000
 #define MAX_FAILURES 5
@@ -41,7 +38,6 @@ struct _GfUnlockDialog
   GCancellable   *cancellable;
 
   GfDmSeatGen    *dm_seat;
-  GfLoginSeatGen *login_seat;
 
   GfAuth         *auth;
 
@@ -412,17 +408,9 @@ update_user_switch_button (GfUnlockDialog *self)
 
   enabled = self->user_switch_enabled;
 
-  /*
-   * CanSwitch might be true even if it is not possible:
-   * 
https://github.com/canonical/lightdm/blob/03f218981733e50d810767f9d04e42ee156f7feb/src/lightdm.c#L411-L416
-   * https://bugs.launchpad.net/bugs/1371250
-   */
   if (enabled && self->dm_seat != NULL)
     enabled = gf_dm_seat_gen_get_can_switch (self->dm_seat);
 
-  if (enabled && self->login_seat != NULL)
-    enabled = gf_login_seat_gen_get_can_multi_session (self->login_seat);
-
   gtk_widget_set_visible (self->switch_button, enabled);
 }
 
@@ -454,33 +442,6 @@ dm_seat_ready_cb (GObject      *object,
   update_user_switch_button (self);
 }
 
-static void
-login_seat_ready_cb (GObject      *object,
-                     GAsyncResult *res,
-                     gpointer      user_data)
-{
-  GError *error;
-  GfLoginSeatGen *seat;
-  GfUnlockDialog *self;
-
-  error = NULL;
-  seat = gf_login_seat_gen_proxy_new_for_bus_finish (res, &error);
-
-  if (error != NULL)
-    {
-      if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
-        g_warning ("%s", error->message);
-
-      g_error_free (error);
-      return;
-    }
-
-  self = GF_UNLOCK_DIALOG (user_data);
-  self->login_seat = seat;
-
-  update_user_switch_button (self);
-}
-
 static void
 switch_button_clicked_cb (GtkButton      *button,
                           GfUnlockDialog *self)
@@ -816,7 +777,6 @@ gf_unlock_dialog_dispose (GObject *object)
   g_clear_object (&self->cancellable);
 
   g_clear_object (&self->dm_seat);
-  g_clear_object (&self->login_seat);
 
   if (self->auth != NULL)
     {
@@ -928,7 +888,6 @@ static void
 gf_unlock_dialog_init (GfUnlockDialog *self)
 {
   const gchar *xdg_seat_path;
-  char *session_id;
   GtkStyleContext *style;
   GtkWidget *frame;
   GtkWidget *vbox;
@@ -949,33 +908,6 @@ gf_unlock_dialog_init (GfUnlockDialog *self)
                                         self);
     }
 
-  session_id = NULL;
-  if (gf_find_systemd_session (&session_id))
-    {
-      char *seat;
-
-      seat = NULL;
-      if (sd_session_get_seat (session_id, &seat) >= 0)
-        {
-          char *seat_path;
-
-          seat_path = g_strdup_printf ("/org/freedesktop/login1/seat/%s", seat);
-          free (seat);
-
-          gf_login_seat_gen_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
-                                               G_DBUS_PROXY_FLAGS_NONE,
-                                               "org.freedesktop.login1",
-                                               seat_path,
-                                               self->cancellable,
-                                               login_seat_ready_cb,
-                                               self);
-
-          g_free (seat_path);
-        }
-
-      g_free (session_id);
-    }
-
   gtk_widget_set_size_request (GTK_WIDGET (self), 450, -1);
 
   style = gtk_widget_get_style_context (GTK_WIDGET (self));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]