Mercurial > geeqie
comparison src/filedata.c @ 596:f8c93e1d728d
use some of the new functions in filedata.c
author | nadvornik |
---|---|
date | Tue, 06 May 2008 20:24:16 +0000 |
parents | 2b7b966f61cf |
children | 8268cbe682f1 |
comparison
equal
deleted
inserted
replaced
595:15766932414c | 596:f8c93e1d728d |
---|---|
438 if (len1 > len2) return 1; | 438 if (len1 > len2) return 1; |
439 | 439 |
440 return strncmp(fd1->name, fd2->name, len1); | 440 return strncmp(fd1->name, fd2->name, len1); |
441 } | 441 } |
442 | 442 |
443 void file_data_do_change(FileData *fd) | |
444 { | |
445 //FIXME sidecars | |
446 g_assert(fd->change); | |
447 g_free(fd->path); | |
448 g_hash_table_remove(file_data_pool, fd->original_path); | |
449 g_free(fd->original_path); | |
450 file_data_set_path(fd, fd->change->dest); | |
451 fd->original_path = g_strdup(fd->change->dest); | |
452 g_hash_table_insert(file_data_pool, fd->original_path, fd); | |
453 | |
454 } | |
455 | |
456 gboolean file_data_add_change_info(FileData *fd, FileDataChangeType type, const gchar *src, const gchar *dest) | 443 gboolean file_data_add_change_info(FileData *fd, FileDataChangeType type, const gchar *src, const gchar *dest) |
457 { | 444 { |
458 | 445 |
459 FileDataChangeInfo *fdci; | 446 FileDataChangeInfo *fdci; |
460 | 447 |
521 i++; | 508 i++; |
522 } | 509 } |
523 return 0; | 510 return 0; |
524 } | 511 } |
525 | 512 |
526 gchar *sidecar_file_data_list_to_string(FileData *fd) | |
527 { | |
528 GList *work; | |
529 GString *result = g_string_new(""); | |
530 | |
531 work = fd->sidecar_files; | |
532 while (work) | |
533 { | |
534 FileData *sfd = work->data; | |
535 result = g_string_append(result, "+ "); | |
536 result = g_string_append(result, sfd->extension); | |
537 work = work->next; | |
538 if (work) result = g_string_append_c(result, ' '); | |
539 } | |
540 | |
541 return g_string_free(result, FALSE); | |
542 } | |
543 | 513 |
544 /* | 514 /* |
545 *----------------------------------------------------------------------------- | 515 *----------------------------------------------------------------------------- |
546 * load file list | 516 * load file list |
547 *----------------------------------------------------------------------------- | 517 *----------------------------------------------------------------------------- |
895 * file_data_sc - operates on the given fd + sidecars - all fds linked via fd->sidecar_files or fd->parent | 865 * file_data_sc - operates on the given fd + sidecars - all fds linked via fd->sidecar_files or fd->parent |
896 */ | 866 */ |
897 | 867 |
898 | 868 |
899 /* return list of sidecar file extensions in a string */ | 869 /* return list of sidecar file extensions in a string */ |
900 gchar *file_data_sc_list_to_string(FileData *fd); // now gchar *sidecar_file_data_list_to_string(FileData *fd) | 870 gchar *file_data_sc_list_to_string(FileData *fd) |
871 { | |
872 GList *work; | |
873 GString *result = g_string_new(""); | |
874 | |
875 work = fd->sidecar_files; | |
876 while (work) | |
877 { | |
878 FileData *sfd = work->data; | |
879 result = g_string_append(result, "+ "); | |
880 result = g_string_append(result, sfd->extension); | |
881 work = work->next; | |
882 if (work) result = g_string_append_c(result, ' '); | |
883 } | |
884 | |
885 return g_string_free(result, FALSE); | |
886 } | |
901 | 887 |
902 | 888 |
903 /* disables / enables grouping for particular file, sends UPDATE notification */ | 889 /* disables / enables grouping for particular file, sends UPDATE notification */ |
904 void file_data_disable_grouping(FileData *fd); // now file_data_disconnect_sidecar_file, broken | 890 void file_data_disable_grouping(FileData *fd); // now file_data_disconnect_sidecar_file, broken |
905 void file_data_disable_grouping(FileData *fd); | 891 void file_data_disable_grouping(FileData *fd); |
1171 case FILEDATA_CHANGE_RENAME: | 1157 case FILEDATA_CHANGE_RENAME: |
1172 return file_data_perform_move(fd); /* the same as move */ | 1158 return file_data_perform_move(fd); /* the same as move */ |
1173 case FILEDATA_CHANGE_DELETE: | 1159 case FILEDATA_CHANGE_DELETE: |
1174 return file_data_perform_delete(fd); | 1160 return file_data_perform_delete(fd); |
1175 case FILEDATA_CHANGE_UPDATE: | 1161 case FILEDATA_CHANGE_UPDATE: |
1176 /* notring to do here */ | 1162 /* nothing to do here */ |
1177 break; | 1163 break; |
1178 } | 1164 } |
1179 return TRUE; | 1165 return TRUE; |
1180 } | 1166 } |
1181 | 1167 |
1216 fd->original_path = g_strdup(fd->change->dest); | 1202 fd->original_path = g_strdup(fd->change->dest); |
1217 g_hash_table_insert(file_data_pool, fd->original_path, fd); | 1203 g_hash_table_insert(file_data_pool, fd->original_path, fd); |
1218 } | 1204 } |
1219 } | 1205 } |
1220 | 1206 |
1221 gint file_data_sc_apply_ci(FileData *fd) // now file_data_do_change | 1207 gint file_data_sc_apply_ci(FileData *fd) |
1222 { | 1208 { |
1223 GList *work; | 1209 GList *work; |
1224 FileDataChangeType type = fd->change->type; | 1210 FileDataChangeType type = fd->change->type; |
1225 if (!file_data_sc_check_ci(fd, type)) return FALSE; | 1211 if (!file_data_sc_check_ci(fd, type)) return FALSE; |
1226 | 1212 |