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
This commit is contained in:
Florian Müllner 2012-05-16 22:56:27 +02:00
parent a9a863aab4
commit 5617f91281

View File

@ -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;