Mercurial > geeqie.yaz
changeset 1232:98be4a5e36f8
do not enter a directory after rename
fixed dir tree updating
http://sourceforge.net/tracker/index.php?func=detail&aid=2481287&group_id=222125&atid=1054680
author | nadvornik |
---|---|
date | Fri, 02 Jan 2009 22:57:09 +0000 |
parents | ca8ccf0c3e81 |
children | b51874ca8642 |
files | src/view_dir.c src/view_dir_tree.c |
diffstat | 2 files changed, 22 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/view_dir.c Fri Jan 02 14:58:21 2009 +0000 +++ b/src/view_dir.c Fri Jan 02 22:57:09 2009 +0000 @@ -231,11 +231,6 @@ file_util_rename_dir(fd, new_path, vd->view); - if (vd->layout && vd->dir_fd != fd) - { - layout_set_path(vd->layout, new_path); - } - g_free(new_path); return FALSE;
--- a/src/view_dir_tree.c Fri Jan 02 14:58:21 2009 +0000 +++ b/src/view_dir_tree.c Fri Jan 02 22:57:09 2009 +0000 @@ -357,6 +357,22 @@ return NULL; } +static NodeData *vdtree_find_iter_by_fd(ViewDir *vd, GtkTreeIter *parent, FileData *fd, GtkTreeIter *iter) +{ + GtkTreeModel *store; + + store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)); + if (!fd || !gtk_tree_model_iter_children(store, iter, parent)) return NULL; + do { + NodeData *nd; + + gtk_tree_model_get(store, iter, DIR_COLUMN_POINTER, &nd, -1); + if (nd && nd->fd == fd) return nd; + } while (gtk_tree_model_iter_next(store, iter)); + + return NULL; +} + static void vdtree_add_by_data(ViewDir *vd, FileData *fd, GtkTreeIter *parent) { GtkTreeStore *store; @@ -512,17 +528,17 @@ { NodeData *cnd; - cnd = vdtree_find_iter_by_name(vd, iter, fd->name, &child); + cnd = vdtree_find_iter_by_fd(vd, iter, fd, &child); if (cnd) { - old = g_list_remove(old, cnd); - if (cnd->expanded && cnd->version != fd->version && - vdtree_populate_path_by_iter(vd, &child, FALSE, target_fd)) + if (cnd->expanded && cnd->version != fd->version) { - gtk_tree_store_set(GTK_TREE_STORE(store), &child, DIR_COLUMN_NAME, fd->name, -1); - cnd->version = fd->version; + vdtree_populate_path_by_iter(vd, &child, FALSE, target_fd); } + gtk_tree_store_set(GTK_TREE_STORE(store), &child, DIR_COLUMN_NAME, fd->name, -1); + cnd->version = fd->version; + old = g_list_remove(old, cnd); file_data_unref(fd); } else