Files
federated-calendar/src/gui/event-editor/gcal-event-editor-dialog.blp
T
Jean-François Fortin Tam 3e4ef6f9c7 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
2025-07-11 23:27:08 -04:00

108 lines
2.2 KiB
Plaintext

using Gtk 4.0;
using Adw 1;
template $GcalEventEditorDialog: Adw.Dialog {
content-width: 700;
content-height: 1000;
Adw.ToolbarView {
[top]
Adw.HeaderBar {
show-start-title-buttons: false;
show-end-title-buttons: false;
Button cancel_button {
use-underline: true;
label: _("_Cancel");
clicked => $on_cancel_button_clicked_cb(template) not-swapped;
}
[end]
Button done_button {
use-underline: true;
label: _("_Done");
action-name: "event-editor.save";
styles [
"suggested-action",
]
}
}
content: Box {
orientation: vertical;
Adw.Banner {
title: _("This event is in a read-only calendar. It cannot be edited or deleted.");
revealed: bind template.writable inverted;
}
Adw.PreferencesPage {
vexpand: true;
Adw.PreferencesGroup {
$GcalSummarySection summary_section {
sensitive: bind template.writable;
}
}
Adw.PreferencesGroup {
$GcalCalendarComboRow calendar_combo_row {
sensitive: bind template.writable;
}
}
Adw.PreferencesGroup {
$GcalScheduleSection schedule_section {
sensitive: bind template.writable;
}
}
Adw.PreferencesGroup {
title: _("Reminders");
$GcalRemindersSection reminders_section {
sensitive: bind template.writable;
}
}
Adw.PreferencesGroup {
title: _("Notes");
$GcalNotesSection notes_section {
sensitive: bind template.writable;
vexpand: true;
}
}
Adw.PreferencesGroup delete_group {
Adw.ButtonRow {
activated => $on_delete_row_activated_cb(template) not-swapped;
title: _("Delete Event");
styles [
"destructive-action",
]
}
}
}
};
}
ShortcutController {
Shortcut {
trigger: "<Control>s";
action: "action(event-editor.save)";
}
}
}
SizeGroup {
mode: vertical;
widgets [
cancel_button,
done_button,
]
}