aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-01-30 13:44:12 -0600
committerCharles Kerr <charles.kerr@canonical.com>2014-01-30 13:44:12 -0600
commit197309468247c893bdaa37ef47a98db695b2ea78 (patch)
treee95bd0460940252fc3cc2ff66d88394157e5720f /src
parent0f384f4c9607b785d7df4da8566fe2b869ef11e4 (diff)
downloadayatana-indicator-datetime-197309468247c893bdaa37ef47a98db695b2ea78.tar.gz
ayatana-indicator-datetime-197309468247c893bdaa37ef47a98db695b2ea78.tar.bz2
ayatana-indicator-datetime-197309468247c893bdaa37ef47a98db695b2ea78.zip
following on the review comment covered in the last commit, use shared_ptr<const X> instead of shared_ptr<X> where possible.
Diffstat (limited to 'src')
-rw-r--r--src/clock-live.cpp6
-rw-r--r--src/formatter-desktop.cpp4
-rw-r--r--src/formatter.cpp6
-rw-r--r--src/locations-settings.cpp4
-rw-r--r--src/menu.cpp24
-rw-r--r--src/timezones-live.cpp3
6 files changed, 24 insertions, 23 deletions
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)
{