mirror of
https://github.com/elementary/gala.git
synced 2024-12-27 03:04:08 +03:00
parent
6da349e939
commit
395670ec3d
@ -181,10 +181,16 @@ namespace Gala
|
|||||||
try {
|
try {
|
||||||
var screenshot = Gdk.pixbuf_get_from_surface (image, 0, 0, image.get_width (), image.get_height ());
|
var screenshot = Gdk.pixbuf_get_from_surface (image, 0, 0, image.get_width (), image.get_height ());
|
||||||
var file = File.new_for_path (used_filename);
|
var file = File.new_for_path (used_filename);
|
||||||
var stream = yield file.create_readwrite_async (FileCreateFlags.NONE);
|
FileIOStream stream;
|
||||||
|
if (file.query_exists ()) {
|
||||||
|
stream = yield file.open_readwrite_async (FileCreateFlags.NONE);
|
||||||
|
} else {
|
||||||
|
stream = yield file.create_readwrite_async (FileCreateFlags.NONE);
|
||||||
|
}
|
||||||
yield screenshot.save_to_stream_async (stream.output_stream, "png");
|
yield screenshot.save_to_stream_async (stream.output_stream, "png");
|
||||||
return true;
|
return true;
|
||||||
} catch (GLib.Error e) {
|
} catch (GLib.Error e) {
|
||||||
|
warning ("could not save file: %s", e.message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user