aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2016-02-01 18:05:45 -0600
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-08-29 14:27:02 +0200
commitdfa174a82854b214b7eeaa62ad8b7567c4c1a949 (patch)
treef75dd55c9f24cde812b542a8cda50381913b6d4c
parent9aeb0b4e50e93cb391e5eff4c57c88cdeef9488b (diff)
downloadayatana-indicator-datetime-dfa174a82854b214b7eeaa62ad8b7567c4c1a949.tar.gz
ayatana-indicator-datetime-dfa174a82854b214b7eeaa62ad8b7567c4c1a949.tar.bz2
ayatana-indicator-datetime-dfa174a82854b214b7eeaa62ad8b7567c4c1a949.zip
don't show calendar event notifications if com.ubuntu.calendar's notifications are blacklisted
-rw-r--r--include/datetime/settings.h1
-rw-r--r--src/snap.cpp17
2 files changed, 18 insertions, 0 deletions
diff --git a/include/datetime/settings.h b/include/datetime/settings.h
index 253a00a..d5e81c6 100644
--- a/include/datetime/settings.h
+++ b/include/datetime/settings.h
@@ -61,6 +61,7 @@ public:
core::Property<unsigned int> alarm_volume;
core::Property<unsigned int> alarm_duration;
core::Property<unsigned int> snooze_duration;
+ core::Property<std::set<std::pair<std::string,std::string>>> muted_apps;
};
} // namespace datetime
diff --git a/src/snap.cpp b/src/snap.cpp
index f0300af..934ad19 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -84,6 +84,12 @@ public:
appointment_func snooze,
appointment_func ok)
{
+ // If calendar notifications are muted, don't show them
+ if (!appointment.is_ubuntu_alarm() && calendar_events_are_muted()) {
+ g_debug("Skipping muted calendar event '%s' notification", appointment.summary.c_str());
+ return;
+ }
+
/* Alarms and calendar events are treated differently.
Alarms should require manual intervention to dismiss.
Calendar events are less urgent and shouldn't require manual
@@ -159,6 +165,17 @@ public:
private:
+ bool calendar_events_are_muted() const
+ {
+ for(const auto& app : m_settings->muted_apps.get()) {
+ if (app.first == "com.ubuntu.calendar") {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
static void on_sound_proxy_ready(GObject* /*source_object*/, GAsyncResult* res, gpointer gself)
{
GError * error;