aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/menu.cpp7
-rw-r--r--tests/test-menus.cpp8
2 files changed, 12 insertions, 3 deletions
diff --git a/src/menu.cpp b/src/menu.cpp
index b0ba79d..40a94fa 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -74,6 +74,9 @@ protected:
update_header(); // update header's label
update_section(Locations); // locations' relative time may have changed
});
+ m_state->settings->show_calendar.changed().connect([this](bool){
+ update_section(Calendar);
+ });
m_state->settings->show_events.changed().connect([this](bool){
update_section(Appointments); // showing events got toggled
});
@@ -219,8 +222,8 @@ private:
{
const bool allow_activation = (profile == Desktop)
|| (profile == Phone);
- const bool show_calendar = (profile == Desktop)
- || (profile == DesktopGreeter);
+ const bool show_calendar = m_state->settings->show_calendar.get() &&
+ ((profile == Desktop) || (profile == DesktopGreeter));
auto menu = g_menu_new();
// add a menuitem that shows the current date
diff --git a/tests/test-menus.cpp b/tests/test-menus.cpp
index fe1e86e..27248ad 100644
--- a/tests/test-menus.cpp
+++ b/tests/test-menus.cpp
@@ -93,7 +93,8 @@ protected:
{
gchar* str = nullptr;
const auto actions_expected = (profile == Menu::Desktop) || (profile == Menu::Phone);
- const auto calendar_expected = (profile == Menu::Desktop) || (profile == Menu::DesktopGreeter);
+ const auto calendar_expected = ((profile == Menu::Desktop) || (profile == Menu::DesktopGreeter))
+ && (m_state->settings->show_calendar.get());
// get the calendar section
auto submenu = g_menu_model_get_item_link(menu_model, 0, G_MENU_LINK_SUBMENU);
@@ -377,6 +378,11 @@ TEST_F(MenuFixture, Sections)
TEST_F(MenuFixture, Calendar)
{
+ m_state->settings->show_calendar.set(true);
+ for(auto& menu : m_menus)
+ InspectCalendar(menu->menu_model(), menu->profile());
+
+ m_state->settings->show_calendar.set(false);
for(auto& menu : m_menus)
InspectCalendar(menu->menu_model(), menu->profile());
}