From ab76cd59bea2451c866c1209c1093b29fc8123e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Fortin=20Tam?= Date: Thu, 1 Jan 2026 16:21:10 -0500 Subject: [PATCH] Create only DISPLAY alarms in reminders, not AUDIO Creating "AUDIO" VALARM notification actions causes endless problems: users may only hear a sound notification (with no visuals), if at all, and most other apps don't honor nor support editing audio-only alarms. Other systems typically play a sound automatically on "DISPLAY" alarms. https://datatracker.ietf.org/doc/html/rfc5545#section-3.6.6 says: > Multiple mutually independent "VALARM" calendar components > can be specified for a single "VEVENT" or "VTODO" calendar component. However, each component states: > 'action' and 'trigger' are both REQUIRED, > but MUST NOT occur more than once. To keep the UI simple, we should pick one or the other; "DISPLAY" it is. Remove "AUDIO" alarm code and add a warning to never add it again. Fixes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1280 Part-of: --- src/gui/event-editor/gcal-alarm-row.blp | 12 --------- src/gui/event-editor/gcal-alarm-row.c | 27 ------------------- src/gui/event-editor/gcal-reminders-section.c | 7 ++++- 3 files changed, 6 insertions(+), 40 deletions(-) diff --git a/src/gui/event-editor/gcal-alarm-row.blp b/src/gui/event-editor/gcal-alarm-row.blp index 187fcdf9..06bd4ce1 100644 --- a/src/gui/event-editor/gcal-alarm-row.blp +++ b/src/gui/event-editor/gcal-alarm-row.blp @@ -2,18 +2,6 @@ using Gtk 4.0; using Adw 1; template $GcalAlarmRow: Adw.ActionRow { - ToggleButton volume_button { - valign: center; - icon-name: "audio-volume-high-symbolic"; - tooltip-text: _("Toggle Alarm Sound"); - notify::active => $on_sound_toggle_changed_cb(template) not-swapped; - active: true; - - styles [ - "flat", - ] - } - Button remove_button { valign: center; icon-name: "edit-delete-symbolic"; diff --git a/src/gui/event-editor/gcal-alarm-row.c b/src/gui/event-editor/gcal-alarm-row.c index d6829e85..98c31b01 100644 --- a/src/gui/event-editor/gcal-alarm-row.c +++ b/src/gui/event-editor/gcal-alarm-row.c @@ -207,7 +207,6 @@ setup_alarm (GcalAlarmRow *self) { g_autofree gchar *formatted_duration = NULL; ECalComponentAlarmTrigger *trigger; - ECalComponentAlarmAction action; ICalDuration *duration; trigger = e_cal_component_alarm_get_trigger (self->alarm); @@ -215,9 +214,6 @@ setup_alarm (GcalAlarmRow *self) formatted_duration = format_alarm_duration (duration); adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self), formatted_duration); - - action = e_cal_component_alarm_get_action (self->alarm); - gtk_toggle_button_set_active (self->volume_button, action == E_CAL_COMPONENT_ALARM_AUDIO); } @@ -232,28 +228,6 @@ on_remove_button_clicked_cb (GtkButton *button, g_signal_emit (self, signals[REMOVE_ALARM], 0); } -static void -on_sound_toggle_changed_cb (GtkToggleButton *button, - GParamSpec *pspec, - GcalAlarmRow *self) -{ - ECalComponentAlarmAction action; - gboolean has_sound; - - has_sound = gtk_toggle_button_get_active (button); - - /* Setup the alarm action */ - action = has_sound ? E_CAL_COMPONENT_ALARM_AUDIO : E_CAL_COMPONENT_ALARM_DISPLAY; - - e_cal_component_alarm_set_action (self->alarm, action); - - /* Update the volume icon */ - gtk_button_set_icon_name (GTK_BUTTON (self->volume_button), - has_sound ? "audio-volume-high-symbolic" : "audio-volume-muted-symbolic"); - - g_signal_emit (self, signals[UPDATE_ALARM], 0); -} - /* * GObject overrides @@ -348,7 +322,6 @@ gcal_alarm_row_class_init (GcalAlarmRowClass *klass) gtk_widget_class_bind_template_child (widget_class, GcalAlarmRow, volume_button); gtk_widget_class_bind_template_callback (widget_class, on_remove_button_clicked_cb); - gtk_widget_class_bind_template_callback (widget_class, on_sound_toggle_changed_cb); } static void diff --git a/src/gui/event-editor/gcal-reminders-section.c b/src/gui/event-editor/gcal-reminders-section.c index 6c8d6983..c1677fc8 100644 --- a/src/gui/event-editor/gcal-reminders-section.c +++ b/src/gui/event-editor/gcal-reminders-section.c @@ -128,7 +128,12 @@ create_alarm (guint minutes) alarm = e_cal_component_alarm_new (); e_cal_component_alarm_take_trigger (alarm, trigger); - e_cal_component_alarm_set_action (alarm, E_CAL_COMPONENT_ALARM_AUDIO); + + /* ONLY create "DISPLAY" alarm types. Don't expose "AUDIO" as an alarm type possibility for users to create; + * they're mutually independent from "DISPLAY" in RFC5545, and audio-only alarms are useless for users in practice. + * Furthermore, some other applications don't even allow creating/viewing/editing audio-only alarms on events! + * We should instead expect alarm notification systems to automatically play sounds when displaying notifications. */ + e_cal_component_alarm_set_action (alarm, E_CAL_COMPONENT_ALARM_DISPLAY); return alarm; }