diff --git a/po/POTFILES.in b/po/POTFILES.in index fa196aa8a60190fe74245e9b7d1dee717c195b5b..8278e7c2436909b701d9e153d272fe64040493fe 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -3,59 +3,58 @@ data/org.gnome.Calendar.desktop.in.in data/org.gnome.calendar.gschema.xml.in src/appdata/org.gnome.Calendar.metainfo.xml.in.in -src/main.c src/core/gcal-event.c -src/gui/calendar-management/calendar-row.ui -src/gui/calendar-management/gcal-calendar-management-dialog.ui +src/gui/calendar-management/calendar-row.blp +src/gui/calendar-management/gcal-calendar-management-dialog.blp +src/gui/calendar-management/gcal-calendars-page.blp src/gui/calendar-management/gcal-calendars-page.c -src/gui/calendar-management/gcal-calendars-page.ui +src/gui/calendar-management/gcal-edit-calendar-page.blp src/gui/calendar-management/gcal-edit-calendar-page.c -src/gui/calendar-management/gcal-edit-calendar-page.ui +src/gui/calendar-management/gcal-new-calendar-page.blp src/gui/calendar-management/gcal-new-calendar-page.c -src/gui/calendar-management/gcal-new-calendar-page.ui src/gui/common/gcal-calendar-combo-row-item.c -src/gui/common/gcal-calendar-combo-row.ui +src/gui/common/gcal-calendar-combo-row.blp src/gui/common/gcal-date-chooser.c +src/gui/event-editor/gcal-alarm-row.blp src/gui/event-editor/gcal-alarm-row.c -src/gui/event-editor/gcal-alarm-row.ui -src/gui/event-editor/gcal-date-chooser-row.ui +src/gui/event-editor/gcal-date-chooser-row.blp +src/gui/event-editor/gcal-date-time-chooser.blp src/gui/event-editor/gcal-date-time-chooser.c -src/gui/event-editor/gcal-date-time-chooser.ui -src/gui/event-editor/gcal-time-chooser-row.ui +src/gui/event-editor/gcal-event-editor-dialog.blp src/gui/event-editor/gcal-event-editor-dialog.c -src/gui/event-editor/gcal-event-editor-dialog.ui -src/gui/event-editor/gcal-reminders-section.ui +src/gui/event-editor/gcal-reminders-section.blp +src/gui/event-editor/gcal-schedule-section.blp src/gui/event-editor/gcal-schedule-section.c -src/gui/event-editor/gcal-schedule-section.ui +src/gui/event-editor/gcal-summary-section.blp src/gui/event-editor/gcal-summary-section.c -src/gui/event-editor/gcal-summary-section.ui +src/gui/event-editor/gcal-time-chooser-row.blp +src/gui/event-editor/gcal-time-zone-dialog.blp src/gui/event-editor/gcal-time-zone-dialog.c -src/gui/event-editor/gcal-time-zone-dialog.ui src/gui/gcal-application.c -src/gui/gcal-calendar-button.ui +src/gui/gcal-calendar-button.blp +src/gui/gcal-event-popover.blp src/gui/gcal-event-popover.c -src/gui/gcal-event-popover.ui src/gui/gcal-event-widget.c +src/gui/gcal-meeting-row.blp src/gui/gcal-meeting-row.c -src/gui/gcal-meeting-row.ui +src/gui/gcal-quick-add-popover.blp src/gui/gcal-quick-add-popover.c -src/gui/gcal-quick-add-popover.ui -src/gui/gcal-search-button.ui -src/gui/gcal-sync-indicator.ui -src/gui/gcal-weather-settings.ui +src/gui/gcal-search-button.blp +src/gui/gcal-sync-indicator.blp +src/gui/gcal-weather-settings.blp +src/gui/gcal-window.blp src/gui/gcal-window.c -src/gui/gcal-window.ui -src/gui/gtk/help-overlay.ui +src/gui/gtk/help-overlay.blp +src/gui/importer/gcal-import-dialog.blp src/gui/importer/gcal-import-dialog.c -src/gui/importer/gcal-import-dialog.ui -src/gui/importer/gcal-importer.c src/gui/importer/gcal-import-file-row.c +src/gui/importer/gcal-importer.c +src/gui/views/gcal-agenda-view.blp src/gui/views/gcal-agenda-view.c -src/gui/views/gcal-agenda-view.ui -src/gui/views/gcal-month-popover.ui +src/gui/views/gcal-month-popover.blp src/gui/views/gcal-week-grid.c src/gui/views/gcal-week-header.c src/gui/views/gcal-week-hour-bar.c src/gui/views/gcal-week-view.c +src/main.c src/utils/gcal-utils.c - diff --git a/src/gui/calendar-management/calendar-row.blp b/src/gui/calendar-management/calendar-row.blp new file mode 100644 index 0000000000000000000000000000000000000000..bb9e8a0952f75711d00855c7d13c53e4f621cb8c --- /dev/null +++ b/src/gui/calendar-management/calendar-row.blp @@ -0,0 +1,42 @@ +using Gtk 4.0; +using Adw 1; + +Adw.ActionRow row { + use-markup: false; + activatable: true; + + [prefix] + Image icon { + pixel-size: 24; + accessible-role: presentation; + + styles [ + "calendar-color-image", + ] + } + + [suffix] + Image read_only_icon { + tooltip-text: _("Read-Only Calendar"); + icon-name: "changes-prevent-symbolic"; + pixel-size: 20; + valign: center; + } + + [suffix] + Switch switch { + valign: center; + tooltip-text: _("Display Calendar"); + } + + [suffix] + Image { + halign: end; + valign: center; + icon-name: "go-next-symbolic"; + + accessibility { + label: _("Edit calendar"); + } + } +} diff --git a/src/gui/calendar-management/calendar-row.ui b/src/gui/calendar-management/calendar-row.ui deleted file mode 100644 index b4cbd400fac774a9778c02fdb7f80cf384c7007c..0000000000000000000000000000000000000000 --- a/src/gui/calendar-management/calendar-row.ui +++ /dev/null @@ -1,44 +0,0 @@ - - - - False - True - - - 24 - presentation - - - - - - - - Read-Only Calendar - changes-prevent-symbolic - 20 - center - - - - - - center - Display Calendar - - - - - - end - center - go-next-symbolic - - Edit calendar - - - - - diff --git a/src/gui/calendar-management/gcal-calendar-management-dialog.blp b/src/gui/calendar-management/gcal-calendar-management-dialog.blp new file mode 100644 index 0000000000000000000000000000000000000000..9598c14bcdfa47c7851ddd48a04befae6ab005b2 --- /dev/null +++ b/src/gui/calendar-management/gcal-calendar-management-dialog.blp @@ -0,0 +1,13 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalCalendarManagementDialog: Adw.Dialog { + title: _("Calendar Settings"); + width-request: 360; + height-request: 500; + content-width: 500; + + Adw.NavigationView navigation_view { + popped => $on_navigation_view_popped_cb(template) not-swapped; + } +} diff --git a/src/gui/calendar-management/gcal-calendar-management-dialog.ui b/src/gui/calendar-management/gcal-calendar-management-dialog.ui deleted file mode 100644 index f94876f331118f6aa986a1009651397b6b4ac722..0000000000000000000000000000000000000000 --- a/src/gui/calendar-management/gcal-calendar-management-dialog.ui +++ /dev/null @@ -1,14 +0,0 @@ - - - - diff --git a/src/gui/calendar-management/gcal-calendars-page.blp b/src/gui/calendar-management/gcal-calendars-page.blp new file mode 100644 index 0000000000000000000000000000000000000000..bd8f2f40d76ef23d19eb3f88a39f77b829701c81 --- /dev/null +++ b/src/gui/calendar-management/gcal-calendars-page.blp @@ -0,0 +1,74 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalCalendarsPage: Adw.NavigationPage { + title: _("Calendars"); + tag: "calendars"; + + child: Adw.ToastOverlay toast_overlay { + Adw.ToolbarView { + [top] + Adw.HeaderBar {} + + content: ScrolledWindow { + hexpand: true; + hscrollbar-policy: never; + max-content-height: 900; + propagate-natural-height: true; + + child: Adw.Clamp { + child: Box { + orientation: vertical; + spacing: 24; + margin-top: 24; + margin-bottom: 24; + margin-start: 12; + margin-end: 12; + valign: start; + + ListBox listbox { + selection-mode: none; + row-activated => $on_listbox_row_activated_cb(template) not-swapped; + + styles [ + "calendars-list", + "boxed-list", + ] + } + }; + }; + }; + + [bottom] + Adw.Clamp { + ListBox { + selection-mode: none; + margin-top: 15; + margin-bottom: 15; + margin-start: 12; + margin-end: 12; + + Adw.ButtonRow { + title: _("_Add Calendar"); + use-underline: true; + end-icon-name: "go-next-symbolic"; + activated => $on_new_calendar_row_activated_cb(template) not-swapped; + + ShortcutController { + scope: managed; + + Shortcut { + trigger: "n"; + action: "activate"; + } + } + } + + styles [ + "boxed-list", + ] + } + } + } + }; +} diff --git a/src/gui/calendar-management/gcal-calendars-page.ui b/src/gui/calendar-management/gcal-calendars-page.ui deleted file mode 100644 index 84ef852ee0d2c6c020619df94160998e42e901a4..0000000000000000000000000000000000000000 --- a/src/gui/calendar-management/gcal-calendars-page.ui +++ /dev/null @@ -1,98 +0,0 @@ - - - - diff --git a/src/gui/calendar-management/gcal-edit-calendar-page.blp b/src/gui/calendar-management/gcal-edit-calendar-page.blp new file mode 100644 index 0000000000000000000000000000000000000000..1e23619123eb9d344c3c540aea36eb1e7cc6a970 --- /dev/null +++ b/src/gui/calendar-management/gcal-edit-calendar-page.blp @@ -0,0 +1,93 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalEditCalendarPage: Adw.NavigationPage { + title: _("Edit Calendar"); + tag: "edit-calendar"; + + child: Adw.ToolbarView { + [top] + Adw.HeaderBar { + title-widget: Adw.WindowTitle { + title: bind name_entry.text; + }; + } + + content: Adw.PreferencesPage { + Adw.PreferencesGroup { + Adw.ActionRow account_row { + title: _("Account"); + subtitle-selectable: true; + + styles [ + "property", + ] + + Button settings_button { + tooltip-text: _("Open in Settings"); + valign: center; + clicked => $on_settings_button_clicked_cb(template) not-swapped; + + styles [ + "flat", + ] + + Image { + icon-name: "external-link-symbolic"; + accessible-role: presentation; + } + } + } + + Adw.ActionRow calendar_url_row { + title: _("Location"); + subtitle-lines: 1; + + styles [ + "property", + ] + } + } + + Adw.PreferencesGroup { + Adw.EntryRow name_entry { + title: _("Calendar Name"); + } + + Adw.ActionRow { + title: _("Color"); + activatable-widget: calendar_color_button; + + ColorDialogButton calendar_color_button { + valign: center; + + dialog: ColorDialog { + modal: true; + with-alpha: false; + }; + + notify::rgba => $on_calendar_color_changed_cb(template) not-swapped; + } + } + + Adw.SwitchRow calendar_visible_row { + title: _("_Display Calendar"); + use-underline: true; + notify::active => $on_calendar_visibility_changed_cb(template) not-swapped; + } + } + + Adw.PreferencesGroup remove_group { + Adw.ButtonRow remove_button_row { + title: _("_Remove Calendar"); + use-underline: true; + activated => $on_remove_button_row_activated_cb(template) not-swapped; + + styles [ + "destructive-action", + ] + } + } + }; + }; +} diff --git a/src/gui/calendar-management/gcal-edit-calendar-page.ui b/src/gui/calendar-management/gcal-edit-calendar-page.ui deleted file mode 100644 index 4b724bb81105bf47549a028d8937b0653feb17df..0000000000000000000000000000000000000000 --- a/src/gui/calendar-management/gcal-edit-calendar-page.ui +++ /dev/null @@ -1,144 +0,0 @@ - - - - - diff --git a/src/gui/calendar-management/gcal-new-calendar-page.blp b/src/gui/calendar-management/gcal-new-calendar-page.blp new file mode 100644 index 0000000000000000000000000000000000000000..9587d7e1ee3ddb3eb34273947358a793509c60fa --- /dev/null +++ b/src/gui/calendar-management/gcal-new-calendar-page.blp @@ -0,0 +1,168 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalNewCalendarPage: Adw.NavigationPage { + title: _("New Calendar"); + tag: "new-calendar"; + + child: Adw.ToolbarView { + [top] + Adw.HeaderBar { + show-end-title-buttons: false; + show-start-title-buttons: false; + } + + content: Adw.PreferencesPage { + Adw.PreferencesGroup { + title: _("Create a Local Calendar"); + + Adw.EntryRow local_calendar_name_row { + title: _("Calendar Name"); + notify::text => $on_local_calendar_name_row_text_changed_cb(template) not-swapped; + } + + Adw.ActionRow { + title: _("Color"); + activatable-widget: local_calendar_color_button; + + ColorDialogButton local_calendar_color_button { + valign: center; + + dialog: ColorDialog { + modal: true; + with-alpha: false; + }; + + notify::rgba => $on_local_calendar_color_button_rgba_changed_cb(template) not-swapped; + } + } + } + + Adw.PreferencesGroup { + title: _("Connect to an Online Calendar"); + + Grid { + row-spacing: 12; + column-spacing: 12; + + Label { + label: _("HTTPS, CalDAV, or Webcal URLs are supported. Online calendars that can only be updated by the provider will be added as read-only."); + wrap: true; + xalign: 0; + + layout { + column: 0; + row: 0; + column-span: 2; + } + } + + Entry calendar_address_entry { + hexpand: true; + placeholder-text: "https://example.com/calendar.ics"; + input-purpose: url; + notify::text => $on_url_entry_text_changed_cb(template) not-swapped; + activate => $on_calendar_address_activated_cb(template) not-swapped; + + layout { + column: 0; + row: 1; + } + } + + Revealer web_sources_revealer { + transition-type: slide_down; + transition-duration: 200; + + layout { + column: 0; + row: 2; + column-span: 2; + } + + Box web_sources_listbox_box { + orientation: vertical; + spacing: 6; + + Label web_sources_calendar_label { + label: _("Calendars"); + xalign: 0; + + styles [ + "heading", + ] + } + + ListBox web_sources_listbox { + activate-on-single-click: false; + selection-mode: none; + + styles [ + "calendar-list", + ] + } + } + } + + Label web_description_label { + label: _("If the calendar belongs to one of your online accounts, you can add it through the online account settings."); + use-markup: true; + wrap: true; + xalign: 0; + activate-link => $on_web_description_label_link_activated_cb(template) not-swapped; + + layout { + column: 0; + row: 3; + column-span: 2; + } + } + } + } + + Adw.PreferencesGroup { + Button add_button { + halign: center; + label: C_("button", "Add Calendar"); + sensitive: false; + clicked => $on_add_button_clicked_cb(template) not-swapped; + + styles [ + "pill", + "suggested-action", + ] + } + } + }; + }; +} + +Adw.MessageDialog credentials_dialog { + heading: _("Credentials"); + hide-on-close: true; + + extra-child: Adw.Clamp { + ListBox { + Adw.EntryRow credentials_user_entry { + title: _("User"); + } + + Adw.PasswordEntryRow credentials_password_entry { + title: _("Password"); + } + + styles [ + "boxed-list", + ] + } + }; + + responses [ + cancel: _("_Cancel"), + connect: _("_Connect") suggested, + ] + + default-response: "connect"; + close-response: "cancel"; + response => $on_credentials_dialog_response_cb(template) not-swapped; +} diff --git a/src/gui/calendar-management/gcal-new-calendar-page.ui b/src/gui/calendar-management/gcal-new-calendar-page.ui deleted file mode 100644 index 39165532935fa29d7ddb44df0d7340775b368cf8..0000000000000000000000000000000000000000 --- a/src/gui/calendar-management/gcal-new-calendar-page.ui +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - - Credentials - True - - - - - - - User - - - - - Password - - - - - - - - - _Cancel - _Connect - - connect - cancel - - - - diff --git a/src/gui/calendar-management/meson.build b/src/gui/calendar-management/meson.build index d8c51c4002a77d3d9629377840b4454c237c38df..bfa756865c7112aeaf776920ce3628bb1f34a5aa 100644 --- a/src/gui/calendar-management/meson.build +++ b/src/gui/calendar-management/meson.build @@ -1,9 +1,29 @@ calendar_incs += include_directories('.') +blueprints = custom_target( + 'blueprints', + input: files( + 'calendar-row.blp', + 'gcal-calendar-management-dialog.blp', + 'gcal-calendars-page.blp', + 'gcal-edit-calendar-page.blp', + 'gcal-new-calendar-page.blp', + ), + output: '.', + command: [ + find_program('blueprint-compiler'), + 'batch-compile', + '@OUTPUT@', + '@CURRENT_SOURCE_DIR@', + '@INPUT@', + ], +) + built_sources += gnome.compile_resources( 'calendar-management-resources', 'calendar-management.gresource.xml', c_name: 'calendar_management', + dependencies: blueprints, ) sources += files( diff --git a/src/gui/common/gcal-calendar-combo-row-item.blp b/src/gui/common/gcal-calendar-combo-row-item.blp new file mode 100644 index 0000000000000000000000000000000000000000..c0c2997bcc254f63a63f41ac2d0e343dd2f70505 --- /dev/null +++ b/src/gui/common/gcal-calendar-combo-row-item.blp @@ -0,0 +1,27 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalCalendarComboRowItem: Adw.PreferencesRow { + Box { + orientation: horizontal; + spacing: 6; + + Image color_image { + styles [ + "calendar-color-image", + ] + } + + Label title_label { + ellipsize: end; + xalign: 0.0; + label: bind template.title; + } + + Image visibility_image { + halign: end; + hexpand: true; + icon-name: "eye-not-looking-symbolic"; + } + } +} diff --git a/src/gui/common/gcal-calendar-combo-row-item.ui b/src/gui/common/gcal-calendar-combo-row-item.ui deleted file mode 100644 index 7499529dc166b82fef402a94775bef55f59adeff..0000000000000000000000000000000000000000 --- a/src/gui/common/gcal-calendar-combo-row-item.ui +++ /dev/null @@ -1,32 +0,0 @@ - - - - diff --git a/src/gui/common/gcal-calendar-combo-row.blp b/src/gui/common/gcal-calendar-combo-row.blp new file mode 100644 index 0000000000000000000000000000000000000000..ea3827971028a5238a9534a9ca9859501718f81a --- /dev/null +++ b/src/gui/common/gcal-calendar-combo-row.blp @@ -0,0 +1,13 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalCalendarComboRow: Adw.ComboRow { + title: _("Calendar"); + title-lines: 1; + + factory: SignalListItemFactory { + setup => $calendar_item_setup_cb(); + bind => $calendar_item_bind_cb(); + unbind => $calendar_item_unbind_cb(); + }; +} diff --git a/src/gui/common/gcal-calendar-combo-row.ui b/src/gui/common/gcal-calendar-combo-row.ui deleted file mode 100644 index 5794f443a3100b4de5d5aab6143dad83647ac8e5..0000000000000000000000000000000000000000 --- a/src/gui/common/gcal-calendar-combo-row.ui +++ /dev/null @@ -1,16 +0,0 @@ - - - - diff --git a/src/gui/common/gcal-date-chooser-day.blp b/src/gui/common/gcal-date-chooser-day.blp new file mode 100644 index 0000000000000000000000000000000000000000..72c4b747a1fae7d674cc9846de74f065ffbea770 --- /dev/null +++ b/src/gui/common/gcal-date-chooser-day.blp @@ -0,0 +1,46 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalDateChooserDay: Button { + halign: center; + valign: center; + hexpand: true; + vexpand: true; + + styles [ + "circular", + "day", + "flat", + "text-button", + ] + + Box { + orientation: vertical; + valign: center; + + Label label { + halign: center; + label: "0"; + valign: center; + width-chars: 2; + + styles [ + "day", + "numeric", + ] + } + + Revealer dot_revealer { + halign: center; + transition-type: crossfade; + valign: end; + visible: false; + + child: Adw.Bin dot { + css-name: "dot"; + halign: center; + valign: center; + }; + } + } +} diff --git a/src/gui/common/gcal-date-chooser-day.ui b/src/gui/common/gcal-date-chooser-day.ui deleted file mode 100644 index 1e861554685db367d233508a0c080f0006d358a7..0000000000000000000000000000000000000000 --- a/src/gui/common/gcal-date-chooser-day.ui +++ /dev/null @@ -1,48 +0,0 @@ - - - - diff --git a/src/gui/common/gcal-date-chooser.blp b/src/gui/common/gcal-date-chooser.blp new file mode 100644 index 0000000000000000000000000000000000000000..e3fbab607a604b0f7c131c56a42cdf160d0af807 --- /dev/null +++ b/src/gui/common/gcal-date-chooser.blp @@ -0,0 +1,92 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalDateChooser: Adw.Bin { + Grid { + orientation: vertical; + + $GcalMultiChoice month_choice { + halign: fill; + min-value: 0; + max-value: 11; + animate: false; + value: 0; + visible: bind $get_split_choice_visible(template.show-heading, template.split-month-year) as ; + notify::value => $split_multi_choice_changed() swapped; + + layout { + column: 0; + row: 0; + } + } + + $GcalMultiChoice year_choice { + visible: bind $get_split_choice_visible(template.show-heading, template.split-month-year) as ; + halign: fill; + min-value: 1; + max-value: 9999; + animate: false; + value: 0; + notify::value => $split_multi_choice_changed() swapped; + + layout { + column: 1; + row: 0; + } + } + + $GcalMultiChoice combined_choice { + visible: bind $get_combined_choice_visible(template.show-heading, template.split-month-year) as ; + halign: fill; + min-value: 12; + max-value: 119999; + popover: popover; + animate: false; + value: 0; + notify::value => $combined_multi_choice_changed() swapped; + + layout { + column: 0; + column-span: 2; + row: 0; + } + } + + Grid grid { + row-homogeneous: true; + column-homogeneous: true; + + layout { + column: 0; + column-span: 2; + row: 1; + } + } + } +} + +Popover popover { + Box { + orientation: vertical; + spacing: 12; + + $GcalMultiChoice popover_month_choice { + min-value: bind month_choice.min-value bidirectional; + max-value: bind month_choice.max-value bidirectional; + animate: bind month_choice.animate bidirectional; + value: bind month_choice.value bidirectional; + } + + $GcalMultiChoice { + min-value: bind year_choice.min-value bidirectional; + max-value: bind year_choice.max-value bidirectional; + animate: bind year_choice.animate bidirectional; + value: bind year_choice.value bidirectional; + } + + styles [ + "activatable", + "month", + ] + } +} diff --git a/src/gui/common/gcal-date-chooser.ui b/src/gui/common/gcal-date-chooser.ui deleted file mode 100644 index 02d3c9cc1f0eb350cdbebdf5df1b1cfec1f7ddc4..0000000000000000000000000000000000000000 --- a/src/gui/common/gcal-date-chooser.ui +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - vertical - 12 - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/common/meson.build b/src/gui/common/meson.build index 33103435696f58b47cdb6dc7167a42c08dacda79..9a8ba3ec34a9999e066434dba79c4bbd400e3ebd 100644 --- a/src/gui/common/meson.build +++ b/src/gui/common/meson.build @@ -1,9 +1,28 @@ calendar_incs += include_directories('.') +blueprints = custom_target( + 'blueprints', + input: files( + 'gcal-calendar-combo-row-item.blp', + 'gcal-calendar-combo-row.blp', + 'gcal-date-chooser-day.blp', + 'gcal-date-chooser.blp', + ), + output: '.', + command: [ + find_program('blueprint-compiler'), + 'batch-compile', + '@OUTPUT@', + '@CURRENT_SOURCE_DIR@', + '@INPUT@', + ], +) + built_sources += gnome.compile_resources( 'common-resources', 'common.gresource.xml', c_name: 'common', + dependencies: blueprints, ) sources += files( diff --git a/src/gui/event-editor/gcal-alarm-row.blp b/src/gui/event-editor/gcal-alarm-row.blp new file mode 100644 index 0000000000000000000000000000000000000000..187fcdf9decd1645073b0efb4d28306470b2fcfd --- /dev/null +++ b/src/gui/event-editor/gcal-alarm-row.blp @@ -0,0 +1,27 @@ +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"; + tooltip-text: _("Remove Alarm"); + clicked => $on_remove_button_clicked_cb(template) not-swapped; + + styles [ + "flat", + ] + } +} diff --git a/src/gui/event-editor/gcal-alarm-row.ui b/src/gui/event-editor/gcal-alarm-row.ui deleted file mode 100644 index 3fb1e10e51e1cac7a1f8fbfdc53bdd2b95c1fe85..0000000000000000000000000000000000000000 --- a/src/gui/event-editor/gcal-alarm-row.ui +++ /dev/null @@ -1,28 +0,0 @@ - - - - diff --git a/src/gui/event-editor/gcal-date-chooser-row.blp b/src/gui/event-editor/gcal-date-chooser-row.blp new file mode 100644 index 0000000000000000000000000000000000000000..21f261bef1ce14dedc9f173fd59ea49d2d9b9670 --- /dev/null +++ b/src/gui/event-editor/gcal-date-chooser-row.blp @@ -0,0 +1,39 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalDateChooserRow: Adw.EntryRow { + EventControllerFocus { + notify::contains-focus => $on_contains_focus_changed_cb(template) not-swapped; + } + + MenuButton { + icon-name: "calendar-month-symbolic"; + valign: center; + tooltip-text: _("Edit Date"); + + popover: Popover { + position: bottom; + margin-top: 12; + margin-bottom: 12; + margin-start: 12; + margin-end: 12; + + $GcalDateChooser date_chooser { + show-events: false; + show-selected-week: false; + show-week-numbers: true; + day-selected => $on_date_selected_changed_cb(template) not-swapped; + } + + show => $on_date_popover_shown_cb(template) not-swapped; + }; + + accessibility { + label: _("Edit date"); + } + + styles [ + "flat", + ] + } +} diff --git a/src/gui/event-editor/gcal-date-chooser-row.ui b/src/gui/event-editor/gcal-date-chooser-row.ui deleted file mode 100644 index b9e5e88f27282edabd5601a082a5f6c5eea54460..0000000000000000000000000000000000000000 --- a/src/gui/event-editor/gcal-date-chooser-row.ui +++ /dev/null @@ -1,48 +0,0 @@ - - - - diff --git a/src/gui/event-editor/gcal-date-selector.blp b/src/gui/event-editor/gcal-date-selector.blp new file mode 100644 index 0000000000000000000000000000000000000000..e7f63558b02e37ccd0666bdac2bf3f4e164d3bcf --- /dev/null +++ b/src/gui/event-editor/gcal-date-selector.blp @@ -0,0 +1,28 @@ +using Gtk 4.0; + +template $GcalDateSelector: Entry { + width-chars: 11; + max-width-chars: 11; + secondary-icon-name: "pan-down-symbolic"; + input-hints: no_emoji; + icon-press => $icon_pressed_cb(template) not-swapped; + + EventControllerFocus { + notify::contains-focus => $on_contains_focus_changed_cb(template) not-swapped; + } + + Popover date_selector_popover { + position: bottom; + margin-top: 12; + margin-bottom: 12; + margin-start: 12; + margin-end: 12; + + $GcalDateChooser date_chooser { + show-events: false; + show-selected-week: false; + show-week-numbers: true; + day-selected => $calendar_day_selected(template); + } + } +} diff --git a/src/gui/event-editor/gcal-date-selector.ui b/src/gui/event-editor/gcal-date-selector.ui deleted file mode 100644 index 250cfd2c6dc1e62145a73f9188b2b75460380651..0000000000000000000000000000000000000000 --- a/src/gui/event-editor/gcal-date-selector.ui +++ /dev/null @@ -1,35 +0,0 @@ - - - - diff --git a/src/gui/event-editor/gcal-date-time-chooser.blp b/src/gui/event-editor/gcal-date-time-chooser.blp new file mode 100644 index 0000000000000000000000000000000000000000..218c8dd3c5ebadb2df3926985cfe2a59b4d663ce --- /dev/null +++ b/src/gui/event-editor/gcal-date-time-chooser.blp @@ -0,0 +1,125 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalDateTimeChooser: Adw.PreferencesGroup { + $GcalDateChooserRow date_row { + title: _("Date"); + notify::date => $on_date_changed_cb(template); + } + + Adw.EntryRow time_row { + title: _("Time"); + + EventControllerFocus { + notify::contains-focus => $on_time_row_contains_focus_changed_cb(template) not-swapped; + } + + MenuButton { + icon-name: "clock-alt-symbolic"; + valign: center; + tooltip-text: _("Edit Time"); + + popover: Popover time_popover { + position: bottom; + + Box { + spacing: 15; + margin-top: 6; + margin-bottom: 6; + margin-start: 6; + margin-end: 6; + orientation: vertical; + + Box { + spacing: 12; + halign: center; + orientation: horizontal; + + Box { + spacing: 6; + halign: center; + + SpinButton { + xalign: 0.5; + orientation: vertical; + adjustment: hour_adjustment; + wrap: true; + output => $on_spin_button_output_cb(template) not-swapped; + wrapped => $on_hour_spin_button_wrapped_cb(template) not-swapped; + } + + Label { + label: _(":"); + } + + SpinButton { + xalign: 0.5; + orientation: vertical; + adjustment: minute_adjustment; + wrap: true; + output => $on_spin_button_output_cb(template) not-swapped; + } + } + + Adw.ToggleGroup period_toggle_group { + visible: false; + valign: center; + active-name: "am"; + + Adw.Toggle { + label: _("AM"); + name: "am"; + } + + Adw.Toggle { + label: _("PM"); + name: "pm"; + } + + notify::active => $on_period_toggle_group_active_changed_cb(); + } + } + + Button { + valign: center; + tooltip-text: _("Change Timezone"); + + Adw.ButtonContent time_zone_button_content { + icon-name: "globe-symbolic"; + } + + clicked => $on_time_zone_button_clicked_cb(template) not-swapped; + + accessibility { + label: _("Change Timezone"); + } + } + } + + show => $on_time_popover_shown_cb(template) not-swapped; + }; + + accessibility { + label: _("Edit time"); + } + + styles [ + "flat", + ] + } + } +} + +Adjustment hour_adjustment { + upper: 23; + step-increment: 1; + page-increment: 5; + value-changed => $on_spin_buttons_value_changed_cb(template); +} + +Adjustment minute_adjustment { + upper: 59; + step-increment: 1; + page-increment: 10; + value-changed => $on_spin_buttons_value_changed_cb(template); +} diff --git a/src/gui/event-editor/gcal-date-time-chooser.ui b/src/gui/event-editor/gcal-date-time-chooser.ui deleted file mode 100644 index b07bf3d75150c8df515accf55c8368f6bf59b356..0000000000000000000000000000000000000000 --- a/src/gui/event-editor/gcal-date-time-chooser.ui +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - 23 - 1 - 5 - - - - 59 - 1 - 10 - - - - diff --git a/src/gui/event-editor/gcal-event-editor-dialog.blp b/src/gui/event-editor/gcal-event-editor-dialog.blp new file mode 100644 index 0000000000000000000000000000000000000000..2b441a129cdfcd9ffafca6068f128a988eb31226 --- /dev/null +++ b/src/gui/event-editor/gcal-event-editor-dialog.blp @@ -0,0 +1,108 @@ +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; + sensitive: bind template.writable no-sync-create; + title: _("Delete Event"); + + styles [ + "destructive-action", + ] + } + } + } + }; + } + + ShortcutController { + Shortcut { + trigger: "s"; + action: "action(event-editor.save)"; + } + } +} + +SizeGroup { + mode: vertical; + + widgets [ + cancel_button, + done_button, + ] +} diff --git a/src/gui/event-editor/gcal-event-editor-dialog.ui b/src/gui/event-editor/gcal-event-editor-dialog.ui deleted file mode 100644 index 6f6d469952b622ddae2495e09f7802db18a16829..0000000000000000000000000000000000000000 --- a/src/gui/event-editor/gcal-event-editor-dialog.ui +++ /dev/null @@ -1,146 +0,0 @@ - - - - - vertical - - - - - - diff --git a/src/gui/event-editor/gcal-multi-choice.blp b/src/gui/event-editor/gcal-multi-choice.blp new file mode 100644 index 0000000000000000000000000000000000000000..8b8c952e7572d055281e5d77eb607af39f1d8254 --- /dev/null +++ b/src/gui/event-editor/gcal-multi-choice.blp @@ -0,0 +1,64 @@ +using Gtk 4.0; + +template $GcalMultiChoice: Box { + spacing: 6; + + Button down_button { + icon-name: "pan-start-symbolic"; + clicked => $button_clicked_cb(); + + styles [ + "back-button", + "circular", + "flat", + ] + } + + ToggleButton button { + toggled => $button_toggled_cb() swapped; + + styles [ + "flat", + "pill", + "popup", + ] + + accessibility { + labelled-by: [ + template, + ]; + + described-by: [ + template, + ]; + } + + Stack stack { + hexpand: true; + vexpand: true; + + StackPage { + name: "label1"; + + child: Label label1 {}; + } + + StackPage { + name: "label2"; + + child: Label label2 {}; + } + } + } + + Button up_button { + icon-name: "pan-end-symbolic"; + clicked => $button_clicked_cb(); + + styles [ + "circular", + "flat", + "forward-button", + ] + } +} diff --git a/src/gui/event-editor/gcal-multi-choice.ui b/src/gui/event-editor/gcal-multi-choice.ui deleted file mode 100644 index 1ceab30e28d56009e33c33a5376b642b25a96367..0000000000000000000000000000000000000000 --- a/src/gui/event-editor/gcal-multi-choice.ui +++ /dev/null @@ -1,67 +0,0 @@ - - - - diff --git a/src/gui/event-editor/gcal-notes-section.blp b/src/gui/event-editor/gcal-notes-section.blp new file mode 100644 index 0000000000000000000000000000000000000000..0bdc311ca7d48388b6c3f76e20976f849ac5b12c --- /dev/null +++ b/src/gui/event-editor/gcal-notes-section.blp @@ -0,0 +1,27 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalNotesSection: Adw.PreferencesRow { + activatable: false; + focusable: false; + + styles [ + "entry", + "notes-section", + ] + + Box { + TextView notes_text { + height-request: 250; + hexpand: true; + top-margin: 6; + bottom-margin: 6; + left-margin: 6; + right-margin: 6; + sensitive: true; + wrap-mode: word_char; + accepts-tab: false; + state-flags-changed => $on_notes_text_state_flags_changed_cb(template) not-swapped; + } + } +} diff --git a/src/gui/event-editor/gcal-notes-section.ui b/src/gui/event-editor/gcal-notes-section.ui deleted file mode 100644 index b32e59ec312e5189b338353b1a593c4e94dd778e..0000000000000000000000000000000000000000 --- a/src/gui/event-editor/gcal-notes-section.ui +++ /dev/null @@ -1,33 +0,0 @@ - - - - diff --git a/src/gui/event-editor/gcal-reminders-section.blp b/src/gui/event-editor/gcal-reminders-section.blp new file mode 100644 index 0000000000000000000000000000000000000000..cead4f2c37b902015d0c8b946a905c10d9eb8454 --- /dev/null +++ b/src/gui/event-editor/gcal-reminders-section.blp @@ -0,0 +1,86 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalRemindersSection: Box { + orientation: vertical; + + ListBox alarms_listbox { + selection-mode: none; + row-activated => $on_alarms_listbox_row_activated_cb(template) not-swapped; + + styles [ + "boxed-list", + ] + + Adw.ButtonRow new_alarm_row { + title: _("Add Reminder"); + start-icon-name: "add-reminder-symbolic"; + } + } +} + +Popover alarms_popover { + width-request: 175; + + styles [ + "menu", + ] + + Box { + margin-top: 12; + margin-bottom: 12; + margin-start: 12; + margin-end: 12; + orientation: vertical; + + $GtkModelButton event_start_button { + text: _("Event start"); + clicked => $on_add_alarm_button_clicked_cb(template) not-swapped; + } + + $GtkModelButton five_minutes_button { + text: _("5 Minutes"); + clicked => $on_add_alarm_button_clicked_cb(template) not-swapped; + } + + $GtkModelButton ten_minutes_button { + text: _("10 Minutes"); + clicked => $on_add_alarm_button_clicked_cb(template) not-swapped; + } + + $GtkModelButton fifteen_minutes_button { + text: _("15 Minutes"); + clicked => $on_add_alarm_button_clicked_cb(template) not-swapped; + } + + $GtkModelButton thirty_minutes_button { + text: _("30 Minutes"); + clicked => $on_add_alarm_button_clicked_cb(template) not-swapped; + } + + $GtkModelButton one_hour_button { + text: _("1 Hour"); + clicked => $on_add_alarm_button_clicked_cb(template) not-swapped; + } + + $GtkModelButton one_day_button { + text: _("1 Day"); + clicked => $on_add_alarm_button_clicked_cb(template) not-swapped; + } + + $GtkModelButton two_days_button { + text: _("2 Days"); + clicked => $on_add_alarm_button_clicked_cb(template) not-swapped; + } + + $GtkModelButton three_days_button { + text: _("3 Days"); + clicked => $on_add_alarm_button_clicked_cb(template) not-swapped; + } + + $GtkModelButton one_week_button { + text: _("1 Week"); + clicked => $on_add_alarm_button_clicked_cb(template) not-swapped; + } + } +} diff --git a/src/gui/event-editor/gcal-reminders-section.ui b/src/gui/event-editor/gcal-reminders-section.ui deleted file mode 100644 index 3db8d662ba8a6676ef4499abbb7810ccb2400c61..0000000000000000000000000000000000000000 --- a/src/gui/event-editor/gcal-reminders-section.ui +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - 175 - - - - 12 - 12 - 12 - 12 - vertical - - - Event start - - - - - - 5 Minutes - - - - - - 10 Minutes - - - - - - 15 Minutes - - - - - - 30 Minutes - - - - - - 1 Hour - - - - - - 1 Day - - - - - - 2 Days - - - - - - 3 Days - - - - - - 1 Week - - - - - - - diff --git a/src/gui/event-editor/gcal-schedule-section.blp b/src/gui/event-editor/gcal-schedule-section.blp new file mode 100644 index 0000000000000000000000000000000000000000..8baf77ef981324ffc69535eaaab1bdc178482e60 --- /dev/null +++ b/src/gui/event-editor/gcal-schedule-section.blp @@ -0,0 +1,120 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalScheduleSection: Box { + orientation: vertical; + spacing: 12; + + Adw.ToggleGroup schedule_type_toggle_group { + active-name: "time-slot"; + homogeneous: true; + + Adw.Toggle { + label: _("_All Day"); + use-underline: true; + name: "all-day"; + } + + Adw.Toggle { + label: _("_Time Slot"); + use-underline: true; + name: "time-slot"; + } + } + + Adw.PreferencesGroup start_date_group { + $GcalDateChooserRow start_date_row { + title: _("Start Date"); + notify::date => $on_start_date_changed_cb(template) not-swapped; + } + } + + Adw.PreferencesGroup end_date_group { + $GcalDateChooserRow end_date_row { + title: _("End Date"); + notify::date => $on_end_date_changed_cb(template) not-swapped; + } + } + + $GcalDateTimeChooser start_date_time_chooser { + date-label: _("Start Date"); + time-label: _("Start Time"); + notify::date-time => $on_start_date_time_changed_cb(template) not-swapped; + } + + $GcalDateTimeChooser end_date_time_chooser { + date-label: _("End Date"); + time-label: _("End Time"); + notify::date-time => $on_end_date_time_changed_cb(template) not-swapped; + } + + Adw.PreferencesGroup { + margin-top: 12; + + Adw.ComboRow repeat_combo { + title: _("Repeat"); + valign: center; + + model: StringList { + strings [ + _("No Repeat"), + _("Daily"), + _("Monday – Friday"), + _("Weekly"), + _("Monthly"), + _("Yearly"), + ] + }; + + notify::selected-item => $on_repeat_type_changed_cb(); + } + + Adw.ComboRow repeat_duration_combo { + title: _("End Repeat"); + valign: center; + + model: StringList { + strings [ + _("Forever"), + _("Number of Occurrences"), + _("Until Date"), + ] + }; + + notify::selected-item => $on_repeat_duration_changed_cb(); + } + + Adw.ActionRow { + visible: bind number_of_occurrences_spin.visible; + title: _("Number of Occurrences"); + activatable-widget: number_of_occurrences_spin; + + SpinButton number_of_occurrences_spin { + visible: false; + numeric: true; + adjustment: number_of_occurrences_adjustment; + valign: center; + } + } + + Adw.ActionRow { + visible: bind until_date_selector.visible; + title: _("End Repeat Date"); + activatable-widget: until_date_selector; + + $GcalDateSelector until_date_selector { + visible: false; + valign: center; + } + } + } +} + +Adjustment number_of_occurrences_adjustment { + lower: 2; + upper: 999999999; + step-increment: 1; + page-increment: 1; + page-size: 10; + value: 2; +} diff --git a/src/gui/event-editor/gcal-schedule-section.ui b/src/gui/event-editor/gcal-schedule-section.ui deleted file mode 100644 index ac8b5e8a76e25bbc494558590b1530650a06df99..0000000000000000000000000000000000000000 --- a/src/gui/event-editor/gcal-schedule-section.ui +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - 2 - 999999999 - 1 - 1 - 10 - 2 - - diff --git a/src/gui/event-editor/gcal-summary-section.blp b/src/gui/event-editor/gcal-summary-section.blp new file mode 100644 index 0000000000000000000000000000000000000000..1d9a8aa89e75e42cdbab5c7a52249377d1a79de8 --- /dev/null +++ b/src/gui/event-editor/gcal-summary-section.blp @@ -0,0 +1,21 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalSummarySection: Adw.Bin { + ListBox { + selection-mode: none; + + styles [ + "boxed-list", + ] + + Adw.EntryRow summary_entry { + title: _("Title"); + changed => $on_summary_entry_text_changed_cb(template) not-swapped; + } + + Adw.EntryRow location_entry { + title: _("Location"); + } + } +} diff --git a/src/gui/event-editor/gcal-summary-section.ui b/src/gui/event-editor/gcal-summary-section.ui deleted file mode 100644 index c491431325ac0c150898fe868340192b6c584c69..0000000000000000000000000000000000000000 --- a/src/gui/event-editor/gcal-summary-section.ui +++ /dev/null @@ -1,33 +0,0 @@ - - - - diff --git a/src/gui/event-editor/gcal-time-chooser-row.blp b/src/gui/event-editor/gcal-time-chooser-row.blp new file mode 100644 index 0000000000000000000000000000000000000000..f295f873ab8404d7ee6e3ae0a3f7187e304be62f --- /dev/null +++ b/src/gui/event-editor/gcal-time-chooser-row.blp @@ -0,0 +1,36 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalTimeChooserRow: Adw.EntryRow { + EventControllerFocus { + notify::contains-focus => $on_contains_focus_changed_cb(template) not-swapped; + } + + MenuButton { + icon-name: "clock-alt-symbolic"; + valign: center; + tooltip-text: _("Edit Time"); + + popover: Popover { + position: bottom; + margin-top: 12; + margin-bottom: 12; + margin-start: 12; + margin-end: 12; + + $GcalTimeSelector time_selector { + notify::time => $on_time_selected_changed_cb(template) not-swapped; + } + + show => $on_time_popover_shown_cb(template) not-swapped; + }; + + accessibility { + label: _("Edit time"); + } + + styles [ + "flat", + ] + } +} diff --git a/src/gui/event-editor/gcal-time-chooser-row.ui b/src/gui/event-editor/gcal-time-chooser-row.ui deleted file mode 100644 index 4d8ae7df1dc824db9f3311bbb196e72cc513c4a8..0000000000000000000000000000000000000000 --- a/src/gui/event-editor/gcal-time-chooser-row.ui +++ /dev/null @@ -1,45 +0,0 @@ - - - - diff --git a/src/gui/event-editor/gcal-time-zone-dialog-row.blp b/src/gui/event-editor/gcal-time-zone-dialog-row.blp new file mode 100644 index 0000000000000000000000000000000000000000..a9548c1baca6bbfdd8125eabd57c2a3eb89fd398 --- /dev/null +++ b/src/gui/event-editor/gcal-time-zone-dialog-row.blp @@ -0,0 +1,10 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalTimeZoneDialogRow: Adw.ActionRow { + activatable: true; + + styles [ + "property", + ] +} diff --git a/src/gui/event-editor/gcal-time-zone-dialog-row.ui b/src/gui/event-editor/gcal-time-zone-dialog-row.ui deleted file mode 100644 index 70fc7ccae39a5060572e24f6448906df9e558228..0000000000000000000000000000000000000000 --- a/src/gui/event-editor/gcal-time-zone-dialog-row.ui +++ /dev/null @@ -1,9 +0,0 @@ - - - - diff --git a/src/gui/event-editor/gcal-time-zone-dialog.blp b/src/gui/event-editor/gcal-time-zone-dialog.blp new file mode 100644 index 0000000000000000000000000000000000000000..60971ef66c4cf19308c849d003dc55fcb995038b --- /dev/null +++ b/src/gui/event-editor/gcal-time-zone-dialog.blp @@ -0,0 +1,48 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalTimeZoneDialog: Adw.Dialog { + title: _("Select Timezone"); + content-width: 400; + content-height: 540; + + child: Adw.ToolbarView { + [top] + Adw.HeaderBar dialog-header-bar {} + + [top] + Adw.Bin { + SearchEntry location_entry { + placeholder-text: _("Search Locations"); + search-changed => $on_search_changed(template) not-swapped; + stop-search => $on_stop_search_cb(template) not-swapped; + } + + styles [ + "toolbar", + ] + } + + content: Stack stack { + Adw.StatusPage empty_search { + icon-name: "loupe-large-symbolic"; + title: _("Search for a Timezone"); + } + + Adw.PreferencesPage search_results { + Adw.PreferencesGroup { + ListBox listbox { + valign: start; + hexpand: true; + selection-mode: none; + row-activated => $on_row_activated_cb(template) not-swapped; + + styles [ + "boxed-list", + ] + } + } + } + }; + }; +} diff --git a/src/gui/event-editor/gcal-time-zone-dialog.ui b/src/gui/event-editor/gcal-time-zone-dialog.ui deleted file mode 100644 index 677538b1b87c6d0707162a442c3dc8fab3a11b9f..0000000000000000000000000000000000000000 --- a/src/gui/event-editor/gcal-time-zone-dialog.ui +++ /dev/null @@ -1,60 +0,0 @@ - - - - diff --git a/src/gui/event-editor/meson.build b/src/gui/event-editor/meson.build index 7efca8c25592944caeed379b6d1e11123b2d22a6..01ab836430db81109b86948cb6633e304877db4d 100644 --- a/src/gui/event-editor/meson.build +++ b/src/gui/event-editor/meson.build @@ -1,9 +1,37 @@ calendar_incs += include_directories('.') +blueprints = custom_target( + 'blueprints', + input: files( + 'gcal-alarm-row.blp', + 'gcal-date-chooser-row.blp', + 'gcal-date-selector.blp', + 'gcal-date-time-chooser.blp', + 'gcal-event-editor-dialog.blp', + 'gcal-multi-choice.blp', + 'gcal-notes-section.blp', + 'gcal-reminders-section.blp', + 'gcal-schedule-section.blp', + 'gcal-summary-section.blp', + 'gcal-time-chooser-row.blp', + 'gcal-time-zone-dialog-row.blp', + 'gcal-time-zone-dialog.blp', + ), + output: '.', + command: [ + find_program('blueprint-compiler'), + 'batch-compile', + '@OUTPUT@', + '@CURRENT_SOURCE_DIR@', + '@INPUT@', + ], +) + built_sources += gnome.compile_resources( 'event-editor-resources', 'event-editor.gresource.xml', c_name: 'event_editor', + dependencies: blueprints, ) sources += files( diff --git a/src/gui/gcal-calendar-list.blp b/src/gui/gcal-calendar-list.blp new file mode 100644 index 0000000000000000000000000000000000000000..3c574dbfde59d3c825d3f4cc5de4fdc03bb4544a --- /dev/null +++ b/src/gui/gcal-calendar-list.blp @@ -0,0 +1,26 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalCalendarList: Adw.Bin { + child: ScrolledWindow { + hscrollbar-policy: never; + propagate-natural-height: true; + propagate-natural-width: true; + + child: Adw.Clamp { + maximum-size: 800; + tightening-threshold: 800; + + child: ListBox calendar_listbox { + hexpand: true; + selection-mode: none; + row-activated => $on_listbox_row_activated_cb(template) not-swapped; + + styles [ + "navigation-sidebar", + "calendar-list", + ] + }; + }; + }; +} diff --git a/src/gui/gcal-calendar-list.ui b/src/gui/gcal-calendar-list.ui deleted file mode 100644 index 83ff123d9faff452fb6b004ee229fcfa70def401..0000000000000000000000000000000000000000 --- a/src/gui/gcal-calendar-list.ui +++ /dev/null @@ -1,31 +0,0 @@ - - - - diff --git a/src/gui/gcal-calendar-navigation-button.blp b/src/gui/gcal-calendar-navigation-button.blp new file mode 100644 index 0000000000000000000000000000000000000000..649b5191c08035f17c00830b87a3210b667050ad --- /dev/null +++ b/src/gui/gcal-calendar-navigation-button.blp @@ -0,0 +1,48 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalCalendarNavigationButton: Adw.Bin { + child: Stack stack { + hhomogeneous: false; + + StackPage { + name: "active"; + + child: MenuButton button { + popover: popover_date_chooser; + label: _("_Choose Date"); + use-underline: true; + can-shrink: true; + tooltip-text: _("Choose a Date"); + always-show-arrow: true; + }; + } + + StackPage { + name: "inactive"; + + child: Label static_label { + styles [ + "heading", + ] + + label: bind button.label no-sync-create; + margin-start: 9; + margin-end: 9; + }; + } + + visible-child-name: "active"; + }; +} + +Popover popover_date_chooser { + position: bottom; + + child: $GcalDateChooser { + split-month-year: true; + vexpand: false; + valign: end; + active-date: bind template.active-date no-sync-create bidirectional; + }; +} diff --git a/src/gui/gcal-calendar-navigation-button.ui b/src/gui/gcal-calendar-navigation-button.ui deleted file mode 100644 index eb5cafb76b01de227ee3c2d903ae662c0b0cc380..0000000000000000000000000000000000000000 --- a/src/gui/gcal-calendar-navigation-button.ui +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - bottom - - - True - False - end - - - - - - - diff --git a/src/gui/gcal-event-popover.blp b/src/gui/gcal-event-popover.blp new file mode 100644 index 0000000000000000000000000000000000000000..eb57cc47ee05bd5245af8d88b25430beeff2138e --- /dev/null +++ b/src/gui/gcal-event-popover.blp @@ -0,0 +1,165 @@ +using Gtk 4.0; + +template $GcalEventPopover: Popover { + default-widget: action_button; + position: top; + width-request: 250; + + styles [ + "event-popover", + ] + + child: Box { + orientation: vertical; + + Box { + spacing: 18; + margin-top: 18; + margin-bottom: 12; + margin-start: 18; + margin-end: 18; + + Box { + hexpand: true; + orientation: vertical; + spacing: 6; + + Label summary_label { + selectable: true; + wrap: true; + wrap-mode: word_char; + xalign: 0.0; + max-width-chars: 23; + lines: 6; + ellipsize: end; + + styles [ + "title-4", + ] + } + + Label date_time_label { + xalign: 0.0; + + styles [ + "dim-label", + ] + } + } + + Box { + spacing: 6; + + Image read_only_icon { + tooltip-markup: _("This event is part of a read-only calendar\n You cannot delete or change this event."); + icon-name: "changes-prevent-symbolic"; + pixel-size: 18; + valign: start; + halign: end; + margin-top: 8; + margin-bottom: 8; + + styles [ + "dim-label", + ] + } + + Button action_button { + can-focus: true; + valign: start; + halign: end; + + styles [ + "circular", + ] + + clicked => $on_action_button_clicked_cb(template) not-swapped; + } + } + } + + Separator {} + + Label placeholder_label { + vexpand: true; + label: _("No event notes"); + margin-top: 12; + margin-bottom: 12; + use-markup: true; + + styles [ + "dim-label", + ] + } + + ScrolledWindow description_scrolled_window { + hscrollbar-policy: never; + propagate-natural-height: true; + propagate-natural-width: true; + max-content-height: 350; + + child: Label description_label { + use-markup: true; + selectable: true; + halign: fill; + xalign: 0.0; + wrap: true; + max-width-chars: 35; + wrap-mode: word_char; + margin-top: 12; + margin-bottom: 18; + margin-start: 18; + margin-end: 18; + }; + } + + Box location_box { + orientation: vertical; + + Separator {} + + Box { + orientation: vertical; + margin-top: 12; + margin-bottom: 12; + margin-start: 18; + margin-end: 18; + + Label { + halign: start; + label: _("Location"); + + styles [ + "heading", + ] + } + + Label location_label { + halign: start; + selectable: true; + ellipsize: end; + max-width-chars: 35; + } + } + } + + Box meetings_box { + orientation: vertical; + visible: false; + + Separator {} + + ListBox meetings_listbox { + selection-mode: none; + margin-top: 12; + margin-bottom: 12; + margin-start: 18; + margin-end: 18; + + styles [ + "calendar-list", + ] + } + } + }; +} diff --git a/src/gui/gcal-event-popover.ui b/src/gui/gcal-event-popover.ui deleted file mode 100644 index ea8b74d091d4b6b8f3d19d2cc63864f6eca2e5dc..0000000000000000000000000000000000000000 --- a/src/gui/gcal-event-popover.ui +++ /dev/null @@ -1,216 +0,0 @@ - - - - diff --git a/src/gui/gcal-event-widget.blp b/src/gui/gcal-event-widget.blp new file mode 100644 index 0000000000000000000000000000000000000000..7bb889d6e0b213ed94ce02fd67dce4434eae7b8b --- /dev/null +++ b/src/gui/gcal-event-widget.blp @@ -0,0 +1,89 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalEventWidget: Widget { + focusable: true; + overflow: hidden; + receives-default: true; + + DragSource drag_source { + prepare => $on_drag_source_prepare_cb(template) not-swapped; + begin => $on_drag_source_begin_cb(template) not-swapped; + } + + GestureClick { + button: 1; + pressed => $on_click_gesture_pressed_cb(template) not-swapped; + released => $on_click_gesture_release_cb(template) not-swapped; + } + + Box main_widget { + hexpand: false; + + Adw.Bin edge { + styles [ + "edge", + ] + } + + $GcalOverflowBin { + hexpand: true; + request-mode: width-for-height; + + styles [ + "content", + ] + + Adw.Squeezer squeezer { + hexpand: false; + homogeneous: false; + orientation: vertical; + + Box vertical_box { + visible: bind $get_vertical_enabled(template.event, template.orientation) as ; + orientation: vertical; + + $GcalOverflowBin { + request-mode: width-for-height; + + Label { + label: bind timestamp_label.label no-sync-create; + xalign: 0.0; + + styles [ + "dim-label", + ] + } + } + + Inscription { + text: bind summary_inscription.text no-sync-create; + hexpand: true; + vexpand: true; + xalign: 0.0; + yalign: 0.0; + min-lines: 1; + text-overflow: ellipsize_end; + } + } + + Box horizontal_box { + spacing: 4; + + Inscription summary_inscription { + hexpand: true; + xalign: 0.0; + min-lines: 1; + text-overflow: ellipsize_end; + } + + Label timestamp_label { + styles [ + "dim-label", + ] + } + } + } + } + } +} diff --git a/src/gui/gcal-event-widget.ui b/src/gui/gcal-event-widget.ui deleted file mode 100644 index 1e8883d6b7e37e59e8172a589b879643607bbb01..0000000000000000000000000000000000000000 --- a/src/gui/gcal-event-widget.ui +++ /dev/null @@ -1,119 +0,0 @@ - - - - diff --git a/src/gui/gcal-meeting-row.blp b/src/gui/gcal-meeting-row.blp new file mode 100644 index 0000000000000000000000000000000000000000..f5f762b426bf7abaaff2a319411536fbfb881c0b --- /dev/null +++ b/src/gui/gcal-meeting-row.blp @@ -0,0 +1,44 @@ +using Gtk 4.0; + +template $GcalMeetingRow: ListBoxRow { + activatable: false; + selectable: false; + + child: Box { + spacing: 6; + + Box { + orientation: vertical; + hexpand: true; + + Label title { + halign: start; + + styles [ + "heading", + ] + } + + Label subtitle { + halign: start; + single-line-mode: true; + ellipsize: end; + max-width-chars: 25; + } + } + + Button join_button { + halign: end; + valign: center; + margin-start: 12; + use-underline: true; + label: _("_Join"); + + styles [ + "suggested-action", + ] + + clicked => $on_join_button_clicked_cb(template) not-swapped; + } + }; +} diff --git a/src/gui/gcal-meeting-row.ui b/src/gui/gcal-meeting-row.ui deleted file mode 100644 index 79bf993830a65ba4f8553a5cb138bb025495bdee..0000000000000000000000000000000000000000 --- a/src/gui/gcal-meeting-row.ui +++ /dev/null @@ -1,53 +0,0 @@ - - - - diff --git a/src/gui/gcal-quick-add-popover.blp b/src/gui/gcal-quick-add-popover.blp new file mode 100644 index 0000000000000000000000000000000000000000..5780c0a75bb76f6214db21480192af013b94fe7f --- /dev/null +++ b/src/gui/gcal-quick-add-popover.blp @@ -0,0 +1,166 @@ +using Gtk 4.0; + +template $GcalQuickAddPopover: Popover { + width-request: 350; + show => $gtk_widget_grab_focus(summary_entry); + + Stack stack { + hexpand: true; + vexpand: true; + margin-top: 12; + margin-bottom: 12; + margin-start: 12; + margin-end: 12; + hhomogeneous: false; + vhomogeneous: true; + transition-type: slide_left_right; + interpolate-size: true; + + StackPage { + name: "events"; + + child: Grid { + row-spacing: 12; + column-spacing: 12; + + Label title_label { + hexpand: true; + + styles [ + "heading", + ] + + layout { + column: 0; + row: 0; + column-span: 3; + } + } + + Entry summary_entry { + hexpand: true; + notify::text => $summary_entry_text_changed(template) not-swapped; + activate => $summary_entry_activated(template) not-swapped; + + layout { + column: 0; + row: 1; + column-span: 3; + } + } + + Button select_calendar_button { + hexpand: true; + clicked => $select_calendar_button_clicked(template); + + layout { + column: 0; + row: 2; + column-span: 3; + } + + Box { + spacing: 12; + + Image color_image { + styles [ + "calendar-color-image", + ] + } + + Label calendar_name_label { + hexpand: true; + xalign: 0; + } + + Image { + icon-name: "go-next-symbolic"; + } + } + } + + Button edit_button { + label: _("Edit Details…"); + margin-top: 6; + clicked => $edit_or_create_event(template); + + layout { + column: 0; + row: 3; + } + } + + Button add_button { + label: _("Add"); + sensitive: false; + margin-top: 6; + clicked => $edit_or_create_event(template); + + layout { + column: 2; + row: 3; + } + + styles [ + "suggested-action", + ] + } + }; + } + + StackPage { + name: "calendars"; + + child: Box { + orientation: vertical; + spacing: 6; + + CenterBox { + [start] + Button back_button { + icon-name: "go-previous-symbolic"; + clicked => $back_button_clicked(template); + + styles [ + "flat", + ] + } + + [center] + Label { + label: _("Calendar"); + + styles [ + "heading", + ] + } + } + + ScrolledWindow { + hexpand: true; + vexpand: true; + + Viewport { + scroll-to-focus: true; + + ListBox calendars_listbox { + selection-mode: none; + row-activated => $select_row(template); + + styles [ + "calendars-list", + ] + } + } + } + }; + } + } +} + +SizeGroup { + widgets [ + edit_button, + add_button, + ] +} diff --git a/src/gui/gcal-quick-add-popover.ui b/src/gui/gcal-quick-add-popover.ui deleted file mode 100644 index 9581e833e33305c7f06b6c9d9da593e2b997d90e..0000000000000000000000000000000000000000 --- a/src/gui/gcal-quick-add-popover.ui +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - - - - - - diff --git a/src/gui/gcal-search-button.blp b/src/gui/gcal-search-button.blp new file mode 100644 index 0000000000000000000000000000000000000000..d085e2febb57f430c5851f783c844adf0ed84475 --- /dev/null +++ b/src/gui/gcal-search-button.blp @@ -0,0 +1,166 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalSearchButton: Adw.Bin { + EventControllerFocus { + leave => $on_focus_controller_leave_cb(template) not-swapped; + } + + Stack stack { + hhomogeneous: false; + vhomogeneous: true; + interpolate-size: true; + transition-type: crossfade; + transition-duration: 200; + + styles [ + "suggestionbutton", + ] + + StackPage { + name: "button"; + + child: Button button { + halign: start; + icon-name: "edit-find-symbolic"; + tooltip-text: _("Search Events"); + clicked => $on_button_clicked_cb(template) not-swapped; + + ShortcutController { + scope: global; + + Shortcut { + trigger: "f"; + action: "activate"; + } + } + }; + } + + StackPage { + name: "entry"; + + child: SearchEntry entry { + placeholder-text: _("Search events"); + max-width-chars: 0; + width-chars: 0; + search-delay: 500; + activate => $on_entry_activate_cb(template) not-swapped; + next-match => $on_entry_next_match_cb(template) not-swapped; + previous-match => $on_entry_previous_match_cb(template) not-swapped; + search-changed => $on_entry_search_changed_cb(template) not-swapped; + stop-search => $on_entry_stop_search_cb(template) not-swapped; + + accessibility { + labelled-by: [ + entry, + ]; + } + + ShortcutController { + Shortcut { + trigger: "Up"; + action: "signal(previous-match)"; + } + + Shortcut { + trigger: "Down"; + action: "signal(next-match)"; + } + } + }; + } + } +} + +Popover popover { + position: bottom; + autohide: false; + default-widget: results_listview; + + styles [ + "menu", + ] + + Revealer results_revealer { + transition-type: slide_down; + notify::reveal-child => $on_results_revealer_child_reveal_state_changed_cb(template) not-swapped; + notify::child-revealed => $on_results_revealer_child_reveal_state_changed_cb(template) not-swapped; + + ScrolledWindow { + max-content-width: 450; + max-content-height: 400; + propagate-natural-width: true; + propagate-natural-height: true; + hscrollbar-policy: never; + + ListView results_listview { + hscroll-policy: natural; + vscroll-policy: natural; + single-click-activate: true; + + model: SingleSelection results_selection_model { + autoselect: true; + can-unselect: false; + }; + + factory: BuilderListItemFactory { + template ListItem { + activatable: true; + selectable: true; + + child: Box { + Image image { + valign: center; + hexpand: false; + icon-size: normal; + paintable: bind template.item as <$GcalSearchHit>.primary-icon; + + accessibility { + labelled-by: [ + title, + ]; + } + + styles [ + "title", + ] + } + + Label title { + use-markup: true; + ellipsize: end; + xalign: 0.0; + max-width-chars: 40; + label: bind $escape_markup_cb(template.item as <$GcalSearchHit>.title) as ; + } + + Label separator { + label: "—"; + visible: bind $string_is_not_empty_cb(template.item as <$GcalSearchHit>.subtitle) as ; + + styles [ + "dim-label", + ] + } + + Label subtitle { + hexpand: true; + use-markup: true; + ellipsize: end; + xalign: 0.0; + label: bind $escape_markup_cb(template.item as <$GcalSearchHit>.subtitle) as ; + + styles [ + "subtitle", + ] + } + }; + } + }; + + activate => $on_results_listview_activated_cb(template) not-swapped; + } + } + } +} diff --git a/src/gui/gcal-search-button.ui b/src/gui/gcal-search-button.ui deleted file mode 100644 index 5fac0afbae606dbaae741d6768b515799c251005..0000000000000000000000000000000000000000 --- a/src/gui/gcal-search-button.ui +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - bottom - False - results_listview - - - - slide-down - - - - - - 450 - 400 - True - True - never - - - - natural - natural - True - - - True - False - - - - - - - - - ]]> - - - - - - - - - - - - - - diff --git a/src/gui/gcal-sync-indicator.blp b/src/gui/gcal-sync-indicator.blp new file mode 100644 index 0000000000000000000000000000000000000000..82c9d9bfdd421dabc72104091e65a02b9bf7e9a7 --- /dev/null +++ b/src/gui/gcal-sync-indicator.blp @@ -0,0 +1,31 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalSyncIndicator: Adw.Bin { + child: Stack stack { + transition-type: crossfade; + transition-duration: 250; + + StackPage { + name: "empty"; + + child: Box {}; + } + + StackPage { + name: "spinner"; + + child: Adw.Spinner refreshing_spinner { + tooltip-text: C_("tooltip", "Synchronizing Remote Calendars"); + }; + } + + StackPage { + name: "success"; + + child: Image success_image { + icon-name: "checkmark-small-symbolic"; + }; + } + }; +} diff --git a/src/gui/gcal-sync-indicator.ui b/src/gui/gcal-sync-indicator.ui deleted file mode 100644 index b5cb3765f0535a146dbe20e2198ec63c47a22025..0000000000000000000000000000000000000000 --- a/src/gui/gcal-sync-indicator.ui +++ /dev/null @@ -1,39 +0,0 @@ - - - - diff --git a/src/gui/gcal-weather-settings.blp b/src/gui/gcal-weather-settings.blp new file mode 100644 index 0000000000000000000000000000000000000000..d409e11637474c3a508ccfd91b44422a69a7b7b9 --- /dev/null +++ b/src/gui/gcal-weather-settings.blp @@ -0,0 +1,47 @@ +using Gtk 4.0; + +template $GcalWeatherSettings: Box { + orientation: vertical; + margin-top: 12; + margin-bottom: 12; + margin-start: 12; + margin-end: 12; + spacing: 6; + + Box { + spacing: 18; + + Label { + hexpand: true; + xalign: 0.0; + label: _("Show Weather"); + } + + Switch show_weather_switch { + notify::active => $on_show_weather_changed_cb(template) not-swapped; + } + } + + Box weather_auto_location_box { + spacing: 18; + + Label { + hexpand: true; + xalign: 0.0; + label: _("Automatic Location"); + } + + Switch weather_auto_location_switch { + notify::active => $on_weather_auto_location_changed_cb(template) not-swapped; + } + } + + Entry weather_location_entry { + placeholder-text: _("Search locations"); + primary-icon-name: "edit-find-symbolic"; + primary-icon-activatable: false; + primary-icon-sensitive: false; + changed => $on_weather_location_searchbox_changed_cb(template) not-swapped; + activate => $on_weather_location_searchbox_changed_cb(template) not-swapped; + } +} diff --git a/src/gui/gcal-weather-settings.ui b/src/gui/gcal-weather-settings.ui deleted file mode 100644 index 87644bfd3a9b326c5e249753827b7464d8336ab2..0000000000000000000000000000000000000000 --- a/src/gui/gcal-weather-settings.ui +++ /dev/null @@ -1,55 +0,0 @@ - - - - diff --git a/src/gui/gcal-window.blp b/src/gui/gcal-window.blp new file mode 100644 index 0000000000000000000000000000000000000000..625884110bcba07615dd95c312af641529d6a067 --- /dev/null +++ b/src/gui/gcal-window.blp @@ -0,0 +1,398 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalWindow: Adw.ApplicationWindow { + title: _("Calendar"); + default-width: 800; + default-height: 600; + width-request: 360; + height-request: 600; + + ShortcutController { + Shortcut { + trigger: "t"; + action: "action(win.today)"; + } + + Shortcut { + trigger: "Down"; + action: "action(win.today)"; + } + + Shortcut { + trigger: "Home"; + action: "action(win.today)"; + } + + Shortcut { + trigger: "Left"; + action: "action(win.previous-date)"; + } + + Shortcut { + trigger: "Page_Up"; + action: "action(win.previous-date)"; + } + + Shortcut { + trigger: "Right"; + action: "action(win.next-date)"; + } + + Shortcut { + trigger: "Page_Down"; + action: "action(win.next-date)"; + } + + Shortcut { + trigger: "Page_Down"; + action: "action(win.change-view)"; + arguments: "-1"; + } + + Shortcut { + trigger: "Page_Up"; + action: "action(win.change-view)"; + arguments: "-2"; + } + + Shortcut { + trigger: "1"; + action: "action(win.change-view)"; + arguments: "0"; + } + + Shortcut { + trigger: "2"; + action: "action(win.change-view)"; + arguments: "1"; + } + + Shortcut { + trigger: "3"; + action: "action(win.change-view)"; + arguments: "3"; + } + + Shortcut { + trigger: "n"; + action: "action(win.new-event)"; + } + + Shortcut { + trigger: "q"; + action: "action(app.quit)"; + } + + Shortcut { + trigger: "m"; + action: "action(win.show-calendars)"; + } + + Shortcut { + trigger: "r"; + action: "action(app.sync)"; + } + + Shortcut { + trigger: "F5"; + action: "action(app.sync)"; + } + + Shortcut { + trigger: "F8"; + action: "action(win.show-calendars)"; + } + } + + Adw.ToastOverlay overlay { + $GcalDropOverlay drop_overlay { + overlayed: Adw.StatusPage drop_status_page { + title: _("Drop Event Files to Import"); + icon-name: "calendar-month-symbolic"; + + styles [ + "drop-overlay-area", + "compact", + ] + }; + + child: Adw.OverlaySplitView split_view { + pin-sidebar: true; + show-sidebar: false; + + DropTarget drop_target { + actions: copy; + propagation-phase: capture; + accept => $on_drop_target_accept_cb(template) not-swapped; + drop => $on_drop_target_drop_cb(template) not-swapped; + } + + styles [ + "drop-target", + ] + + sidebar: Adw.ToolbarView { + [top] + Adw.HeaderBar {} + + content: Box { + orientation: vertical; + + $GcalDateChooser date_chooser { + split-month-year: true; + vexpand: false; + active-date: bind template.active-date no-sync-create bidirectional; + day-selected => $day_selected(template); + } + + $GcalCalendarList calendars_list {} + }; + }; + + content: Adw.ToolbarView main_toolbar { + styles [ + "view", + ] + + [top] + Adw.HeaderBar header_bar { + [start] + ToggleButton sidebar_button { + icon-name: "sidebar-show-symbolic"; + tooltip-text: _("Toggle Sidebar"); + active: bind split_view.show-sidebar bidirectional; + + ShortcutController { + scope: managed; + + Shortcut { + trigger: "F9"; + action: "activate"; + } + } + } + + [start] + $GcalSyncIndicator sync_indicator {} + + title-widget: $GcalCalendarNavigationButton navigation_button_title { + active-date: bind template.active-date no-sync-create bidirectional; + active: bind split_view.show-sidebar inverted; + }; + + [end] + MenuButton menu_button { + icon-name: "open-menu-symbolic"; + popover: win_menu; + tooltip-text: _("Main Menu"); + primary: true; + } + + [end] + $GcalSearchButton search_button { + tooltip-text: C_("tooltip", "Search"); + } + } + + content: Adw.ViewStack views_stack { + hexpand: true; + vexpand: true; + notify::visible-child => $view_changed(template) not-swapped; + + styles [ + "view", + ] + + Adw.ViewStackPage month_page { + name: "month"; + title: _("_Month"); + use-underline: true; + icon-name: "calendar-month-symbolic"; + + child: $GcalMonthView month_view { + active-date: bind template.active-date no-sync-create bidirectional; + create-event => $show_new_event_widget(template) not-swapped; + create-event-detailed => $create_event_detailed_cb(template) not-swapped; + event-activated => $event_activated(template) not-swapped; + }; + } + + Adw.ViewStackPage week_page { + name: "week"; + title: _("_Week"); + use-underline: true; + icon-name: "calendar-week-symbolic"; + + child: $GcalWeekView week_view { + active-date: bind template.active-date no-sync-create bidirectional; + create-event => $show_new_event_widget(template) not-swapped; + event-activated => $event_activated(template) not-swapped; + }; + } + + Adw.ViewStackPage agenda_page { + name: "agenda"; + title: _("_Agenda"); + use-underline: true; + icon-name: "calendar-agenda-symbolic"; + visible: false; + + child: $GcalAgendaView agenda_view { + vexpand: true; + active-date: bind template.active-date no-sync-create bidirectional; + create-event => $show_new_event_widget(template) not-swapped; + event-activated => $event_activated(template) not-swapped; + }; + } + }; + + [bottom] + ActionBar { + [start] + Button previous_date_button { + icon-name: "go-previous-symbolic"; + action-name: "win.previous-date"; + } + + [start] + Button next_date_button { + icon-name: "go-next-symbolic"; + action-name: "win.next-date"; + } + + [start] + Button { + action-name: "win.today"; + + child: Adw.ButtonContent { + label: _("_Today"); + use-underline: true; + icon-name: "calendar-today-symbolic"; + can-shrink: true; + tooltip-text: _("Go to Today"); + }; + } + + [center] + Adw.Bin view_switcher_bin { + child: Adw.ViewSwitcher view_switcher_wide { + stack: views_stack; + policy: wide; + }; + } + + [end] + Button { + icon-name: "list-add-symbolic"; + action-name: "win.new-event"; + tooltip-text: C_("tooltip", "Add Event"); + } + + [end] + Button { + icon-name: "x-office-calendar-symbolic"; + tooltip-text: _("Manage Calendars"); + action-name: "win.show-calendars"; + } + } + }; + }; + } + } + + notify::current-breakpoint => $on_breakpoint_changed(template) not-swapped; + + Adw.Breakpoint { + condition ("max-width: 1000sp") + + setters { + split_view.collapsed: true; + view_switcher_bin.child: view_switcher_narrow; + } + } + + Adw.Breakpoint { + condition ("max-width: 700sp") + + setters { + split_view.collapsed: true; + view_switcher_bin.visible: false; + previous_date_button.visible: false; + next_date_button.visible: false; + split_view.show-sidebar: false; + sidebar_button.visible: false; + header_bar.title-widget: null; + navigation_button_title.active: false; + week_page.visible: false; + month_page.visible: false; + agenda_page.visible: true; + } + } +} + +Adw.InlineViewSwitcher view_switcher_narrow { + styles [ + "flat", + ] + + stack: views_stack; + display-mode: icons; +} + +$GcalQuickAddPopover quick_add_popover { + edit-event => $edit_event(template) not-swapped; + closed => $close_new_event_widget(template) not-swapped; +} + +$GcalEventEditorDialog event_editor { + remove-event => $on_event_editor_dialog_remove_event_cb(template) not-swapped; +} + +menu menu { + section { + item { + label: _("_Synchronize Calendars"); + action: "app.sync"; + } + } + + section { + item { + label: _("_Date & Time Settings…"); + action: "win.open-date-time-settings"; + } + + item { + label: _("_Online Accounts…"); + action: "win.open-online-accounts"; + } + + submenu { + label: _("Weather"); + + item { + custom: "weather"; + } + } + } + + section { + item { + label: _("_Keyboard Shortcuts"); + action: "win.show-help-overlay"; + } + + item { + label: _("_About Calendar"); + action: "app.about"; + } + } +} + +PopoverMenu win_menu { + menu-model: menu; + + [weather] + $GcalWeatherSettings weather_settings {} +} diff --git a/src/gui/gcal-window.ui b/src/gui/gcal-window.ui deleted file mode 100644 index 4a221adc8bbb9f5a29a5a8e7b37f4b4e8dc05bcf..0000000000000000000000000000000000000000 --- a/src/gui/gcal-window.ui +++ /dev/null @@ -1,454 +0,0 @@ - - - - - - - views_stack - icons - - - - - - - - - - - - -
- - _Synchronize Calendars - app.sync - -
-
- - _Date & Time Settings… - win.open-date-time-settings - - - _Online Accounts… - win.open-online-accounts - - - Weather - - weather - - -
-
- - _Keyboard Shortcuts - win.show-help-overlay - - - _About Calendar - app.about - -
-
- - - menu - - - - - - - - diff --git a/src/gui/gtk/help-overlay.blp b/src/gui/gtk/help-overlay.blp new file mode 100644 index 0000000000000000000000000000000000000000..7e7641e9adb1dd53ba984befb907abf830f11b03 --- /dev/null +++ b/src/gui/gtk/help-overlay.blp @@ -0,0 +1,102 @@ +using Gtk 4.0; + +ShortcutsWindow help_overlay { + modal: true; + + ShortcutsSection { + section-name: "shortcuts"; + max-height: 17; + + ShortcutsGroup { + title: C_("shortcut window", "General"); + + ShortcutsShortcut { + title: C_("shortcut window", "Open Main Menu"); + accelerator: "F10"; + } + + ShortcutsShortcut { + title: C_("shortcut window", "Open Calendars Menu"); + accelerator: "F8"; + } + + ShortcutsShortcut { + title: C_("shortcut window", "New Event"); + accelerator: "N"; + } + + ShortcutsShortcut { + title: C_("shortcut window", "Manage Calendars"); + accelerator: "m"; + } + + ShortcutsShortcut { + title: C_("shortcut window", "Synchronize Calendars"); + accelerator: "F5 r"; + } + + ShortcutsShortcut { + title: C_("shortcut window", "Close Window"); + accelerator: "Q"; + } + + ShortcutsShortcut { + title: C_("shortcut window", "Search"); + accelerator: "F"; + } + + ShortcutsShortcut { + title: C_("shortcut window", "Show Help"); + accelerator: "F1"; + } + + ShortcutsShortcut { + title: C_("shortcut window", "Shortcuts"); + accelerator: "question"; + } + } + + ShortcutsGroup { + title: C_("shortcut window", "Navigation"); + + ShortcutsShortcut { + title: C_("shortcut window", "Go Back"); + accelerator: "Left Page_Up"; + } + + ShortcutsShortcut { + title: C_("shortcut window", "Go Forward"); + accelerator: "Right Page_Down"; + } + + ShortcutsShortcut { + title: C_("shortcut window", "Show Today"); + accelerator: "Down T Home"; + } + + ShortcutsShortcut { + title: C_("shortcut window", "Next View"); + accelerator: "Page_Down"; + } + + ShortcutsShortcut { + title: C_("shortcut window", "Previous View"); + accelerator: "Page_Up"; + } + } + + ShortcutsGroup { + title: C_("shortcut window", "View"); + + ShortcutsShortcut { + title: C_("shortcut window", "Week View"); + accelerator: "1"; + } + + ShortcutsShortcut { + title: C_("shortcut window", "Month View"); + accelerator: "2"; + } + } + } +} diff --git a/src/gui/gtk/help-overlay.ui b/src/gui/gtk/help-overlay.ui deleted file mode 100644 index 05e0230ad8985237bd0f05455f6494430d2517f2..0000000000000000000000000000000000000000 --- a/src/gui/gtk/help-overlay.ui +++ /dev/null @@ -1,123 +0,0 @@ - - - - True - - - shortcuts - 17 - - - General - - - Open Main Menu - F10 - - - - - Open Calendars Menu - F8 - - - - - New Event - <Primary>N - - - - - Manage Calendars - <Ctrl><Alt>m - - - - - Synchronize Calendars - F5 <Ctrl>r - - - - - Close Window - <Primary>Q - - - - - Search - <Primary>F - - - - - Show Help - F1 - - - - - Shortcuts - <Primary>question - - - - - - - Navigation - - - Go Back - <Alt>Left Page_Up - - - - - Go Forward - <Alt>Right Page_Down - - - - - Show Today - <Alt>Down <Primary>T Home - - - - - Next View - <Primary>Page_Down - - - - - Previous View - <Primary>Page_Up - - - - - - - View - - - Week View - <Alt>1 - - - - - Month View - <Alt>2 - - - - - - - - diff --git a/src/gui/gtk/meson.build b/src/gui/gtk/meson.build index fb999e0cfdf85ff71404ecff859d4d01eb4c45e3..0ebe2021972e009920a29e65f69221a3d6edf812 100644 --- a/src/gui/gtk/meson.build +++ b/src/gui/gtk/meson.build @@ -1,5 +1,21 @@ +blueprints = custom_target( + 'blueprints', + input: files( + 'help-overlay.blp', + ), + output: '.', + command: [ + find_program('blueprint-compiler'), + 'batch-compile', + '@OUTPUT@', + '@CURRENT_SOURCE_DIR@', + '@INPUT@', + ], +) + built_sources += gnome.compile_resources( 'gtk-resources', 'gtk.gresource.xml', c_name: 'gtk', + dependencies: blueprints, ) diff --git a/src/gui/importer/gcal-import-dialog.blp b/src/gui/importer/gcal-import-dialog.blp new file mode 100644 index 0000000000000000000000000000000000000000..12ba5926a6cc8593640e9f75bc6ca7e4ae3d46dd --- /dev/null +++ b/src/gui/importer/gcal-import-dialog.blp @@ -0,0 +1,78 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalImportDialog: Adw.Dialog { + title: _("Import Files…"); + height-request: 294; + follows-content-size: true; + + Adw.ToastOverlay toast_overlay { + Adw.ToolbarView { + [top] + Adw.HeaderBar headerbar { + show-end-title-buttons: false; + show-start-title-buttons: false; + + [start] + Button cancel_button { + label: _("_Cancel"); + use-underline: true; + action-name: "sheet.close"; + } + + [end] + Button import_button { + label: _("_Import"); + use-underline: true; + clicked => $on_import_button_clicked_cb(template) not-swapped; + + styles [ + "suggested-action", + ] + } + } + + content: ScrolledWindow { + propagate-natural-height: true; + propagate-natural-width: true; + + Adw.Clamp { + margin-top: 24; + margin-bottom: 24; + margin-start: 12; + margin-end: 12; + + Box calendars_box { + orientation: vertical; + spacing: 18; + + Adw.PreferencesGroup { + $GcalCalendarComboRow calendar_combo_row { + title: _("C_alendar"); + use-underline: true; + } + } + + Adw.PreferencesGroup files_group { + Adw.Spinner placeholder_spinner { + halign: center; + valign: center; + } + } + } + } + }; + } + } + + ShortcutController { + Shortcut { + trigger: "Escape"; + action: "action(sheet.close)"; + } + } +} + +SizeGroup title_sizegroup { + mode: horizontal; +} diff --git a/src/gui/importer/gcal-import-dialog.ui b/src/gui/importer/gcal-import-dialog.ui deleted file mode 100644 index 779f702cfd09c5c857232d463e6dfae8e2026a44..0000000000000000000000000000000000000000 --- a/src/gui/importer/gcal-import-dialog.ui +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - horizontal - - - - diff --git a/src/gui/importer/gcal-import-file-row.blp b/src/gui/importer/gcal-import-file-row.blp new file mode 100644 index 0000000000000000000000000000000000000000..d54cc819be66cc23a5eee90c19e60664703335d6 --- /dev/null +++ b/src/gui/importer/gcal-import-file-row.blp @@ -0,0 +1,12 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalImportFileRow: Adw.Bin { + ListBox events_listbox { + selection-mode: none; + + styles [ + "boxed-list", + ] + } +} diff --git a/src/gui/importer/gcal-import-file-row.ui b/src/gui/importer/gcal-import-file-row.ui deleted file mode 100644 index 83f3a12619ff875e264e20036f262eb21fb27052..0000000000000000000000000000000000000000 --- a/src/gui/importer/gcal-import-file-row.ui +++ /dev/null @@ -1,16 +0,0 @@ - - - - diff --git a/src/gui/importer/meson.build b/src/gui/importer/meson.build index f635d37a01c8467f4b31fb2e64e71216c0814ed0..c8a7de2cff84d1c87fb8cebbc1977e84fb0d4b48 100644 --- a/src/gui/importer/meson.build +++ b/src/gui/importer/meson.build @@ -1,9 +1,26 @@ calendar_incs += include_directories('.') +blueprints = custom_target( + 'blueprints', + input: files( + 'gcal-import-dialog.blp', + 'gcal-import-file-row.blp', + ), + output: '.', + command: [ + find_program('blueprint-compiler'), + 'batch-compile', + '@OUTPUT@', + '@CURRENT_SOURCE_DIR@', + '@INPUT@', + ], +) + built_sources += gnome.compile_resources( 'importer-resources', 'importer.gresource.xml', c_name: 'importer', + dependencies: blueprints, ) sources += files( diff --git a/src/gui/meson.build b/src/gui/meson.build index 5e799494fc30b1fd799a9b64230f9dbd94335950..0aec56e8290571c1903aa13fb37055635a089b81 100644 --- a/src/gui/meson.build +++ b/src/gui/meson.build @@ -8,10 +8,35 @@ subdir('views') calendar_incs += include_directories('.') +blueprints = custom_target( + 'blueprints', + input: files( + 'gcal-calendar-list.blp', + 'gcal-calendar-navigation-button.blp', + 'gcal-event-popover.blp', + 'gcal-event-widget.blp', + 'gcal-meeting-row.blp', + 'gcal-quick-add-popover.blp', + 'gcal-search-button.blp', + 'gcal-sync-indicator.blp', + 'gcal-weather-settings.blp', + 'gcal-window.blp', + ), + output: '.', + command: [ + find_program('blueprint-compiler'), + 'batch-compile', + '@OUTPUT@', + '@CURRENT_SOURCE_DIR@', + '@INPUT@', + ], +) + built_sources += gnome.compile_resources( 'gui-resources', 'gui.gresource.xml', c_name: 'gui', + dependencies: blueprints, ) sources += files( diff --git a/src/gui/views/gcal-agenda-view.blp b/src/gui/views/gcal-agenda-view.blp new file mode 100644 index 0000000000000000000000000000000000000000..82ce33131a253dfd5f152e67b22de6a3744cf3e3 --- /dev/null +++ b/src/gui/views/gcal-agenda-view.blp @@ -0,0 +1,38 @@ +using Gtk 4.0; + +template $GcalAgendaView: Box { + orientation: vertical; + + $GcalDateChooser date_chooser { + split-month-year: false; + vexpand: false; + valign: end; + active-date: bind template.active-date no-sync-create bidirectional; + } + + ScrolledWindow scrolled_window { + hexpand: true; + vexpand: true; + + ListBox list_box { + hexpand: true; + selection-mode: none; + vexpand: true; + row-activated => $on_list_box_row_activated_cb(template) not-swapped; + + ListBoxRow no_events_row { + activatable: false; + + child: Label { + label: _("No events"); + xalign: 0; + + styles [ + "no-events", + "dim-label", + ] + }; + } + } + } +} diff --git a/src/gui/views/gcal-agenda-view.ui b/src/gui/views/gcal-agenda-view.ui deleted file mode 100644 index 6ca98c5650d2ae01b7fb9b341cb8796926c4445d..0000000000000000000000000000000000000000 --- a/src/gui/views/gcal-agenda-view.ui +++ /dev/null @@ -1,43 +0,0 @@ - - - - diff --git a/src/gui/views/gcal-month-cell.blp b/src/gui/views/gcal-month-cell.blp new file mode 100644 index 0000000000000000000000000000000000000000..33bc91793769a00d5c45faa8b2b638843269f7df --- /dev/null +++ b/src/gui/views/gcal-month-cell.blp @@ -0,0 +1,75 @@ +using Gtk 4.0; +using Adw 1; + +template $GcalMonthCell: Adw.BreakpointBin { + Adw.Breakpoint breakpoint_narrow { + condition ("max-width: 120sp") + + setters { + weather_icon.halign: end; + weather_icon.hexpand: true; + weather_icon.margin-start: 6; + temp_label.visible: false; + } + } + + width-request: 50; + height-request: 50; + hexpand: true; + vexpand: true; + focusable: true; + + Overlay overlay { + [overlay] + Box header_box { + valign: start; + spacing: 6; + margin-top: 6; + margin-bottom: 6; + margin-start: 6; + margin-end: 6; + + Label day_label { + styles [ + "day-label", + "numeric", + ] + } + + Label month_name_label {} + + Image weather_icon { + pixel-size: 16; + margin-start: 12; + + styles [ + "dim-label", + ] + } + + Label temp_label { + styles [ + "dim-label", + "temp-label", + ] + } + } + + [overlay] + Button overflow_button { + valign: end; + sensitive: false; + clicked => $overflow_button_clicked_cb(template) not-swapped; + + styles [ + "flat", + ] + + Box { + Inscription overflow_inscription { + text-overflow: ellipsize_end; + } + } + } + } +} diff --git a/src/gui/views/gcal-month-cell.ui b/src/gui/views/gcal-month-cell.ui deleted file mode 100644 index 28ccada48622645129a457482520c8824fc5b995..0000000000000000000000000000000000000000 --- a/src/gui/views/gcal-month-cell.ui +++ /dev/null @@ -1,87 +0,0 @@ - - - - diff --git a/src/gui/views/gcal-month-popover.blp b/src/gui/views/gcal-month-popover.blp new file mode 100644 index 0000000000000000000000000000000000000000..7873953a91d205840e83987a1653bd0e976934e8 --- /dev/null +++ b/src/gui/views/gcal-month-popover.blp @@ -0,0 +1,64 @@ +using Gtk 4.0; + +template $GcalMonthPopover: Widget { + visible: false; + + ShortcutController { + Shortcut { + trigger: "Escape"; + action: "action(month-popover.popdown)"; + } + } + + Box main_box { + orientation: vertical; + spacing: 12; + + styles [ + "card", + "view", + ] + + Box { + Label day_label { + label: "12"; + xalign: 0.0; + hexpand: true; + + styles [ + "large-title", + ] + } + + Button { + halign: end; + valign: start; + icon-name: "window-close-symbolic"; + clicked => $close_button_clicked_cb(template); + + styles [ + "flat", + "circular", + ] + } + } + + ListBox listbox { + vexpand: true; + selection-mode: none; + + styles [ + "calendar-list", + ] + } + + Button new_event_button { + label: _("New Event…"); + clicked => $new_event_button_clicked_cb(template) not-swapped; + + styles [ + "flat", + ] + } + } +} diff --git a/src/gui/views/gcal-month-popover.ui b/src/gui/views/gcal-month-popover.ui deleted file mode 100644 index 9d50b89819d06f1f1d0a6fdce59a713ea855b0cc..0000000000000000000000000000000000000000 --- a/src/gui/views/gcal-month-popover.ui +++ /dev/null @@ -1,80 +0,0 @@ - - - - diff --git a/src/gui/views/gcal-month-view.blp b/src/gui/views/gcal-month-view.blp new file mode 100644 index 0000000000000000000000000000000000000000..5d26748f03cf1b14ddde7fb3d5360f634383dc2b --- /dev/null +++ b/src/gui/views/gcal-month-view.blp @@ -0,0 +1,109 @@ +using Gtk 4.0; + +template $GcalMonthView: Widget { + overflow: hidden; + + EventControllerScroll { + flags: vertical | kinetic; + scroll-begin => $on_scroll_controller_scroll_begin_cb(template) not-swapped; + scroll => $on_scroll_controller_scroll_cb(template) not-swapped; + scroll-end => $on_scroll_controller_scroll_end_cb(template) not-swapped; + decelerate => $on_scroll_controller_decelerate_cb(template) not-swapped; + } + + EventControllerScroll { + flags: vertical | discrete; + scroll => $on_discrete_scroll_controller_scroll_cb(template) not-swapped; + } + + GestureClick { + button: 1; + pressed => $on_click_gesture_pressed_cb(template) not-swapped; + released => $on_click_gesture_released_cb(template) not-swapped; + } + + EventControllerMotion motion_controller { + propagation-phase: none; + motion => $on_motion_controller_motion_cb(template) not-swapped; + } + + [header] + Box { + styles [ + "month-header", + "view", + ] + + homogeneous: true; + + Label label_0 { + margin-start: 6; + hexpand: true; + xalign: 0.0; + + styles [ + "header", + ] + } + + Label label_1 { + margin-start: 6; + hexpand: true; + xalign: 0.0; + + styles [ + "header", + ] + } + + Label label_2 { + margin-start: 6; + hexpand: true; + xalign: 0.0; + + styles [ + "header", + ] + } + + Label label_3 { + margin-start: 6; + hexpand: true; + xalign: 0.0; + + styles [ + "header", + ] + } + + Label label_4 { + margin-start: 6; + hexpand: true; + xalign: 0.0; + + styles [ + "header", + ] + } + + Label label_5 { + margin-start: 6; + hexpand: true; + xalign: 0.0; + + styles [ + "header", + ] + } + + Label label_6 { + margin-start: 6; + hexpand: true; + xalign: 0.0; + + styles [ + "header", + ] + } + } +} diff --git a/src/gui/views/gcal-month-view.ui b/src/gui/views/gcal-month-view.ui deleted file mode 100644 index 9e48d8f4a10b0aad90aa86775dd3212038592096..0000000000000000000000000000000000000000 --- a/src/gui/views/gcal-month-view.ui +++ /dev/null @@ -1,126 +0,0 @@ - - - - diff --git a/src/gui/views/gcal-week-header.blp b/src/gui/views/gcal-week-header.blp new file mode 100644 index 0000000000000000000000000000000000000000..ff6c4bf2282a41305ffdc9d11498384362824ce6 --- /dev/null +++ b/src/gui/views/gcal-week-header.blp @@ -0,0 +1,49 @@ +using Gtk 4.0; + +template $GcalWeekHeader: Widget { + Box main_box { + hexpand: true; + vexpand: false; + orientation: vertical; + + styles [ + "week-header", + ] + + Box { + orientation: vertical; + + GestureClick { + button: 1; + pressed => $on_button_pressed(template) not-swapped; + released => $on_button_released(template) not-swapped; + } + + EventControllerMotion motion_controller { + propagation-phase: none; + motion => $on_motion_notify(template) not-swapped; + } + + Box weekdays_box { + homogeneous: true; + } + + ScrolledWindow scrolledwindow { + hscrollbar-policy: never; + vscrollbar-policy: never; + propagate-natural-height: true; + margin-bottom: 2; + + Viewport { + Grid grid { + column-homogeneous: true; + hexpand: true; + column-spacing: 6; + row-spacing: 2; + margin-start: 6; + } + } + } + } + } +} diff --git a/src/gui/views/gcal-week-header.ui b/src/gui/views/gcal-week-header.ui deleted file mode 100644 index 6312fc0b42c43d6c5c76a739ecf9413c534eb8c4..0000000000000000000000000000000000000000 --- a/src/gui/views/gcal-week-header.ui +++ /dev/null @@ -1,68 +0,0 @@ - - - - diff --git a/src/gui/views/gcal-week-view.blp b/src/gui/views/gcal-week-view.blp new file mode 100644 index 0000000000000000000000000000000000000000..47979e42286adddbec265b865ea18518b4369264 --- /dev/null +++ b/src/gui/views/gcal-week-view.blp @@ -0,0 +1,89 @@ +using Gtk 4.0; + +template $GcalWeekView: Box { + orientation: vertical; + + styles [ + "week-view", + ] + + Box { + orientation: horizontal; + + Box expand_button_box { + hexpand: false; + + ToggleButton { + visible: bind header.can-expand; + active: bind header.expanded bidirectional; + hexpand: true; + halign: center; + valign: end; + margin-bottom: 6; + icon-name: "go-down-symbolic"; + + styles [ + "flat", + "circular", + "week-header-expander", + ] + } + } + + $GcalWeekHeader header { + hexpand: true; + event-activated => $on_event_activated(template); + } + } + + Separator {} + + ScrolledWindow scrolled_window { + hexpand: true; + vexpand: true; + + GestureZoom { + scale-changed => $on_zoom_gesture_scale_changed_cb(template) not-swapped; + begin => $on_zoom_gesture_begin_cb(template) not-swapped; + end => $on_zoom_gesture_end_cb(template) not-swapped; + } + + EventControllerScroll { + propagation-phase: capture; + flags: vertical | kinetic; + scroll-begin => $on_scroll_controller_scroll_begin_cb(template) not-swapped; + scroll => $on_scroll_controller_scroll_cb(template) not-swapped; + scroll-end => $on_scroll_controller_scroll_end_cb(template) not-swapped; + } + + EventControllerMotion { + propagation-phase: capture; + enter => $on_motion_controller_enter_cb(template) not-swapped; + motion => $on_motion_controller_motion_cb(template) not-swapped; + leave => $on_motion_controller_leave_cb(template) not-swapped; + } + + Viewport { + Box content { + orientation: horizontal; + + $GcalWeekHourBar hours_bar {} + + $GcalWeekGrid week_grid { + hexpand: true; + vexpand: true; + event-activated => $on_event_activated(template); + } + } + } + } +} + +SizeGroup sizegroup { + mode: horizontal; + + widgets [ + expand_button_box, + hours_bar, + ] +} diff --git a/src/gui/views/gcal-week-view.ui b/src/gui/views/gcal-week-view.ui deleted file mode 100644 index 34fc6fd9ea21fc0a410e35114aaad8b2174959f4..0000000000000000000000000000000000000000 --- a/src/gui/views/gcal-week-view.ui +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - horizontal - - - - - - diff --git a/src/gui/views/meson.build b/src/gui/views/meson.build index a6798a060ca2f2a589ad33f233c7eb41d92dd198..4cbae4f80788cd7ca20d81d59a2af2005925760c 100644 --- a/src/gui/views/meson.build +++ b/src/gui/views/meson.build @@ -1,9 +1,30 @@ calendar_incs += include_directories('.') +blueprints = custom_target( + 'blueprints', + input: files( + 'gcal-agenda-view.blp', + 'gcal-month-cell.blp', + 'gcal-month-popover.blp', + 'gcal-month-view.blp', + 'gcal-week-header.blp', + 'gcal-week-view.blp', + ), + output: '.', + command: [ + find_program('blueprint-compiler'), + 'batch-compile', + '@OUTPUT@', + '@CURRENT_SOURCE_DIR@', + '@INPUT@', + ], +) + built_sources += gnome.compile_resources( 'views-resources', 'views.gresource.xml', c_name: 'views', + dependencies: blueprints, ) sources += files(