Commit 7ab280ff authored by Alexandru Băluț's avatar Alexandru Băluț

Use the GSound libcanberra wrapper

The "complete" sound we need is part of sound-theme-freedesktop. This
means we won't use the system's xdg sound theme. There is no other way
currently.

Fixes https://phabricator.freedesktop.org/T7598Reviewed-by: Thibault Saunier's avatarThibault Saunier <tsaunier@gnome.org>
Differential Revision: https://phabricator.freedesktop.org/D1577
parent 12dcde0e
......@@ -34,6 +34,26 @@
}
]
},
{
"name": "sound-theme-freedesktop",
"sources": [
{
"type": "git",
"url": "https://anongit.freedesktop.org/git/sound-theme-freedesktop.git",
"branch": "0.8"
}
]
},
{
"name": "gsound",
"sources": [
{
"type": "git",
"url": "https://git.gnome.org/browse/gsound",
"branch": "1.0.2"
}
]
},
{
"name": "x264",
"config-opts": ["--enable-shared", "--enable-static", "--enable-pic", "--disable-lavf"],
......
......@@ -373,8 +373,8 @@ HARD_DEPENDENCIES = [GICheck("3.20.0"),
]
SOFT_DEPENDENCIES = (
ClassicDependency("pycanberra", None,
_("enables sound notifications when rendering is complete")),
GIDependency("GSound", "1.0", None,
_("enables sound notifications when rendering is complete")),
GIDependency("Notify", "0.7", None,
_("enables visual notifications when rendering is complete")),
GstPluginDependency("libav", None,
......
......@@ -885,13 +885,17 @@ class RenderDialog(Loggable):
def destroy(self):
self.window.destroy()
@staticmethod
def _maybePlayFinishedSound():
if "pycanberra" in missing_soft_deps:
def _maybe_play_finished_sound(self):
"""Plays a sound to signal the render operation is done."""
if "GSound" in missing_soft_deps:
return
import pycanberra
canberra = pycanberra.Canberra()
canberra.play(1, pycanberra.CA_PROP_EVENT_ID, "complete-media", None)
from gi.repository import GSound
sound_context = GSound.Context()
try:
sound_context.init()
sound_context.play_simple({GSound.ATTR_EVENT_ID: "complete"})
except GLib.Error as e:
self.warning("GSound failed to play: %s", e)
def __maybeUseSourceAsset(self):
if self.__always_use_proxies.get_active():
......@@ -1042,7 +1046,7 @@ class RenderDialog(Loggable):
'"%s" has finished rendering.' % self.fileentry.get_text())
self.notification = self.app.system.desktopMessage(
_("Render complete"), notification, "pitivi")
self._maybePlayFinishedSound()
self._maybe_play_finished_sound()
self.progress.play_rendered_file_button.show()
self.progress.close_button.show()
self.progress.cancel_button.hide()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment