global: Allow overriding the override schema

This commit is contained in:
Florian Müllner 2017-10-11 00:36:18 +02:00 committed by Ray Strode
parent e11404d1cf
commit d376b829b4
2 changed files with 29 additions and 2 deletions

View File

@ -38,6 +38,7 @@ extern GType gnome_shell_plugin_get_type (void);
static gboolean is_gdm_mode = FALSE;
static char *session_mode = NULL;
static char *override_schema = NULL;
static int caught_signal = 0;
#define DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1
@ -450,6 +451,12 @@ GOptionEntry gnome_shell_options[] = {
N_("List possible modes"),
NULL
},
{
"override-schema", 0, 0, G_OPTION_ARG_STRING,
&override_schema,
N_("Override the override schema"),
"SCHEMA"
},
{ NULL }
};
@ -507,7 +514,9 @@ main (int argc, char **argv)
if (session_mode == NULL)
session_mode = is_gdm_mode ? (char *)"gdm" : (char *)"user";
_shell_global_init ("session-mode", session_mode, NULL);
_shell_global_init ("session-mode", session_mode,
"override-schema", override_schema,
NULL);
shell_prefs_init ();

View File

@ -65,6 +65,7 @@ struct _ShellGlobal {
MetaScreen *meta_screen;
char *session_mode;
char *override_schema;
XserverRegion input_region;
@ -96,6 +97,7 @@ enum {
PROP_0,
PROP_SESSION_MODE,
PROP_OVERRIDE_SCHEMA,
PROP_SCREEN,
PROP_DISPLAY,
PROP_SCREEN_WIDTH,
@ -138,6 +140,10 @@ shell_global_set_property(GObject *object,
g_clear_pointer (&global->session_mode, g_free);
global->session_mode = g_ascii_strdown (g_value_get_string (value), -1);
break;
case PROP_OVERRIDE_SCHEMA:
g_clear_pointer (&global->override_schema, g_free);
global->override_schema = g_value_dup_string (value);
break;
case PROP_FRAME_TIMESTAMPS:
global->frame_timestamps = g_value_get_boolean (value);
break;
@ -163,6 +169,9 @@ shell_global_get_property(GObject *object,
case PROP_SESSION_MODE:
g_value_set_string (value, shell_global_get_session_mode (global));
break;
case PROP_OVERRIDE_SCHEMA:
g_value_set_string (value, global->override_schema);
break;
case PROP_SCREEN:
g_value_set_object (value, global->meta_screen);
break;
@ -368,6 +377,13 @@ shell_global_class_init (ShellGlobalClass *klass)
g_param_spec_string ("session-mode",
"Session Mode",
"The session mode to use",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class,
PROP_OVERRIDE_SCHEMA,
g_param_spec_string ("override-schema",
"Override Schema",
"The override schema to use",
"user",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class,
@ -1360,7 +1376,9 @@ shell_global_get_overrides_settings (ShellGlobal *global)
if (!settings)
{
if (strcmp (global->session_mode, "classic") == 0)
if (global->override_schema != NULL)
schema = global->override_schema;
else if (strcmp (global->session_mode, "classic") == 0)
schema = "org.gnome.shell.extensions.classic-overrides";
else if (strcmp (global->session_mode, "user") == 0)
schema = "org.gnome.shell.overrides";