~charlesk/indicator-datetime/lp-1283834

« back to all changes in this revision

Viewing changes to src/menu.cpp

  • Committer: CI bot
  • Author(s): Charles Kerr
  • Date: 2014-02-05 18:22:42 UTC
  • mfrom: (290.3.1 lp-1255716)
  • Revision ID: ps-jenkins@lists.canonical.com-20140205182242-cpfusjqd3w1xhv0i
Don't load the alarm icon until it's needed s.t. we don't hit click unnecessarily when starting up in the greeter. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
        m_actions(actions),
79
79
        m_formatter(formatter)
80
80
    {
81
 
        // preload the alarm icon from click
82
 
        m_serialized_alarm_icon = create_alarm_icon();
83
 
 
84
81
        // initialize the menu
85
82
        create_gmenu();
86
83
        for (int i=0; i<NUM_SECTIONS; i++)
141
138
    std::shared_ptr<const Formatter> m_formatter;
142
139
    GMenu* m_submenu = nullptr;
143
140
 
144
 
    GVariant* get_serialized_alarm_icon() { return m_serialized_alarm_icon; }
 
141
    GVariant* get_serialized_alarm_icon()
 
142
    {
 
143
        if (G_UNLIKELY(m_serialized_alarm_icon == nullptr))
 
144
            m_serialized_alarm_icon = create_alarm_icon();
 
145
 
 
146
        return m_serialized_alarm_icon;
 
147
    }
145
148
 
146
149
private:
147
150