calendar-management/calendars-page: Delete calendar during unmapping
The previous commit reintroduced https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1270 In order to solve this without destroying the dialog, the calendar is forcefully deleted when unmapping. Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/712>
This commit is contained in:
@@ -185,6 +185,29 @@ delete_calendar (GcalCalendarsPage *self,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clear_toast_and_delete_calendar (GcalCalendarsPage *self,
|
||||||
|
AdwToast *toast)
|
||||||
|
{
|
||||||
|
GcalCalendar *calendar;
|
||||||
|
|
||||||
|
GCAL_ENTRY;
|
||||||
|
|
||||||
|
calendar = g_object_get_data (G_OBJECT (toast), "calendar");
|
||||||
|
|
||||||
|
if (!calendar)
|
||||||
|
{
|
||||||
|
g_assert (self->toast == NULL);
|
||||||
|
GCAL_RETURN ();
|
||||||
|
}
|
||||||
|
|
||||||
|
delete_calendar (self, calendar);
|
||||||
|
|
||||||
|
g_clear_object (&self->toast);
|
||||||
|
|
||||||
|
GCAL_EXIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Callbacks
|
* Callbacks
|
||||||
@@ -291,23 +314,7 @@ static void
|
|||||||
on_toast_dismissed_cb (AdwToast *toast,
|
on_toast_dismissed_cb (AdwToast *toast,
|
||||||
GcalCalendarsPage *self)
|
GcalCalendarsPage *self)
|
||||||
{
|
{
|
||||||
GcalCalendar *calendar;
|
clear_toast_and_delete_calendar (self, toast);
|
||||||
|
|
||||||
GCAL_ENTRY;
|
|
||||||
|
|
||||||
calendar = g_object_get_data (G_OBJECT (toast), "calendar");
|
|
||||||
|
|
||||||
if (!calendar)
|
|
||||||
{
|
|
||||||
g_assert (self->toast == NULL);
|
|
||||||
GCAL_RETURN ();
|
|
||||||
}
|
|
||||||
|
|
||||||
delete_calendar (self, calendar);
|
|
||||||
|
|
||||||
g_clear_object (&self->toast);
|
|
||||||
|
|
||||||
GCAL_EXIT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -363,6 +370,23 @@ gcal_calendar_management_page_iface_init (GcalCalendarManagementPageInterface *i
|
|||||||
iface->activate = gcal_calendars_page_activate;
|
iface->activate = gcal_calendars_page_activate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* GtkWidget overrides
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void
|
||||||
|
gcal_calendars_page_unmap (GtkWidget *widget)
|
||||||
|
{
|
||||||
|
GcalCalendarsPage *self = GCAL_CALENDARS_PAGE (widget);
|
||||||
|
|
||||||
|
if (self->toast)
|
||||||
|
clear_toast_and_delete_calendar (self, self->toast);
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (gcal_calendars_page_parent_class)->unmap (widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GObject overrides
|
* GObject overrides
|
||||||
*/
|
*/
|
||||||
@@ -385,6 +409,8 @@ gcal_calendars_page_class_init (GcalCalendarsPageClass *klass)
|
|||||||
|
|
||||||
object_class->finalize = gcal_calendars_page_finalize;
|
object_class->finalize = gcal_calendars_page_finalize;
|
||||||
|
|
||||||
|
widget_class->unmap = gcal_calendars_page_unmap;
|
||||||
|
|
||||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/gui/calendar-management/gcal-calendars-page.ui");
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/gui/calendar-management/gcal-calendars-page.ui");
|
||||||
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalCalendarsPage, listbox);
|
gtk_widget_class_bind_template_child (widget_class, GcalCalendarsPage, listbox);
|
||||||
|
|||||||
Reference in New Issue
Block a user