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

« back to all changes in this revision

Viewing changes to src/menumodel-cpp/gio-helpers/util.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:
36
36
    return G_SOURCE_REMOVE;
37
37
}
38
38
 
39
 
GMainLoopDispatch::GMainLoopDispatch(Func func)
 
39
GMainLoopDispatch::GMainLoopDispatch(Func func, int priority, bool force_delayed)
40
40
{
41
41
    std::unique_lock<std::mutex> lock(_lock);
42
42
 
43
 
    if (g_main_context_acquire(g_main_context_default())) {
 
43
    if (!force_delayed &&
 
44
         g_main_context_acquire(g_main_context_default())) {
44
45
        // already running inside GMainLoop..
45
46
        // free the lock and dispatch immediately.
46
47
        lock.unlock();
49
50
    } else {
50
51
        std::function<void()> *funcPtr = new std::function<void()>(func);
51
52
        if (_funcs.empty()) {
52
 
            g_idle_add_full(G_PRIORITY_HIGH,
 
53
            g_idle_add_full(priority,
53
54
                            GSourceFunc(GMainLoopDispatch::dispatch_cb),
54
55
                            NULL,
55
56
                            NULL);