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: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/680>
This commit is contained in:
committed by
Marge Bot
parent
c3635967bc
commit
ab76cd59be
@@ -2,18 +2,6 @@ using Gtk 4.0;
|
|||||||
using Adw 1;
|
using Adw 1;
|
||||||
|
|
||||||
template $GcalAlarmRow: Adw.ActionRow {
|
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 {
|
Button remove_button {
|
||||||
valign: center;
|
valign: center;
|
||||||
icon-name: "edit-delete-symbolic";
|
icon-name: "edit-delete-symbolic";
|
||||||
|
|||||||
@@ -207,7 +207,6 @@ setup_alarm (GcalAlarmRow *self)
|
|||||||
{
|
{
|
||||||
g_autofree gchar *formatted_duration = NULL;
|
g_autofree gchar *formatted_duration = NULL;
|
||||||
ECalComponentAlarmTrigger *trigger;
|
ECalComponentAlarmTrigger *trigger;
|
||||||
ECalComponentAlarmAction action;
|
|
||||||
ICalDuration *duration;
|
ICalDuration *duration;
|
||||||
|
|
||||||
trigger = e_cal_component_alarm_get_trigger (self->alarm);
|
trigger = e_cal_component_alarm_get_trigger (self->alarm);
|
||||||
@@ -215,9 +214,6 @@ setup_alarm (GcalAlarmRow *self)
|
|||||||
formatted_duration = format_alarm_duration (duration);
|
formatted_duration = format_alarm_duration (duration);
|
||||||
|
|
||||||
adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self), formatted_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);
|
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
|
* 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_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_remove_button_clicked_cb);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, on_sound_toggle_changed_cb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -128,7 +128,12 @@ create_alarm (guint minutes)
|
|||||||
|
|
||||||
alarm = e_cal_component_alarm_new ();
|
alarm = e_cal_component_alarm_new ();
|
||||||
e_cal_component_alarm_take_trigger (alarm, trigger);
|
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;
|
return alarm;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user