From 7b71ec8ff0e5c0056e03747adf2d818a59ea59b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Sat, 4 Dec 2021 00:23:23 +0100 Subject: [PATCH] color-device: Add new 'changed' signal for when the device changes What triggers emission right now is the assigned profile changing. Part-of: --- src/backends/meta-color-device.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/backends/meta-color-device.c b/src/backends/meta-color-device.c index 8ec1571c4..a935723ff 100644 --- a/src/backends/meta-color-device.c +++ b/src/backends/meta-color-device.c @@ -36,6 +36,7 @@ enum { READY, + CHANGED, N_SIGNALS }; @@ -148,7 +149,12 @@ ensure_default_profile_cb (GObject *source_object, } color_device = META_COLOR_DEVICE (user_data); + if (color_device->assigned_profile == color_profile) + return; + g_set_object (&color_device->assigned_profile, color_profile); + + g_signal_emit (color_device, signals[CHANGED], 0); } static void @@ -310,6 +316,12 @@ meta_color_device_class_init (MetaColorDeviceClass *klass) NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); + signals[CHANGED] = + g_signal_new ("changed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, 0, + NULL, NULL, NULL, + G_TYPE_NONE, 0); } static void