[longomatch] Store last directory in the config



commit 32a0540b171c3fa7a9f0093e1e5a41faa2048c44
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Apr 1 19:33:42 2015 +0200

    Store last directory in the config

 LongoMatch.Core/Config.cs                   |   12 ++++++++++++
 LongoMatch.GUI.Helpers/FileChooserHelper.cs |    8 +++-----
 2 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/LongoMatch.Core/Config.cs b/LongoMatch.Core/Config.cs
index 9eb8537..e9d9d65 100644
--- a/LongoMatch.Core/Config.cs
+++ b/LongoMatch.Core/Config.cs
@@ -464,6 +464,16 @@ namespace LongoMatch
                        }
                }
 
+               public static string LastDir {
+                       get {
+                               return state.lastDir;
+                       }
+                       set {
+                               state.lastDir = value;
+                               Save ();
+                       }
+               }
+
                public static string LastRenderDir {
                        get {
                                return state.lastRenderDir;
@@ -539,6 +549,7 @@ namespace LongoMatch
                public bool autorender;
                public string autorenderDir;
                public string lastRenderDir;
+               public string lastDir;
                public bool reviewPlaysInSameWindow;
                public string defaultTemplate;
                public Hotkeys hotkeys;
@@ -564,6 +575,7 @@ namespace LongoMatch
                        autorender = false;
                        autorenderDir = null;
                        lastRenderDir = null;
+                       lastDir = null;
                        reviewPlaysInSameWindow = true;
                        defaultTemplate = null;
                        hotkeys = new Hotkeys ();
diff --git a/LongoMatch.GUI.Helpers/FileChooserHelper.cs b/LongoMatch.GUI.Helpers/FileChooserHelper.cs
index 58291d3..39ad1c1 100644
--- a/LongoMatch.GUI.Helpers/FileChooserHelper.cs
+++ b/LongoMatch.GUI.Helpers/FileChooserHelper.cs
@@ -24,8 +24,6 @@ namespace LongoMatch.Gui.Helpers
        public class FileChooserHelper
        {
        
-               static string lastDirectory = null;
-
                static public string SaveFile (Widget parent, string title, string defaultName,
                                               string defaultFolder, string filterName,
                                               string[] extensions)
@@ -96,8 +94,8 @@ namespace LongoMatch.Gui.Helpers
                        fChooser.SelectMultiple = allowMultiple;
                        if (defaultFolder != null) {
                                fChooser.SetCurrentFolder (defaultFolder);
-                       } else if (lastDirectory != null) {
-                               fChooser.SetCurrentFolder (lastDirectory);
+                       } else if (Config.LastDir != null) {
+                               fChooser.SetCurrentFolder (Config.LastDir);
                        }
                        if (defaultName != null)
                                fChooser.CurrentName = defaultName;
@@ -117,7 +115,7 @@ namespace LongoMatch.Gui.Helpers
                        } else {
                                path = new List<string> (fChooser.Filenames);
                                if (defaultFolder == null && fChooser.Filenames.Length > 0) {
-                                       lastDirectory = System.IO.Path.GetDirectoryName (fChooser.Filenames 
[0]);
+                                       Config.LastDir = System.IO.Path.GetDirectoryName (fChooser.Filenames 
[0]);
                                }
                        }
 


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