diff options
-rw-r--r-- | include/datetime/state-live.h | 49 | ||||
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/main.cpp | 21 | ||||
-rw-r--r-- | src/state-live.cpp | 56 |
4 files changed, 18 insertions, 109 deletions
diff --git a/include/datetime/state-live.h b/include/datetime/state-live.h deleted file mode 100644 index 2b93722..0000000 --- a/include/datetime/state-live.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2013 Canonical Ltd. - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - * - * Authors: - * Charles Kerr <charles.kerr@canonical.com> - */ - -#ifndef INDICATOR_DATETIME_STATE_LIVE_H -#define INDICATOR_DATETIME_STATE_LIVE_H - -#include <datetime/state.h> - -namespace unity { -namespace indicator { -namespace datetime { - -/*** -**** -***/ - -class LiveState: public State -{ -public: - LiveState(); - virtual ~LiveState() =default; -}; - -/*** -**** -***/ - - -} // namespace datetime -} // namespace indicator -} // namespace unity - -#endif // INDICATOR_DATETIME_SETTINGS_LIVE_H diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d5236ad..810e299 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,7 +27,6 @@ add_library (${SERVICE_LIB} STATIC menu.cpp planner-eds.cpp settings-live.cpp - state-live.cpp timezone-file.cpp timezone-geoclue.cpp timezones-live.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 <http://www.gnu.org/licenses/>. */ + + #include <datetime/actions-live.h> +#include <datetime/clock.h> #include <datetime/exporter.h> +#include <datetime/locations-settings.h> #include <datetime/menu.h> -#include <datetime/state-live.h> +#include <datetime/planner-eds.h> +#include <datetime/settings-live.h> +#include <datetime/state.h> +#include <datetime/timezones-live.h> #include <glib/gi18n.h> // bindtextdomain() #include <gio/gio.h> @@ -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> state(new LiveState); + // 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)); + 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> actions(new LiveActions(state)); MenuFactory factory(actions, state); diff --git a/src/state-live.cpp b/src/state-live.cpp deleted file mode 100644 index fe1e6cd..0000000 --- a/src/state-live.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2013 Canonical Ltd. - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3, as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranties of - * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - * - * Authors: - * Charles Kerr <charles.kerr@canonical.com> - */ - -#include <datetime/state-live.h> - -#include <datetime/clock.h> -#include <datetime/locations-settings.h> -#include <datetime/planner-eds.h> -#include <datetime/settings-live.h> -#include <datetime/state.h> -#include <datetime/timezones-live.h> - -namespace unity { -namespace indicator { -namespace datetime { - -/*** -**** -***/ - -LiveState::LiveState() -{ - 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)); - - settings = live_settings; - clock = live_clock; - locations.reset(new SettingsLocations(live_settings, live_timezones)); - planner.reset(new PlannerEds); - planner->time = clock->localtime(); -} - -/*** -**** -***/ - -} // namespace datetime -} // namespace indicator -} // namespace unity |