[gnome-shell/wip/fmuellner/per-desktop-overrides: 8/9] Replace custom override schema with per-desktop override



commit 393d7246cc176cbe8200a62bd661830597ca2fb6
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Aug 16 21:15:48 2017 +0200

    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

 data/00_org.gnome.shell.gschema.override |  6 ++++++
 data/meson.build                         |  1 +
 data/org.gnome.shell.gschema.xml.in      |  1 +
 js/ui/windowManager.js                   | 10 +---------
 src/main.c                               | 24 ------------------------
 src/shell-global.c                       | 31 -------------------------------
 src/shell-global.h                       |  1 -
 7 files changed, 9 insertions(+), 65 deletions(-)
---
diff --git a/data/00_org.gnome.shell.gschema.override b/data/00_org.gnome.shell.gschema.override
new file mode 100644
index 000000000..ac732e670
--- /dev/null
+++ b/data/00_org.gnome.shell.gschema.override
@@ -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
diff --git a/data/meson.build b/data/meson.build
index 1c2b952a2..de2e2053c 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -92,6 +92,7 @@ schema = configure_file(
   configuration: schemaconf,
   install_dir: schemadir
 )
+install_data('00_org.gnome.shell.gschema.override', install_dir: schemadir)
 
 if have_systemd
   unitconf = configuration_data()
diff --git a/data/org.gnome.shell.gschema.xml.in b/data/org.gnome.shell.gschema.xml.in
index 63a19032d..4ec01a427 100644
--- a/data/org.gnome.shell.gschema.xml.in
+++ b/data/org.gnome.shell.gschema.xml.in
@@ -190,6 +190,7 @@
     </key>
   </schema>
 
+  <!-- unused, change 00_org.gnome.shell.gschema.override instead --!>
   <schema id="org.gnome.shell.overrides" path="/org/gnome/shell/overrides/"
          gettext-domain="@GETTEXT_PACKAGE@">
     <key name="attach-modal-dialogs" type="b">
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index d2d441d0c..79c9797d2 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -215,20 +215,12 @@ var WorkspaceTracker = new Lang.Class({
         global.display.connect('restacked',
                                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._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() {
         this._pauseWorkspaceCheck = true;
     },
diff --git a/src/main.c b/src/main.c
index 857877b0b..01155777c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -31,8 +31,6 @@ extern GType gnome_shell_plugin_get_type (void);
 #define SHELL_DBUS_SERVICE "org.gnome.Shell"
 #define MAGNIFIER_DBUS_SERVICE "org.gnome.Magnifier"
 
-#define OVERRIDES_SCHEMA "org.gnome.shell.overrides"
-
 #define WM_NAME "GNOME Shell"
 #define GNOME_WM_KEYBINDINGS "Mutter,GNOME Shell"
 
@@ -172,26 +170,6 @@ shell_dbus_init (gboolean replace)
   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
 shell_introspection_init (void)
 {
@@ -509,8 +487,6 @@ main (int argc, char **argv)
 
   _shell_global_init ("session-mode", session_mode, NULL);
 
-  shell_prefs_init ();
-
   dump_gjs_stack_on_signal (SIGABRT);
   dump_gjs_stack_on_signal (SIGFPE);
   dump_gjs_stack_on_signal (SIGIOT);
diff --git a/src/shell-global.c b/src/shell-global.c
index 52b1f72a4..dbd3bbe95 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -1338,37 +1338,6 @@ shell_global_get_settings (ShellGlobal *global)
   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:
  * @global: A #ShellGlobal
diff --git a/src/shell-global.h b/src/shell-global.h
index ce03fb51f..c8cddf883 100644
--- a/src/shell-global.h
+++ b/src/shell-global.h
@@ -19,7 +19,6 @@ ClutterStage  *shell_global_get_stage                 (ShellGlobal *global);
 MetaDisplay   *shell_global_get_display               (ShellGlobal *global);
 GList         *shell_global_get_window_actors         (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);
 
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]