[gnome-shell/gnome-3-36] screenshot: Return an error when operation is blocked
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-36] screenshot: Return an error when operation is blocked
- Date: Fri, 29 May 2020 09:02:24 +0000 (UTC)
commit c8d91b2c309632e9c690b20800ed66ed4beabf02
Author: Florian Müllner <fmuellner gnome org>
Date: Fri May 29 00:35:27 2020 +0200
screenshot: Return an error when operation is blocked
Right now _createScreenshot() returns a tuple that indicates failure
when a sender requests a screenshot operation before a previously
started operation finished.
However that doesn't work for the PickColor() method, as it uses a
different return type than the other methods.
Address this by returning an error instead, which works in any case;
arguably trying to start multiple operations in parallel is an error
by the caller more than it is a failed operation anyway.
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1288
js/ui/screenshot.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js
index 7aed8d01b4..6f88e1a203 100644
--- a/js/ui/screenshot.js
+++ b/js/ui/screenshot.js
@@ -30,7 +30,9 @@ var ScreenshotService = class {
let sender = invocation.get_sender();
if (this._screenShooter.has(sender) || lockedDown) {
- invocation.return_value(GLib.Variant.new('(bs)', [false, '']));
+ invocation.return_error_literal(
+ Gio.IOErrorEnum, Gio.IOErrorEnum.BUSY,
+ 'There is an ongoing operation for this sender');
return null;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]