diff --git a/data/meson.build b/data/meson.build index 6e93084..f0a277c 100644 --- a/data/meson.build +++ b/data/meson.build @@ -110,3 +110,10 @@ if compile_schemas.found() args: ['--strict', '--dry-run', meson.current_source_dir()], ) endif + +# Sounds (fallback for systems without telephony events in sound theme) +install_data( + 'sounds/phone-outgoing-calling.oga', + 'sounds/phone-outgoing-busy.oga', + install_dir: join_paths(datadir, calls_name, 'sounds'), +) diff --git a/data/sounds/phone-outgoing-busy.oga b/data/sounds/phone-outgoing-busy.oga new file mode 100644 index 0000000..469f0e9 Binary files /dev/null and b/data/sounds/phone-outgoing-busy.oga differ diff --git a/data/sounds/phone-outgoing-calling.oga b/data/sounds/phone-outgoing-calling.oga new file mode 100644 index 0000000..dd398dc Binary files /dev/null and b/data/sounds/phone-outgoing-calling.oga differ diff --git a/meson.build b/meson.build index cdf7a0c..97c8444 100644 --- a/meson.build +++ b/meson.build @@ -78,6 +78,8 @@ config_data.set_quoted('APP_DATA_NAME', calls_name) config_data.set_quoted('GETTEXT_PACKAGE', calls_name) config_data.set_quoted('LOCALEDIR', full_localedir) config_data.set_quoted('PLUGIN_LIBDIR', full_calls_plugin_libdir) +config_data.set_quoted('CALLS_SOUNDS_DIR', + join_paths(prefix, get_option('datadir'), calls_name, 'sounds')) config_data.set_quoted('PACKAGE_URL', calls_homepage) config_data.set_quoted('PACKAGE_VERSION', calls_version) config_data.set('PACKAGE_URL_RAW', calls_homepage) diff --git a/src/calls-media-playback.c b/src/calls-media-playback.c index d2c68c8..9b90e98 100644 --- a/src/calls-media-playback.c +++ b/src/calls-media-playback.c @@ -26,6 +26,8 @@ #include "calls-media-playback.h" +#include "calls-config.h" + #include @@ -96,6 +98,23 @@ playback_event_to_string (PlaybackEvent event) } } + +static const char * +playback_event_to_filename (PlaybackEvent event) +{ + switch (event) { + case PLAYBACK_CALLING: + return CALLS_SOUNDS_DIR "/phone-outgoing-calling.oga"; + + case PLAYBACK_BUSY: + return CALLS_SOUNDS_DIR "/phone-outgoing-busy.oga"; + + case PLAYBACK_LAST: + default: + return NULL; + } +} + static void calls_media_playback_dispose (GObject *object) { @@ -182,11 +201,13 @@ static void playback_data (MediaPlaybackData *data) { const char *event_id; + const char *filename; g_assert (CALLS_IS_MEDIA_PLAYBACK (data->self)); g_assert (data->self->context); event_id = playback_event_to_string (data->event); + filename = playback_event_to_filename (data->event); if (!event_id) { g_warning ("No event id found for %d", data->event); @@ -201,6 +222,7 @@ playback_data (MediaPlaybackData *data) data, GSOUND_ATTR_CANBERRA_CACHE_CONTROL, "volatile", GSOUND_ATTR_EVENT_ID, event_id, + GSOUND_ATTR_MEDIA_FILENAME, filename, NULL); }