diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-10-05 17:12:40 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-10-09 16:38:03 +0200 |
| commit | 1159a169b0296813ba6a80f973bacbedaf02f1ef (patch) | |
| tree | 109b7dafa10c7ab5d6d71bb7eb8fb32a388ea6e0 /plugins/http-files/src | |
| parent | 9214e31b98d69d2c8ad56f8634345aeb98b234cc (diff) | |
| download | dino-1159a169b0296813ba6a80f973bacbedaf02f1ef.tar.gz | |
Inhibit suspend on file upload/download
Diffstat (limited to 'plugins/http-files/src')
| -rw-r--r-- | plugins/http-files/src/file_sender.vala | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/http-files/src/file_sender.vala b/plugins/http-files/src/file_sender.vala index 0dfa5b1b..9c2e8327 100644 --- a/plugins/http-files/src/file_sender.vala +++ b/plugins/http-files/src/file_sender.vala @@ -125,16 +125,23 @@ public class HttpFileSender : FileSender, Object { foreach (var entry in file_send_data.headers.entries) { put_message.request_headers.append(entry.key, entry.value); } + + uint inhibit_cookie = 0; try { + inhibit_cookie = Application.get_default() + .inhibit_app("Ongoing file upload"); #if SOUP_3_0 yield session.send_async(put_message, GLib.Priority.LOW, file_transfer.cancellable); #else yield session.send_async(put_message, file_transfer.cancellable); #endif + Application.get_default().uninhibit_app(inhibit_cookie); + if (put_message.status_code < 200 || put_message.status_code >= 300) { throw new FileSendError.UPLOAD_FAILED("HTTP status code %s".printf(put_message.status_code.to_string())); } } catch (Error e) { + Application.get_default().uninhibit_app(inhibit_cookie); throw new FileSendError.UPLOAD_FAILED("HTTP upload error: %s".printf(e.message)); } } |
