diff options
-rw-r--r-- | include/datetime/clock.h | 2 | ||||
-rw-r--r-- | include/datetime/formatter.h | 8 | ||||
-rw-r--r-- | include/datetime/locations-settings.h | 8 | ||||
-rw-r--r-- | include/datetime/menu.h | 4 | ||||
-rw-r--r-- | include/datetime/timezones-live.h | 4 | ||||
-rw-r--r-- | src/clock-live.cpp | 6 | ||||
-rw-r--r-- | src/formatter-desktop.cpp | 4 | ||||
-rw-r--r-- | src/formatter.cpp | 6 | ||||
-rw-r--r-- | src/locations-settings.cpp | 4 | ||||
-rw-r--r-- | src/menu.cpp | 24 | ||||
-rw-r--r-- | src/timezones-live.cpp | 3 |
11 files changed, 37 insertions, 36 deletions
diff --git a/include/datetime/clock.h b/include/datetime/clock.h index b3e3538..4a9db8f 100644 --- a/include/datetime/clock.h +++ b/include/datetime/clock.h @@ -79,7 +79,7 @@ class Timezones; class LiveClock: public Clock { public: - LiveClock (const std::shared_ptr<Timezones>& zones); + LiveClock (const std::shared_ptr<const Timezones>& zones); virtual ~LiveClock(); virtual DateTime localtime() const; diff --git a/include/datetime/formatter.h b/include/datetime/formatter.h index 3de109e..f323858 100644 --- a/include/datetime/formatter.h +++ b/include/datetime/formatter.h @@ -86,7 +86,7 @@ public: std::string getRelativeFormat(GDateTime* then, GDateTime* then_end=nullptr) const; protected: - Formatter(const std::shared_ptr<Clock>&); + Formatter(const std::shared_ptr<const Clock>&); virtual ~Formatter(); static const char* getDefaultHeaderTimeFormat(bool twelvehour, bool show_seconds); @@ -107,10 +107,10 @@ private: class DesktopFormatter: public Formatter { public: - DesktopFormatter(const std::shared_ptr<Clock>&, const std::shared_ptr<Settings>&); + DesktopFormatter(const std::shared_ptr<const Clock>&, const std::shared_ptr<const Settings>&); private: - std::shared_ptr<Settings> m_settings; + std::shared_ptr<const Settings> m_settings; void rebuildHeaderFormat(); const gchar* getFullTimeFormatString() const; @@ -126,7 +126,7 @@ private: class PhoneFormatter: public Formatter { public: - PhoneFormatter(const std::shared_ptr<Clock>& clock): Formatter(clock) { + PhoneFormatter(const std::shared_ptr<const Clock>& clock): Formatter(clock) { headerFormat.set(getDefaultHeaderTimeFormat(is_locale_12h(), false)); } }; diff --git a/include/datetime/locations-settings.h b/include/datetime/locations-settings.h index d01cbb5..8757f43 100644 --- a/include/datetime/locations-settings.h +++ b/include/datetime/locations-settings.h @@ -39,12 +39,12 @@ public: * @param[in] settings the #Settings whose locations property is to be used * @param[in] timezones the #Timezones to always show first in the list */ - SettingsLocations (const std::shared_ptr<Settings>& settings, - const std::shared_ptr<Timezones>& timezones); + SettingsLocations (const std::shared_ptr<const Settings>& settings, + const std::shared_ptr<const Timezones>& timezones); private: - std::shared_ptr<Settings> m_settings; - std::shared_ptr<Timezones> m_timezones; + std::shared_ptr<const Settings> m_settings; + std::shared_ptr<const Timezones> m_timezones; void reload(); }; diff --git a/include/datetime/menu.h b/include/datetime/menu.h index a95be10..7b351c3 100644 --- a/include/datetime/menu.h +++ b/include/datetime/menu.h @@ -70,12 +70,12 @@ private: class MenuFactory { public: - MenuFactory (const std::shared_ptr<Actions>& actions, const std::shared_ptr<State>& state); + MenuFactory (const std::shared_ptr<Actions>& actions, const std::shared_ptr<const State>& state); std::shared_ptr<Menu> buildMenu(Menu::Profile profile); private: std::shared_ptr<Actions> m_actions; - std::shared_ptr<State> m_state; + std::shared_ptr<const State> m_state; }; } // namespace datetime diff --git a/include/datetime/timezones-live.h b/include/datetime/timezones-live.h index 286c967..ca4ef31 100644 --- a/include/datetime/timezones-live.h +++ b/include/datetime/timezones-live.h @@ -38,14 +38,14 @@ namespace datetime { class LiveTimezones: public Timezones { public: - LiveTimezones(std::shared_ptr<Settings>& settings, const std::string& filename); + LiveTimezones(const std::shared_ptr<const Settings>& settings, const std::string& filename); private: void update_geolocation(); void update_timezones(); FileTimezone m_file; - std::shared_ptr<Settings> m_settings; + std::shared_ptr<const Settings> m_settings; std::shared_ptr<GeoclueTimezone> m_geo; }; diff --git a/src/clock-live.cpp b/src/clock-live.cpp index 69ebda7..7c9db40 100644 --- a/src/clock-live.cpp +++ b/src/clock-live.cpp @@ -59,7 +59,7 @@ class LiveClock::Impl { public: - Impl(LiveClock& owner, const std::shared_ptr<Timezones>& tzd): + Impl(LiveClock& owner, const std::shared_ptr<const Timezones>& tzd): m_owner(owner), m_timezones(tzd) { @@ -135,13 +135,13 @@ protected: LiveClock& m_owner; GTimeZone* m_timezone = nullptr; - std::shared_ptr<Timezones> m_timezones; + std::shared_ptr<const Timezones> m_timezones; DateTime m_prev_datetime; unsigned int m_timer = 0; }; -LiveClock::LiveClock(const std::shared_ptr<Timezones>& tzd): +LiveClock::LiveClock(const std::shared_ptr<const Timezones>& tzd): p(new Impl(*this, tzd)) { } diff --git a/src/formatter-desktop.cpp b/src/formatter-desktop.cpp index d542ec4..9a098c6 100644 --- a/src/formatter-desktop.cpp +++ b/src/formatter-desktop.cpp @@ -64,8 +64,8 @@ std::string joinDateAndTimeFormatStrings(const char* date_string, **** ***/ -DesktopFormatter::DesktopFormatter(const std::shared_ptr<Clock>& clock_in, - const std::shared_ptr<Settings>& settings_in): +DesktopFormatter::DesktopFormatter(const std::shared_ptr<const Clock>& clock_in, + const std::shared_ptr<const Settings>& settings_in): Formatter(clock_in), m_settings(settings_in) { diff --git a/src/formatter.cpp b/src/formatter.cpp index a15c7f8..638eac4 100644 --- a/src/formatter.cpp +++ b/src/formatter.cpp @@ -118,7 +118,7 @@ class Formatter::Impl { public: - Impl(Formatter* owner, const std::shared_ptr<Clock>& clock): + Impl(Formatter* owner, const std::shared_ptr<const Clock>& clock): m_owner(owner), m_clock(clock) { @@ -208,14 +208,14 @@ private: guint m_relative_timer = 0; public: - std::shared_ptr<Clock> m_clock; + std::shared_ptr<const Clock> m_clock; }; /*** **** ***/ -Formatter::Formatter(const std::shared_ptr<Clock>& clock): +Formatter::Formatter(const std::shared_ptr<const Clock>& clock): p(new Formatter::Impl(this, clock)) { } diff --git a/src/locations-settings.cpp b/src/locations-settings.cpp index 9b90bc0..ef3085f 100644 --- a/src/locations-settings.cpp +++ b/src/locations-settings.cpp @@ -29,8 +29,8 @@ namespace unity { namespace indicator { namespace datetime { -SettingsLocations::SettingsLocations(const std::shared_ptr<Settings>& settings, - const std::shared_ptr<Timezones>& timezones): +SettingsLocations::SettingsLocations(const std::shared_ptr<const Settings>& settings, + const std::shared_ptr<const Timezones>& timezones): m_settings(settings), m_timezones(timezones) { diff --git a/src/menu.cpp b/src/menu.cpp index 42265c9..e92d398 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -70,9 +70,9 @@ class MenuImpl: public Menu protected: MenuImpl(const Menu::Profile profile_in, const std::string& name_in, - std::shared_ptr<State>& state, + std::shared_ptr<const State>& state, std::shared_ptr<Actions>& actions, - std::shared_ptr<Formatter> formatter): + std::shared_ptr<const Formatter> formatter): Menu(profile_in, name_in), m_state(state), m_actions(actions), @@ -136,9 +136,9 @@ protected: g_action_group_change_action_state(action_group, action_name.c_str(), state); } - std::shared_ptr<State> m_state; + std::shared_ptr<const State> m_state; std::shared_ptr<Actions> m_actions; - std::shared_ptr<Formatter> m_formatter; + std::shared_ptr<const Formatter> m_formatter; GMenu* m_submenu = nullptr; GVariant* get_serialized_alarm_icon() { return m_serialized_alarm_icon; } @@ -450,10 +450,10 @@ class DesktopBaseMenu: public MenuImpl protected: DesktopBaseMenu(Menu::Profile profile_, const std::string& name_, - std::shared_ptr<State>& state_, + std::shared_ptr<const State>& state_, std::shared_ptr<Actions>& actions_): MenuImpl(profile_, name_, state_, actions_, - std::shared_ptr<Formatter>(new DesktopFormatter(state_->clock, state_->settings))) + std::shared_ptr<const Formatter>(new DesktopFormatter(state_->clock, state_->settings))) { update_header(); } @@ -477,14 +477,14 @@ protected: class DesktopMenu: public DesktopBaseMenu { public: - DesktopMenu(std::shared_ptr<State>& state_, std::shared_ptr<Actions>& actions_): + DesktopMenu(std::shared_ptr<const State>& state_, std::shared_ptr<Actions>& actions_): DesktopBaseMenu(Desktop,"desktop", state_, actions_) {} }; class DesktopGreeterMenu: public DesktopBaseMenu { public: - DesktopGreeterMenu(std::shared_ptr<State>& state_, std::shared_ptr<Actions>& actions_): + DesktopGreeterMenu(std::shared_ptr<const State>& state_, std::shared_ptr<Actions>& actions_): DesktopBaseMenu(DesktopGreeter,"desktop_greeter", state_, actions_) {} }; @@ -493,7 +493,7 @@ class PhoneBaseMenu: public MenuImpl protected: PhoneBaseMenu(Menu::Profile profile_, const std::string& name_, - std::shared_ptr<State>& state_, + std::shared_ptr<const State>& state_, std::shared_ptr<Actions>& actions_): MenuImpl(profile_, name_, state_, actions_, std::shared_ptr<Formatter>(new PhoneFormatter(state_->clock))) @@ -534,7 +534,7 @@ protected: class PhoneMenu: public PhoneBaseMenu { public: - PhoneMenu(std::shared_ptr<State>& state_, + PhoneMenu(std::shared_ptr<const State>& state_, std::shared_ptr<Actions>& actions_): PhoneBaseMenu(Phone, "phone", state_, actions_) {} }; @@ -542,7 +542,7 @@ public: class PhoneGreeterMenu: public PhoneBaseMenu { public: - PhoneGreeterMenu(std::shared_ptr<State>& state_, + PhoneGreeterMenu(std::shared_ptr<const State>& state_, std::shared_ptr<Actions>& actions_): PhoneBaseMenu(PhoneGreeter, "phone_greeter", state_, actions_) {} }; @@ -552,7 +552,7 @@ public: ****/ MenuFactory::MenuFactory(const std::shared_ptr<Actions>& actions_, - const std::shared_ptr<State>& state_): + const std::shared_ptr<const State>& state_): m_actions(actions_), m_state(state_) { diff --git a/src/timezones-live.cpp b/src/timezones-live.cpp index baac05d..4902b76 100644 --- a/src/timezones-live.cpp +++ b/src/timezones-live.cpp @@ -25,7 +25,8 @@ namespace unity { namespace indicator { namespace datetime { -LiveTimezones::LiveTimezones(std::shared_ptr<Settings>& settings, const std::string& filename): +LiveTimezones::LiveTimezones(const std::shared_ptr<const Settings>& settings, + const std::string& filename): m_file(filename), m_settings(settings) { |