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_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,
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));
g_object_class_install_property (object_class,
PROP_CONNECTION,
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));
g_object_class_install_property (object_class,
PROP_CURSOR_MODE,
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));
g_object_class_install_property (object_class,
PROP_FLAGS,
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_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),