use global_update_keys

First set the properties in the object itself and then copy them
over to the global. This ensure that the global properties are
also in the object and makes code a bit cleaner.

It also make it possible to use the global id to make the property
values unique, if we want to later .
This commit is contained in:
Wim Taymans 2020-08-05 12:55:33 +02:00
parent f79c347667
commit 469dff0153
9 changed files with 32 additions and 72 deletions

View file

@ -286,16 +286,10 @@ int session_init(struct session *this,
this->client_sess = client_sess;
this->props = properties;
properties = pw_properties_new(NULL, NULL);
if (!properties)
goto no_mem;
pw_properties_update_keys(properties, &this->props->dict, keys);
this->global = pw_global_new (context,
PW_TYPE_INTERFACE_Session,
PW_VERSION_SESSION,
properties, session_bind, this);
NULL, session_bind, this);
if (!this->global)
goto no_mem;
@ -306,6 +300,8 @@ int session_init(struct session *this,
this->info.id = pw_global_get_id(this->global);
this->info.props = &this->props->dict;
pw_global_update_keys(this->global, &this->props->dict, keys);
pw_resource_set_bound_id(client_sess->resource, this->info.id);
return pw_global_register(this->global);