aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-03-09 22:26:26 -0500
committerCharles Kerr <charles.kerr@canonical.com>2014-03-09 22:26:26 -0500
commit462e8e6d8e46475ea3222056f65ff40823e9e0bf (patch)
treed6538de2306f6d7a2c6b00117dfaa4dda52abc2f /src/main.cpp
parent3f4d409f21bbb1f79f149a5ee66dcddaa505ddb1 (diff)
downloadayatana-indicator-datetime-462e8e6d8e46475ea3222056f65ff40823e9e0bf.tar.gz
ayatana-indicator-datetime-462e8e6d8e46475ea3222056f65ff40823e9e0bf.tar.bz2
ayatana-indicator-datetime-462e8e6d8e46475ea3222056f65ff40823e9e0bf.zip
don't connect to EDS when running in the greeter.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp18
1 files changed, 13 insertions, 5 deletions
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 <datetime/actions-live.h>
#include <datetime/clock.h>
#include <datetime/clock-watcher.h>
+#include <datetime/engine-mock.h>
#include <datetime/engine-eds.h>
#include <datetime/exporter.h>
#include <datetime/locations-settings.h>
#include <datetime/menu.h>
-#include <datetime/planner-eds.h>
+#include <datetime/planner-range.h>
#include <datetime/settings-live.h>
#include <datetime/snap.h>
#include <datetime/state.h>
@@ -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> 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> state(new State);
std::shared_ptr<Settings> live_settings(new LiveSettings);
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));
- auto calendar_month = new MonthPlanner(std::shared_ptr<RangePlanner>(new EdsPlanner(eds_engine, file_timezone)), now);
+ auto calendar_month = new MonthPlanner(std::shared_ptr<RangePlanner>(new SimpleRangePlanner(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));
+ state->calendar_upcoming.reset(new UpcomingPlanner(std::shared_ptr<RangePlanner>(new SimpleRangePlanner(engine, file_timezone)), now));
std::shared_ptr<Actions> actions(new LiveActions(state));
MenuFactory factory(actions, state);
// snap decisions
- std::shared_ptr<UpcomingPlanner> upcoming_planner(new UpcomingPlanner(std::shared_ptr<RangePlanner>(new EdsPlanner (eds_engine, file_timezone)), now));
+ std::shared_ptr<UpcomingPlanner> upcoming_planner(new UpcomingPlanner(std::shared_ptr<RangePlanner>(new SimpleRangePlanner(engine, file_timezone)), now));
ClockWatcherImpl clock_watcher(live_clock, upcoming_planner);
Snap snap;
clock_watcher.alarm_reached().connect([&snap](const Appointment& appt){