GNOME Bugzilla – Bug 740484
[patch] Use GSound rather than libcanberra for playing sounds
Last modified: 2014-11-23 08:51:10 UTC
I've written a little GObject wrapper around libcanberra called GSound, which you can read about at [1]. It's mostly intended for use in introspected languages where libcanberra isn't available, but it works well in Vala and has a GObject-y API than canberra. Attached (assuming I can get git-bz to work) is a simple patch swapping libcanberra for GSound in gnome-clocks. It saves a massive 9 lines of code, but as an added bonus does proper error checking and sends the correct application name to Pulseaudio (visible in the sound tab in gnome-control-center, for example). [1] https://wiki.gnome.org/Projects/GSound
Created attachment 291148 [details] [review] utils: Use GSound rather than calling libcanberra directly
Review of attachment 291148 [details] [review]: Thanks! I am ok with this change, some minor nitpicks below ::: src/utils.vala @@ +305,3 @@ } + public async void ring_real (bool repeat) this method should be private @@ -303,3 +306,3 @@ - private bool keep_ringing () { - Canberra.Proplist pl; + public async void ring_real (bool repeat) + { { on the function line @@ -304,3 +307,3 @@ - private bool keep_ringing () { - Canberra.Proplist pl; - Canberra.Proplist.create (out pl); + public async void ring_real (bool repeat) + { + if (gsound == null) always use { } also for 1 line conditions
Created attachment 291220 [details] [review] utils: Use GSound rather than calling libcanberra directly Issues fixed as per comments. Okay to commit?
Review of attachment 291220 [details] [review]: Looks good! Thanks again. Please make sure to also add the gsound dependency in https://git.gnome.org/browse/jhbuild/tree/modulesets/gnome-apps-3.16.modules#n637
Attachment 291220 [details] pushed as 2f52b22 - utils: Use GSound rather than calling libcanberra directly