color-manager: Set up a D-Bus proxy to org.gnome.SettingsDaemon.Color

gsd-color provides this API, which exposes details about the night light
state. Currently, gsd-color also turns this state into CRTC gamma
changes, but this will eventually change, and this is a preparation for
this.

The proxy isn't yet used for anything.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2164>
This commit is contained in:
Jonas Ådahl
2021-10-29 11:23:18 +02:00
parent 0dc6d76371
commit 43cd70089e
5 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,31 @@
'''gsd-color proxy mock template
'''
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option) any
# later version. See http://www.gnu.org/copyleft/lgpl.html for the full text
# of the license.
__author__ = 'Jonas Ådahl'
__copyright__ = '(c) 2021 Red Hat Inc.'
import dbus
import os
from dbusmock import MOCK_IFACE
BUS_NAME = 'org.gnome.SettingsDaemon.Color'
MAIN_OBJ = '/org/gnome/SettingsDaemon/Color'
MAIN_IFACE = BUS_NAME
SYSTEM_BUS = False
def load(mock, parameters=None):
mock.night_light_active = False
mock.temperature = 6500
mock.AddProperty(MAIN_IFACE, 'NightLightActive', dbus.Boolean())
mock.AddProperty(MAIN_IFACE, 'Temperature', dbus.UInt32())
mock.Set(MAIN_IFACE, 'NightLightActive', mock.night_light_active)
mock.Set(MAIN_IFACE, 'Temperature', dbus.UInt32(mock.temperature))

View File

@ -43,6 +43,7 @@ class MutterDBusTestCase(DBusTestCase):
klass.start_from_local_template('localed')
klass.start_from_local_template('colord')
klass.start_from_local_template('gsd-color')
klass.system_bus_con = klass.get_dbus(system_bus=True)
klass.session_bus_con = klass.get_dbus(system_bus=False)