diff options
-rw-r--r-- | src/canberra-gtk.c | 29 | ||||
-rw-r--r-- | todo | 2 |
2 files changed, 28 insertions, 3 deletions
diff --git a/src/canberra-gtk.c b/src/canberra-gtk.c index ed6f029..687842f 100644 --- a/src/canberra-gtk.c +++ b/src/canberra-gtk.c @@ -50,8 +50,10 @@ * * libcanberra-gtk maintains a single application-global ca_context * object. Use this function to access it. The - * %CA_PROP_CANBERRA_XDG_THEME_NAME of this context property is dynamically bound to - * the XSETTINGS setting for the XDG theme name. + * %CA_PROP_CANBERRA_XDG_THEME_NAME of this context property is + * dynamically bound to the XSETTINGS setting for the XDG theme + * name. CA_PROP_APPLICATION_NAME is bound to + * g_get_application_name(). * * Returns: a pa_context object */ @@ -60,6 +62,7 @@ ca_context *ca_gtk_context_get(void) { static GStaticPrivate context_private = G_STATIC_PRIVATE_INIT; ca_context *c = NULL; const char *name; + GValue value; if ((c = g_static_private_get(&context_private))) return c; @@ -69,6 +72,28 @@ ca_context *ca_gtk_context_get(void) { if ((name = g_get_application_name())) ca_assert_se(ca_context_change_props(c, CA_PROP_APPLICATION_NAME, name, NULL) == 0); + if (gdk_screen_get_setting(gdk_screen_get_default(), "xdg-sound-theme", &value)) { + const char *t; + + /* FIXME, this needs more love, we need to subscribe to theme changes */ + + if ((t = g_value_get_string(&value))) + ca_assert_se(ca_context_change_props(c, CA_PROP_CANBERRA_XDG_THEME_NAME, t, NULL) == 0); + + g_value_unset(&value); + } + + if (gdk_screen_get_setting(gdk_screen_get_default(), "xdg-sound-theme-output-profile", &value)) { + const char *t; + + /* FIXME, this needs more love, we need to subscribe to theme changes */ + + if ((t = g_value_get_string(&value))) + ca_assert_se(ca_context_change_props(c, CA_PROP_CANBERRA_XDG_THEME_OUTPUT_PROFILE, t, NULL) == 0); + + g_value_unset(&value); + } + g_static_private_set(&context_private, c, (GDestroyNotify) ca_context_destroy); return c; @@ -1,5 +1,4 @@ * dso backend -* link GtkSettings to prop * git move * indent by 8 chars @@ -7,3 +6,4 @@ Later: * lookup cache * ca_context_left_to_play() * queuing, looping, prefixing, postfixing +* make CA_PROP_CANBERRA_XDG_xxx follow GtkSettings |