[gnome-session/wip/benzea/systemd-user-switch: 15/15] system: Remove is_last_session API as it is unused



commit 2cd25cd38c2ecb82186e011dcfb0bc9db2a39c5f
Author: Benjamin Berg <bberg redhat com>
Date:   Wed Apr 17 11:15:00 2019 +0200

    system: Remove is_last_session API as it is unused
    
    We cannot support multiple graphical sessions for one user and the API
    is now unsed. Remove it.

 gnome-session/gsm-consolekit.c |  7 -----
 gnome-session/gsm-system.c     |  7 -----
 gnome-session/gsm-system.h     |  3 ---
 gnome-session/gsm-systemd.c    | 61 ------------------------------------------
 4 files changed, 78 deletions(-)
---
diff --git a/gnome-session/gsm-consolekit.c b/gnome-session/gsm-consolekit.c
index 44ee25f9..d3da33ab 100644
--- a/gnome-session/gsm-consolekit.c
+++ b/gnome-session/gsm-consolekit.c
@@ -885,12 +885,6 @@ gsm_consolekit_complete_shutdown (GsmSystem *system)
         drop_delay_inhibitor (consolekit);
 }
 
-static gboolean
-gsm_consolekit_is_last_session_for_user (GsmSystem *system)
-{
-        return FALSE;
-}
-
 static void
 gsm_consolekit_system_init (GsmSystemInterface *iface)
 {
@@ -909,7 +903,6 @@ gsm_consolekit_system_init (GsmSystemInterface *iface)
         iface->remove_inhibitor = gsm_consolekit_remove_inhibitor;
         iface->prepare_shutdown = gsm_consolekit_prepare_shutdown;
         iface->complete_shutdown = gsm_consolekit_complete_shutdown;
-        iface->is_last_session_for_user = gsm_consolekit_is_last_session_for_user;
 }
 
 GsmConsolekit *
diff --git a/gnome-session/gsm-system.c b/gnome-session/gsm-system.c
index 4ce20c1d..929a52d4 100644
--- a/gnome-session/gsm-system.c
+++ b/gnome-session/gsm-system.c
@@ -99,7 +99,6 @@ gsm_system_null_init_iface (GsmSystemInterface *iface)
         iface->remove_inhibitor  = (void *) do_nothing;
         iface->prepare_shutdown  = (void *) do_nothing;
         iface->complete_shutdown = (void *) do_nothing;
-        iface->is_last_session_for_user = (void *) return_false;
 }
 
 static void
@@ -234,12 +233,6 @@ gsm_system_is_login_session (GsmSystem *system)
         return GSM_SYSTEM_GET_IFACE (system)->is_login_session (system);
 }
 
-gboolean
-gsm_system_is_last_session_for_user (GsmSystem *system)
-{
-        return GSM_SYSTEM_GET_IFACE (system)->is_last_session_for_user (system);
-}
-
 /**
  * gsm_system_is_active:
  *
diff --git a/gnome-session/gsm-system.h b/gnome-session/gsm-system.h
index b25ee61a..95226e0a 100644
--- a/gnome-session/gsm-system.h
+++ b/gnome-session/gsm-system.h
@@ -73,7 +73,6 @@ struct _GsmSystemInterface
         void     (* prepare_shutdown) (GsmSystem   *system,
                                        gboolean     restart);
         void     (* complete_shutdown)(GsmSystem   *system);
-        gboolean (* is_last_session_for_user) (GsmSystem *system);
 };
 
 enum _GsmSystemError {
@@ -115,8 +114,6 @@ void       gsm_system_set_session_idle (GsmSystem *system,
 
 gboolean   gsm_system_is_login_session (GsmSystem *system);
 
-gboolean   gsm_system_is_last_session_for_user (GsmSystem *system);
-
 gboolean   gsm_system_is_active        (GsmSystem *system);
 
 void       gsm_system_add_inhibitor    (GsmSystem        *system,
diff --git a/gnome-session/gsm-systemd.c b/gnome-session/gsm-systemd.c
index 6ac6c9bf..086335b0 100644
--- a/gnome-session/gsm-systemd.c
+++ b/gnome-session/gsm-systemd.c
@@ -1050,66 +1050,6 @@ gsm_systemd_complete_shutdown (GsmSystem *system)
         drop_delay_inhibitor (systemd);
 }
 
-static gboolean
-gsm_systemd_is_last_session_for_user (GsmSystem *system)
-{
-        char **sessions = NULL;
-        char *session = NULL;
-        gboolean is_last_session;
-        int ret, i;
-
-        if (!gsm_systemd_find_session (&session)) {
-                return FALSE;
-        }
-
-        ret = sd_uid_get_sessions (getuid (), FALSE, &sessions);
-
-        if (ret <= 0) {
-                free (session);
-                return FALSE;
-        }
-
-        is_last_session = TRUE;
-        for (i = 0; sessions[i]; i++) {
-                char *state = NULL;
-                char *type = NULL;
-
-                if (g_strcmp0 (sessions[i], session) == 0)
-                        continue;
-
-                ret = sd_session_get_state (sessions[i], &state);
-
-                if (ret != 0)
-                        continue;
-
-                if (g_strcmp0 (state, "closing") == 0) {
-                        free (state);
-                        continue;
-                }
-                free (state);
-
-                ret = sd_session_get_type (sessions[i], &type);
-
-                if (ret != 0)
-                        continue;
-
-                if (g_strcmp0 (type, "x11") != 0 &&
-                    g_strcmp0 (type, "wayland") != 0) {
-                        free (type);
-                        continue;
-                }
-
-                is_last_session = FALSE;
-        }
-
-        for (i = 0; sessions[i]; i++)
-                free (sessions[i]);
-        free (sessions);
-        free (session);
-
-        return is_last_session;
-}
-
 static void
 gsm_systemd_system_init (GsmSystemInterface *iface)
 {
@@ -1130,7 +1070,6 @@ gsm_systemd_system_init (GsmSystemInterface *iface)
         iface->remove_inhibitor = gsm_systemd_remove_inhibitor;
         iface->prepare_shutdown = gsm_systemd_prepare_shutdown;
         iface->complete_shutdown = gsm_systemd_complete_shutdown;
-        iface->is_last_session_for_user = gsm_systemd_is_last_session_for_user;
 }
 
 GsmSystemd *


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