diff options
author | Giovanni Campagna <gcampagna@src.gnome.org> | 2014-06-15 16:07:09 +0200 |
---|---|---|
committer | Giovanni Campagna <gcampagna@src.gnome.org> | 2014-06-15 16:40:41 +0200 |
commit | 272d8c935808ec879e41ee53f0b9030ffd4abf56 (patch) | |
tree | 6d357494c0f26e8e6e0155c1ca78812f6a593f75 | |
parent | c6e0ef5b7cae8ac9d6cc79c54dded79869e5346e (diff) | |
download | gjs-272d8c935808ec879e41ee53f0b9030ffd4abf56.tar.gz |
mainloop: restore priority arguments to *_add() calls
The original Mainloop API had an optional priority argument at the
end of idle_add(), timeout_add() and timeout_add_seconds(). Restore
support for it.
https://bugzilla.gnome.org/show_bug.cgi?id=726333
-rw-r--r-- | modules/mainloop.js | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/modules/mainloop.js b/modules/mainloop.js index 06458a36..89c37feb 100644 --- a/modules/mainloop.js +++ b/modules/mainloop.js @@ -46,34 +46,40 @@ function quit(name) { loop.quit(); } -function idle_source(handler) { +function idle_source(handler, priority) { let s = GLib.idle_source_new(); GObject.source_set_closure(s, handler); + if (priority !== undefined) + s.set_priority(priority); return s; } -function idle_add(handler) { - return idle_source(handler).attach(null); +function idle_add(handler, priority) { + return idle_source(handler, priority).attach(null); } -function timeout_source(timeout, handler) { +function timeout_source(timeout, handler, priority) { let s = GLib.timeout_source_new(timeout); GObject.source_set_closure(s, handler); + if (priority !== undefined) + s.set_priority(priority); return s; } -function timeout_seconds_source(timeout, handler) { +function timeout_seconds_source(timeout, handler, priority) { let s = GLib.timeout_source_new_seconds(timeout); GObject.source_set_closure(s, handler); + if (priority !== undefined) + s.set_priority(priority); return s; } -function timeout_add(timeout, handler) { - return timeout_source(timeout, handler).attach(null); +function timeout_add(timeout, handler, priority) { + return timeout_source(timeout, handler, priority).attach(null); } -function timeout_add_seconds(timeout, handler) { - return timeout_seconds_source(timeout, handler).attach(null); +function timeout_add_seconds(timeout, handler, priority) { + return timeout_seconds_source(timeout, handler, priority).attach(null); } function source_remove(id) { |