aboutsummaryrefslogtreecommitdiff
path: root/src/menu.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-01-16 16:45:40 -0600
committerCharles Kerr <charles.kerr@canonical.com>2014-01-16 16:45:40 -0600
commita2b5c79157fa8db36d94786de1b86b756308912d (patch)
tree052475103594dd1b87dcbda97ffed2b8822f2d69 /src/menu.cpp
parent9c81a4d60d06b1f33001602cd0cde9844c9233a6 (diff)
downloadayatana-indicator-datetime-a2b5c79157fa8db36d94786de1b86b756308912d.tar.gz
ayatana-indicator-datetime-a2b5c79157fa8db36d94786de1b86b756308912d.tar.bz2
ayatana-indicator-datetime-a2b5c79157fa8db36d94786de1b86b756308912d.zip
Plug the Settings object into the State container s.t. menus and actions can update themselves when the user's settings change.
Diffstat (limited to 'src/menu.cpp')
-rw-r--r--src/menu.cpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/menu.cpp b/src/menu.cpp
index 76306cc..c81f185 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -69,11 +69,11 @@ protected:
update_section(Appointments); // uses formatter.getRelativeFormat()
update_section(Locations); // uses formatter.getRelativeFormat()
});
- m_state->show_clock.changed().connect([this](bool){
+ m_state->settings->show_clock.changed().connect([this](bool){
update_header(); // update header's label
update_section(Locations); // locations' relative time may have changed
});
- m_state->show_events.changed().connect([this](bool){
+ m_state->settings->show_events.changed().connect([this](bool){
update_section(Appointments); // showing events got toggled
});
m_state->planner->upcoming.changed().connect([this](const std::vector<Appointment>&){
@@ -261,7 +261,7 @@ private:
{
auto menu = g_menu_new();
- if (((profile==Phone) || (profile==Desktop)) && m_state->show_events.get())
+ if (((profile==Phone) || (profile==Desktop)) && m_state->settings->show_events.get())
{
add_appointments (menu, profile);
@@ -363,14 +363,14 @@ protected:
std::shared_ptr<State>& state_,
std::shared_ptr<Actions>& actions_):
MenuImpl(profile_, name_, state_, actions_,
- std::shared_ptr<Formatter>(new DesktopFormatter(state_->clock)))
+ std::shared_ptr<Formatter>(new DesktopFormatter(state_->clock, state_->settings)))
{
update_header();
}
GVariant* create_header_state()
{
- const auto visible = m_state->show_clock.get();
+ const auto visible = m_state->settings->show_clock.get();
const auto title = _("Date and Time");
auto label = g_variant_new_string(m_formatter->header.get().c_str());
@@ -472,32 +472,22 @@ std::shared_ptr<Menu>
MenuFactory::buildMenu(Menu::Profile profile)
{
std::shared_ptr<Menu> menu;
- m_state->show_clock.set (true); // FIXME
-
- //std::shared_ptr<State> state(new State);
- //state->clock = clock;
- //state->planner = planner;
- //state->locations = locations;
switch (profile)
{
case Menu::Desktop:
- m_state->show_events.set(true); // FIXME
menu.reset(new DesktopMenu(m_state, m_actions));
break;
case Menu::DesktopGreeter:
- m_state->show_events.set(true); // FIXME
menu.reset(new DesktopGreeterMenu(m_state, m_actions));
break;
case Menu::Phone:
- m_state->show_events.set(true); // FIXME
menu.reset(new PhoneMenu(m_state, m_actions));
break;
case Menu::PhoneGreeter:
- m_state->show_events.set(false); // FIXME
menu.reset(new PhoneGreeterMenu(m_state, m_actions));
break;