event-editor-dialog: Use an AdwBanner when a calendar is read-only

Using a tooltip to inform when the calendar is read-only won't
work in touch devices.

This change also improves a11y, as Orca now reads this message,
something that wasn't happening before.
This commit is contained in:
Automeris naranja
2024-10-22 11:29:53 +00:00
committed by Georges Basile Stavracas Neto
parent 3c85d7d19e
commit 061c027520
2 changed files with 58 additions and 56 deletions
@@ -55,7 +55,6 @@ struct _GcalEventEditorDialog
GtkWidget *cancel_button;
GtkWidget *delete_group;
GtkWidget *done_button;
GtkWidget *lock;
GcalEventEditorSection *notes_section;
GcalEventEditorSection *reminders_section;
GcalEventEditorSection *schedule_section;
@@ -626,7 +625,6 @@ gcal_event_editor_dialog_class_init (GcalEventEditorDialogClass *klass)
gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, cancel_button);
gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, delete_group);
gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, done_button);
gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, lock);
gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, notes_section);
gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, reminders_section);
gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, schedule_section);
@@ -16,14 +16,6 @@
<signal name="clicked" handler="on_cancel_button_clicked_cb" object="GcalEventEditorDialog" swapped="no"/>
</object>
</child>
<child>
<object class="GtkImage" id="lock">
<property name="visible" bind-source="GcalEventEditorDialog" bind-property="writable" bind-flags="default|invert-boolean|sync-create" />
<property name="tooltip-markup" translatable="yes">&lt;b&gt;This event is part of a read-only calendar&lt;/b&gt;
You cannot delete or change this event.</property>
<property name="icon_name">changes-prevent-symbolic</property>
</object>
</child>
<child type="title">
<object class="GtkMenuButton" id="sources_button">
<property name="popover">
@@ -115,74 +107,86 @@ You cannot delete or change this event.</property>
</object>
</child>
<property name="content">
<object class="AdwPreferencesPage">
<property name="vexpand">True</property>
<!-- Summary -->
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="GcalSummarySection" id="summary_section">
<property name="sensitive" bind-source="GcalEventEditorDialog" bind-property="writable" bind-flags="default|sync-create" />
</object>
</child>
<object class="AdwBanner">
<property name="title" translatable="yes">This event is in a read-only calendar. It cannot be edited or deleted.</property>
<property name="revealed" bind-source="GcalEventEditorDialog" bind-property="writable" bind-flags="default|invert-boolean|sync-create" />
</object>
</child>
<!-- Schedule -->
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Schedule</property>
<object class="AdwPreferencesPage">
<property name="vexpand">True</property>
<!-- Summary -->
<child>
<object class="GcalScheduleSection" id="schedule_section">
<property name="sensitive" bind-source="GcalEventEditorDialog" bind-property="writable" bind-flags="default|sync-create" />
<object class="AdwPreferencesGroup">
<child>
<object class="GcalSummarySection" id="summary_section">
<property name="sensitive" bind-source="GcalEventEditorDialog" bind-property="writable" bind-flags="default|sync-create" />
</object>
</child>
</object>
</child>
</object>
</child>
<!-- Reminders -->
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Reminders</property>
<!-- Schedule -->
<child>
<object class="GcalRemindersSection" id="reminders_section">
<property name="sensitive" bind-source="GcalEventEditorDialog" bind-property="writable" bind-flags="default|sync-create" />
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Schedule</property>
<child>
<object class="GcalScheduleSection" id="schedule_section">
<property name="sensitive" bind-source="GcalEventEditorDialog" bind-property="writable" bind-flags="default|sync-create" />
</object>
</child>
</object>
</child>
</object>
</child>
<!-- Notes -->
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Notes</property>
<!-- Reminders -->
<child>
<object class="GcalNotesSection" id="notes_section">
<property name="sensitive" bind-source="GcalEventEditorDialog" bind-property="writable" bind-flags="default|sync-create" />
<property name="vexpand">True</property>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Reminders</property>
<child>
<object class="GcalRemindersSection" id="reminders_section">
<property name="sensitive" bind-source="GcalEventEditorDialog" bind-property="writable" bind-flags="default|sync-create" />
</object>
</child>
</object>
</child>
</object>
</child>
<!-- Delete Button -->
<child>
<object class="AdwPreferencesGroup" id="delete_group">
<!-- Notes -->
<child>
<object class="AdwButtonRow">
<signal name="activated" handler="on_delete_row_activated_cb" object="GcalEventEditorDialog" swapped="no"/>
<property name="sensitive" bind-source="GcalEventEditorDialog" bind-property="writable" bind-flags="default" />
<property name="title" translatable="yes">Delete Event</property>
<style>
<class name="destructive-action"/>
</style>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Notes</property>
<child>
<object class="GcalNotesSection" id="notes_section">
<property name="sensitive" bind-source="GcalEventEditorDialog" bind-property="writable" bind-flags="default|sync-create" />
<property name="vexpand">True</property>
</object>
</child>
</object>
</child>
<!-- Delete Button -->
<child>
<object class="AdwPreferencesGroup" id="delete_group">
<child>
<object class="AdwButtonRow">
<signal name="activated" handler="on_delete_row_activated_cb" object="GcalEventEditorDialog" swapped="no"/>
<property name="sensitive" bind-source="GcalEventEditorDialog" bind-property="writable" bind-flags="default" />
<property name="title" translatable="yes">Delete Event</property>
<style>
<class name="destructive-action"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>