diff --git a/data/org.ayatana.indicator.datetime.gschema.xml.in b/data/org.ayatana.indicator.datetime.gschema.xml.in
index 62e86b9c..d4610199 100644
--- a/data/org.ayatana.indicator.datetime.gschema.xml.in
+++ b/data/org.ayatana.indicator.datetime.gschema.xml.in
@@ -138,6 +138,14 @@
If a calendar or reminder event doesn't specify its own sound file, this file will be used as the fallback sound.
+
+
+ 50
+ The calendar's reminder alert default volume level.
+
+ The volume at which calendar reminder alert will be played.
+
+
'@ALARM_DEFAULT_SOUND@'
The alarm's default sound file.
diff --git a/include/datetime/settings-live.h b/include/datetime/settings-live.h
index 6a923f30..97c1d7a3 100644
--- a/include/datetime/settings-live.h
+++ b/include/datetime/settings-live.h
@@ -60,6 +60,7 @@ class LiveSettings: public Settings
void update_time_format_mode();
void update_timezone_name();
void update_calendar_sound();
+ void update_calendar_volume();
void update_alarm_sound();
void update_alarm_volume();
void update_alarm_duration();
diff --git a/include/datetime/settings-shared.h b/include/datetime/settings-shared.h
index 6e973287..949a712f 100644
--- a/include/datetime/settings-shared.h
+++ b/include/datetime/settings-shared.h
@@ -46,6 +46,7 @@ TimeFormatMode;
#define SETTINGS_LOCATIONS_S "locations"
#define SETTINGS_TIMEZONE_NAME_S "timezone-name"
#define SETTINGS_CALENDAR_SOUND_S "calendar-default-sound"
+#define SETTINGS_CALENDAR_VOLUME_S "calendar-default-volume"
#define SETTINGS_ALARM_SOUND_S "alarm-default-sound"
#define SETTINGS_ALARM_VOLUME_S "alarm-default-volume"
#define SETTINGS_ALARM_DURATION_S "alarm-duration-minutes"
diff --git a/include/datetime/settings.h b/include/datetime/settings.h
index 29905fd3..e95a6e7d 100644
--- a/include/datetime/settings.h
+++ b/include/datetime/settings.h
@@ -57,6 +57,7 @@ class Settings
core::Property time_format_mode;
core::Property timezone_name;
core::Property calendar_sound;
+ core::Property calendar_volume;
core::Property alarm_sound;
core::Property alarm_haptic;
core::Property alarm_volume;
diff --git a/src/settings-live.cpp b/src/settings-live.cpp
index 9cbc23c5..ef260e52 100644
--- a/src/settings-live.cpp
+++ b/src/settings-live.cpp
@@ -55,6 +55,7 @@ LiveSettings::LiveSettings():
update_time_format_mode();
update_timezone_name();
update_calendar_sound();
+ update_calendar_volume();
update_alarm_sound();
update_alarm_volume();
update_alarm_duration();
@@ -150,6 +151,10 @@ LiveSettings::LiveSettings():
g_settings_set_string(m_settings, SETTINGS_CALENDAR_SOUND_S, value.c_str());
});
+ calendar_volume.changed().connect([this](unsigned int value){
+ g_settings_set_uint(m_settings, SETTINGS_CALENDAR_VOLUME_S, value);
+ });
+
alarm_sound.changed().connect([this](const std::string& value){
g_settings_set_string(m_settings, SETTINGS_ALARM_SOUND_S, value.c_str());
});
@@ -291,6 +296,11 @@ void LiveSettings::update_calendar_sound()
g_free(val);
}
+void LiveSettings::update_calendar_volume()
+{
+ calendar_volume.set(g_settings_get_uint(m_settings, SETTINGS_CALENDAR_VOLUME_S));
+}
+
void LiveSettings::update_alarm_sound()
{
auto val = g_settings_get_string(m_settings, SETTINGS_ALARM_SOUND_S);
@@ -436,6 +446,8 @@ void LiveSettings::update_key_ccid(const std::string& key)
update_timezone_name();
else if (key == SETTINGS_CALENDAR_SOUND_S)
update_calendar_sound();
+ else if (key == SETTINGS_CALENDAR_VOLUME_S)
+ update_calendar_volume();
else if (key == SETTINGS_ALARM_SOUND_S)
update_alarm_sound();
else if (key == SETTINGS_ALARM_VOLUME_S)
diff --git a/src/snap.cpp b/src/snap.cpp
index c18f9553..4cfc0314 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -121,7 +121,7 @@ class Snap::Impl
// create the sound.
const auto role = appointment.is_alarm() ? "alarm" : "alert";
const auto uri = get_alarm_uri(appointment, alarm, m_settings);
- const auto volume = m_settings->alarm_volume.get();
+ const auto volume = appointment.is_alarm() ? m_settings->alarm_volume.get() : m_settings->calendar_volume.get();
const bool loop = interactive;
sound = m_sound_builder->create(role, uri, volume, loop);
}
diff --git a/tests/test-settings.cpp b/tests/test-settings.cpp
index 9e206aef..4e5d6822 100644
--- a/tests/test-settings.cpp
+++ b/tests/test-settings.cpp
@@ -180,6 +180,7 @@ TEST_F(SettingsFixture, StringProperties)
TestStringProperty(m_gsettings, m_settings->timezone_name, SETTINGS_TIMEZONE_NAME_S);
TestStringProperty(m_gsettings, m_settings->alarm_sound, SETTINGS_ALARM_SOUND_S);
TestStringProperty(m_gsettings, m_settings->calendar_sound, SETTINGS_CALENDAR_SOUND_S);
+ TestStringProperty(m_gsettings, m_settings->calendar_volume, SETTINGS_CALENDAR_VOLUME_S);
TestStringProperty(m_gsettings, m_settings->alarm_haptic, SETTINGS_ALARM_HAPTIC_S);
}