Screenshot: Refactor ScreenshotManager.save_image

In previous versions of GNOME Settings daemon (elementary OS <= 5),
saving to clipboard was handled by the daemon. The daemon used to
request Gala to save the screenshot in a temp path like
"/tmp/gnome-settings-daemon-screenshot-XXXX" and copied the image to
the  clipboard from there.

More information: https://github.com/elementary/gala/issues/474

Now, Gala is in charge of copying to clipboard when the take screenshot
methods receive an empty filename.

This commit: Move the code from save_image to save_image_to_file.
This commit is contained in:
José Expósito 2021-05-17 10:50:41 +02:00 committed by Cassidy James Blaede
parent c0506cb99b
commit 0c9a68aa8b

View File

@ -254,6 +254,10 @@ namespace Gala {
}
static async bool save_image (Cairo.ImageSurface image, string filename, out string used_filename) {
return yield save_image_to_file (image, filename, out used_filename);
}
static async bool save_image_to_file (Cairo.ImageSurface image, string filename, out string used_filename) {
used_filename = filename;
// We only alter non absolute filename because absolute