[simple-scan] Move get_temporary_filename() to the only file it's used in



commit 0a85cc1a45171679032302c82f733ce32638f46e
Author: Robert Ancell <robert ancell canonical com>
Date:   Wed May 24 14:12:58 2017 +1200

    Move get_temporary_filename() to the only file it's used in

 src/app-window.vala         |   21 +++++++++++++++++++++
 src/preferences-dialog.vala |   21 ---------------------
 2 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/src/app-window.vala b/src/app-window.vala
index d05e6c2..ff7356a 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -1217,6 +1217,27 @@ public class AppWindow : Gtk.ApplicationWindow
         }
     }
 
+    private string? get_temporary_filename (string prefix, string extension)
+    {
+        /* NOTE: I'm not sure if this is a 100% safe strategy to use g_file_open_tmp(), close and
+         * use the filename but it appears to work in practice */
+
+        var filename = "%sXXXXXX.%s".printf (prefix, extension);
+        string path;
+        try
+        {
+            var fd = FileUtils.open_tmp (filename, out path);
+            Posix.close (fd);
+        }
+        catch (Error e)
+        {
+            warning ("Error creating temporary file: %s", e.message);
+            return null;
+        }
+
+        return path;
+    }
+
     private void print_document ()
     {
         var print = new Gtk.PrintOperation ();
diff --git a/src/preferences-dialog.vala b/src/preferences-dialog.vala
index 7ce8ffc..d67c111 100644
--- a/src/preferences-dialog.vala
+++ b/src/preferences-dialog.vala
@@ -512,27 +512,6 @@ private class ProgressBarDialog : Gtk.Window
     }
 }
 
-private string? get_temporary_filename (string prefix, string extension)
-{
-    /* NOTE: I'm not sure if this is a 100% safe strategy to use g_file_open_tmp(), close and
-     * use the filename but it appears to work in practice */
-
-    var filename = "%sXXXXXX.%s".printf (prefix, extension);
-    string path;
-    try
-    {
-        var fd = FileUtils.open_tmp (filename, out path);
-        Posix.close (fd);
-    }
-    catch (Error e)
-    {
-        warning ("Error creating temporary file: %s", e.message);
-        return null;
-    }
-
-    return path;
-}
-
 private class PageIcon : Gtk.DrawingArea
 {
     private string text;


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