[longomatch] Remind last directory used to render



commit 1826ec592473c3ee6757314978eb0a96ca3d6fa9
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sat Oct 12 18:38:42 2013 +0200

    Remind last directory used to render

 LongoMatch.Core/Config.cs                          |   12 ++++++++++++
 .../Gui/Dialog/VideoEditionProperties.cs           |   17 ++++++++++++++---
 2 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/LongoMatch.Core/Config.cs b/LongoMatch.Core/Config.cs
index 4b12d01..7ddce17 100644
--- a/LongoMatch.Core/Config.cs
+++ b/LongoMatch.Core/Config.cs
@@ -313,6 +313,16 @@ namespace LongoMatch
                        }
                }
                
+               public static string LastRenderDir {
+                       get {
+                               return state.lastRenderDir;
+                       }
+                       set {
+                               state.lastRenderDir = value;
+                               Save ();
+                       }
+               }
+               
                public static bool ReviewPlaysInSameWindow {
                        get {
                                return state.reviewPlaysInSameWindow;
@@ -345,6 +355,7 @@ namespace LongoMatch
                public bool enableAudio;
                public bool autorender;
                public string autorenderDir;
+               public string lastRenderDir;
                public bool reviewPlaysInSameWindow;
                
                public ConfigState () {
@@ -365,6 +376,7 @@ namespace LongoMatch
                        fps_d = 1;
                        autorender = false;
                        autorenderDir = null;
+                       lastRenderDir = null;
                        reviewPlaysInSameWindow = true;
                }
        }
diff --git a/LongoMatch.GUI/Gui/Dialog/VideoEditionProperties.cs 
b/LongoMatch.GUI/Gui/Dialog/VideoEditionProperties.cs
index cdfd41d..9310719 100644
--- a/LongoMatch.GUI/Gui/Dialog/VideoEditionProperties.cs
+++ b/LongoMatch.GUI/Gui/Dialog/VideoEditionProperties.cs
@@ -19,6 +19,7 @@
 //
 
 using System;
+using System.IO;
 using Gtk;
 using Mono.Unix;
 using LongoMatch.Video.Editor;
@@ -117,8 +118,12 @@ namespace LongoMatch.Gui.Dialog
                                        FileChooserAction.Save,
                                        "gtk-cancel",ResponseType.Cancel,
                                        "gtk-save",ResponseType.Accept);
-                       fChooser.SetCurrentFolder(Config.VideosDir);
-                       fChooser.CurrentName = "NewVideo."+GetExtension();
+                       if (Directory.Exists (Config.LastRenderDir)) {
+                               fChooser.SetCurrentFolder(Config.LastRenderDir);
+                       } else {
+                               fChooser.SetCurrentFolder(Config.VideosDir);
+                       }
+                       fChooser.CurrentName = "NewVideo."+ GetExtension();
                        fChooser.DoOverwriteConfirmation = true;
                        FileFilter filter = new FileFilter();
                        filter.Name = "Multimedia Files";
@@ -131,6 +136,7 @@ namespace LongoMatch.Gui.Dialog
                        fChooser.Filter = filter;
                        if(fChooser.Run() == (int)ResponseType.Accept) {
                                filelabel.Text = fChooser.Filename;
+                               Config.LastRenderDir = System.IO.Path.GetDirectoryName (fChooser.Filename);
                        }
                        fChooser.Destroy();
                }
@@ -155,11 +161,16 @@ namespace LongoMatch.Gui.Dialog
                                        FileChooserAction.SelectFolder,
                                        "gtk-cancel",ResponseType.Cancel,
                                        "gtk-open",ResponseType.Accept);
-                       fChooser.SetCurrentFolder(Config.VideosDir);
+                       if (Directory.Exists (Config.LastRenderDir)) {
+                               fChooser.SetCurrentFolder(Config.LastRenderDir);
+                       } else {
+                               fChooser.SetCurrentFolder(Config.VideosDir);
+                       }
                        fChooser.CurrentName = "Playlist";
                        if(fChooser.Run() == (int)ResponseType.Accept) {
                                dirlabel.Text = fChooser.Filename;
                                OutputDir = fChooser.Filename;
+                               Config.LastRenderDir = OutputDir;
                        }
                        fChooser.Destroy();
                }


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