aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-02-05 18:22:42 +0000
committerCI bot <ps-jenkins@lists.canonical.com>2014-02-05 18:22:42 +0000
commitfbe9e3b15080ff82760dcae600bde9cfa27f04b7 (patch)
tree6284e1fb51e699f849093b0b3f31bcca0fd775c2
parentd9f800001c1f9a8cd82329c75d9e2e2f5492a0b4 (diff)
parent533f7c24e5490b5958165ce5815db495e0bd202c (diff)
downloadayatana-indicator-datetime-fbe9e3b15080ff82760dcae600bde9cfa27f04b7.tar.gz
ayatana-indicator-datetime-fbe9e3b15080ff82760dcae600bde9cfa27f04b7.tar.bz2
ayatana-indicator-datetime-fbe9e3b15080ff82760dcae600bde9cfa27f04b7.zip
Don't load the alarm icon until it's needed s.t. we don't hit click unnecessarily when starting up in the greeter.
-rw-r--r--src/menu.cpp11
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: