From 5617f91281c5356d6814c9b5203ae551fc1c6926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 16 May 2012 22:56:27 +0200 Subject: [PATCH] main: Add generic --mode switch We are going to need "special" modes other than GDM, for instance for the initial setup[0]. Rather than adding one command line switch per mode (and logic to deal with multiple switches being given at the same time), add a generic --mode switch to specify the mode as string. [0] https://live.gnome.org/GnomeOS/Design/Whiteboards/InitialSetup https://bugzilla.gnome.org/show_bug.cgi?id=676156 --- src/main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 5b8bf818c..b19ff2963 100644 --- a/src/main.c +++ b/src/main.c @@ -36,6 +36,7 @@ extern GType gnome_shell_plugin_get_type (void); #define OVERRIDES_SCHEMA "org.gnome.shell.overrides" static gboolean is_gdm_mode = FALSE; +static char *session_mode = NULL; #define DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1 #define DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER 4 @@ -257,11 +258,17 @@ GOptionEntry gnome_shell_options[] = { NULL }, { - "gdm-mode", 0, 0, G_OPTION_ARG_NONE, + "gdm-mode", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &is_gdm_mode, N_("Mode used by GDM for login screen"), NULL }, + { + "mode", 0, 0, G_OPTION_ARG_STRING, + &session_mode, + N_("Use a specific mode, e.g. \"gdm\" for login screen"), + "MODE" + }, { NULL } }; @@ -324,7 +331,9 @@ main (int argc, char **argv) g_log_set_default_handler (default_log_handler, sender); /* Initialize the global object */ - if (is_gdm_mode) + if (g_strcmp0 (session_mode, "gdm") == 0) + session_type = SHELL_SESSION_GDM; + else if (is_gdm_mode) session_type = SHELL_SESSION_GDM; else session_type = SHELL_SESSION_USER;