aboutsummaryrefslogtreecommitdiff
path: root/src/planner-eds.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-02-26 03:46:01 -0600
committerCharles Kerr <charles.kerr@canonical.com>2014-02-26 03:46:01 -0600
commite5f71ea767515f50f5ed8c34946a87746a3d4ed7 (patch)
tree57e6d0c7094593193c5c82c017adaf8ccc163573 /src/planner-eds.cpp
parentbb4bb77908d8ccd80260aee4541e45d0a075b0ad (diff)
downloadayatana-indicator-datetime-e5f71ea767515f50f5ed8c34946a87746a3d4ed7.tar.gz
ayatana-indicator-datetime-e5f71ea767515f50f5ed8c34946a87746a3d4ed7.tar.bz2
ayatana-indicator-datetime-e5f71ea767515f50f5ed8c34946a87746a3d4ed7.zip
use the timezones object to set the ECalComponent's default timezone. This is needed to properly handle the 'floating' dates in the alarms
Diffstat (limited to 'src/planner-eds.cpp')
-rw-r--r--src/planner-eds.cpp16
1 files changed, 10 insertions, 6 deletions
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>& clock):
+ Impl(PlannerEds& owner,
+ const std::shared_ptr<Clock>& clock,
+ const std::shared_ptr<Timezones>& 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<Appointment>& 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<Clock> m_clock;
+ std::shared_ptr<Timezones> m_timezones;
std::set<ESource*> m_sources;
std::map<ESource*,ECalClient*> m_clients;
std::map<ESource*,ECalClientView*> m_views;
@@ -545,7 +547,9 @@ private:
enum { UPCOMING=(1<<0), MONTH=(1<<1), ALL=UPCOMING|MONTH };
};
-PlannerEds::PlannerEds(const std::shared_ptr<Clock>& clock): p(new Impl(*this, clock)) {}
+PlannerEds::PlannerEds(const std::shared_ptr<Clock>& clock,
+ const std::shared_ptr<Timezones>& timezones):
+ p(new Impl(*this, clock, timezones)) {}
PlannerEds::~PlannerEds() =default;