~ci-train-bot/unity/unity-ubuntu-disco-3336

« back to all changes in this revision

Viewing changes to tools/migration-scripts/04_unity_update_software_center_desktop_file

UnitySettings: use the ubuntu-schemas path for scaling settings

Also remove unused parts of EMConverter (LP: #1721082)

Approved by: Andrea Azzarone

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from gi.repository import Gio
22
22
 
23
23
UNITY_LAUNCHER_SETTINGS = "com.canonical.Unity.Launcher";
24
 
UNITY_LAUNCHER_SETTINGS_PATH = "/com/canonical/unity/launcher/"
25
24
UNITY_LAUNCER_FAVORITES = "favorites";
26
25
 
27
 
favorites = Gio.Settings(schema=UNITY_LAUNCHER_SETTINGS).get_strv(UNITY_LAUNCER_FAVORITES)
 
26
launcher_settings = Gio.Settings.new(UNITY_LAUNCHER_SETTINGS)
 
27
favorites = launcher_settings.get_strv(UNITY_LAUNCER_FAVORITES)
 
28
replaced = False
28
29
 
29
30
for i in range(len(favorites)):
30
31
  if 'ubuntu-software-center.desktop' in favorites[i]:
31
32
    favorites[i] = favorites[i].replace('ubuntu-software-center', 'org.gnome.Software')
 
33
    replaced = True
32
34
 
33
 
# gsettings doesn't work directly, the key is somewhat reverted. Work one level under then: dconf!
34
 
from subprocess import Popen, PIPE, STDOUT
35
 
p = Popen(("dconf load "+UNITY_LAUNCHER_SETTINGS_PATH).split(), stdout=PIPE, stdin=PIPE, stderr=STDOUT)
36
 
p.communicate(input=bytes("[/]\n"+UNITY_LAUNCER_FAVORITES+"={}".format(favorites), 'utf-8'))
 
35
if replaced:
 
36
  launcher_settings.set_strv(UNITY_LAUNCER_FAVORITES, favorites)
 
37
  Gio.Settings.sync()