diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2017-10-02 15:13:36 -0400 | 
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2017-10-02 15:13:36 -0400 | 
| commit | b957bbb5e838d6d964789eef542fb0f69500523b (patch) | |
| tree | bc38d7de661e08c5772392071a049fe8bb646a9b | |
| parent | 03e75fff06b6f7e1fc12c452ea5fc5e7a49359c3 (diff) | |
MigrationScript: add 05_unity_use_ubuntu_scaling_settings_schemas
This converts gnome desktop interface settings to ubuntu ones (bzr r4253.4.6)
| -rw-r--r-- | debian/unity.migrations | 1 | ||||
| -rwxr-xr-x | tools/migration-scripts/05_unity_use_ubuntu_scaling_settings_schemas | 49 | 
2 files changed, 50 insertions, 0 deletions
diff --git a/debian/unity.migrations b/debian/unity.migrations index 58bd12d59..98ba87204 100644 --- a/debian/unity.migrations +++ b/debian/unity.migrations @@ -2,3 +2,4 @@ tools/migration-scripts/01_unity_change_dconf_path  tools/migration-scripts/02_unity_setup_text_scale_factor  tools/migration-scripts/03_unity_first_run_stamp_move  tools/migration-scripts/04_unity_update_software_center_desktop_file +tools/migration-scripts/05_unity_use_ubuntu_scaling_settings_schemas \ No newline at end of file diff --git a/tools/migration-scripts/05_unity_use_ubuntu_scaling_settings_schemas b/tools/migration-scripts/05_unity_use_ubuntu_scaling_settings_schemas new file mode 100755 index 000000000..1273483c0 --- /dev/null +++ b/tools/migration-scripts/05_unity_use_ubuntu_scaling_settings_schemas @@ -0,0 +1,49 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +# Copyright (C) 2014-2017 Canonical +# +# Authors: +# Marco Trevisan <marco.trevisan@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,sys + +GNOME_UI_SETTINGS = "org.gnome.desktop.interface"; +UBUNTU_UI_SETTINGS = "com.ubuntu.user-interface.desktop"; + +KEYS_TO_MIGRATE = [ "scaling-factor", "text-scaling-factor", "cursor-size" ] + +gnome_ui_schema = Gio.SettingsSchemaSource.get_default().lookup(GNOME_UI_SETTINGS, recursive=False) +if not gnome_ui_schema: + print("No gnome desktop interface schemas found, no migration needed") + sys.exit(0) + +ubuntu_ui_schema = Gio.SettingsSchemaSource.get_default().lookup(UBUNTU_UI_SETTINGS, recursive=False) +if not ubuntu_ui_schema: + print("No ubuntu desktop interface schemas found, no migration needed") + sys.exit(0) + +gnome_settings = Gio.Settings(settings_schema=gnome_ui_schema) +ubuntu_settings = Gio.Settings(settings_schema=ubuntu_ui_schema) + +for key in KEYS_TO_MIGRATE: + gnome_value = gnome_settings.get_value(key) + ubuntu_value = ubuntu_settings.get_value(key) + + if ubuntu_value != gnome_value: + ubuntu_settings.set_value(key, gnome_value) + +Gio.Settings.sync()  | 
