diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2014-03-09 21:08:47 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2014-03-09 21:08:47 -0500 |
commit | 3f4d409f21bbb1f79f149a5ee66dcddaa505ddb1 (patch) | |
tree | ab1f4ba4e7635b3ea2cb600cc8de9b3e52a6c9d1 /src/main.cpp | |
parent | 375277fa6b2c8eaac2e2a824bd1e43bbd54b75e3 (diff) | |
download | ayatana-indicator-datetime-3f4d409f21bbb1f79f149a5ee66dcddaa505ddb1.tar.gz ayatana-indicator-datetime-3f4d409f21bbb1f79f149a5ee66dcddaa505ddb1.tar.bz2 ayatana-indicator-datetime-3f4d409f21bbb1f79f149a5ee66dcddaa505ddb1.zip |
decouple the planner's states; need three separate sets: upcoming-now (for alarms in the current time), upcoming-calendar (to show events coming from the selected calendar date), and calendar-month (all the appointments in the month displayed in the menu).
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp index 24a9409..3e16555 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,6 +20,7 @@ #include <datetime/actions-live.h> #include <datetime/clock.h> #include <datetime/clock-watcher.h> +#include <datetime/engine-eds.h> #include <datetime/exporter.h> #include <datetime/locations-settings.h> #include <datetime/menu.h> @@ -58,16 +59,20 @@ main(int /*argc*/, char** /*argv*/) std::shared_ptr<Timezones> live_timezones(new LiveTimezones(live_settings, TIMEZONE_FILE)); std::shared_ptr<Clock> live_clock(new LiveClock(live_timezones)); std::shared_ptr<Timezone> file_timezone(new FileTimezone(TIMEZONE_FILE)); + std::shared_ptr<EdsEngine> eds_engine (new EdsEngine); + const auto now = live_clock->localtime(); state->settings = live_settings; state->clock = live_clock; state->locations.reset(new SettingsLocations(live_settings, live_timezones)); - state->planner.reset(new PlannerEds(live_clock, file_timezone)); - state->planner->time = live_clock->localtime(); + auto calendar_month = new MonthPlanner(std::shared_ptr<RangePlanner>(new EdsPlanner(eds_engine, file_timezone)), now); + state->calendar_month.reset(calendar_month); + state->calendar_upcoming.reset(new UpcomingPlanner(std::shared_ptr<RangePlanner>(new EdsPlanner(eds_engine, file_timezone)), now)); std::shared_ptr<Actions> actions(new LiveActions(state)); MenuFactory factory(actions, state); // snap decisions - ClockWatcherImpl clock_watcher(state); + std::shared_ptr<UpcomingPlanner> upcoming_planner(new UpcomingPlanner(std::shared_ptr<RangePlanner>(new EdsPlanner (eds_engine, file_timezone)), now)); + ClockWatcherImpl clock_watcher(live_clock, upcoming_planner); Snap snap; clock_watcher.alarm_reached().connect([&snap](const Appointment& appt){ auto snap_show = [](const Appointment& a){ |