Merge ~3v1n0/ubuntu/+source/gnome-session:ubuntu/master into ~ubuntu-desktop/ubuntu/+source/gnome-session:ubuntu/master

Proposed by Marco Trevisan (Treviño)
Status: Superseded
Proposed branch: ~3v1n0/ubuntu/+source/gnome-session:ubuntu/master
Merge into: ~ubuntu-desktop/ubuntu/+source/gnome-session:ubuntu/master
Diff against target: 82 lines (+62/-0)
3 files modified
debian/changelog (+7/-0)
debian/ubuntu-session.migrations (+1/-0)
debian/ubuntu-settings-migrate-to-defaults.18.10.0.py (+54/-0)
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Needs Fixing
Ubuntu Desktop Pending
Review via email: mp+353340@code.launchpad.net

This proposal has been superseded by a proposal from 2018-08-31.

Description of the change

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 (or gprinterr)
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.

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Ah, as mentioned marking this as needs-fixing, since we need to decide what's the best approach for not making this run in NON-ubuntu sessions without having to make sessions-migration to trigger errors.

Another option would even been making sessions-migration XDG_CURRENT_DESKTOP aware and then supporting .desktop files as migration scripts, where we can quickly filter them using the various `OnlyShowIn`/`NotShowIn` to filter.

review: Needs Fixing

Unmerged commits

65cae30... by Marco Trevisan (Treviño)

debian/ubuntu-settings-migrate-to-defaults.18.10.0.py

Ensure we migrate changed theme settings

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 432151e..1ede2c2 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+gnome-session (3.29.90-1ubuntu2) UNRELEASED; urgency=medium
7+
8+ * debian/ubuntu-settings-migrate-to-defaults.18.10.0.py:
9+ - Migrate users using old default ubuntu-settings to current ones
10+
11+ -- Marco Trevisan (Treviño) <marco@ubuntu.com> Fri, 17 Aug 2018 19:16:26 +0200
12+
13 gnome-session (3.29.90-1ubuntu1) cosmic; urgency=medium
14
15 * Merge with debian, remaining changes:
16diff --git a/debian/ubuntu-session.migrations b/debian/ubuntu-session.migrations
17index 9d16384..7073c2a 100644
18--- a/debian/ubuntu-session.migrations
19+++ b/debian/ubuntu-session.migrations
20@@ -1 +1,2 @@
21 debian/unity-gnome-shell-migration.*.py
22+debian/ubuntu-settings-migrate-to-defaults.*.py
23diff --git a/debian/ubuntu-settings-migrate-to-defaults.18.10.0.py b/debian/ubuntu-settings-migrate-to-defaults.18.10.0.py
24new file mode 100755
25index 0000000..62d7e96
26--- /dev/null
27+++ b/debian/ubuntu-settings-migrate-to-defaults.18.10.0.py
28@@ -0,0 +1,54 @@
29+#!/usr/bin/python3
30+# -*- coding: utf-8 -*-
31+# Copyright (C) 2018 Canonical
32+#
33+# Authors:
34+# Marco Trevisan <marco.trevisan@canonical.com>
35+#
36+# This program is free software; you can redistribute it and/or modify it under
37+# the terms of the GNU General Public License as published by the Free Software
38+# Foundation; version 3.
39+#
40+# This program is distributed in the hope that it will be useful, but WITHOUTa
41+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
42+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
43+# details.
44+#
45+# You should have received a copy of the GNU General Public License along with
46+# this program; if not, write to the Free Software Foundation, Inc.,
47+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
48+
49+from gi.repository import Gio
50+import os
51+
52+OLD_DEFAULTS = {
53+ "org.gnome.desktop.sound": {
54+ "theme-name": ["ubuntu"],
55+ },
56+ "org.gnome.desktop.interface": {
57+ "gtk-theme": ["Ambiance", "Radiance"],
58+ "icon-theme": ["ubuntu-mono-dark"],
59+ "cursor-theme": ["DMZ-White"],
60+ }
61+}
62+
63+any_changed = False
64+
65+for schema in OLD_DEFAULTS.keys():
66+ settings = Gio.Settings.new(schema)
67+ old_settings = OLD_DEFAULTS[schema]
68+
69+ for key in old_settings.keys():
70+ user_value = settings.get_user_value(key)
71+
72+ if user_value and user_value.unpack() in old_settings[key]:
73+ print('{}.{} is using old ubuntu setting ("{}"), replacing it with '
74+ 'the latest default ("{}")'.format(schema, key,
75+ user_value.unpack(),
76+ settings.get_default_value(key).unpack()))
77+ settings.reset(key)
78+ any_changed = True
79+
80+if any_changed:
81+ Gio.Settings.sync()
82+

Subscribers

People subscribed via source and target branches