Replace custom override schema with per-desktop override

GSettings now recognizes per-desktop overrides that can be used
to change schemas' default values for a particular desktop. This
is not entirely unlike our existing custom override mechanism in
mutter, except that it is not limited to keys in org.gnome.mutter,
and it doesn't require a separate schema - the latter means that
we (and gnome-teak-tool) no longer have to figure out the correct
schema for the current login session and just use the original one.

https://bugzilla.gnome.org/show_bug.cgi?id=786496
This commit is contained in:
Florian Müllner 2017-08-16 21:15:48 +02:00 committed by Florian Müllner
parent 6217c3b88d
commit 393d7246cc
7 changed files with 9 additions and 65 deletions

View File

@ -0,0 +1,6 @@
[org.gnome.mutter:GNOME]
attach-modal-dialogs=true
edge-tiling=true
dynamic-workspaces=true
workspaces-only-on-primary=true
focus-change-on-pointer-rest=true

View File

@ -92,6 +92,7 @@ schema = configure_file(
configuration: schemaconf, configuration: schemaconf,
install_dir: schemadir install_dir: schemadir
) )
install_data('00_org.gnome.shell.gschema.override', install_dir: schemadir)
if have_systemd if have_systemd
unitconf = configuration_data() unitconf = configuration_data()

View File

@ -190,6 +190,7 @@
</key> </key>
</schema> </schema>
<!-- unused, change 00_org.gnome.shell.gschema.override instead --!>
<schema id="org.gnome.shell.overrides" path="/org/gnome/shell/overrides/" <schema id="org.gnome.shell.overrides" path="/org/gnome/shell/overrides/"
gettext-domain="@GETTEXT_PACKAGE@"> gettext-domain="@GETTEXT_PACKAGE@">
<key name="attach-modal-dialogs" type="b"> <key name="attach-modal-dialogs" type="b">

View File

@ -215,20 +215,12 @@ var WorkspaceTracker = new Lang.Class({
global.display.connect('restacked', global.display.connect('restacked',
this._windowsRestacked.bind(this)); this._windowsRestacked.bind(this));
this._workspaceSettings = this._getWorkspaceSettings(); this._workspaceSettings = new Gio.Settings({ schema_id: 'org.gnome.mutter' });
this._workspaceSettings.connect('changed::dynamic-workspaces', this._queueCheckWorkspaces.bind(this)); this._workspaceSettings.connect('changed::dynamic-workspaces', this._queueCheckWorkspaces.bind(this));
this._nWorkspacesChanged(); this._nWorkspacesChanged();
}, },
_getWorkspaceSettings() {
let settings = global.get_overrides_settings();
if (settings &&
settings.settings_schema.list_keys().indexOf('dynamic-workspaces') > -1)
return settings;
return new Gio.Settings({ schema_id: 'org.gnome.mutter' });
},
blockUpdates() { blockUpdates() {
this._pauseWorkspaceCheck = true; this._pauseWorkspaceCheck = true;
}, },

View File

@ -31,8 +31,6 @@ extern GType gnome_shell_plugin_get_type (void);
#define SHELL_DBUS_SERVICE "org.gnome.Shell" #define SHELL_DBUS_SERVICE "org.gnome.Shell"
#define MAGNIFIER_DBUS_SERVICE "org.gnome.Magnifier" #define MAGNIFIER_DBUS_SERVICE "org.gnome.Magnifier"
#define OVERRIDES_SCHEMA "org.gnome.shell.overrides"
#define WM_NAME "GNOME Shell" #define WM_NAME "GNOME Shell"
#define GNOME_WM_KEYBINDINGS "Mutter,GNOME Shell" #define GNOME_WM_KEYBINDINGS "Mutter,GNOME Shell"
@ -172,26 +170,6 @@ shell_dbus_init (gboolean replace)
g_object_unref (session); g_object_unref (session);
} }
static void
shell_prefs_init (void)
{
ShellGlobal *global = shell_global_get ();
GSettings *settings = shell_global_get_overrides_settings (global);
GSettingsSchema *schema;
char **keys, **k;
if (!settings)
return;
g_object_get (G_OBJECT (settings), "settings-schema", &schema, NULL);
for (keys = k = g_settings_schema_list_keys (schema); *k; k++)
meta_prefs_override_preference_schema (*k, g_settings_schema_get_id (schema));
g_strfreev (keys);
g_settings_schema_unref (schema);
}
static void static void
shell_introspection_init (void) shell_introspection_init (void)
{ {
@ -509,8 +487,6 @@ main (int argc, char **argv)
_shell_global_init ("session-mode", session_mode, NULL); _shell_global_init ("session-mode", session_mode, NULL);
shell_prefs_init ();
dump_gjs_stack_on_signal (SIGABRT); dump_gjs_stack_on_signal (SIGABRT);
dump_gjs_stack_on_signal (SIGFPE); dump_gjs_stack_on_signal (SIGFPE);
dump_gjs_stack_on_signal (SIGIOT); dump_gjs_stack_on_signal (SIGIOT);

View File

@ -1338,37 +1338,6 @@ shell_global_get_settings (ShellGlobal *global)
return global->settings; return global->settings;
} }
/**
* shell_global_get_overrides_settings:
* @global: A #ShellGlobal
*
* Get the session overrides GSettings instance.
*
* Return value: (transfer none): The GSettings object
*/
GSettings *
shell_global_get_overrides_settings (ShellGlobal *global)
{
static GSettings *settings = NULL;
const char *schema;
g_return_val_if_fail (SHELL_IS_GLOBAL (global), NULL);
if (!settings)
{
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";
else
return NULL;
settings = g_settings_new (schema);
}
return settings;
}
/** /**
* shell_global_get_current_time: * shell_global_get_current_time:
* @global: A #ShellGlobal * @global: A #ShellGlobal

View File

@ -19,7 +19,6 @@ ClutterStage *shell_global_get_stage (ShellGlobal *global);
MetaDisplay *shell_global_get_display (ShellGlobal *global); MetaDisplay *shell_global_get_display (ShellGlobal *global);
GList *shell_global_get_window_actors (ShellGlobal *global); GList *shell_global_get_window_actors (ShellGlobal *global);
GSettings *shell_global_get_settings (ShellGlobal *global); GSettings *shell_global_get_settings (ShellGlobal *global);
GSettings *shell_global_get_overrides_settings (ShellGlobal *global);
guint32 shell_global_get_current_time (ShellGlobal *global); guint32 shell_global_get_current_time (ShellGlobal *global);