Marco Trevisan (Treviño) has proposed merging 
~3v1n0/ubuntu/+source/gnome-session:ubuntu/master into 
~ubuntu-desktop/ubuntu/+source/gnome-session:ubuntu/master.

Requested reviews:
  Ubuntu Desktop (ubuntu-desktop)

For more details, see:
https://code.launchpad.net/~3v1n0/ubuntu/+source/gnome-session/+git/gnome-session/+merge/353340

Ensre we migrate Yaru relevant settings to defaults if the user values matches 
the old defaults.

However... This should actually only run when the ubuntu-session is running, or 
might change the settings to someone running the classic gnome-session but with 
the old ubuntu settings.

session migrations doesn't seem to help much on this, but there could be some 
strategies:

1) Return an error if the migration script runs in a session it doesn't care 
about
  1a) change session-migrations to support a specific exit-code as "skip this" 
without triggering any error
2) Add this script to an XDG_DATA_DIR that is only specific for the 
ubuntu-session (needs more changes and is ugly)

So... Let me know what you prefer.
-- 
Your team Ubuntu Desktop is requested to review the proposed merge of 
~3v1n0/ubuntu/+source/gnome-session:ubuntu/master into 
~ubuntu-desktop/ubuntu/+source/gnome-session:ubuntu/master.
diff --git a/debian/changelog b/debian/changelog
index 432151e..1ede2c2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+gnome-session (3.29.90-1ubuntu2) UNRELEASED; urgency=medium
+
+  * debian/ubuntu-settings-migrate-to-defaults.18.10.0.py:
+    - Migrate users using old default ubuntu-settings to current ones
+
+ -- Marco Trevisan (Treviño) <ma...@ubuntu.com>  Fri, 17 Aug 2018 19:16:26 +0200
+
 gnome-session (3.29.90-1ubuntu1) cosmic; urgency=medium
 
   * Merge with debian, remaining changes:
diff --git a/debian/ubuntu-session.migrations b/debian/ubuntu-session.migrations
index 9d16384..7073c2a 100644
--- a/debian/ubuntu-session.migrations
+++ b/debian/ubuntu-session.migrations
@@ -1 +1,2 @@
 debian/unity-gnome-shell-migration.*.py
+debian/ubuntu-settings-migrate-to-defaults.*.py
diff --git a/debian/ubuntu-settings-migrate-to-defaults.18.10.0.py b/debian/ubuntu-settings-migrate-to-defaults.18.10.0.py
new file mode 100755
index 0000000..62d7e96
--- /dev/null
+++ b/debian/ubuntu-settings-migrate-to-defaults.18.10.0.py
@@ -0,0 +1,54 @@
+#!/usr/bin/python3
+# -*- coding: utf-8 -*-
+# Copyright (C) 2018 Canonical
+#
+# Authors:
+#  Marco Trevisan <marco.trevi...@canonical.com>
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation; version 3.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUTa
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+from gi.repository import Gio
+import os
+
+OLD_DEFAULTS = {
+    "org.gnome.desktop.sound": {
+        "theme-name": ["ubuntu"],
+    },
+    "org.gnome.desktop.interface": {
+        "gtk-theme": ["Ambiance", "Radiance"],
+        "icon-theme": ["ubuntu-mono-dark"],
+        "cursor-theme": ["DMZ-White"],
+    }
+}
+
+any_changed = False
+
+for schema in OLD_DEFAULTS.keys():
+    settings = Gio.Settings.new(schema)
+    old_settings = OLD_DEFAULTS[schema]
+
+    for key in old_settings.keys():
+        user_value = settings.get_user_value(key)
+
+        if user_value and user_value.unpack() in old_settings[key]:
+            print('{}.{} is using old ubuntu setting ("{}"), replacing it with '
+                'the latest default ("{}")'.format(schema, key,
+                    user_value.unpack(),
+                    settings.get_default_value(key).unpack()))
+            settings.reset(key)
+            any_changed = True
+
+if any_changed:
+    Gio.Settings.sync()
+
-- 
ubuntu-desktop mailing list
ubuntu-desktop@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-desktop

Reply via email to