Mercurial > geeqie
comparison src/filelist.c @ 318:b16b9b8979e5
Add a new struct ConfOptions to handle options.
Changes were made among the code to use only one global var
named "options" of type ConfOptions *.
Initialization takes place in new init_options().
author | zas_ |
---|---|
date | Fri, 11 Apr 2008 22:14:36 +0000 |
parents | 667e49f52168 |
children | 3c4bad726e98 |
comparison
equal
deleted
inserted
replaced
317:46169c246c51 | 318:b16b9b8979e5 |
---|---|
316 gint filter_name_exists(const gchar *name) | 316 gint filter_name_exists(const gchar *name) |
317 { | 317 { |
318 GList *work; | 318 GList *work; |
319 gint ln; | 319 gint ln; |
320 | 320 |
321 if (!extension_list || file_filter_disable) return TRUE; | 321 if (!extension_list || options->file_filter_disable) return TRUE; |
322 | 322 |
323 ln = strlen(name); | 323 ln = strlen(name); |
324 work = extension_list; | 324 work = extension_list; |
325 while (work) | 325 while (work) |
326 { | 326 { |
421 | 421 |
422 GList *path_list_filter(GList *list, gint is_dir_list) | 422 GList *path_list_filter(GList *list, gint is_dir_list) |
423 { | 423 { |
424 GList *work; | 424 GList *work; |
425 | 425 |
426 if (!is_dir_list && file_filter_disable && show_dot_files) return list; | 426 if (!is_dir_list && options->file_filter_disable && options->show_dot_files) return list; |
427 | 427 |
428 work = list; | 428 work = list; |
429 while (work) | 429 while (work) |
430 { | 430 { |
431 gchar *name = work->data; | 431 gchar *name = work->data; |
432 const gchar *base; | 432 const gchar *base; |
433 | 433 |
434 base = filename_from_path(name); | 434 base = filename_from_path(name); |
435 | 435 |
436 if ((!show_dot_files && ishidden(base)) || | 436 if ((!options->show_dot_files && ishidden(base)) || |
437 (!is_dir_list && !filter_name_exists(base)) || | 437 (!is_dir_list && !filter_name_exists(base)) || |
438 (is_dir_list && base[0] == '.' && (strcmp(base, GQ_CACHE_LOCAL_THUMB) == 0 || | 438 (is_dir_list && base[0] == '.' && (strcmp(base, GQ_CACHE_LOCAL_THUMB) == 0 || |
439 strcmp(base, GQ_CACHE_LOCAL_METADATA) == 0)) ) | 439 strcmp(base, GQ_CACHE_LOCAL_METADATA) == 0)) ) |
440 { | 440 { |
441 GList *link = work; | 441 GList *link = work; |
1218 } | 1218 } |
1219 | 1219 |
1220 while ((dir = readdir(dp)) != NULL) | 1220 while ((dir = readdir(dp)) != NULL) |
1221 { | 1221 { |
1222 gchar *name = dir->d_name; | 1222 gchar *name = dir->d_name; |
1223 if (show_dot_files || !ishidden(name)) | 1223 if (options->show_dot_files || !ishidden(name)) |
1224 { | 1224 { |
1225 gchar *filepath = g_strconcat(pathl, "/", name, NULL); | 1225 gchar *filepath = g_strconcat(pathl, "/", name, NULL); |
1226 if ((follow_symlinks ? | 1226 if ((follow_symlinks ? |
1227 stat(filepath, &ent_sbuf) : | 1227 stat(filepath, &ent_sbuf) : |
1228 lstat(filepath, &ent_sbuf)) >= 0) | 1228 lstat(filepath, &ent_sbuf)) >= 0) |
1347 | 1347 |
1348 GList *filelist_filter(GList *list, gint is_dir_list) | 1348 GList *filelist_filter(GList *list, gint is_dir_list) |
1349 { | 1349 { |
1350 GList *work; | 1350 GList *work; |
1351 | 1351 |
1352 if (!is_dir_list && file_filter_disable && show_dot_files) return list; | 1352 if (!is_dir_list && options->file_filter_disable && options->show_dot_files) return list; |
1353 | 1353 |
1354 work = list; | 1354 work = list; |
1355 while (work) | 1355 while (work) |
1356 { | 1356 { |
1357 FileData *fd = (FileData *)(work->data); | 1357 FileData *fd = (FileData *)(work->data); |
1358 const gchar *name = fd->name; | 1358 const gchar *name = fd->name; |
1359 | 1359 |
1360 if ((!show_dot_files && ishidden(name)) || | 1360 if ((!options->show_dot_files && ishidden(name)) || |
1361 (!is_dir_list && !filter_name_exists(name)) || | 1361 (!is_dir_list && !filter_name_exists(name)) || |
1362 (is_dir_list && name[0] == '.' && (strcmp(name, GQ_CACHE_LOCAL_THUMB) == 0 || | 1362 (is_dir_list && name[0] == '.' && (strcmp(name, GQ_CACHE_LOCAL_THUMB) == 0 || |
1363 strcmp(name, GQ_CACHE_LOCAL_METADATA) == 0)) ) | 1363 strcmp(name, GQ_CACHE_LOCAL_METADATA) == 0)) ) |
1364 { | 1364 { |
1365 GList *link = work; | 1365 GList *link = work; |