← Back to team overview

simple-scan-team team mailing list archive

[Merge] lp:~victor-mireyev/simple-scan/bug-719741 into lp:simple-scan

 

Victor Mireyev has proposed merging lp:~victor-mireyev/simple-scan/bug-719741 into lp:simple-scan.

Requested reviews:
  Robert Ancell (robert-ancell)
Related bugs:
  Bug #719741 in Simple Scan: "Save dialog does not force file name extensions"
  https://bugs.launchpad.net/simple-scan/+bug/719741

For more details, see:
https://code.launchpad.net/~victor-mireyev/simple-scan/bug-719741/+merge/166375

Fix LP#719741. Save dialog should force file name extensions
-- 
https://code.launchpad.net/~victor-mireyev/simple-scan/bug-719741/+merge/166375
Your team Simple Scan Development Team is subscribed to branch lp:simple-scan.
=== modified file 'src/ui.vala'
--- src/ui.vala	2013-05-19 21:55:27 +0000
+++ src/ui.vala	2013-05-29 19:58:30 +0000
@@ -385,7 +385,7 @@
         string extension = "";
         var index = default_file_name.last_index_of_char ('.');
         if (index >= 0)
-            extension = default_file_name.slice (0, index);
+            extension = default_file_name.substring (index);
 
         var file_type_store = new Gtk.ListStore (2, typeof (string), typeof (string));
         Gtk.TreeIter iter;
@@ -435,7 +435,18 @@
 
         string? uri = null;
         if (response == Gtk.ResponseType.ACCEPT)
+        {
+            var path = save_dialog.get_filename ();
+            var basename = Path.get_basename (path);
+            // Check if file name doesn't have extension
+            if (basename.last_index_of_char ('.') <= 0)
+            {
+                var selection = file_type_view.get_selection ();
+                // Force file name extension
+                on_file_type_changed (selection);
+            }
             uri = save_dialog.get_uri ();
+        }
 
         settings.set_string ("save-directory", save_dialog.get_current_folder ());
 


Follow ups