Mercurial > geeqie
comparison src/filelist.c @ 576:9dc0513837b5
dropped path_list functions, use filelist functions everywhere
author | nadvornik |
---|---|
date | Sun, 04 May 2008 21:54:20 +0000 |
parents | 985fdfebd89e |
children |
comparison
equal
deleted
inserted
replaced
575:b941403a4cd9 | 576:9dc0513837b5 |
---|---|
424 g_free(key); | 424 g_free(key); |
425 g_free(ext); | 425 g_free(ext); |
426 g_free(desc); | 426 g_free(desc); |
427 } | 427 } |
428 | 428 |
429 GList *path_list_filter(GList *list, gint is_dir_list) | |
430 { | |
431 GList *work; | |
432 | |
433 if (!is_dir_list && options->file_filter.disable && options->file_filter.show_hidden_files) return list; | |
434 | |
435 work = list; | |
436 while (work) | |
437 { | |
438 gchar *name = work->data; | |
439 const gchar *base; | |
440 | |
441 base = filename_from_path(name); | |
442 | |
443 if ((!options->file_filter.show_hidden_files && ishidden(base)) || | |
444 (!is_dir_list && !filter_name_exists(base)) || | |
445 (is_dir_list && base[0] == '.' && (strcmp(base, GQ_CACHE_LOCAL_THUMB) == 0 || | |
446 strcmp(base, GQ_CACHE_LOCAL_METADATA) == 0)) ) | |
447 { | |
448 GList *link = work; | |
449 work = work->next; | |
450 list = g_list_remove_link(list, link); | |
451 g_free(name); | |
452 g_list_free(link); | |
453 } | |
454 else | |
455 { | |
456 work = work->next; | |
457 } | |
458 } | |
459 | |
460 return list; | |
461 } | |
462 | |
463 | |
464 /* | 429 /* |
465 *----------------------------------------------------------------------------- | 430 *----------------------------------------------------------------------------- |
466 * sidecar extension list | 431 * sidecar extension list |
467 *----------------------------------------------------------------------------- | 432 *----------------------------------------------------------------------------- |
468 */ | 433 */ |
521 } | 486 } |
522 | 487 |
523 void sidecar_ext_add_defaults() | 488 void sidecar_ext_add_defaults() |
524 { | 489 { |
525 sidecar_ext_parse(".jpg;.cr2;.nef;.crw;.xmp", FALSE); | 490 sidecar_ext_parse(".jpg;.cr2;.nef;.crw;.xmp", FALSE); |
526 } | |
527 | |
528 /* | |
529 *----------------------------------------------------------------------------- | |
530 * path list recursive | |
531 *----------------------------------------------------------------------------- | |
532 */ | |
533 | |
534 static gint path_list_sort_cb(gconstpointer a, gconstpointer b) | |
535 { | |
536 return CASE_SORT((gchar *)a, (gchar *)b); | |
537 } | |
538 | |
539 GList *path_list_sort(GList *list) | |
540 { | |
541 return g_list_sort(list, path_list_sort_cb); | |
542 } | |
543 | |
544 static void path_list_recursive_append(GList **list, GList *dirs) | |
545 { | |
546 GList *work; | |
547 | |
548 work = dirs; | |
549 while (work) | |
550 { | |
551 const gchar *path = work->data; | |
552 GList *f = NULL; | |
553 GList *d = NULL; | |
554 | |
555 if (path_list(path, &f, &d)) | |
556 { | |
557 f = path_list_filter(f, FALSE); | |
558 f = path_list_sort(f); | |
559 *list = g_list_concat(*list, f); | |
560 | |
561 d = path_list_filter(d, TRUE); | |
562 d = path_list_sort(d); | |
563 path_list_recursive_append(list, d); | |
564 path_list_free(d); | |
565 } | |
566 | |
567 work = work->next; | |
568 } | |
569 } | |
570 | |
571 GList *path_list_recursive(const gchar *path) | |
572 { | |
573 GList *list = NULL; | |
574 GList *d = NULL; | |
575 | |
576 if (!path_list(path, &list, &d)) return NULL; | |
577 list = path_list_filter(list, FALSE); | |
578 list = path_list_sort(list); | |
579 | |
580 d = path_list_filter(d, TRUE); | |
581 d = path_list_sort(d); | |
582 path_list_recursive_append(&list, d); | |
583 path_list_free(d); | |
584 | |
585 return list; | |
586 } | 491 } |
587 | 492 |
588 /* | 493 /* |
589 *----------------------------------------------------------------------------- | 494 *----------------------------------------------------------------------------- |
590 * text conversion utils | 495 * text conversion utils |