Mercurial > hg > forks > geeqie
changeset 2392:335b038e401c
Fix hidden directories not showing in a tree view
Directory tree view contains code that when "Show hidden files or folders"
option is not enabled but the user enters a path containing hidden
directories the missing tree entries are added automatically.
This didn't work (at least) in case when the first hidden directory in
newly selected path was in a current directory because the tree populating
function exited early when directory contents did not change since last
run, before checking for this special case.
Fix this by skipping this check when we have to add such hidden directory
entry.
This check must also be skipped when 'force' flag is passed to this
function, otherwise when enabling "Show hidden files or folders" option
the missing directories are not added to the tree until Geeqie is
restarted.
Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
author | Maciej S. Szmigiero <mail@maciej.szmigiero.name> |
---|---|
date | Sat, 09 Jul 2016 18:57:08 +0200 |
parents | b7228e6b2a02 |
children | 959c579fd4bb |
files | src/view_dir_tree.c |
diffstat | 1 files changed, 22 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/view_dir_tree.c Tue Jul 05 19:47:40 2016 +0100 +++ b/src/view_dir_tree.c Sat Jul 09 18:57:08 2016 +0200 @@ -440,6 +440,7 @@ time_t current_time; GtkTreeIter child; NodeData *nd; + gboolean add_hidden = FALSE; store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); gtk_tree_model_get(store, iter, DIR_COLUMN_POINTER, &nd, -1); @@ -464,13 +465,8 @@ return TRUE; } file_data_check_changed_files(nd->fd); /* make sure we have recent info */ - if (nd->fd->version == nd->version) return TRUE; } - vdtree_busy_push(vd); - - filelist_read(nd->fd, NULL, &list); - /* when hidden files are not enabled, and the user enters a hidden path, * allow the tree to display that path by specifically inserting the hidden entries */ @@ -482,21 +478,32 @@ n = strlen(nd->fd->path); if (target_fd->path[n] == G_DIR_SEPARATOR && target_fd->path[n+1] == '.') - { - gchar *name8; + add_hidden = TRUE; + } - n++; + if (nd->expanded && (!force && !add_hidden) && nd->fd->version == nd->version) + return TRUE; - while (target_fd->path[n] != '\0' && target_fd->path[n] != G_DIR_SEPARATOR) n++; - name8 = g_strndup(target_fd->path, n); + vdtree_busy_push(vd); + + filelist_read(nd->fd, NULL, &list); - if (isdir(name8)) - { - list = g_list_prepend(list, file_data_new_dir(name8)); - } + if (add_hidden) + { + gint n; + gchar *name8; + + n = strlen(nd->fd->path) + 1; - g_free(name8); + while (target_fd->path[n] != '\0' && target_fd->path[n] != G_DIR_SEPARATOR) n++; + name8 = g_strndup(target_fd->path, n); + + if (isdir(name8)) + { + list = g_list_prepend(list, file_data_new_dir(name8)); } + + g_free(name8); } old = NULL;