changeset 1702:2725ab224b07

fixed switching of multiline texts
author nadvornik
date Fri, 24 Jul 2009 13:32:37 +0000
parents 2309e6150e8c
children 80c83468a47c
files src/view_file_list.c
diffstat 1 files changed, 16 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/view_file_list.c	Fri Jul 24 12:56:54 2009 +0000
+++ b/src/view_file_list.c	Fri Jul 24 13:32:37 2009 +0000
@@ -65,7 +65,7 @@
 
 static gboolean vflist_row_is_selected(ViewFile *vf, FileData *fd);
 static gboolean vflist_row_rename_cb(TreeEditData *td, const gchar *old, const gchar *new, gpointer data);
-static void vflist_populate_view(ViewFile *vf);
+static void vflist_populate_view(ViewFile *vf, gboolean force);
 static gboolean vflist_is_multiline(ViewFile *vf);
 static void vflist_set_expanded(ViewFile *vf, GtkTreeIter *iter, gboolean expanded);
 
@@ -934,7 +934,7 @@
 	g_free(formatted);
 }
 
-static void vflist_setup_iter_recursive(ViewFile *vf, GtkTreeStore *store, GtkTreeIter *parent_iter, GList *list, GList *selected)
+static void vflist_setup_iter_recursive(ViewFile *vf, GtkTreeStore *store, GtkTreeIter *parent_iter, GList *list, GList *selected, gboolean force)
 {
 	GList *work;
 	GtkTreeIter iter;
@@ -1003,7 +1003,7 @@
 					}
 
 				vflist_setup_iter(vf, store, &new, file_data_ref(fd));
-				vflist_setup_iter_recursive(vf, store, &new, fd->sidecar_files, selected);
+				vflist_setup_iter_recursive(vf, store, &new, fd->sidecar_files, selected, force);
 				
 				if (g_list_find(selected, fd))
 					{
@@ -1022,10 +1022,10 @@
 				}
 			else
 				{
-				if (fd->version != old_version)
+				if (fd->version != old_version || force)
 					{
 					vflist_setup_iter(vf, store, &iter, fd);
-					vflist_setup_iter_recursive(vf, store, &iter, fd->sidecar_files, selected);
+					vflist_setup_iter_recursive(vf, store, &iter, fd->sidecar_files, selected, force);
 					}
 
 				if (valid) valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
@@ -1667,7 +1667,7 @@
 			/* mark functions can have various side effects - update all columns to be sure */
 			vflist_setup_iter(vf, GTK_TREE_STORE(store), &iter, fd);
 			/* mark functions can change sidecars too */
-			vflist_setup_iter_recursive(vf, GTK_TREE_STORE(store), &iter, fd->sidecar_files, NULL);
+			vflist_setup_iter_recursive(vf, GTK_TREE_STORE(store), &iter, fd->sidecar_files, NULL, FALSE);
 			}
 
 		
@@ -1723,7 +1723,7 @@
 }
 
 
-static void vflist_populate_view(ViewFile *vf)
+static void vflist_populate_view(ViewFile *vf, gboolean force)
 {
 	GtkTreeStore *store;
 	GList *selected;
@@ -1743,7 +1743,7 @@
 
 	selected = vflist_selection_get_list(vf);
 	
-	vflist_setup_iter_recursive(vf, store, NULL, vf->list, selected);
+	vflist_setup_iter_recursive(vf, store, NULL, vf->list, selected, force);
 
 	if (selected && vflist_selection_count(vf, NULL) == 0)
 		{
@@ -1780,7 +1780,7 @@
 
 	DEBUG_1("%s vflist_refresh: populate view", get_exec_time());
 
-	vflist_populate_view(vf);
+	vflist_populate_view(vf, FALSE);
 
 	filelist_free(old_list);
 	DEBUG_1("%s vflist_refresh: done", get_exec_time());
@@ -1910,7 +1910,7 @@
 		/* mark functions can have various side effects - update all columns to be sure */
 		vflist_setup_iter(vf, GTK_TREE_STORE(store), &iter, fd);
 		/* mark functions can change sidecars too */
-		vflist_setup_iter_recursive(vf, GTK_TREE_STORE(store), &iter, fd->sidecar_files, NULL);
+		vflist_setup_iter_recursive(vf, GTK_TREE_STORE(store), &iter, fd->sidecar_files, NULL, FALSE);
 		}
 	file_data_register_notify_func(vf_notify_cb, vf, NOTIFY_PRIORITY_MEDIUM);
 
@@ -2055,7 +2055,12 @@
 	if (VFLIST(vf)->thumbs_enabled == enable) return;
 
 	VFLIST(vf)->thumbs_enabled = enable;
-	if (vf->layout) vf_refresh(vf);
+	
+	/* vflist_populate_view is better than vf_refresh:
+	   - no need to re-read the directory
+	   - force update because the formatted string has changed
+	*/
+	if (vf->layout) vflist_populate_view(vf, TRUE); 
 }
 
 void vflist_marks_set(ViewFile *vf, gboolean enable)