diff options
author | Lennart Poettering <lennart@poettering.net> | 2009-02-02 00:28:37 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2009-02-02 00:28:37 +0100 |
commit | 8ccc9aa6651f3a21be9c2e843d558b75c8fb0616 (patch) | |
tree | 3398bcb2010ed0db80082bf087c0bc10863b6f9d /src/pulsecore | |
parent | 8fbce6eb895ebb0c793d79a617ef54df645a11db (diff) |
try to use glib's g_get_application_name() to set PA_PROP_APPLICATION_NAME
Diffstat (limited to 'src/pulsecore')
-rw-r--r-- | src/pulsecore/proplist-util.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/src/pulsecore/proplist-util.c b/src/pulsecore/proplist-util.c index 35c9985a..0a2d7183 100644 --- a/src/pulsecore/proplist-util.c +++ b/src/pulsecore/proplist-util.c @@ -25,6 +25,7 @@ #include <string.h> #include <locale.h> +#include <dlfcn.h> #include <pulse/proplist.h> #include <pulse/utf8.h> @@ -36,7 +37,6 @@ #include "proplist-util.h" void pa_init_proplist(pa_proplist *p) { - int a, b; #if !HAVE_DECL_ENVIRON extern char **environ; #endif @@ -99,22 +99,36 @@ void pa_init_proplist(pa_proplist *p) { } } - a = pa_proplist_contains(p, PA_PROP_APPLICATION_PROCESS_BINARY); - b = pa_proplist_contains(p, PA_PROP_APPLICATION_NAME); - - if (!a || !b) { + if (!pa_proplist_contains(p, PA_PROP_APPLICATION_PROCESS_BINARY)) { char t[PATH_MAX]; if (pa_get_binary_name(t, sizeof(t))) { char *c = pa_utf8_filter(t); + pa_proplist_sets(p, PA_PROP_APPLICATION_PROCESS_BINARY, c); + pa_xfree(c); + } + } - if (!a) - pa_proplist_sets(p, PA_PROP_APPLICATION_PROCESS_BINARY, c); - if (!b) - pa_proplist_sets(p, PA_PROP_APPLICATION_NAME, c); +#ifdef RTLD_NOLOAD + if (!pa_proplist_contains(p, PA_PROP_APPLICATION_NAME)) { + void *dl; - pa_xfree(c); + if ((dl = dlopen("libglib-2.0", RTLD_NOLOAD))) { + const char *(*_g_get_application_name)(void); + + if ((*(void**) &_g_get_application_name = dlsym(dl, "g_get_application_name"))) + pa_proplist_sets(p, PA_PROP_APPLICATION_NAME, _g_get_application_name()); + + dlclose(dl); } } +#endif + + if (!pa_proplist_contains(p, PA_PROP_APPLICATION_NAME)) { + const char *t; + + if ((t = pa_proplist_gets(p, PA_PROP_APPLICATION_PROCESS_BINARY))) + pa_proplist_sets(p, PA_PROP_APPLICATION_NAME, t); + } if (!pa_proplist_contains(p, PA_PROP_APPLICATION_LANGUAGE)) { const char *l; |