diff --git a/src/gui/calendar-management/gcal-calendar-management-dialog.c b/src/gui/calendar-management/gcal-calendar-management-dialog.c index 9e2cd0fe..684e68ea 100644 --- a/src/gui/calendar-management/gcal-calendar-management-dialog.c +++ b/src/gui/calendar-management/gcal-calendar-management-dialog.c @@ -94,16 +94,14 @@ set_page (GcalCalendarManagementDialog *self, const gchar *page_name, GcalCalendar *calendar) { - GcalCalendarManagementPage *next_page; AdwNavigationPage *page; GCAL_TRACE_MSG ("Switching to page '%s'", page_name); page = adw_navigation_view_find_page (self->navigation_view, page_name); - g_assert (page != NULL); - next_page = GCAL_CALENDAR_MANAGEMENT_PAGE (adw_navigation_page_get_child (page)); + g_assert (GCAL_IS_CALENDAR_MANAGEMENT_PAGE (page)); - gcal_calendar_management_page_activate (next_page, calendar); + gcal_calendar_management_page_activate (GCAL_CALENDAR_MANAGEMENT_PAGE (page), calendar); adw_navigation_view_pop (self->navigation_view); @@ -129,16 +127,12 @@ setup_context (GcalCalendarManagementDialog *self) for (i = 0; i < N_PAGES; i++) { GcalCalendarManagementPage *page; - AdwNavigationPage *navigation_page; page = g_object_new (pages[i].gtype, "context", self->context, NULL); - navigation_page = adw_navigation_page_new (GTK_WIDGET (page), - gcal_calendar_management_page_get_title (page)); - adw_navigation_page_set_tag (navigation_page, gcal_calendar_management_page_get_name (page)); - adw_navigation_view_add (self->navigation_view, navigation_page); + adw_navigation_view_add (self->navigation_view, ADW_NAVIGATION_PAGE (page)); g_signal_connect_object (page, "switch-page", @@ -164,12 +158,9 @@ on_navigation_view_popped_cb (AdwNavigationView *navigation_view, AdwNavigationPage *popped_page, GcalCalendarManagementDialog *self) { - GcalCalendarManagementPage *page; + g_assert (GCAL_IS_CALENDAR_MANAGEMENT_PAGE (popped_page)); - page = GCAL_CALENDAR_MANAGEMENT_PAGE (adw_navigation_page_get_child (popped_page)); - g_assert (page != NULL); - - gcal_calendar_management_page_deactivate (page); + gcal_calendar_management_page_deactivate (GCAL_CALENDAR_MANAGEMENT_PAGE (popped_page)); } static void diff --git a/src/gui/calendar-management/gcal-calendar-management-page.c b/src/gui/calendar-management/gcal-calendar-management-page.c index afa305f0..fe7ae239 100644 --- a/src/gui/calendar-management/gcal-calendar-management-page.c +++ b/src/gui/calendar-management/gcal-calendar-management-page.c @@ -24,7 +24,7 @@ #include "gcal-calendar-management-page.h" #include "gcal-context.h" -G_DEFINE_INTERFACE (GcalCalendarManagementPage, gcal_calendar_management_page, G_TYPE_OBJECT) +G_DEFINE_INTERFACE (GcalCalendarManagementPage, gcal_calendar_management_page, ADW_TYPE_NAVIGATION_PAGE) enum { diff --git a/src/gui/calendar-management/gcal-calendar-management-page.h b/src/gui/calendar-management/gcal-calendar-management-page.h index e9130fe7..834abf83 100644 --- a/src/gui/calendar-management/gcal-calendar-management-page.h +++ b/src/gui/calendar-management/gcal-calendar-management-page.h @@ -28,7 +28,7 @@ G_BEGIN_DECLS #define GCAL_TYPE_CALENDAR_MANAGEMENT_PAGE (gcal_calendar_management_page_get_type ()) -G_DECLARE_INTERFACE (GcalCalendarManagementPage, gcal_calendar_management_page, GCAL, CALENDAR_MANAGEMENT_PAGE, GtkWidget) +G_DECLARE_INTERFACE (GcalCalendarManagementPage, gcal_calendar_management_page, GCAL, CALENDAR_MANAGEMENT_PAGE, AdwNavigationPage) struct _GcalCalendarManagementPageInterface { diff --git a/src/gui/calendar-management/gcal-calendars-page.c b/src/gui/calendar-management/gcal-calendars-page.c index 1975f623..d2f5da3f 100644 --- a/src/gui/calendar-management/gcal-calendars-page.c +++ b/src/gui/calendar-management/gcal-calendars-page.c @@ -31,7 +31,7 @@ struct _GcalCalendarsPage { - AdwBin parent; + AdwNavigationPage parent; GtkListBox *listbox; AdwToastOverlay *toast_overlay; @@ -47,7 +47,7 @@ static void on_calendar_color_changed_cb (GcalCalendar GParamSpec *pspec, GtkImage *icon); -G_DEFINE_TYPE_WITH_CODE (GcalCalendarsPage, gcal_calendars_page, ADW_TYPE_BIN, +G_DEFINE_TYPE_WITH_CODE (GcalCalendarsPage, gcal_calendars_page, ADW_TYPE_NAVIGATION_PAGE, G_IMPLEMENT_INTERFACE (GCAL_TYPE_CALENDAR_MANAGEMENT_PAGE, gcal_calendar_management_page_iface_init)) diff --git a/src/gui/calendar-management/gcal-calendars-page.h b/src/gui/calendar-management/gcal-calendars-page.h index c9b52ce6..237b6f1c 100644 --- a/src/gui/calendar-management/gcal-calendars-page.h +++ b/src/gui/calendar-management/gcal-calendars-page.h @@ -25,6 +25,6 @@ G_BEGIN_DECLS #define GCAL_TYPE_CALENDARS_PAGE (gcal_calendars_page_get_type()) -G_DECLARE_FINAL_TYPE (GcalCalendarsPage, gcal_calendars_page, GCAL, CALENDARS_PAGE, AdwBin) +G_DECLARE_FINAL_TYPE (GcalCalendarsPage, gcal_calendars_page, GCAL, CALENDARS_PAGE, AdwNavigationPage) G_END_DECLS diff --git a/src/gui/calendar-management/gcal-calendars-page.ui b/src/gui/calendar-management/gcal-calendars-page.ui index c82ee779..2dbc884f 100644 --- a/src/gui/calendar-management/gcal-calendars-page.ui +++ b/src/gui/calendar-management/gcal-calendars-page.ui @@ -1,7 +1,10 @@ -