1
0
Fork 0

color-device: Add new 'changed' signal for when the device changes

What triggers emission right now is the assigned profile changing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
This commit is contained in:
Jonas Ådahl 2021-12-04 00:23:23 +01:00
parent 985292c109
commit 7b71ec8ff0

View file

@ -36,6 +36,7 @@
enum enum
{ {
READY, READY,
CHANGED,
N_SIGNALS N_SIGNALS
}; };
@ -148,7 +149,12 @@ ensure_default_profile_cb (GObject *source_object,
} }
color_device = META_COLOR_DEVICE (user_data); 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_set_object (&color_device->assigned_profile, color_profile);
g_signal_emit (color_device, signals[CHANGED], 0);
} }
static void static void
@ -310,6 +316,12 @@ meta_color_device_class_init (MetaColorDeviceClass *klass)
NULL, NULL, NULL, NULL, NULL, NULL,
G_TYPE_NONE, 1, G_TYPE_NONE, 1,
G_TYPE_BOOLEAN); 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 static void