diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2014-01-29 17:53:26 -0600 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2014-01-29 17:53:26 -0600 |
commit | 533f7c24e5490b5958165ce5815db495e0bd202c (patch) | |
tree | 17252b76d9b6b92639633f731a2253a2cff0043a /src | |
parent | c0c764e032787251d1990d2949b2044d87b6db38 (diff) | |
download | ayatana-indicator-datetime-533f7c24e5490b5958165ce5815db495e0bd202c.tar.gz ayatana-indicator-datetime-533f7c24e5490b5958165ce5815db495e0bd202c.tar.bz2 ayatana-indicator-datetime-533f7c24e5490b5958165ce5815db495e0bd202c.zip |
don't load the alarm icon until we need it, which in the case of the desktop greeter is never.
Diffstat (limited to 'src')
-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 44da7b7..4ed0a03 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -51,9 +51,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++) @@ -114,7 +111,13 @@ protected: std::shared_ptr<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: |