Mercurial > geeqie.yaz
comparison src/filedata.c @ 1713:30d649102a9f
fixes sidecar file grouping
files with a number in extension were listed twice, it
caused problems later
author | nadvornik |
---|---|
date | Mon, 07 Sep 2009 19:48:05 +0000 |
parents | b16a453bfde6 |
children | 9c7d4fe93759 |
comparison
equal
deleted
inserted
replaced
1712:7f91f906f9c2 | 1713:30d649102a9f |
---|---|
365 sfd = work->data; | 365 sfd = work->data; |
366 work = work->next; | 366 work = work->next; |
367 | 367 |
368 file_data_disconnect_sidecar_file(fd, sfd); | 368 file_data_disconnect_sidecar_file(fd, sfd); |
369 } | 369 } |
370 if (sfd) file_data_check_sidecars(sfd, FALSE); /* this will group the sidecars back together */ | 370 if (sfd) file_data_check_sidecars(sfd, NULL); /* this will group the sidecars back together */ |
371 file_data_send_notification(fd, NOTIFY_REREAD); | 371 file_data_send_notification(fd, NOTIFY_REREAD); |
372 } | 372 } |
373 else | 373 else |
374 { | 374 { |
375 ret |= file_data_check_changed_files_recursive(fd, &st); | 375 ret |= file_data_check_changed_files_recursive(fd, &st); |
442 gchar *extl; | 442 gchar *extl; |
443 gint ext_len; | 443 gint ext_len; |
444 GList *list = NULL; | 444 GList *list = NULL; |
445 | 445 |
446 sl = path_from_utf8(path); | 446 sl = path_from_utf8(path); |
447 | 447 |
448 extl = strrchr(sl, '.'); | 448 extl = strrchr(sl, '.'); |
449 if (extl) | 449 if (extl) |
450 { | 450 { |
451 gint i, j; | 451 gint i, j; |
452 extl++; /* the first char after . */ | 452 extl++; /* the first char after . */ |
453 ext_len = strlen(extl); | 453 ext_len = strlen(extl); |
454 | 454 |
455 for (i = 0; i < (1 << ext_len); i++) | 455 for (i = 0; i < (1 << ext_len); i++) |
456 { | 456 { |
457 struct stat st; | 457 struct stat st; |
458 gboolean skip = FALSE; | |
458 for (j = 0; j < ext_len; j++) | 459 for (j = 0; j < ext_len; j++) |
459 { | 460 { |
460 if (i & (1 << (ext_len - 1 - j))) | 461 if (i & (1 << (ext_len - 1 - j))) |
462 { | |
461 extl[j] = g_ascii_tolower(extl[j]); | 463 extl[j] = g_ascii_tolower(extl[j]); |
464 /* make sure the result does not contain duplicates */ | |
465 if (extl[j] == g_ascii_toupper(extl[j])) | |
466 { | |
467 /* no change, probably a number, we have already tested this combination */ | |
468 skip = TRUE; | |
469 break; | |
470 } | |
471 } | |
462 else | 472 else |
463 extl[j] = g_ascii_toupper(extl[j]); | 473 extl[j] = g_ascii_toupper(extl[j]); |
464 } | 474 } |
475 if (skip) continue; | |
476 | |
465 if (stat(sl, &st) == 0) | 477 if (stat(sl, &st) == 0) |
466 { | 478 { |
467 list = g_list_prepend(list, file_data_new_local(sl, &st, FALSE, FALSE)); | 479 list = g_list_prepend(list, file_data_new_local(sl, &st, FALSE, FALSE)); |
468 } | 480 } |
469 } | 481 } |