From 462e8e6d8e46475ea3222056f65ff40823e9e0bf Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 9 Mar 2014 22:26:26 -0500 Subject: don't connect to EDS when running in the greeter. --- src/main.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 3e16555..c7b35e5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,11 +20,12 @@ #include #include #include +#include #include #include #include #include -#include +#include #include #include #include @@ -53,25 +54,32 @@ main(int /*argc*/, char** /*argv*/) bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR); textdomain(GETTEXT_PACKAGE); + // we don't show appointments in the greeter, + // so no need to connect to EDS there... + std::shared_ptr engine; + if (!g_strcmp0("lightdm", g_get_user_name())) + engine.reset(new MockEngine); + else + engine.reset(new EdsEngine); + // 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)); std::shared_ptr file_timezone(new FileTimezone(TIMEZONE_FILE)); - std::shared_ptr 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)); - auto calendar_month = new MonthPlanner(std::shared_ptr(new EdsPlanner(eds_engine, file_timezone)), now); + auto calendar_month = new MonthPlanner(std::shared_ptr(new SimpleRangePlanner(engine, file_timezone)), now); state->calendar_month.reset(calendar_month); - state->calendar_upcoming.reset(new UpcomingPlanner(std::shared_ptr(new EdsPlanner(eds_engine, file_timezone)), now)); + state->calendar_upcoming.reset(new UpcomingPlanner(std::shared_ptr(new SimpleRangePlanner(engine, file_timezone)), now)); std::shared_ptr actions(new LiveActions(state)); MenuFactory factory(actions, state); // snap decisions - std::shared_ptr upcoming_planner(new UpcomingPlanner(std::shared_ptr(new EdsPlanner (eds_engine, file_timezone)), now)); + std::shared_ptr upcoming_planner(new UpcomingPlanner(std::shared_ptr(new SimpleRangePlanner(engine, file_timezone)), now)); ClockWatcherImpl clock_watcher(live_clock, upcoming_planner); Snap snap; clock_watcher.alarm_reached().connect([&snap](const Appointment& appt){ -- cgit v1.2.3