From e5f71ea767515f50f5ed8c34946a87746a3d4ed7 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 26 Feb 2014 03:46:01 -0600 Subject: use the timezones object to set the ECalComponent's default timezone. This is needed to properly handle the 'floating' dates in the alarms --- src/main.cpp | 2 +- src/planner-eds.cpp | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index 31d9db6..762795f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -59,7 +59,7 @@ main(int /*argc*/, char** /*argv*/) state->settings = live_settings; state->clock = live_clock; state->locations.reset(new SettingsLocations(live_settings, live_timezones)); - state->planner.reset(new PlannerEds(live_clock)); + state->planner.reset(new PlannerEds(live_clock, live_timezones)); state->planner->time = live_clock->localtime(); std::shared_ptr actions(new LiveActions(state)); MenuFactory factory(actions, state); diff --git a/src/planner-eds.cpp b/src/planner-eds.cpp index da406eb..8bf4665 100644 --- a/src/planner-eds.cpp +++ b/src/planner-eds.cpp @@ -41,9 +41,12 @@ class PlannerEds::Impl { public: - Impl(PlannerEds& owner, const std::shared_ptr& clock): + Impl(PlannerEds& owner, + const std::shared_ptr& clock, + const std::shared_ptr& timezones): m_owner(owner), m_clock(clock), + m_timezones(timezones), m_cancellable(g_cancellable_new()) { e_source_registry_new(m_cancellable, on_source_registry_ready, this); @@ -362,7 +365,7 @@ private: void rebuild_upcoming() { const auto ref = m_clock->localtime(); - const auto begin = g_date_time_add_minutes(ref.get(),-10); + const auto begin = g_date_time_add_days(ref.get(),-1); const auto end = g_date_time_add_months(begin,1); get_appointments(begin, end, [this](const std::vector& appointments) { @@ -390,9 +393,7 @@ private: **/ icaltimezone * default_timezone = nullptr; - - const auto tz = g_date_time_get_timezone_abbreviation(m_owner.time.get().get()); - g_debug("%s tz is %s", G_STRLOC, tz); + const auto tz = m_timezones->timezone.get().c_str(); if (tz && *tz) { default_timezone = icaltimezone_get_builtin_timezone(tz); @@ -535,6 +536,7 @@ private: PlannerEds& m_owner; std::shared_ptr m_clock; + std::shared_ptr m_timezones; std::set m_sources; std::map m_clients; std::map m_views; @@ -545,7 +547,9 @@ private: enum { UPCOMING=(1<<0), MONTH=(1<<1), ALL=UPCOMING|MONTH }; }; -PlannerEds::PlannerEds(const std::shared_ptr& clock): p(new Impl(*this, clock)) {} +PlannerEds::PlannerEds(const std::shared_ptr& clock, + const std::shared_ptr& timezones): + p(new Impl(*this, clock, timezones)) {} PlannerEds::~PlannerEds() =default; -- cgit v1.2.3