From c2a8239044f350a6548e0e8314b4f40b49a726b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 11 Oct 2017 00:36:18 +0200 Subject: [PATCH] global: Allow overriding the override schema --- src/main.c | 11 ++++++++++- src/shell-global.c | 20 +++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 9a89aa4d6..085399b68 100644 --- a/src/main.c +++ b/src/main.c @@ -39,6 +39,7 @@ extern GType gnome_shell_plugin_get_type (void); static gboolean is_gdm_mode = FALSE; static char *session_mode = NULL; static int caught_signal = 0; +static char *override_schema = NULL; #define DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1 #define DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER 4 @@ -455,6 +456,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 } }; @@ -512,7 +519,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 (); diff --git a/src/shell-global.c b/src/shell-global.c index 855f6257c..181dbb825 100644 --- a/src/shell-global.c +++ b/src/shell-global.c @@ -67,6 +67,7 @@ struct _ShellGlobal { GdkScreen *gdk_screen; char *session_mode; + char *override_schema; XserverRegion input_region; @@ -98,6 +99,7 @@ enum { PROP_0, PROP_SESSION_MODE, + PROP_OVERRIDE_SCHEMA, PROP_SCREEN, PROP_GDK_SCREEN, PROP_DISPLAY, @@ -141,6 +143,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; @@ -166,6 +172,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; @@ -370,6 +379,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, @@ -1495,7 +1511,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"; -- 2.14.2