[virt-tools-list] [PATCH virt-viewer] screenshot: Prefill filename suffix

Pavel Grunt pgrunt at redhat.com
Thu Jun 8 13:08:02 UTC 2017


Use .png as the default

Related: rhbz#1455832
---
 src/virt-viewer-window.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 3ba4e2c..9531f15 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -974,7 +974,8 @@ virt_viewer_window_menu_file_screenshot(GtkWidget *menu G_GNUC_UNUSED,
 {
     GtkWidget *dialog;
     VirtViewerWindowPrivate *priv = self->priv;
-    const char *image_dir;
+    const gchar *image_dir;
+    gchar *save_name;
 
     g_return_if_fail(priv->display != NULL);
 
@@ -990,7 +991,9 @@ virt_viewer_window_menu_file_screenshot(GtkWidget *menu G_GNUC_UNUSED,
     image_dir = g_get_user_special_dir(G_USER_DIRECTORY_PICTURES);
     if (image_dir != NULL)
         gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER (dialog), image_dir);
-    gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER (dialog), _("Screenshot"));
+    save_name = g_strdup_printf("%s.png", _("Screenshot"));
+    gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER (dialog), save_name);
+    g_free(save_name);
 
     if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
         char *filename;
-- 
2.13.0




More information about the virt-tools-list mailing list