From 731c3e0ba3dad52ca01343e4dfb139d81c636d83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 4 Sep 2023 11:43:01 +0200 Subject: [PATCH] screen-cast/stream: Keep track of object properties This will make it possible to emit notify events without going via strings. Part-of: --- src/backends/meta-screen-cast-stream.c | 66 +++++++++++++------------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/src/backends/meta-screen-cast-stream.c b/src/backends/meta-screen-cast-stream.c index 3176e5ae1..17a5dee2e 100644 --- a/src/backends/meta-screen-cast-stream.c +++ b/src/backends/meta-screen-cast-stream.c @@ -38,8 +38,12 @@ enum PROP_CONNECTION, PROP_CURSOR_MODE, PROP_FLAGS, + + N_PROPS }; +static GParamSpec *obj_props[N_PROPS]; + enum { CLOSED, @@ -428,40 +432,34 @@ meta_screen_cast_stream_class_init (MetaScreenCastStreamClass *klass) object_class->set_property = meta_screen_cast_stream_set_property; object_class->get_property = meta_screen_cast_stream_get_property; - g_object_class_install_property (object_class, - PROP_SESSION, - g_param_spec_object ("session", NULL, NULL, - META_TYPE_SCREEN_CAST_SESSION, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (object_class, - PROP_CONNECTION, - g_param_spec_object ("connection", NULL, NULL, - G_TYPE_DBUS_CONNECTION, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (object_class, - PROP_CURSOR_MODE, - g_param_spec_uint ("cursor-mode", NULL, NULL, - META_SCREEN_CAST_CURSOR_MODE_HIDDEN, - META_SCREEN_CAST_CURSOR_MODE_METADATA, - META_SCREEN_CAST_CURSOR_MODE_HIDDEN, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (object_class, - PROP_FLAGS, - g_param_spec_flags ("flags", NULL, NULL, - META_TYPE_SCREEN_CAST_FLAG, - META_SCREEN_CAST_FLAG_NONE, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_STATIC_STRINGS)); + obj_props[PROP_SESSION] = + g_param_spec_object ("session", NULL, NULL, + META_TYPE_SCREEN_CAST_SESSION, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + obj_props[PROP_CONNECTION] = + g_param_spec_object ("connection", NULL, NULL, + G_TYPE_DBUS_CONNECTION, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + obj_props[PROP_CURSOR_MODE] = + g_param_spec_uint ("cursor-mode", NULL, NULL, + META_SCREEN_CAST_CURSOR_MODE_HIDDEN, + META_SCREEN_CAST_CURSOR_MODE_METADATA, + META_SCREEN_CAST_CURSOR_MODE_HIDDEN, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + obj_props[PROP_FLAGS] = + g_param_spec_flags ("flags", NULL, NULL, + META_TYPE_SCREEN_CAST_FLAG, + META_SCREEN_CAST_FLAG_NONE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + g_object_class_install_properties (object_class, N_PROPS, obj_props); signals[CLOSED] = g_signal_new ("closed", G_TYPE_FROM_CLASS (klass),