diff options
Diffstat (limited to 'src/menu.cpp')
-rw-r--r-- | src/menu.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/menu.cpp b/src/menu.cpp index 91f7dd2..bdf92c3 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -78,9 +78,6 @@ protected: m_actions(actions), m_formatter(formatter) { - // preload the alarm icon from click - m_serialized_alarm_icon = create_alarm_icon(); - // initialize the menu create_gmenu(); for (int i=0; i<NUM_SECTIONS; i++) @@ -141,7 +138,13 @@ protected: std::shared_ptr<const Formatter> m_formatter; GMenu* m_submenu = nullptr; - GVariant* get_serialized_alarm_icon() { return m_serialized_alarm_icon; } + GVariant* get_serialized_alarm_icon() + { + if (G_UNLIKELY(m_serialized_alarm_icon == nullptr)) + m_serialized_alarm_icon = create_alarm_icon(); + + return m_serialized_alarm_icon; + } private: |