views/month: Jump to first day of month with PgUp/PgDown
With this we always jump to the first day of the next/previous month when pressing the PgDown/PgUp key in the month view. Partially fixes the regression described in https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1103 Co-authored-by: Maximiliano Sandoval <msandova@gnome.org> Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/369>
This commit is contained in:
committed by
Hari Rana
co-authored by
Maximiliano Sandoval
parent
8fdd01d24a
commit
da90b94bbd
@@ -1227,9 +1227,14 @@ static GDateTime*
|
||||
gcal_month_view_get_next_date (GcalView *view)
|
||||
{
|
||||
GcalMonthView *self = GCAL_MONTH_VIEW (view);
|
||||
g_autoptr (GDateTime) date = NULL;
|
||||
gint year, month;
|
||||
|
||||
g_assert (self->date != NULL);
|
||||
return g_date_time_add_months (self->date, 1);
|
||||
g_assert_nonnull (self->date);
|
||||
date = g_date_time_add_months (self->date, 1);
|
||||
g_date_time_get_ymd (date, &year, &month, NULL);
|
||||
|
||||
return g_date_time_new_local (year, month, 1, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1237,9 +1242,14 @@ static GDateTime*
|
||||
gcal_month_view_get_previous_date (GcalView *view)
|
||||
{
|
||||
GcalMonthView *self = GCAL_MONTH_VIEW (view);
|
||||
g_autoptr (GDateTime) date = NULL;
|
||||
gint year, month;
|
||||
|
||||
g_assert (self->date != NULL);
|
||||
return g_date_time_add_months (self->date, -1);
|
||||
g_assert_nonnull (self->date);
|
||||
date = g_date_time_add_months (self->date, -1);
|
||||
g_date_time_get_ymd (date, &year, &month, NULL);
|
||||
|
||||
return g_date_time_new_local (year, month, 1, 0, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user