screen-cast/stream: Keep track of object properties

This will make it possible to emit notify events without going via
strings.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3241>
This commit is contained in:
Jonas Ådahl 2023-09-04 11:43:01 +02:00
parent 9c3b130f67
commit 731c3e0ba3

View File

@ -38,8 +38,12 @@ enum
PROP_CONNECTION, PROP_CONNECTION,
PROP_CURSOR_MODE, PROP_CURSOR_MODE,
PROP_FLAGS, PROP_FLAGS,
N_PROPS
}; };
static GParamSpec *obj_props[N_PROPS];
enum enum
{ {
CLOSED, 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->set_property = meta_screen_cast_stream_set_property;
object_class->get_property = meta_screen_cast_stream_get_property; object_class->get_property = meta_screen_cast_stream_get_property;
g_object_class_install_property (object_class, obj_props[PROP_SESSION] =
PROP_SESSION, g_param_spec_object ("session", NULL, NULL,
g_param_spec_object ("session", NULL, NULL, META_TYPE_SCREEN_CAST_SESSION,
META_TYPE_SCREEN_CAST_SESSION, G_PARAM_READWRITE |
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
G_PARAM_STATIC_STRINGS)); obj_props[PROP_CONNECTION] =
g_param_spec_object ("connection", NULL, NULL,
g_object_class_install_property (object_class, G_TYPE_DBUS_CONNECTION,
PROP_CONNECTION, G_PARAM_READWRITE |
g_param_spec_object ("connection", NULL, NULL, G_PARAM_CONSTRUCT_ONLY |
G_TYPE_DBUS_CONNECTION, G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | obj_props[PROP_CURSOR_MODE] =
G_PARAM_CONSTRUCT_ONLY | g_param_spec_uint ("cursor-mode", NULL, NULL,
G_PARAM_STATIC_STRINGS)); META_SCREEN_CAST_CURSOR_MODE_HIDDEN,
META_SCREEN_CAST_CURSOR_MODE_METADATA,
g_object_class_install_property (object_class, META_SCREEN_CAST_CURSOR_MODE_HIDDEN,
PROP_CURSOR_MODE, G_PARAM_READWRITE |
g_param_spec_uint ("cursor-mode", NULL, NULL, G_PARAM_CONSTRUCT_ONLY |
META_SCREEN_CAST_CURSOR_MODE_HIDDEN, G_PARAM_STATIC_STRINGS);
META_SCREEN_CAST_CURSOR_MODE_METADATA, obj_props[PROP_FLAGS] =
META_SCREEN_CAST_CURSOR_MODE_HIDDEN, g_param_spec_flags ("flags", NULL, NULL,
G_PARAM_READWRITE | META_TYPE_SCREEN_CAST_FLAG,
G_PARAM_CONSTRUCT_ONLY | META_SCREEN_CAST_FLAG_NONE,
G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
g_object_class_install_property (object_class, G_PARAM_STATIC_STRINGS);
PROP_FLAGS, g_object_class_install_properties (object_class, N_PROPS, obj_props);
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));
signals[CLOSED] = g_signal_new ("closed", signals[CLOSED] = g_signal_new ("closed",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),