screenshot: Add and implement new D-Bus method
The new InteractiveScreenshot() D-Bus method is implemented using the signals introduced by the previous commit, and is fundamentally very simple: take the screenshot, and return the GFile URI. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2999>
This commit is contained in:

committed by
Marge Bot

parent
c80f3af79b
commit
ee150f2949
@ -2604,6 +2604,34 @@ export class ScreenshotService {
|
||||
}
|
||||
}
|
||||
|
||||
async InteractiveScreenshotAsync(params, invocation) {
|
||||
try {
|
||||
await this._senderChecker.checkInvocation(invocation);
|
||||
} catch (e) {
|
||||
invocation.return_gerror(e);
|
||||
return;
|
||||
}
|
||||
|
||||
Main.screenshotUI.connectObject(
|
||||
'screenshot-taken', (ui, file) => {
|
||||
Main.screenshotUI.disconnectObject(invocation);
|
||||
invocation.return_value(new GLib.Variant('(bs)', [true, file.get_uri()]));
|
||||
},
|
||||
'closed', () => {
|
||||
Main.screenshotUI.disconnectObject(invocation);
|
||||
invocation.return_value(new GLib.Variant('(bs)', [false, '']));
|
||||
},
|
||||
invocation);
|
||||
|
||||
|
||||
try {
|
||||
Main.screenshotUI.open(UIMode.SCREENSHOT_ONLY);
|
||||
} catch (e) {
|
||||
Main.screenshotUI.disconnectObject(invocation);
|
||||
invocation.return_value(new GLib.Variant('(bs)', [false, '']));
|
||||
}
|
||||
}
|
||||
|
||||
async SelectAreaAsync(params, invocation) {
|
||||
try {
|
||||
await this._senderChecker.checkInvocation(invocation);
|
||||
|
Reference in New Issue
Block a user