diff options
author | Lennart Poettering <lennart@poettering.net> | 2009-01-15 18:21:57 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2009-01-15 18:21:57 +0100 |
commit | a3695dd9eb67d4e5ba8a331b9c5432a10317105c (patch) | |
tree | e8a8d698c8c2839fae8b22262133f4b9e09bd05c /src/modules | |
parent | 5abda63a1fa4d2c867af8b33b0090cd651ba8599 (diff) |
port missing modules to new pa_client_new() API
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/module-console-kit.c | 22 | ||||
-rw-r--r-- | src/modules/module-x11-xsmp.c | 19 |
2 files changed, 29 insertions, 12 deletions
diff --git a/src/modules/module-console-kit.c b/src/modules/module-console-kit.c index e1933c28..4f3ed8dd 100644 --- a/src/modules/module-console-kit.c +++ b/src/modules/module-console-kit.c @@ -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_proplist_sets(session->client->proplist, "console-kit.session", id); + 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); + + 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); diff --git a/src/modules/module-x11-xsmp.c b/src/modules/module-x11-xsmp.c index 57d182fd..5fc8047d 100644 --- a/src/modules/module-x11-xsmp.c +++ b/src/modules/module-x11-xsmp.c @@ -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; |