~ci-train-bot/indicator-network/indicator-network-ubuntu-vivid-proposed

« back to all changes in this revision

Viewing changes to src/indicator/quick-access-section.cpp

  • Committer: CI Train Bot
  • Author(s): Antti Kaijanmäki
  • Date: 2014-12-12 12:11:18 UTC
  • mfrom: (462.3.1 15.04)
  • Revision ID: ci-train-bot@canonical.com-20141212121118-usrzyaiuw4ndx8e3
fix flighmode switch bouncing on krillin. Fixes: #1393488
Approved by: Jussi Pakkanen

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
        });
77
77
    });
78
78
    m_flightModeSwitch->activated().connect([this](){
79
 
        if (m_flightModeSwitch->state().get()) {
80
 
            try {
81
 
                m_manager->enableFlightMode();
82
 
            } catch (const std::exception &e) {
83
 
                std::cerr << e.what() << std::endl;
84
 
            }
85
 
        } else {
86
 
            try {
87
 
                m_manager->disableFlightMode();
88
 
            } catch (const std::exception &e) {
89
 
                std::cerr << e.what() << std::endl;
90
 
            }
91
 
        }
 
79
        bool state = m_flightModeSwitch->state().get();
 
80
        auto manager = m_manager;
 
81
        GMainLoopDispatch([manager, state](){
 
82
            if (state) {
 
83
                try {
 
84
                    manager->enableFlightMode();
 
85
                } catch (const std::exception &e) {
 
86
                    std::cerr << e.what() << std::endl;
 
87
                }
 
88
            } else {
 
89
                try {
 
90
                    manager->disableFlightMode();
 
91
                } catch (const std::exception &e) {
 
92
                    std::cerr << e.what() << std::endl;
 
93
                }
 
94
            }
 
95
        }, G_PRIORITY_LOW, true);
92
96
    });
93
97
 
94
98
    m_actionGroupMerger->add(*m_flightModeSwitch);