[california/wip/725788-recurring] Show everything in the display, not just in current month
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [california/wip/725788-recurring] Show everything in the display, not just in current month
- Date: Sat, 8 Mar 2014 03:44:16 +0000 (UTC)
commit 4a9d191abd438e6fd51db8a6652b688fbf06c9af
Author: Jim Nelson <jim yorba org>
Date: Fri Mar 7 19:43:51 2014 -0800
Show everything in the display, not just in current month
src/calendar/calendar-span.vala | 7 +++++++
src/view/month/month-controllable.vala | 23 +++++++++++++++++------
2 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/src/calendar/calendar-span.vala b/src/calendar/calendar-span.vala
index 187bd88..416ecad 100644
--- a/src/calendar/calendar-span.vala
+++ b/src/calendar/calendar-span.vala
@@ -66,6 +66,13 @@ public interface Span<G> : BaseObject, Collection.SimpleIterable<G> {
}
/**
+ * Converts the { link Span} into a { link DateSpan}.
+ */
+ public DateSpan to_date_span() {
+ return new DateSpan(start_date, end_date);
+ }
+
+ /**
* true if the { link Span} contains the specified { link Date}.
*
* This is named to conform to Vala's rule for automatic syntax support. This allows for the
diff --git a/src/view/month/month-controllable.vala b/src/view/month/month-controllable.vala
index b22b2d0..a1a0e74 100644
--- a/src/view/month/month-controllable.vala
+++ b/src/view/month/month-controllable.vala
@@ -37,7 +37,7 @@ public class Controllable : Gtk.Grid, View.Controllable {
/**
* @inheritDoc
*/
- public Calendar.FirstOfWeek first_of_week { get; set; }
+ public Calendar.FirstOfWeek first_of_week { get; set; default = Calendar.FirstOfWeek.SUNDAY; }
/**
* Show days outside the current month.
@@ -45,6 +45,11 @@ public class Controllable : Gtk.Grid, View.Controllable {
public bool show_outside_month { get; set; default = true; }
/**
+ * The span of dates being displayed.
+ */
+ public Calendar.DateSpan window { get; private set; }
+
+ /**
* @inheritDoc
*/
public string current_label { get; protected set; }
@@ -109,7 +114,6 @@ public class Controllable : Gtk.Grid, View.Controllable {
// update now that signal handlers are in place
month_of_year = Calendar.System.today.month_of_year();
- first_of_week = Calendar.FirstOfWeek.SUNDAY;
}
/**
@@ -215,6 +219,9 @@ public class Controllable : Gtk.Grid, View.Controllable {
int row = 0;
foreach (Calendar.Week week in span)
update_week(row++, week);
+
+ // update the window being displayed
+ window = span.to_date_span();
}
private void update_first_of_week() {
@@ -227,6 +234,7 @@ public class Controllable : Gtk.Grid, View.Controllable {
// requires updating all the cells as well, since all dates have to be shifted
update_cells();
+ update_subscription();
}
private void on_month_of_year_changed() {
@@ -244,9 +252,12 @@ public class Controllable : Gtk.Grid, View.Controllable {
}
update_cells();
-
- // generate new ExactTimeSpan window for all calendar subscriptions
- Calendar.ExactTimeSpan window = new Calendar.ExactTimeSpan.from_date_span(month_of_year,
+ update_subscription();
+ }
+
+ private void update_subscription() {
+ // convert DateSpan window into an ExactTimeSpan, which is what the subscription wants
+ Calendar.ExactTimeSpan time_window = new Calendar.ExactTimeSpan.from_date_span(window,
Calendar.Timezone.local);
// clear current subscriptions and generate new subscriptions for new window
@@ -254,7 +265,7 @@ public class Controllable : Gtk.Grid, View.Controllable {
foreach (Backing.Store store in Backing.Manager.instance.get_stores()) {
foreach (Backing.Source source in store.get_sources_of_type<Backing.CalendarSource>()) {
Backing.CalendarSource calendar = (Backing.CalendarSource) source;
- calendar.subscribe_async.begin(window, null, on_subscribed);
+ calendar.subscribe_async.begin(time_window, null, on_subscribed);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]