From 80cfd8ed384fdb6642c7bb931d9ee038d4d7b548 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 20 Feb 2010 20:11:30 +0100 Subject: props: set a couple of additional properties by default, and ensure clients may override them --- src/canberra-gtk-play.c | 3 ++- src/canberra-gtk.c | 8 ++++++++ src/pulse.c | 23 +++++++++++++---------- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/canberra-gtk-play.c b/src/canberra-gtk-play.c index 4ab0c89..7494269 100644 --- a/src/canberra-gtk-play.c +++ b/src/canberra-gtk-play.c @@ -161,7 +161,8 @@ int main (int argc, char *argv[]) { ca_context_change_props(ca_gtk_context_get(), CA_PROP_APPLICATION_NAME, "canberra-gtk-play", - CA_PROP_APPLICATION_ID, "org.freedesktop.libcanberra.GtkPlay", + CA_PROP_APPLICATION_VERSION, PACKAGE_VERSION, + CA_PROP_APPLICATION_ID, "org.freedesktop.libcanberra.gtk-play", NULL); if (event_id) diff --git a/src/canberra-gtk.c b/src/canberra-gtk.c index 9f8a31d..c6581a2 100644 --- a/src/canberra-gtk.c +++ b/src/canberra-gtk.c @@ -130,6 +130,14 @@ ca_context *ca_gtk_context_get_for_screen(GdkScreen *screen) { if ((name = g_get_application_name())) ca_proplist_sets(p, CA_PROP_APPLICATION_NAME, name); + else { + ca_proplist_sets(p, CA_PROP_APPLICATION_NAME, "libcanberra-gtk"); + ca_proplist_sets(p, CA_PROP_APPLICATION_VERSION, PACKAGE_VERSION); + ca_proplist_sets(p, CA_PROP_APPLICATION_ID, "org.freedesktop.libcanberra.gtk"); + } + + if ((name = gtk_window_get_default_icon_name())) + ca_proplist_sets(p, CA_PROP_APPLICATION_ICON_NAME, name); if ((name = gdk_display_get_name(gdk_screen_get_display(screen)))) ca_proplist_sets(p, CA_PROP_WINDOW_X11_DISPLAY, name); diff --git a/src/pulse.c b/src/pulse.c index 540d968..797e9fa 100644 --- a/src/pulse.c +++ b/src/pulse.c @@ -164,6 +164,8 @@ static void add_common(pa_proplist *l) { pa_proplist_sets(l, CA_PROP_MEDIA_NAME, t); else if ((t = pa_proplist_gets(l, CA_PROP_MEDIA_FILENAME))) pa_proplist_sets(l, CA_PROP_MEDIA_NAME, t); + else + pa_proplist_sets(l, CA_PROP_MEDIA_NAME, "libcanberra"); } } @@ -228,7 +230,16 @@ static int context_connect(ca_context *c, ca_bool_t nofail) { strip_prefix(l, "canberra."); - if (!(p->context = pa_context_new_with_proplist(pa_threaded_mainloop_get_api(p->mainloop), "libcanberra", l))) { + if (!pa_proplist_contains(l, PA_PROP_APPLICATION_NAME)) { + pa_proplist_sets(l, PA_PROP_APPLICATION_NAME, "libcanberra"); + pa_proplist_sets(l, PA_PROP_APPLICATION_VERSION, PACKAGE_VERSION); + + if (!pa_proplist_contains(l, PA_PROP_APPLICATION_ID)) + pa_proplist_sets(l, PA_PROP_APPLICATION_ID, "org.freedesktop.libcanberra"); + + } + + if (!(p->context = pa_context_new_with_proplist(pa_threaded_mainloop_get_api(p->mainloop), NULL, l))) { pa_proplist_free(l); return CA_ERROR_OOM; } @@ -999,14 +1010,6 @@ int driver_play(ca_context *c, uint32_t id, ca_proplist *proplist, ca_finish_cal } else cm_good = convert_channel_map(out->file, &cm); - if (!name) { - if (!(n = pa_proplist_gets(l, CA_PROP_MEDIA_NAME))) - if (!(n = pa_proplist_gets(l, CA_PROP_MEDIA_NAME))) - n = "libcanberra"; - - name = ca_strdup(n); - } - pa_threaded_mainloop_lock(p->mainloop); if (!p->context) { @@ -1014,7 +1017,7 @@ int driver_play(ca_context *c, uint32_t id, ca_proplist *proplist, ca_finish_cal goto finish_locked; } - if (!(out->stream = pa_stream_new_with_proplist(p->context, name, &ss, cm_good ? &cm : NULL, l))) { + if (!(out->stream = pa_stream_new_with_proplist(p->context, NULL, &ss, cm_good ? &cm : NULL, l))) { ret = translate_error(pa_context_errno(p->context)); goto finish_locked; } -- cgit