comparison src/view_file_list.c @ 1702:2725ab224b07

fixed switching of multiline texts
author nadvornik
date Fri, 24 Jul 2009 13:32:37 +0000
parents bda2d599cc70
children 80c83468a47c
comparison
equal deleted inserted replaced
1701:2309e6150e8c 1702:2725ab224b07
63 63
64 64
65 65
66 static gboolean vflist_row_is_selected(ViewFile *vf, FileData *fd); 66 static gboolean vflist_row_is_selected(ViewFile *vf, FileData *fd);
67 static gboolean vflist_row_rename_cb(TreeEditData *td, const gchar *old, const gchar *new, gpointer data); 67 static gboolean vflist_row_rename_cb(TreeEditData *td, const gchar *old, const gchar *new, gpointer data);
68 static void vflist_populate_view(ViewFile *vf); 68 static void vflist_populate_view(ViewFile *vf, gboolean force);
69 static gboolean vflist_is_multiline(ViewFile *vf); 69 static gboolean vflist_is_multiline(ViewFile *vf);
70 static void vflist_set_expanded(ViewFile *vf, GtkTreeIter *iter, gboolean expanded); 70 static void vflist_set_expanded(ViewFile *vf, GtkTreeIter *iter, gboolean expanded);
71 71
72 72
73 /* 73 /*
932 g_free(sidecars); 932 g_free(sidecars);
933 g_free(name); 933 g_free(name);
934 g_free(formatted); 934 g_free(formatted);
935 } 935 }
936 936
937 static void vflist_setup_iter_recursive(ViewFile *vf, GtkTreeStore *store, GtkTreeIter *parent_iter, GList *list, GList *selected) 937 static void vflist_setup_iter_recursive(ViewFile *vf, GtkTreeStore *store, GtkTreeIter *parent_iter, GList *list, GList *selected, gboolean force)
938 { 938 {
939 GList *work; 939 GList *work;
940 GtkTreeIter iter; 940 GtkTreeIter iter;
941 gboolean valid; 941 gboolean valid;
942 gint num_ordered = 0; 942 gint num_ordered = 0;
1001 num_prepended++; 1001 num_prepended++;
1002 gtk_tree_store_prepend(store, &new, parent_iter); 1002 gtk_tree_store_prepend(store, &new, parent_iter);
1003 } 1003 }
1004 1004
1005 vflist_setup_iter(vf, store, &new, file_data_ref(fd)); 1005 vflist_setup_iter(vf, store, &new, file_data_ref(fd));
1006 vflist_setup_iter_recursive(vf, store, &new, fd->sidecar_files, selected); 1006 vflist_setup_iter_recursive(vf, store, &new, fd->sidecar_files, selected, force);
1007 1007
1008 if (g_list_find(selected, fd)) 1008 if (g_list_find(selected, fd))
1009 { 1009 {
1010 /* renamed files - the same fd appears at different position - select it again*/ 1010 /* renamed files - the same fd appears at different position - select it again*/
1011 GtkTreeSelection *selection; 1011 GtkTreeSelection *selection;
1020 file_data_unref(old_fd); 1020 file_data_unref(old_fd);
1021 valid = gtk_tree_store_remove(store, &iter); 1021 valid = gtk_tree_store_remove(store, &iter);
1022 } 1022 }
1023 else 1023 else
1024 { 1024 {
1025 if (fd->version != old_version) 1025 if (fd->version != old_version || force)
1026 { 1026 {
1027 vflist_setup_iter(vf, store, &iter, fd); 1027 vflist_setup_iter(vf, store, &iter, fd);
1028 vflist_setup_iter_recursive(vf, store, &iter, fd->sidecar_files, selected); 1028 vflist_setup_iter_recursive(vf, store, &iter, fd->sidecar_files, selected, force);
1029 } 1029 }
1030 1030
1031 if (valid) valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter); 1031 if (valid) valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
1032 1032
1033 done = TRUE; 1033 done = TRUE;
1665 else 1665 else
1666 { 1666 {
1667 /* mark functions can have various side effects - update all columns to be sure */ 1667 /* mark functions can have various side effects - update all columns to be sure */
1668 vflist_setup_iter(vf, GTK_TREE_STORE(store), &iter, fd); 1668 vflist_setup_iter(vf, GTK_TREE_STORE(store), &iter, fd);
1669 /* mark functions can change sidecars too */ 1669 /* mark functions can change sidecars too */
1670 vflist_setup_iter_recursive(vf, GTK_TREE_STORE(store), &iter, fd->sidecar_files, NULL); 1670 vflist_setup_iter_recursive(vf, GTK_TREE_STORE(store), &iter, fd->sidecar_files, NULL, FALSE);
1671 } 1671 }
1672 1672
1673 1673
1674 file_data_register_notify_func(vf_notify_cb, vf, NOTIFY_PRIORITY_MEDIUM); 1674 file_data_register_notify_func(vf_notify_cb, vf, NOTIFY_PRIORITY_MEDIUM);
1675 1675
1721 { 1721 {
1722 return (VFLIST(vf)->thumbs_enabled && options->thumbnails.max_height >= 48); 1722 return (VFLIST(vf)->thumbs_enabled && options->thumbnails.max_height >= 48);
1723 } 1723 }
1724 1724
1725 1725
1726 static void vflist_populate_view(ViewFile *vf) 1726 static void vflist_populate_view(ViewFile *vf, gboolean force)
1727 { 1727 {
1728 GtkTreeStore *store; 1728 GtkTreeStore *store;
1729 GList *selected; 1729 GList *selected;
1730 1730
1731 store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vf->listview))); 1731 store = GTK_TREE_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vf->listview)));
1741 1741
1742 vflist_listview_set_columns(vf->listview, VFLIST(vf)->thumbs_enabled, vflist_is_multiline(vf)); 1742 vflist_listview_set_columns(vf->listview, VFLIST(vf)->thumbs_enabled, vflist_is_multiline(vf));
1743 1743
1744 selected = vflist_selection_get_list(vf); 1744 selected = vflist_selection_get_list(vf);
1745 1745
1746 vflist_setup_iter_recursive(vf, store, NULL, vf->list, selected); 1746 vflist_setup_iter_recursive(vf, store, NULL, vf->list, selected, force);
1747 1747
1748 if (selected && vflist_selection_count(vf, NULL) == 0) 1748 if (selected && vflist_selection_count(vf, NULL) == 0)
1749 { 1749 {
1750 /* all selected files disappeared */ 1750 /* all selected files disappeared */
1751 vflist_select_closest(vf, selected->data); 1751 vflist_select_closest(vf, selected->data);
1778 vf->list = filelist_sort(vf->list, vf->sort_method, vf->sort_ascend); 1778 vf->list = filelist_sort(vf->list, vf->sort_method, vf->sort_ascend);
1779 } 1779 }
1780 1780
1781 DEBUG_1("%s vflist_refresh: populate view", get_exec_time()); 1781 DEBUG_1("%s vflist_refresh: populate view", get_exec_time());
1782 1782
1783 vflist_populate_view(vf); 1783 vflist_populate_view(vf, FALSE);
1784 1784
1785 filelist_free(old_list); 1785 filelist_free(old_list);
1786 DEBUG_1("%s vflist_refresh: done", get_exec_time()); 1786 DEBUG_1("%s vflist_refresh: done", get_exec_time());
1787 1787
1788 return ret; 1788 return ret;
1908 else 1908 else
1909 { 1909 {
1910 /* mark functions can have various side effects - update all columns to be sure */ 1910 /* mark functions can have various side effects - update all columns to be sure */
1911 vflist_setup_iter(vf, GTK_TREE_STORE(store), &iter, fd); 1911 vflist_setup_iter(vf, GTK_TREE_STORE(store), &iter, fd);
1912 /* mark functions can change sidecars too */ 1912 /* mark functions can change sidecars too */
1913 vflist_setup_iter_recursive(vf, GTK_TREE_STORE(store), &iter, fd->sidecar_files, NULL); 1913 vflist_setup_iter_recursive(vf, GTK_TREE_STORE(store), &iter, fd->sidecar_files, NULL, FALSE);
1914 } 1914 }
1915 file_data_register_notify_func(vf_notify_cb, vf, NOTIFY_PRIORITY_MEDIUM); 1915 file_data_register_notify_func(vf_notify_cb, vf, NOTIFY_PRIORITY_MEDIUM);
1916 1916
1917 gtk_tree_path_free(path); 1917 gtk_tree_path_free(path);
1918 } 1918 }
2053 void vflist_thumb_set(ViewFile *vf, gboolean enable) 2053 void vflist_thumb_set(ViewFile *vf, gboolean enable)
2054 { 2054 {
2055 if (VFLIST(vf)->thumbs_enabled == enable) return; 2055 if (VFLIST(vf)->thumbs_enabled == enable) return;
2056 2056
2057 VFLIST(vf)->thumbs_enabled = enable; 2057 VFLIST(vf)->thumbs_enabled = enable;
2058 if (vf->layout) vf_refresh(vf); 2058
2059 /* vflist_populate_view is better than vf_refresh:
2060 - no need to re-read the directory
2061 - force update because the formatted string has changed
2062 */
2063 if (vf->layout) vflist_populate_view(vf, TRUE);
2059 } 2064 }
2060 2065
2061 void vflist_marks_set(ViewFile *vf, gboolean enable) 2066 void vflist_marks_set(ViewFile *vf, gboolean enable)
2062 { 2067 {
2063 GList *columns, *work; 2068 GList *columns, *work;