mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
port missing modules to new pa_client_new() API
This commit is contained in:
parent
5abda63a1f
commit
a3695dd9eb
2 changed files with 28 additions and 11 deletions
|
|
@ -63,6 +63,7 @@ struct session {
|
|||
};
|
||||
|
||||
struct userdata {
|
||||
pa_module *module;
|
||||
pa_core *core;
|
||||
pa_dbus_connection *connection;
|
||||
pa_hashmap *sessions;
|
||||
|
|
@ -73,7 +74,7 @@ static void add_session(struct userdata *u, const char *id) {
|
|||
DBusMessage *m = NULL, *reply = NULL;
|
||||
uint32_t uid;
|
||||
struct session *session;
|
||||
char *t;
|
||||
pa_client_new_data data;
|
||||
|
||||
dbus_error_init (&error);
|
||||
|
||||
|
|
@ -109,11 +110,19 @@ static void add_session(struct userdata *u, const char *id) {
|
|||
session = pa_xnew(struct session, 1);
|
||||
session->id = pa_xstrdup(id);
|
||||
|
||||
t = pa_sprintf_malloc("ConsoleKit Session %s", id);
|
||||
session->client = pa_client_new(u->core, __FILE__, t);
|
||||
pa_xfree(t);
|
||||
pa_client_new_data_init(&data);
|
||||
data.module = u->module;
|
||||
data.driver = __FILE__;
|
||||
pa_proplist_setf(data.proplist, PA_PROP_APPLICATION_NAME, "ConsoleKit Session %s", id);
|
||||
pa_proplist_sets(data.proplist, "console-kit.session", id);
|
||||
session->client = pa_client_new(u->core, &data);
|
||||
pa_client_new_data_done(&data);
|
||||
|
||||
pa_proplist_sets(session->client->proplist, "console-kit.session", id);
|
||||
if (!session->client) {
|
||||
pa_xfree(session->id);
|
||||
pa_xfree(session);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
pa_hashmap_put(u->sessions, session->id, session);
|
||||
|
||||
|
|
@ -295,6 +304,7 @@ int pa__init(pa_module*m) {
|
|||
|
||||
m->userdata = u = pa_xnew(struct userdata, 1);
|
||||
u->core = m->core;
|
||||
u->module = m;
|
||||
u->connection = connection;
|
||||
u->sessions = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
|
||||
|
||||
|
|
|
|||
|
|
@ -117,13 +117,14 @@ static void new_ice_connection(IceConn connection, IcePointer client_data, Bool
|
|||
int pa__init(pa_module*m) {
|
||||
|
||||
pa_modargs *ma = NULL;
|
||||
char t[256], *vendor, *client_id, *k;
|
||||
char t[256], *vendor, *client_id;
|
||||
SmcCallbacks callbacks;
|
||||
SmProp prop_program, prop_user;
|
||||
SmProp *prop_list[2];
|
||||
SmPropValue val_program, val_user;
|
||||
struct userdata *u;
|
||||
const char *e;
|
||||
pa_client_new_data data;
|
||||
|
||||
pa_assert(m);
|
||||
|
||||
|
|
@ -198,16 +199,22 @@ int pa__init(pa_module*m) {
|
|||
SmcSetProperties(u->connection, PA_ELEMENTSOF(prop_list), prop_list);
|
||||
|
||||
pa_log_info("Connected to session manager '%s' as '%s'.", vendor = SmcVendor(u->connection), client_id);
|
||||
k = pa_sprintf_malloc("XSMP Session on %s as %s", vendor, client_id);
|
||||
u->client = pa_client_new(u->core, __FILE__, k);
|
||||
pa_xfree(k);
|
||||
|
||||
pa_proplist_sets(u->client->proplist, "xsmp.vendor", vendor);
|
||||
pa_proplist_sets(u->client->proplist, "xsmp.client.id", client_id);
|
||||
pa_client_new_data_init(&data);
|
||||
data.module = m;
|
||||
data.driver = __FILE__;
|
||||
pa_proplist_setf(data.proplist, PA_PROP_APPLICATION_NAME, "XSMP Session on %s as %s", vendor, client_id);
|
||||
pa_proplist_sets(data.proplist, "xsmp.vendor", vendor);
|
||||
pa_proplist_sets(data.proplist, "xsmp.client.id", client_id);
|
||||
u->client = pa_client_new(u->core, &data);
|
||||
pa_client_new_data_done(&data);
|
||||
|
||||
free(vendor);
|
||||
free(client_id);
|
||||
|
||||
if (!u->client)
|
||||
goto fail;
|
||||
|
||||
pa_modargs_free(ma);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue