[sysprof] save-as: add .syscap extension if necessary



commit f73f5e98ec8e1df84b5d7ccb4cc491ea4922bcdd
Author: Christian Hergert <christian hergert me>
Date:   Wed Apr 13 09:23:21 2016 -0700

    save-as: add .syscap extension if necessary
    
    We have *.syscap glob registered with the mime types, so ensure that the
    file gets saved with that extension.

 src/sp-window.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/sp-window.c b/src/sp-window.c
index 6ceb9e6..ab5b618 100644
--- a/src/sp-window.c
+++ b/src/sp-window.c
@@ -550,6 +550,18 @@ sp_window_save_capture (GSimpleAction *action,
 
       filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
 
+      if (filename == NULL)
+        goto failure;
+
+      if (!g_str_has_suffix (filename, ".syscap"))
+        {
+          gchar *tmp;
+
+          tmp = g_strdup_printf ("%s.syscap", filename);
+          g_free (filename);
+          filename = tmp;
+        }
+
       /* this should really be done outside the main loop. */
       if (!sp_capture_reader_save_as (reader, filename, &error))
         {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]