[gnome-calendar] year-view: Not in sync with month-view
- From: Isaque Galdino de Araujo <igaldino src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] year-view: Not in sync with month-view
- Date: Thu, 6 Oct 2016 03:29:12 +0000 (UTC)
commit 7c01508620db12ded4cfc986dab93c259efd59e5
Author: Isaque Galdino <igaldino gmail com>
Date: Wed Oct 5 23:47:02 2016 -0300
year-view: Not in sync with month-view
When user changes the date in month-view, there is no sync with
year-view. The other way around works just fine, when user selects a
date in year-view, month-view goes to the same date.
Both views share an "active-date", but year-view doesn't obey that
property in some cases. Month-view also doesn't warn when changing that
property.
This commit fixes both views to keep them in sync, updating and using
"active-date" correctly.
https://bugzilla.gnome.org/show_bug.cgi?id=750478
src/gcal-month-view.c | 8 ++++++--
src/gcal-year-view.c | 15 ++++++++++++---
2 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index de0c288..1cf8bd8 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -766,11 +766,11 @@ gcal_month_view_key_press (GtkWidget *widget,
self->keyboard_cell = self->days_delay + self->keyboard_cell + diff - max - 1;
else
self->keyboard_cell = self->days_delay + icaltime_days_in_month (self->date->month,
self->date->year) - min + self->keyboard_cell + diff;
-
- g_object_notify (G_OBJECT (widget), "active-date");
}
current_day = self->keyboard_cell - self->days_delay + 1;
+ self->date->day = current_day;
+ g_object_notify (G_OBJECT (widget), "active-date");
if (selection)
{
@@ -2228,6 +2228,10 @@ gcal_month_view_button_release (GtkWidget *widget,
self->keyboard_cell = current_day;
self->end_mark_cell = g_date_time_new_local (self->date->year, self->date->month, current_day -
self->days_delay + 1, 0, 0, 0);
+
+ self->date->day = g_date_time_get_day_of_month (self->end_mark_cell);
+ g_object_notify (G_OBJECT (self), "active-date");
+
return show_popover_for_position (GCAL_MONTH_VIEW (widget), x, y, released_indicator);
}
else
diff --git a/src/gcal-year-view.c b/src/gcal-year-view.c
index e1c5d4c..84b59a6 100644
--- a/src/gcal-year-view.c
+++ b/src/gcal-year-view.c
@@ -165,8 +165,9 @@ static void
update_date (GcalYearView *year_view,
icaltimetype *new_date)
{
+ gboolean needs_reset = FALSE;
if (year_view->date != NULL && icaltime_compare_date (year_view->date, new_date) &&
year_view->start_selected_date->day != 0)
- reset_sidebar (year_view);
+ needs_reset = TRUE;
g_clear_pointer (&year_view->date, g_free);
year_view->date = new_date;
@@ -175,6 +176,9 @@ update_date (GcalYearView *year_view,
1, G_DATE_JANUARY, year_view->date->year);;
year_view->last_week_of_year = get_last_week_of_year_dmy (year_view->first_weekday,
31, G_DATE_DECEMBER, year_view->date->year);
+
+ if (needs_reset)
+ reset_sidebar (year_view);
}
static void
@@ -233,15 +237,20 @@ update_selected_dates_from_button_data (GcalYearView *year_view)
}
else
{
- *(year_view->start_selected_date) = *(year_view->current_date);
+ *(year_view->start_selected_date) = year_view->date ? *(year_view->date) : *(year_view->current_date);
year_view->start_selected_date->hour = 0;
year_view->start_selected_date->minute = 0;
year_view->start_selected_date->second = 0;
- *(year_view->end_selected_date) = *(year_view->current_date);
+ *(year_view->end_selected_date) = *(year_view->start_selected_date);
year_view->end_selected_date->hour = 23;
year_view->end_selected_date->minute = 59;
*(year_view->end_selected_date) = icaltime_normalize (*(year_view->end_selected_date));
+
+ year_view->selected_data->start_day = year_view->start_selected_date->day;
+ year_view->selected_data->start_month = year_view->start_selected_date->month - 1;
+ year_view->selected_data->end_day = year_view->end_selected_date->day;
+ year_view->selected_data->end_month = year_view->end_selected_date->month -1;
}
if (year_view->end_selected_date->year != year_view->start_selected_date->year)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]