[evolution-data-server] evo-I#1026 - alarm-notify: Add option to enable/disable desktop notifications
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] evo-I#1026 - alarm-notify: Add option to enable/disable desktop notifications
- Date: Wed, 20 Apr 2022 11:43:10 +0000 (UTC)
commit 9ff6973c76ab03fc538dfc93de7dd0b12105582c
Author: Milan Crha <mcrha redhat com>
Date: Wed Apr 20 13:39:46 2022 +0200
evo-I#1026 - alarm-notify: Add option to enable/disable desktop notifications
Related to https://gitlab.gnome.org/GNOME/evolution/-/issues/1026
data/org.gnome.evolution-data-server.calendar.gschema.xml.in | 5 +++++
src/services/evolution-alarm-notify/e-alarm-notify.c | 9 ++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/data/org.gnome.evolution-data-server.calendar.gschema.xml.in
b/data/org.gnome.evolution-data-server.calendar.gschema.xml.in
index d5b5acd6b..586f5c2bd 100644
--- a/data/org.gnome.evolution-data-server.calendar.gschema.xml.in
+++ b/data/org.gnome.evolution-data-server.calendar.gschema.xml.in
@@ -38,6 +38,11 @@
<summary>Reminder programs</summary>
<description>Programs that are allowed to be run by reminders</description>
</key>
+ <key name="notify-enable-display" type="b">
+ <default>true</default>
+ <summary>Enable desktop notifications</summary>
+ <description>When set to true, the desktop/system notifications are shown</description>
+ </key>
<key name="notify-enable-audio" type="b">
<default>true</default>
<summary>Enable audio notifications</summary>
diff --git a/src/services/evolution-alarm-notify/e-alarm-notify.c
b/src/services/evolution-alarm-notify/e-alarm-notify.c
index f93111fc8..3f2f72380 100644
--- a/src/services/evolution-alarm-notify/e-alarm-notify.c
+++ b/src/services/evolution-alarm-notify/e-alarm-notify.c
@@ -323,7 +323,8 @@ e_alarm_notify_display (EAlarmNotify *an,
notif_id = e_alarm_notify_build_notif_id (rd);
- if (!g_hash_table_contains (an->priv->notification_ids, notif_id)) {
+ if (g_settings_get_boolean (an->priv->settings, "notify-enable-display") &&
+ !g_hash_table_contains (an->priv->notification_ids, notif_id)) {
GNotification *notification;
GtkIconInfo *icon_info;
gchar *detailed_action;
@@ -364,6 +365,11 @@ e_alarm_notify_display (EAlarmNotify *an,
g_object_unref (notification);
g_hash_table_insert (an->priv->notification_ids, notif_id, NULL);
+ } else {
+ g_free (notif_id);
+
+ if (!g_settings_get_boolean (an->priv->settings, "notify-enable-display"))
+ ean_debug_print ("Display notify: Skipped, because disabled in the settings\n");
}
g_free (an->priv->status_icon_tooltip);
@@ -792,6 +798,7 @@ e_alarm_notify_status_icon_popup_menu_cb (GtkStatusIcon *status_icon,
} items[] = {
{ N_("Display Reminders window with _notifications"), "notify-with-tray",
G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_INVERT_BOOLEAN },
{ N_("Keep reminder notification window always on _top"), "notify-window-on-top",
G_SETTINGS_BIND_DEFAULT },
+ { N_("Enable _desktop notifications"), "notify-enable-display", G_SETTINGS_BIND_DEFAULT },
{ N_("Enable _audio notifications"), "notify-enable-audio", G_SETTINGS_BIND_DEFAULT },
{ N_("Display reminders for _completed tasks"), "notify-completed-tasks",
G_SETTINGS_BIND_DEFAULT },
{ N_("Display reminders for _past events"), "notify-past-events", G_SETTINGS_BIND_DEFAULT }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]