[gnome-session/wip/benzea/systemd-user-switch: 8/15] manager: Allow fetching the configured session without manager
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session/wip/benzea/systemd-user-switch: 8/15] manager: Allow fetching the configured session without manager
- Date: Fri, 19 Apr 2019 23:55:14 +0000 (UTC)
commit 70ef7c5aafd048b6c0e8eee24848fd46dca4c48f
Author: Benjamin Berg <bberg redhat com>
Date: Sat Apr 20 01:14:31 2019 +0200
manager: Allow fetching the configured session without manager
When starting on systemd we need to know the session to start for the
target name. However, we don't need anything else from the manager, so
allow calling the function with NULL.
gnome-session/gsm-manager.c | 10 ++++++++--
gnome-session/gsm-manager.h | 2 +-
2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index b364486f..79c0e4d5 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -1457,10 +1457,16 @@ gsm_manager_start (GsmManager *manager)
start_phase (manager);
}
-const char *
+char *
_gsm_manager_get_default_session (GsmManager *manager)
{
- return g_settings_get_string (manager->priv->session_settings,
+ g_autoptr(GSettings) session_settings = NULL;
+
+ if (manager)
+ session_settings = g_object_ref (manager->priv->session_settings);
+ else
+ session_settings = g_settings_new (SESSION_SCHEMA);
+ return g_settings_get_string (session_settings,
KEY_SESSION_NAME);
}
diff --git a/gnome-session/gsm-manager.h b/gnome-session/gsm-manager.h
index 9ac09e77..3ce4350f 100644
--- a/gnome-session/gsm-manager.h
+++ b/gnome-session/gsm-manager.h
@@ -116,7 +116,7 @@ gboolean gsm_manager_add_legacy_session_apps (GsmManager *
void gsm_manager_start (GsmManager *manager);
-const char * _gsm_manager_get_default_session (GsmManager *manager);
+char * _gsm_manager_get_default_session (GsmManager *manager);
void _gsm_manager_set_active_session (GsmManager *manager,
const char *session_name,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]