Mercurial > geeqie
changeset 763:81f9e8dbb4bf
improved infrastructure for tracing changes, optimized vflist_populate_view
author | nadvornik |
---|---|
date | Wed, 28 May 2008 22:12:10 +0000 |
parents | e6927cef8541 |
children | ae618ebec3e9 |
files | src/filedata.c src/filedata.h src/typedefs.h src/view_file_icon.c src/view_file_list.c |
diffstat | 5 files changed, 26 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/filedata.c Tue May 27 18:46:34 2008 +0000 +++ b/src/filedata.c Wed May 28 22:12:10 2008 +0000 @@ -136,6 +136,13 @@ FileData *file_data_disconnect_sidecar_file(FileData *target, FileData *sfd); +void file_data_increment_version(FileData *fd) +{ + fd->version++; + if (fd->parent) fd->parent->version++; +} + + static void file_data_set_path(FileData *fd, const gchar *path) { @@ -184,6 +191,7 @@ fd->date = st->st_mtime; if (fd->pixbuf) g_object_unref(fd->pixbuf); fd->pixbuf = NULL; + file_data_increment_version(fd); } work = fd->sidecar_files; @@ -1347,6 +1355,7 @@ fd->original_path = g_strdup(fd->change->dest); g_hash_table_insert(file_data_pool, fd->original_path, fd); } + file_data_increment_version(fd); } gint file_data_sc_apply_ci(FileData *fd)
--- a/src/filedata.h Tue May 27 18:46:34 2008 +0000 +++ b/src/filedata.h Wed May 28 22:12:10 2008 +0000 @@ -24,6 +24,8 @@ FileData *file_data_ref(FileData *fd); void file_data_unref(FileData *fd); +void file_data_increment_version(FileData *fd); + gboolean file_data_add_change_info(FileData *fd, FileDataChangeType type, const gchar *src, const gchar *dest); void file_data_change_info_free(FileDataChangeInfo *fdci, FileData *fd);
--- a/src/typedefs.h Tue May 27 18:46:34 2008 +0000 +++ b/src/typedefs.h Wed May 28 22:12:10 2008 +0000 @@ -433,6 +433,7 @@ FileDataChangeInfo *change; /* for rename, move ... */ GdkPixbuf *pixbuf; gint ref; + gint version; /* increased when any field in this structure is changed */ gint user_orientation; gint exif_orientation; };
--- a/src/view_file_icon.c Tue May 27 18:46:34 2008 +0000 +++ b/src/view_file_icon.c Wed May 28 22:12:10 2008 +0000 @@ -959,6 +959,7 @@ case STM_MODE_TOGGLE: fd->marks[n] = !fd->marks[mark]; break; } + file_data_increment_version(fd); work = work->next; }
--- a/src/view_file_list.c Tue May 27 18:46:34 2008 +0000 +++ b/src/view_file_list.c Wed May 28 22:12:10 2008 +0000 @@ -34,6 +34,7 @@ enum { FILE_COLUMN_POINTER = 0, + FILE_COLUMN_VERSION, FILE_COLUMN_THUMB, FILE_COLUMN_NAME, FILE_COLUMN_SIDECARS, @@ -717,6 +718,7 @@ size = text_from_size(fd->size); gtk_tree_store_set(store, iter, FILE_COLUMN_POINTER, fd, + FILE_COLUMN_VERSION, fd->version, FILE_COLUMN_THUMB, (VFLIST_INFO(vf, thumbs_enabled)) ? fd->pixbuf : NULL, FILE_COLUMN_NAME, fd->name, FILE_COLUMN_SIDECARS, sidecars, @@ -1418,6 +1420,8 @@ case STM_MODE_TOGGLE: fd->marks[n] = !fd->marks[n]; break; } + + file_data_increment_version(fd); gtk_tree_store_set(GTK_TREE_STORE(store), &iter, FILE_COLUMN_MARKS + n, fd->marks[n], -1); @@ -1496,10 +1500,14 @@ while (!done) { FileData *old_fd = NULL; + gint old_version = 0; if (valid) { - gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, FILE_COLUMN_POINTER, &old_fd, -1); + gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, + FILE_COLUMN_POINTER, &old_fd, + FILE_COLUMN_VERSION, &old_version, + -1); if (fd == old_fd) { @@ -1540,7 +1548,8 @@ } else { - vflist_setup_iter_with_sidecars(vf, store, &iter, fd); + if (old_version != fd->version) + vflist_setup_iter_with_sidecars(vf, store, &iter, fd); if (valid) valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter); @@ -1701,6 +1710,7 @@ gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, FILE_COLUMN_POINTER, &fd, col_idx, &mark, -1); mark = !mark; fd->marks[col_idx - FILE_COLUMN_MARKS] = mark; + file_data_increment_version(fd); gtk_tree_store_set(store, &iter, col_idx, mark, -1); gtk_tree_path_free(path); @@ -1783,6 +1793,7 @@ VFLIST_INFO(vf, select_idle_id) = -1; flist_types[FILE_COLUMN_POINTER] = G_TYPE_POINTER; + flist_types[FILE_COLUMN_VERSION] = G_TYPE_INT; flist_types[FILE_COLUMN_THUMB] = GDK_TYPE_PIXBUF; flist_types[FILE_COLUMN_NAME] = G_TYPE_STRING; flist_types[FILE_COLUMN_SIDECARS] = G_TYPE_STRING;