diff options
author | Zeeshan Ali (Khattak) <zeeshanak@gnome.org> | 2012-07-14 00:35:01 +0300 |
---|---|---|
committer | Zeeshan Ali (Khattak) <zeeshanak@gnome.org> | 2012-07-15 00:48:49 +0300 |
commit | ba8de1d22b540eca56ed65972d59cdbaf11bad12 (patch) | |
tree | abff02844fc9e7a5f89af5e1d71b76351c39685e | |
parent | ef7e5cec70a7851c2f90af0b1bc7263076dc98f7 (diff) |
util: Simplify run()
Basically it now just launches run_sync() through run_in_thread().
https://bugzilla.gnome.org/show_bug.cgi?id=679896
-rw-r--r-- | src/util.vala | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/src/util.vala b/src/util.vala index 8587d30..48df49b 100644 --- a/src/util.vala +++ b/src/util.vala @@ -462,32 +462,9 @@ namespace Boxes { } public async void exec (string[] argv, Cancellable? cancellable) throws GLib.Error { - SourceFunc continuation = exec.callback; - GLib.Error error = null; - var context = MainContext.get_thread_default (); - - g_io_scheduler_push_job ((job) => { - try { - exec_sync (argv); - } catch (GLib.Error err) { - error = err; - } - - var source = new IdleSource (); - source.set_callback (() => { - continuation (); - - return false; - }); - source.attach (context); - - return false; + yield run_in_thread (() => { + exec_sync (argv); }); - - yield; - - if (error != null) - throw error; } public void exec_sync (string[] argv) throws GLib.Error { |