summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-10-06 23:46:43 +0200
committerLennart Poettering <lennart@poettering.net>2009-10-07 00:39:47 +0200
commit76b422c1cb1df676d90fc48171e729317d9b8889 (patch)
tree46889cd80d93d4b6db5f71b71a90df7196d83ab9
parentff02074558d23fc2ebc992e83073815a7c9141e8 (diff)
gtk: even if GtkSettings is not available use context
-rw-r--r--src/canberra-gtk.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/canberra-gtk.c b/src/canberra-gtk.c
index b9de2fe..bddaed7 100644
--- a/src/canberra-gtk.c
+++ b/src/canberra-gtk.c
@@ -137,21 +137,20 @@ ca_context *ca_gtk_context_get_for_screen(GdkScreen *screen) {
ca_context_change_props_full(c, p);
ca_proplist_destroy(p);
- s = gtk_settings_get_for_screen(screen);
-
- ca_return_val_if_fail(s, NULL);
-
- if (g_object_class_find_property(G_OBJECT_GET_CLASS(s), "gtk-sound-theme-name")) {
- g_signal_connect(G_OBJECT(s), "notify::gtk-sound-theme-name", G_CALLBACK(sound_theme_name_changed), c);
- read_sound_theme_name(c, s);
- } else
- g_debug("This Gtk+ version doesn't have the GtkSettings::gtk-sound-theme-name property.");
-
- if (g_object_class_find_property(G_OBJECT_GET_CLASS(s), "gtk-enable-event-sounds")) {
- g_signal_connect(G_OBJECT(s), "notify::gtk-enable-event-sounds", G_CALLBACK(enable_event_sounds_changed), c);
- read_enable_event_sounds(c, s);
- } else
- g_debug("This Gtk+ version doesn't have the GtkSettings::gtk-enable-event-sounds property.");
+ if ((s = gtk_settings_get_for_screen(screen))) {
+
+ if (g_object_class_find_property(G_OBJECT_GET_CLASS(s), "gtk-sound-theme-name")) {
+ g_signal_connect(G_OBJECT(s), "notify::gtk-sound-theme-name", G_CALLBACK(sound_theme_name_changed), c);
+ read_sound_theme_name(c, s);
+ } else
+ g_debug("This Gtk+ version doesn't have the GtkSettings::gtk-sound-theme-name property.");
+
+ if (g_object_class_find_property(G_OBJECT_GET_CLASS(s), "gtk-enable-event-sounds")) {
+ g_signal_connect(G_OBJECT(s), "notify::gtk-enable-event-sounds", G_CALLBACK(enable_event_sounds_changed), c);
+ read_enable_event_sounds(c, s);
+ } else
+ g_debug("This Gtk+ version doesn't have the GtkSettings::gtk-enable-event-sounds property.");
+ }
g_object_set_data_full(G_OBJECT(screen), "canberra::gtk::context", c, (GDestroyNotify) ca_context_destroy);