mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/virt-viewer
synced 2025-12-27 14:54:14 +00:00
Make sure png screenshots have a .png extensions
When falling back to saving to .png, the filename might not end with .png. This commit appends the .png extension to the screenshot filename if it's missing.
This commit is contained in:
parent
f9935c832b
commit
8a7aa6a1e1
@ -801,8 +801,16 @@ virt_viewer_window_save_screenshot(VirtViewerWindow *self,
|
||||
|
||||
if (format == NULL) {
|
||||
g_debug("unknown file extension, falling back to png");
|
||||
gdk_pixbuf_save(pix, file, "png", NULL,
|
||||
"tEXt::Generator App", PACKAGE, NULL);
|
||||
if (!g_str_has_suffix(file, ".png")) {
|
||||
char *png_filename;
|
||||
png_filename = g_strconcat(file, ".png", NULL);
|
||||
gdk_pixbuf_save(pix, png_filename, "png", NULL,
|
||||
"tEXt::Generator App", PACKAGE, NULL);
|
||||
g_free(png_filename);
|
||||
} else {
|
||||
gdk_pixbuf_save(pix, file, "png", NULL,
|
||||
"tEXt::Generator App", PACKAGE, NULL);
|
||||
}
|
||||
} else {
|
||||
char *type = gdk_pixbuf_format_get_name(format);
|
||||
g_debug("saving to %s", type);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user