[gnome-latex: 113/205] File browser: best method for getting the parent dir



commit 398efe5ab6f0642d7d1ecf809ce85378c92a2f62
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date:   Mon Nov 9 18:01:43 2009 +0100

    File browser: best method for getting the parent dir
    
    With the first method, we build the path by adding ".." in the end, but
    the path could become very ugly, for example:
    /home/seb/test/latex/../latex/icons/../../latex/logo/../..
    
    We avoid this problem with the new method.

 src/file_browser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/file_browser.c b/src/file_browser.c
index 710ad1c..66d7bed 100644
--- a/src/file_browser.c
+++ b/src/file_browser.c
@@ -215,7 +215,7 @@ cb_go_to_home_dir (GtkButton *button, gpointer user_data)
 static void
 cb_go_to_parent_dir (GtkButton *button, gpointer user_data)
 {
-       gchar *path = g_build_filename (latexila.prefs.file_browser_dir, "..", NULL);
+       gchar *path = g_path_get_dirname (latexila.prefs.file_browser_dir);
        g_free (latexila.prefs.file_browser_dir);
        latexila.prefs.file_browser_dir = path;
        fill_list_store_with_current_dir ();


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