Reintroduce file_data_new_simple()
authorKlaus Ethgen <Klaus@Ethgen.de>
Thu, 25 Feb 2016 15:48:22 +0000 (16:48 +0100)
committerKlaus Ethgen <Klaus@Ethgen.de>
Thu, 25 Feb 2016 15:48:22 +0000 (16:48 +0100)
This was removed by Vladimir with
efc8096527d6f743d17c44b9982616a169973f39 to always check for sidecars.

However, the newly introduced function file_data_new_group() is very
expensive. Having it in collection (in sort manager) where the dirs of
that files have huge amount of files inside, that is simply blocking
whole geeqie.

It might be that the file_data_new_group() function need to be disarmed
on other places too.

src/collect-io.c
src/filedata.c

index aab9c52..0336108 100644 (file)
@@ -162,7 +162,7 @@ static gboolean collection_load_private(CollectionData *cd, const gchar *path, C
                        if (!flush)
                                changed |= collect_manager_process_action(entry, &buf);
 
-                       valid = (buf[0] == G_DIR_SEPARATOR && collection_add_check(cd, file_data_new_group(buf), FALSE, TRUE));
+                       valid = (buf[0] == G_DIR_SEPARATOR && collection_add_check(cd, file_data_new_simple(buf), FALSE, TRUE));
                        if (!valid) DEBUG_1("collection invalid file: %s", buf);
 
                        total++;
index c99f3a9..c4e0525 100644 (file)
@@ -414,6 +414,27 @@ static FileData *file_data_new_local(const gchar *path, struct stat *st, gboolea
        return ret;
 }
 
+FileData *file_data_new_simple(const gchar *path_utf8)
+{
+       struct stat st;
+       FileData *fd;
+
+       if (!stat_utf8(path_utf8, &st))
+               {
+               st.st_size = 0;
+               st.st_mtime = 0;
+               }
+
+       fd = g_hash_table_lookup(file_data_pool, path_utf8);
+       if (!fd) fd = file_data_new(path_utf8, &st, TRUE);
+       if (fd)
+               {
+               file_data_ref(fd);
+               }
+
+       return fd;
+}
+
 void init_exif_time_data(GList *files)
 {
        FileData *file;