From fee34f529e85e97cb439ea9fbbb210cffd51a6cf Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 30 Jan 2014 13:06:33 -0600 Subject: as per review, make explicit the dependency injection that was implicit in main() --- src/main.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 2c4f160..1534777 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,10 +17,17 @@ * with this program. If not, see . */ + + #include +#include #include +#include #include -#include +#include +#include +#include +#include #include // bindtextdomain() #include @@ -47,8 +54,16 @@ main(int /*argc*/, char** /*argv*/) if(!notify_init("indicator-datetime-service")) g_critical("libnotify initialization failed"); - // build the state and actions for the MenuFactory to use - std::shared_ptr state(new LiveState); + // build the state, actions, and menufactory + std::shared_ptr state(new State); + std::shared_ptr live_settings(new LiveSettings); + std::shared_ptr live_timezones(new LiveTimezones(live_settings, TIMEZONE_FILE)); + std::shared_ptr live_clock(new LiveClock(live_timezones)); + state->settings = live_settings; + state->clock = live_clock; + state->locations.reset(new SettingsLocations(live_settings, live_timezones)); + state->planner.reset(new PlannerEds); + state->planner->time = live_clock->localtime(); std::shared_ptr actions(new LiveActions(state)); MenuFactory factory(actions, state); -- cgit v1.2.3