From e0e345cef808a23a0d4a2b5ce2194b60054c2ee3 Mon Sep 17 00:00:00 2001 From: John Ellis Date: Thu, 14 Apr 2005 14:56:17 +0000 Subject: [PATCH] Thu Apr 14 10:44:00 2005 John Ellis * cache.c (cache_sim_data_load): Fix to return CacheData if any data type exists. * pan-view.c: Fix slow merging of embedded dates into file list; includes optimizing pan_cache_sync_date and plugging a memory leak. ##### Note: GQview CVS on sourceforge is not always up to date, please use ##### ##### an offical release when making enhancements and translation updates. ##### --- ChangeLog | 7 +++++++ TODO | 3 +-- src/cache.c | 6 +++++- src/pan-view.c | 28 +++++++++++++++------------- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index e5576dfa..09bfe610 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Thu Apr 14 10:44:00 2005 John Ellis + + * cache.c (cache_sim_data_load): Fix to return CacheData if any data + type exists. + * pan-view.c: Fix slow merging of embedded dates into file list; + includes optimizing pan_cache_sync_date and plugging a memory leak. + Thu Apr 14 04:49:57 2005 John Ellis * pixbuf-renderer.c (pixbuf_renderer_move): Clear the correct draw diff --git a/TODO b/TODO index 9db50ccb..9976fd70 100644 --- a/TODO +++ b/TODO @@ -31,9 +31,8 @@ Major: > introduced bug (looks like clamp or rounding error) d> optimize pixbuf_draw_triangle > introduced bug (round error?) - > does new pixbuf_draw_triangle contain line edge rounding error? > check ref counting of image when redrawing after finish loading - > speed up sorting image.. stage when sorting/merging cache list + d> speed up sorting image.. stage when sorting/merging cache list > time line view: diff --git a/src/cache.c b/src/cache.c index e2bb0940..597706ac 100644 --- a/src/cache.c +++ b/src/cache.c @@ -476,7 +476,11 @@ CacheData *cache_sim_data_load(const gchar *path) fclose(f); - if (!cd->dimensions && !cd->similarity) + if (!cd->dimensions && + !cd->have_date && + !cd->have_checksum && + !cd->have_md5sum && + !cd->similarity) { cache_sim_data_free(cd); cd = NULL; diff --git a/src/pan-view.c b/src/pan-view.c index 15e5a422..815eccad 100644 --- a/src/pan-view.c +++ b/src/pan-view.c @@ -546,6 +546,7 @@ static gint pan_cache_step(PanWindow *pw) return (pw->cache_cl == NULL); } +/* This sync date function is optimized for lists with a common sort */ static void pan_cache_sync_date(PanWindow *pw, GList *list) { GList *haystack; @@ -572,16 +573,13 @@ static void pan_cache_sync_date(PanWindow *pw, GList *list) path = ((FileData *)pc)->path; if (path && strcmp(path, fd->path) == 0) { - GList *tmp; - if (pc->cd && pc->cd->have_date && pc->cd->date >= 0) { fd->date = pc->cd->date; } - tmp = needle; - needle = needle->next; - haystack = g_list_delete_link(haystack, tmp); + haystack = g_list_delete_link(haystack, needle); + needle = NULL; } else { @@ -589,6 +587,8 @@ static void pan_cache_sync_date(PanWindow *pw, GList *list) } } } + + g_list_free(haystack); } /* @@ -1911,17 +1911,18 @@ static void pan_window_layout_compute_calendar(PanWindow *pw, const gchar *path, gint end_year = 0; gint end_month = 0; - pw->cache_list = filelist_sort(pw->cache_list, SORT_TIME, TRUE); - list = pan_window_layout_list(path, SORT_NONE, TRUE); - list = filelist_sort(list, SORT_TIME, TRUE); if (pw->cache_list && SORT_BY_EXIF_DATE) { + pw->cache_list = filelist_sort(pw->cache_list, SORT_NAME, TRUE); + list = filelist_sort(list, SORT_NAME, TRUE); pan_cache_sync_date(pw, list); - list = filelist_sort(list, SORT_TIME, TRUE); } + pw->cache_list = filelist_sort(pw->cache_list, SORT_TIME, TRUE); + list = filelist_sort(list, SORT_TIME, TRUE); + day_max = 0; count = 0; tc = 0; @@ -2132,17 +2133,18 @@ static void pan_window_layout_compute_timeline(PanWindow *pw, const gchar *path, gint x_width; gint y_height; - pw->cache_list = filelist_sort(pw->cache_list, SORT_TIME, TRUE); - list = pan_window_layout_list(path, SORT_NONE, TRUE); - list = filelist_sort(list, SORT_TIME, TRUE); if (pw->cache_list && SORT_BY_EXIF_DATE) { + pw->cache_list = filelist_sort(pw->cache_list, SORT_NAME, TRUE); + list = filelist_sort(list, SORT_NAME, TRUE); pan_cache_sync_date(pw, list); - list = filelist_sort(list, SORT_TIME, TRUE); } + pw->cache_list = filelist_sort(pw->cache_list, SORT_TIME, TRUE); + list = filelist_sort(list, SORT_TIME, TRUE); + *width = PAN_FOLDER_BOX_BORDER * 2; *height = PAN_FOLDER_BOX_BORDER * 2; -- 2.20.1