event-editor: Hide Cancel & Delete when read-only

Read-only events show a "Done" button instead of the "Save" button.
The "Done" button does the same thing as "Cancel",
so the "Cancel" button is then redundant.

Likewise, it is impossible to delete events from read-only calendars,
as stated by the banner message in that dialog. In that case,
there's no reason to show a big "Delete" button that you can't click on.

Fixes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1168
This commit is contained in:
Jean-François Fortin Tam
2025-07-11 23:27:08 -04:00
parent 7282943d21
commit 3e4ef6f9c7
2 changed files with 3 additions and 2 deletions
@@ -78,7 +78,6 @@ template $GcalEventEditorDialog: Adw.Dialog {
Adw.PreferencesGroup delete_group {
Adw.ButtonRow {
activated => $on_delete_row_activated_cb(template) not-swapped;
sensitive: bind template.writable no-sync-create;
title: _("Delete Event");
styles [
@@ -702,8 +702,10 @@ gcal_event_editor_dialog_set_event (GcalEventEditorDialog *self,
set_writable (self, !gcal_calendar_is_read_only (calendar));
gtk_widget_set_visible (self->cancel_button, self->writable);
self->event_is_new = new_event;
gtk_widget_set_visible (self->delete_group, !new_event);
gtk_widget_set_visible (self->delete_group, !new_event && self->writable);
if (!self->writable)
gtk_widget_grab_focus (self->done_button);