/usr/share/session-migration/scripts/ubuntu-system-settings-sound-gsettings-to-accountsservice.py is in ubuntu-system-settings 0.1+14.04.20140411-0ubuntu2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (C) 2013 Canonical
#
# Authors:
# Iain Lane <iain.lane@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
# Migrate ubuntu-system-settings sound panel settings from GSettings to
# AccountsService
from __future__ import print_function
import dbus
import os
import sys
from gi.repository import Gio
system_bus = dbus.SystemBus()
manager_proxy = system_bus.get_object('org.freedesktop.Accounts',
'/org/freedesktop/Accounts')
object_path = manager_proxy.FindUserById(
os.getuid(), dbus_interface='org.freedesktop.Accounts'
)
user_proxy = system_bus.get_object('org.freedesktop.Accounts', object_path)
gsettings = Gio.Settings(schema="com.ubuntu.touch.sound")
def get_string(key):
return gsettings.get_string(key)
def get_bool(key):
return gsettings.get_boolean(key)
def set_as_setting(interface, setting, value):
try:
user_proxy.Set(interface, setting, value,
dbus_interface=dbus.PROPERTIES_IFACE)
except dbus.exceptions.DBusException as e:
print("Couldn't update %s: %s" % (setting, e), file=sys.stderr)
# (gsettings key, accountsservice key, function to retrieve from gsettings)
keys = [('silent-mode', 'SilentMode', get_bool),
('incoming-call-sound', 'IncomingCallSound', get_string),
('incoming-message-sound', 'IncomingMessageSound', get_string)]
for (g, a, f) in keys:
set_as_setting('com.ubuntu.touch.AccountsService.Sound', a, f(g))
|