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



commit 6da5b81fb2548b405829d0e4361621052e379d23
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      | 44 --------------------------------
 js/ui/windowManager.js                   | 10 +-------
 src/main.c                               | 24 -----------------
 src/shell-global.c                       | 31 ----------------------
 src/shell-global.h                       |  1 -
 7 files changed, 8 insertions(+), 109 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 7c9807721..b3608287a 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)
 
 # for unit tests - gnome.compile_schemas() only looks in srcdir
 custom_target('compile-schemas',
diff --git a/data/org.gnome.shell.gschema.xml.in b/data/org.gnome.shell.gschema.xml.in
index 63a19032d..31f1ed700 100644
--- a/data/org.gnome.shell.gschema.xml.in
+++ b/data/org.gnome.shell.gschema.xml.in
@@ -189,48 +189,4 @@
       </description>
     </key>
   </schema>
-
-  <schema id="org.gnome.shell.overrides" path="/org/gnome/shell/overrides/"
-         gettext-domain="@GETTEXT_PACKAGE@">
-    <key name="attach-modal-dialogs" type="b">
-      <default>true</default>
-      <summary>Attach modal dialog to the parent window</summary>
-      <description>
-        This key overrides the key in org.gnome.mutter when running
-        GNOME Shell.
-      </description>
-    </key>
-
-    <key name="edge-tiling" type="b">
-      <default>true</default>
-      <summary>Enable edge tiling when dropping windows on screen edges</summary>
-      <description>
-        This key overrides the key in org.gnome.mutter when running GNOME Shell.
-      </description>
-    </key>
-
-    <key name="dynamic-workspaces" type="b">
-      <default>true</default>
-      <summary>Workspaces are managed dynamically</summary>
-      <description>
-        This key overrides the key in org.gnome.mutter when running GNOME Shell.
-      </description>
-    </key>
-
-    <key name="workspaces-only-on-primary" type="b">
-      <default>true</default>
-      <summary>Workspaces only on primary monitor</summary>
-      <description>
-        This key overrides the key in org.gnome.mutter when running GNOME Shell.
-      </description>
-    </key>
-
-    <key name="focus-change-on-pointer-rest" type="b">
-      <default>true</default>
-      <summary>Delay focus changes in mouse mode until the pointer stops moving</summary>
-      <description>
-        This key overrides the key in org.gnome.mutter when running GNOME Shell.
-      </description>
-    </key>
-  </schema>
 </schemalist>
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index bab93a03e..470db35e7 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -213,20 +213,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]