Cangjians/ibus-cangjie — pull request #36 by bochecha (2014-01-11 17:45:52+00:00)
Title: Rework the way we make pycanberra optional

We can't assume on pycanberra being available, because it's just a quick hack someone made as a workaround until libcanberra has GObject-Introspection bindings. As a result, it's not available on many operating systems.

So we have to make that optional...

I've never been super happy with that piece of code, because the engine itself had knowledge of whether pycanberra was available or not. Also, we tried importing it every time we needed to play some sound...

This change allows the engine to blissfully ignore all about the availability of pycanberra. It just assumes it's there, and when it's not, the new `ibus_cangjie.canberra` module gave it something that will just silently not do anything.

This simplifies the unit tests a lot as well: they can now assume that pycanberra is available, and we don't need to fiddle with an environment variable to control the execution of tests any more.