Mercurial > geeqie.yaz
changeset 1219:86fcbd0fcb7b
added change notification to bar_info.c
author | nadvornik |
---|---|
date | Tue, 23 Dec 2008 20:53:44 +0000 |
parents | 46e4fda574dd |
children | a0c249bcc4ff |
files | src/bar_info.c src/metadata.c |
diffstat | 2 files changed, 38 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/src/bar_info.c Tue Dec 23 19:15:12 2008 +0000 +++ b/src/bar_info.c Tue Dec 23 20:53:44 2008 +0000 @@ -680,11 +680,19 @@ bar_info_set_selection(bd, FALSE, TRUE, FALSE); } +static void bar_info_notify_cb(FileData *fd, NotifyType type, gpointer data) +{ + BarInfoData *bd = data; + if (fd == bd->fd) bar_info_update(bd); +} + static void bar_info_changed(GtkTextBuffer *buffer, gpointer data) { BarInfoData *bd = data; + file_data_unregister_notify_func(bar_info_notify_cb, bd); bar_info_write(bd); + file_data_register_notify_func(bar_info_notify_cb, bd, NOTIFY_PRIORITY_LOW); } void bar_info_close(GtkWidget *bar) @@ -701,6 +709,7 @@ { BarInfoData *bd = data; + file_data_unregister_notify_func(bar_info_notify_cb, bd); bar_list = g_list_remove(bar_list, bd); file_data_unref(bd->fd); @@ -897,6 +906,8 @@ bar_list = g_list_append(bar_list, bd); + file_data_register_notify_func(bar_info_notify_cb, bd, NOTIFY_PRIORITY_LOW); + return bd->vbox; }
--- a/src/metadata.c Tue Dec 23 19:15:12 2008 +0000 +++ b/src/metadata.c Tue Dec 23 20:53:44 2008 +0000 @@ -546,30 +546,37 @@ * and the only way to get all keywords is to iterate through * the item list. */ - for (item = exif_get_first_item(exif); - item; - item = exif_get_next_item(exif)) + /* Read IPTC keywords only if there are no XMP keywords + * IPTC does not have standard charset, thus the encoding may differ + * from XMP and keyword merging is not reliable. + */ + if (!*keywords) { - guint tag; - - tag = exif_item_get_tag_id(item); - if (tag == 0x0019) + for (item = exif_get_first_item(exif); + item; + item = exif_get_next_item(exif)) { - gchar *tag_name = exif_item_get_tag_name(item); - - if (strcmp(tag_name, "Iptc.Application2.Keywords") == 0) + guint tag; + + tag = exif_item_get_tag_id(item); + if (tag == 0x0019) { - gchar *kw; - gchar *utf8_kw; - - kw = exif_item_get_data_as_text(item); - if (!kw) continue; - - utf8_kw = utf8_validate_or_convert(kw); - *keywords = g_list_append(*keywords, (gpointer) utf8_kw); - g_free(kw); + gchar *tag_name = exif_item_get_tag_name(item); + + if (strcmp(tag_name, "Iptc.Application2.Keywords") == 0) + { + gchar *kw; + gchar *utf8_kw; + + kw = exif_item_get_data_as_text(item); + if (!kw) continue; + + utf8_kw = utf8_validate_or_convert(kw); + *keywords = g_list_append(*keywords, (gpointer) utf8_kw); + g_free(kw); + } + g_free(tag_name); } - g_free(tag_name); } } }