[latexila] File chooser dialog: open in the directory of the current document



commit fa730a5a9ab22a21ef13053e1e7c4116e93f6528
Author: Matthieu Baerts <matttbe gmail com>
Date:   Tue Oct 14 14:38:42 2014 +0200

    File chooser dialog: open in the directory of the current document
    
    When clicking on the Open button, open the file chooser in the directory
    of the current document instead of the home dir.
    
    I think that most of the time, the user will want to open a file which
    is located not so far from the current one.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=738525

 src/main_window_file.vala |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/main_window_file.vala b/src/main_window_file.vala
index 24bf85c..e453413 100644
--- a/src/main_window_file.vala
+++ b/src/main_window_file.vala
@@ -147,7 +147,15 @@ public class MainWindowFile
             Stock.OPEN, ResponseType.ACCEPT
         );
 
-        if (_main_window.default_location != null)
+        // Open in the directory of the current document
+        if (_main_window.active_document != null &&
+            _main_window.active_document.location != null)
+        {
+            File location = _main_window.active_document.location;
+            string dirname = location.get_parent ().get_path ();
+            file_chooser.set_current_folder (dirname);
+        }
+        else if (_main_window.default_location != null)
             file_chooser.set_current_folder (_main_window.default_location);
 
         file_chooser.select_multiple = true;


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