[gnome-session/wip/laney/systemd-user: 4/6] Allow RequiredComponents to be skipped
- From: Iain Lane <iainl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session/wip/laney/systemd-user: 4/6] Allow RequiredComponents to be skipped
- Date: Mon, 29 Oct 2018 12:10:45 +0000 (UTC)
commit 7e4f40174e3cc59a04e6a4c99f2cf9c8a54d307a
Author: Iain Lane <iainl gnome org>
Date: Wed Jul 4 11:59:45 2018 +0100
Allow RequiredComponents to be skipped
We can have a softer transition: if we do this then the .session files
don't need modifying.
gnome-session/gsm-session-fill.c | 29 ++++++++++++++++++-----------
gnome-session/gsm-session-fill.h | 3 ++-
gnome-session/main.c | 4 +++-
3 files changed, 23 insertions(+), 13 deletions(-)
---
diff --git a/gnome-session/gsm-session-fill.c b/gnome-session/gsm-session-fill.c
index af203bbc..4302c102 100644
--- a/gnome-session/gsm-session-fill.c
+++ b/gnome-session/gsm-session-fill.c
@@ -130,12 +130,17 @@ append_required_components_helper (const char *component,
static void
load_standard_apps (GsmManager *manager,
- GKeyFile *keyfile)
+ GKeyFile *keyfile,
+ gboolean ignore_required_components)
{
- g_debug ("fill: *** Adding required components");
- handle_required_components (keyfile, !gsm_manager_get_failsafe (manager),
- append_required_components_helper, manager);
- g_debug ("fill: *** Done adding required components");
+ if (!ignore_required_components) {
+ g_debug ("fill: *** Adding required components");
+ handle_required_components (keyfile, !gsm_manager_get_failsafe (manager),
+ append_required_components_helper, manager);
+ g_debug ("fill: *** Done adding required components");
+ } else {
+ g_debug ("file: *** Ignoring required components as requested");
+ }
if (!gsm_manager_get_failsafe (manager)) {
char **autostart_dirs;
@@ -246,7 +251,8 @@ find_valid_session_keyfile (const char *session)
static GKeyFile *
get_session_keyfile (const char *session,
char **actual_session,
- gboolean *is_fallback)
+ gboolean *is_fallback,
+ gboolean ignore_required_components)
{
GKeyFile *keyfile;
gboolean session_runnable;
@@ -278,7 +284,7 @@ get_session_keyfile (const char *session,
}
g_free (value);
- if (session_runnable) {
+ if (session_runnable && !ignore_required_components) {
session_runnable = check_required (keyfile);
}
@@ -302,7 +308,7 @@ get_session_keyfile (const char *session,
if (!IS_STRING_EMPTY (value)) {
if (is_fallback)
*is_fallback = TRUE;
- keyfile = get_session_keyfile (value, actual_session, NULL);
+ keyfile = get_session_keyfile (value, actual_session, NULL, ignore_required_components);
}
g_free (value);
@@ -311,13 +317,14 @@ get_session_keyfile (const char *session,
gboolean
gsm_session_fill (GsmManager *manager,
- const char *session)
+ const char *session,
+ gboolean ignore_required_components)
{
GKeyFile *keyfile;
gboolean is_fallback;
char *actual_session;
- keyfile = get_session_keyfile (session, &actual_session, &is_fallback);
+ keyfile = get_session_keyfile (session, &actual_session, &is_fallback, ignore_required_components);
if (!keyfile)
return FALSE;
@@ -326,7 +333,7 @@ gsm_session_fill (GsmManager *manager,
g_free (actual_session);
- load_standard_apps (manager, keyfile);
+ load_standard_apps (manager, keyfile, ignore_required_components);
g_key_file_free (keyfile);
diff --git a/gnome-session/gsm-session-fill.h b/gnome-session/gsm-session-fill.h
index 470a441f..e81fd9d1 100644
--- a/gnome-session/gsm-session-fill.h
+++ b/gnome-session/gsm-session-fill.h
@@ -25,7 +25,8 @@
G_BEGIN_DECLS
gboolean gsm_session_fill (GsmManager *manager,
- const char *session);
+ const char *session,
+ gboolean ignore_required_components);
G_END_DECLS
diff --git a/gnome-session/main.c b/gnome-session/main.c
index da1ae7d9..2e0b950a 100644
--- a/gnome-session/main.c
+++ b/gnome-session/main.c
@@ -53,6 +53,7 @@ static gboolean debug = FALSE;
static gboolean please_fail = FALSE;
static gboolean disable_acceleration_check = FALSE;
static const char *session_name = NULL;
+static gboolean ignore_required_components = FALSE;
static GsmManager *manager = NULL;
static char *gl_renderer = NULL;
@@ -149,7 +150,7 @@ create_manager (void)
session_name = _gsm_manager_get_default_session (manager);
}
- if (!gsm_session_fill (manager, session_name)) {
+ if (!gsm_session_fill (manager, session_name, ignore_required_components)) {
gsm_fail_whale_dialog_we_failed (FALSE, TRUE, NULL);
}
@@ -278,6 +279,7 @@ main (int argc, char **argv)
static GOptionEntry entries[] = {
{ "autostart", 'a', 0, G_OPTION_ARG_STRING_ARRAY, &override_autostart_dirs, N_("Override
standard autostart directories"), N_("AUTOSTART_DIR") },
{ "session", 0, 0, G_OPTION_ARG_STRING, &opt_session_name, N_("Session to use"),
N_("SESSION_NAME") },
+ { "ignore-required-components", 0, 0, G_OPTION_ARG_NONE, &ignore_required_components,
N_("Ignore RequiredComponents in the .session file"), NULL },
{ "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL },
{ "failsafe", 'f', 0, G_OPTION_ARG_NONE, &failsafe, N_("Do not load user-specified
applications"), NULL },
{ "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Version of this application"), NULL
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]