comparison src/metadata.c @ 1220:a0c249bcc4ff

allow writing of empty keywords/comment
author nadvornik
date Tue, 23 Dec 2008 22:42:57 +0000
parents 86fcbd0fcb7b
children 31dc2f240afb
comparison
equal deleted inserted replaced
1219:86fcbd0fcb7b 1220:a0c249bcc4ff
584 exif_free_fd(fd, exif); 584 exif_free_fd(fd, exif);
585 585
586 return (comment && *comment) || (keywords && *keywords); 586 return (comment && *comment) || (keywords && *keywords);
587 } 587 }
588 588
589 gint metadata_write(FileData *fd, GList *keywords, const gchar *comment) 589 gint metadata_write(FileData *fd, GList **keywords, gchar **comment)
590 { 590 {
591 gint success = TRUE; 591 gint success = TRUE;
592 gint write_comment = (comment && comment[0]); 592 gint write_comment = (comment && *comment);
593 593
594 if (!fd) return FALSE; 594 if (!fd) return FALSE;
595 595
596 if (write_comment) success = success && metadata_write_string(fd, COMMENT_KEY, comment); 596 if (write_comment) success = success && metadata_write_string(fd, COMMENT_KEY, *comment);
597 if (keywords) success = success && metadata_write_list(fd, KEYWORD_KEY, string_list_copy(keywords)); 597 if (keywords) success = success && metadata_write_list(fd, KEYWORD_KEY, string_list_copy(*keywords));
598 598
599 if (options->metadata.sync_grouped_files) 599 if (options->metadata.sync_grouped_files)
600 { 600 {
601 GList *work = fd->sidecar_files; 601 GList *work = fd->sidecar_files;
602 602
605 FileData *sfd = work->data; 605 FileData *sfd = work->data;
606 work = work->next; 606 work = work->next;
607 607
608 if (filter_file_class(sfd->extension, FORMAT_CLASS_META)) continue; 608 if (filter_file_class(sfd->extension, FORMAT_CLASS_META)) continue;
609 609
610 if (write_comment) success = success && metadata_write_string(sfd, COMMENT_KEY, comment); 610 if (write_comment) success = success && metadata_write_string(sfd, COMMENT_KEY, *comment);
611 if (keywords) success = success && metadata_write_list(sfd, KEYWORD_KEY, string_list_copy(keywords)); 611 if (keywords) success = success && metadata_write_list(sfd, KEYWORD_KEY, string_list_copy(*keywords));
612 } 612 }
613 } 613 }
614 614
615 return success; 615 return success;
616 } 616 }
728 { 728 {
729 keywords_list = new_keywords; 729 keywords_list = new_keywords;
730 } 730 }
731 } 731 }
732 732
733 metadata_write(fd, keywords_list, comment); 733 metadata_write(fd, &keywords_list, &comment);
734 734
735 string_list_free(keywords); 735 string_list_free(keywords);
736 g_free(comment); 736 g_free(comment);
737 } 737 }
738 738