From b56293e7b4fb4b253da17119ad153990744dac3b Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 30 Jan 2014 13:17:11 -0600 Subject: as per review, constify getters where possible. This isn't always possible due to system APIs asking for non-const pointers. --- include/datetime/actions.h | 2 +- include/datetime/menu.h | 1 - src/actions.cpp | 6 +++--- src/menu.cpp | 5 ----- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/include/datetime/actions.h b/include/datetime/actions.h index 6817b4c..99e78f5 100644 --- a/include/datetime/actions.h +++ b/include/datetime/actions.h @@ -51,7 +51,7 @@ public: virtual void set_location(const std::string& zone, const std::string& name)=0; void set_calendar_date(const DateTime&); GActionGroup* action_group(); - std::shared_ptr state(); + const std::shared_ptr state() const; protected: Actions(const std::shared_ptr& state); diff --git a/include/datetime/menu.h b/include/datetime/menu.h index 526cd9f..5821e33 100644 --- a/include/datetime/menu.h +++ b/include/datetime/menu.h @@ -72,7 +72,6 @@ class MenuFactory public: MenuFactory (std::shared_ptr& actions, std::shared_ptr& state); std::shared_ptr buildMenu(Menu::Profile profile); - std::shared_ptr state(); private: std::shared_ptr m_actions; diff --git a/src/actions.cpp b/src/actions.cpp index 6ee3896..cdeb77f 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -65,7 +65,7 @@ void on_activate_appointment(GSimpleAction * /*action*/, g_return_if_fail(uid && *uid); // find url of the upcoming appointment with this uid - for (auto& appt : self->state()->planner->upcoming.get()) + for (const auto& appt : self->state()->planner->upcoming.get()) { if (appt.uid == uid) { @@ -146,7 +146,7 @@ GVariant* create_default_header_state() GVariant* create_calendar_state(const std::shared_ptr& state) { gboolean days[32] = { 0 }; - for(const auto& appt : state->planner->thisMonth.get()) + for (const auto& appt : state->planner->thisMonth.get()) days[appt.begin.day_of_month()] = true; GVariantBuilder day_builder; @@ -254,7 +254,7 @@ GActionGroup* Actions::action_group() return G_ACTION_GROUP(m_actions); } -std::shared_ptr Actions::state() +const std::shared_ptr Actions::state() const { return m_state; } diff --git a/src/menu.cpp b/src/menu.cpp index b263520..696ed2b 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -558,11 +558,6 @@ MenuFactory::MenuFactory(std::shared_ptr& actions_, { } -std::shared_ptr MenuFactory::state() -{ - return m_state; -} - std::shared_ptr MenuFactory::buildMenu(Menu::Profile profile) { -- cgit v1.2.3