drop-overlay: Introduce GcalDropOverlay

A new widget to perform drag and drop operations, for example,
dropping ICS files to the GcalWindow. It allows to overlay
a child for visual feedback when a DnD operation is done.

either in the main window or in the import dialog,
depending on whether none could be imported, or just some
of them.

It is based on Loupe's DragOverlay widget.

Closes #1257
This commit is contained in:
Diego Iván
2024-08-05 12:31:31 -03:00
committed by Georges Basile Stavracas Neto
parent 75ad1425e7
commit dfc5a9b970
6 changed files with 622 additions and 156 deletions
+182 -156
View File
@@ -117,174 +117,200 @@
<child>
<object class="AdwToastOverlay" id="overlay">
<child>
<object class="AdwNavigationSplitView" id="split_view">
<!-- Sidebar -->
<property name="sidebar">
<object class="AdwNavigationPage">
<property name="title" translatable="yes">Calendar</property>
<property name="child">
<object class="AdwToolbarView">
<child type="top">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="AdwHeaderBar">
<child type="start">
<object class="GcalSyncIndicator" id="sync_indicator" />
</child>
<property name="title-widget">
<object class="GcalCalendarButton" id="calendars_button" />
</property>
<child type="end">
<object class="GtkMenuButton" id="menu_button">
<property name="icon-name">open-menu-symbolic</property>
<property name="popover">win_menu</property>
<property name="tooltip-text" translatable="yes">Main Menu</property>
<property name="primary">True</property>
</object>
</child>
</object>
</child>
<child>
<object class="GcalDateChooser" id="date_chooser">
<property name="split-month-year">False</property>
<property name="vexpand">False</property>
<property name="active-date" bind-source="GcalWindow" bind-property="active-date" bind-flags="bidirectional"/>
<signal name="day-selected" handler="day_selected" object="GcalWindow" swapped="yes"/>
</object>
</child>
</object>
</child>
<property name="content">
<object class="GcalAgendaView" id="agenda_view">
<property name="vexpand">True</property>
<property name="active-date" bind-source="GcalWindow" bind-property="active-date" bind-flags="bidirectional"/>
<signal name="create-event" handler="show_new_event_widget" object="GcalWindow" swapped="no"/>
<signal name="event-activated" handler="event_activated" object="GcalWindow" swapped="no"/>
</object>
</property>
<child type="bottom">
<object class="GtkActionBar" id="action_bar">
<property name="revealed">False</property>
<child type="start">
<object class="GtkButton">
<property name="action-name">win.today</property>
<property name="child">
<object class="AdwButtonContent">
<property name="label" translatable="yes">_Today</property>
<property name="use-underline">True</property>
<property name="icon-name">calendar-today-symbolic</property>
<property name="can-shrink">True</property>
</object>
</property>
</object>
</child>
<child type="end">
<object class="GcalToolbarEnd" id="sidebar_toolbar_end"/>
</child>
</object>
</child>
</object>
</property>
<object class="GcalDropOverlay" id="drop_overlay">
<property name="overlayed">
<object class="AdwStatusPage" id="drop_status_page">
<property name="title" translatable="yes">Drop Event Files to Import</property>
<property name="icon-name">calendar-month-symbolic</property>
<style>
<class name="drop-overlay-area"/>
<class name="compact"/>
</style>
</object>
</property>
<property name="child">
<object class="AdwNavigationSplitView" id="split_view">
<child>
<object class="GtkDropTarget" id="drop_target">
<property name="actions">copy</property>
<property name="propagation-phase">capture</property>
<signal name="accept" handler="on_drop_target_accept_cb" object="GcalWindow" swapped="no"/>
<signal name="drop" handler="on_drop_target_drop_cb" object="GcalWindow" swapped="no"/>
</object>
</child>
<style>
<class name="drop-target"/>
</style>
<!-- Sidebar -->
<property name="sidebar">
<object class="AdwNavigationPage">
<property name="title" translatable="yes">Calendar</property>
<property name="child">
<object class="AdwToolbarView">
<child type="top">
<object class="GtkBox">
<property name="orientation">vertical</property>
<!-- Main content -->
<property name="content">
<object class="AdwNavigationPage" id="content_page">
<binding name="title">
<closure type="gchararray" function="content_title">
<lookup type="GcalWindow" name="active-view"/>
</closure>
</binding>
<property name="child">
<object class="AdwToolbarView">
<style>
<class name="view" />
</style>
<child type="top">
<object class="AdwHeaderBar" id="header_bar">
<child>
<object class="GtkButton">
<property name="action-name">win.today</property>
<property name="child">
<object class="AdwButtonContent">
<property name="label" translatable="yes">_Today</property>
<property name="use-underline">True</property>
<property name="icon-name">calendar-today-symbolic</property>
<property name="can-shrink">True</property>
</object>
</property>
</object>
</child>
<child type="title">
<object class="AdwViewSwitcher" id="views_switcher">
<property name="stack">views_stack</property>
<property name="policy">wide</property>
</object>
</child>
<child type="end">
<object class="GcalToolbarEnd" id="toolbar_end" />
</child>
</object>
</child>
<property name="content">
<object class="GtkBox" id="main_box">
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="AdwViewStack" id="views_stack">
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<signal name="notify::visible-child" handler="view_changed" object="GcalWindow" swapped="no"/>
<style>
<class name="view"/>
</style>
<child>
<object class="AdwViewStackPage">
<property name="name">week</property>
<property name="title" translatable="yes">_Week</property>
<property name="use-underline">True</property>
<property name="icon_name">calendar-week-symbolic</property>
<object class="AdwHeaderBar">
<child type="start">
<object class="GcalSyncIndicator" id="sync_indicator" />
</child>
<property name="title-widget">
<object class="GcalCalendarButton" id="calendars_button" />
</property>
<child type="end">
<object class="GtkMenuButton" id="menu_button">
<property name="icon-name">open-menu-symbolic</property>
<property name="popover">win_menu</property>
<property name="tooltip-text" translatable="yes">Main Menu</property>
<property name="primary">True</property>
</object>
</child>
</object>
</child>
<child>
<object class="GcalDateChooser" id="date_chooser">
<property name="split-month-year">False</property>
<property name="vexpand">False</property>
<property name="active-date" bind-source="GcalWindow" bind-property="active-date" bind-flags="bidirectional"/>
<signal name="day-selected" handler="day_selected" object="GcalWindow" swapped="yes"/>
</object>
</child>
</object>
</child>
<property name="content">
<object class="GcalAgendaView" id="agenda_view">
<property name="vexpand">True</property>
<property name="active-date" bind-source="GcalWindow" bind-property="active-date" bind-flags="bidirectional"/>
<signal name="create-event" handler="show_new_event_widget" object="GcalWindow" swapped="no"/>
<signal name="event-activated" handler="event_activated" object="GcalWindow" swapped="no"/>
</object>
</property>
<child type="bottom">
<object class="GtkActionBar" id="action_bar">
<property name="revealed">False</property>
<child type="start">
<object class="GtkButton">
<property name="action-name">win.today</property>
<property name="child">
<object class="GcalWeekView" id="week_view">
<property name="active-date" bind-source="GcalWindow" bind-property="active-date" bind-flags="bidirectional"/>
<signal name="create-event" handler="show_new_event_widget" object="GcalWindow" swapped="no"/>
<signal name="event-activated" handler="event_activated" object="GcalWindow" swapped="no"/>
<object class="AdwButtonContent">
<property name="label" translatable="yes">_Today</property>
<property name="use-underline">True</property>
<property name="icon-name">calendar-today-symbolic</property>
<property name="can-shrink">True</property>
</object>
</property>
</object>
</child>
<child>
<object class="AdwViewStackPage">
<property name="name">month</property>
<property name="title" translatable="yes">_Month</property>
<property name="use-underline">True</property>
<property name="icon_name">calendar-month-symbolic</property>
<property name="child">
<object class="GcalMonthView" id="month_view">
<property name="active-date" bind-source="GcalWindow" bind-property="active-date" bind-flags="bidirectional"/>
<signal name="create-event" handler="show_new_event_widget" object="GcalWindow" swapped="no"/>
<signal name="create-event-detailed" handler="create_event_detailed_cb" object="GcalWindow" swapped="no"/>
<signal name="event-activated" handler="event_activated" object="GcalWindow" swapped="no"/>
</object>
</property>
</object>
<child type="end">
<object class="GcalToolbarEnd" id="sidebar_toolbar_end"/>
</child>
</object>
</child>
</object>
</property>
</object>
</property>
<!-- Main content -->
<property name="content">
<object class="AdwNavigationPage" id="content_page">
<binding name="title">
<closure type="gchararray" function="content_title">
<lookup type="GcalWindow" name="active-view"/>
</closure>
</binding>
<property name="child">
<object class="AdwToolbarView">
<style>
<class name="view" />
</style>
<child type="top">
<object class="AdwHeaderBar" id="header_bar">
<child>
<object class="GtkButton">
<property name="action-name">win.today</property>
<property name="child">
<object class="AdwButtonContent">
<property name="label" translatable="yes">_Today</property>
<property name="use-underline">True</property>
<property name="icon-name">calendar-today-symbolic</property>
<property name="can-shrink">True</property>
</object>
</property>
</object>
</child>
<child type="title">
<object class="AdwViewSwitcher" id="views_switcher">
<property name="stack">views_stack</property>
<property name="policy">wide</property>
</object>
</child>
<child type="end">
<object class="GcalToolbarEnd" id="toolbar_end" />
</child>
</object>
</child>
<property name="content">
<object class="GtkBox" id="main_box">
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="AdwViewStack" id="views_stack">
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<signal name="notify::visible-child" handler="view_changed" object="GcalWindow" swapped="no"/>
<style>
<class name="view"/>
</style>
<child>
<object class="AdwViewStackPage">
<property name="name">week</property>
<property name="title" translatable="yes">_Week</property>
<property name="use-underline">True</property>
<property name="icon_name">calendar-week-symbolic</property>
<property name="child">
<object class="GcalWeekView" id="week_view">
<property name="active-date" bind-source="GcalWindow" bind-property="active-date" bind-flags="bidirectional"/>
<signal name="create-event" handler="show_new_event_widget" object="GcalWindow" swapped="no"/>
<signal name="event-activated" handler="event_activated" object="GcalWindow" swapped="no"/>
</object>
</property>
</object>
</child>
<child>
<object class="AdwViewStackPage">
<property name="name">month</property>
<property name="title" translatable="yes">_Month</property>
<property name="use-underline">True</property>
<property name="icon_name">calendar-month-symbolic</property>
<property name="child">
<object class="GcalMonthView" id="month_view">
<property name="active-date" bind-source="GcalWindow" bind-property="active-date" bind-flags="bidirectional"/>
<signal name="create-event" handler="show_new_event_widget" object="GcalWindow" swapped="no"/>
<signal name="create-event-detailed" handler="create_event_detailed_cb" object="GcalWindow" swapped="no"/>
<signal name="event-activated" handler="event_activated" object="GcalWindow" swapped="no"/>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</property>
</object>
</property>
</object>
@@ -314,7 +340,7 @@
<object class="GcalEventEditorDialog" id="event_editor">
<signal name="remove-event" handler="on_event_editor_dialog_remove_event_cb" object="GcalWindow" swapped="no"/>
</object>
<menu id='menu'>
<section>
<item>
@@ -346,11 +372,11 @@
<object class="GtkPopoverMenu" id="win_menu">
<property name="menu-model">menu</property>
<!-- Weather submenu -->
<child type="weather">
<object class="GcalWeatherSettings" id="weather_settings" />
</child>
</object>
</interface>