Mercurial > geeqie.yaz
comparison src/pan-view.c @ 1288:10073464e6aa
use metadata_read_* functions where possible
switch exiv2 to utf8 charset
support for exiv2 formatting that depends on other tags:
http://dev.robotbattle.com/bugs/view.php?id=0000516
author | nadvornik |
---|---|
date | Sat, 07 Feb 2009 19:01:21 +0000 |
parents | 8b89e3ff286b |
children | 4a3ae0e6f1eb |
comparison
equal
deleted
inserted
replaced
1287:5fdf258f9c24 | 1288:10073464e6aa |
---|---|
16 | 16 |
17 #include "bar_exif.h" | 17 #include "bar_exif.h" |
18 #include "dnd.h" | 18 #include "dnd.h" |
19 #include "editors.h" | 19 #include "editors.h" |
20 #include "exif.h" | 20 #include "exif.h" |
21 #include "metadata.h" | |
21 #include "fullscreen.h" | 22 #include "fullscreen.h" |
22 #include "history_list.h" | 23 #include "history_list.h" |
23 #include "img-view.h" | 24 #include "img-view.h" |
24 #include "info.h" | 25 #include "info.h" |
25 #include "menu.h" | 26 #include "menu.h" |
1432 *----------------------------------------------------------------------------- | 1433 *----------------------------------------------------------------------------- |
1433 */ | 1434 */ |
1434 | 1435 |
1435 static void pan_info_add_exif(PanTextAlignment *ta, FileData *fd) | 1436 static void pan_info_add_exif(PanTextAlignment *ta, FileData *fd) |
1436 { | 1437 { |
1437 ExifData *exif; | |
1438 GList *work; | 1438 GList *work; |
1439 gint i; | 1439 gint i; |
1440 | 1440 |
1441 if (!fd) return; | 1441 if (!fd) return; |
1442 exif = exif_read_fd(fd); | |
1443 if (!exif) return; | |
1444 | 1442 |
1445 pan_text_alignment_add(ta, NULL, NULL); | 1443 pan_text_alignment_add(ta, NULL, NULL); |
1446 | 1444 |
1447 for (i = 0; ExifUIList[i].key; i++) | 1445 for (i = 0; ExifUIList[i].key; i++) |
1448 { | 1446 { |
1449 gchar *label; | 1447 gchar *label; |
1450 gchar *desc; | 1448 gchar *desc; |
1451 gchar *text; | 1449 gchar *text; |
1452 gchar *utf8_text; | |
1453 | 1450 |
1454 if (ExifUIList[i].current == EXIF_UI_OFF) continue; | 1451 if (ExifUIList[i].current == EXIF_UI_OFF) continue; |
1455 | 1452 |
1456 text = exif_get_data_as_text(exif, ExifUIList[i].key); | 1453 text = metadata_read_string(fd, ExifUIList[i].key, METADATA_FORMATTED); |
1454 | |
1457 if (ExifUIList[i].current == EXIF_UI_IFSET && (!text || !*text)) | 1455 if (ExifUIList[i].current == EXIF_UI_IFSET && (!text || !*text)) |
1458 { | 1456 { |
1459 g_free(text); | 1457 g_free(text); |
1460 continue; | 1458 continue; |
1461 } | 1459 } |
1462 | 1460 |
1463 desc = exif_get_description_by_key(ExifUIList[i].key); | 1461 desc = exif_get_description_by_key(ExifUIList[i].key); |
1464 label = g_strdup_printf("%s:", desc); | 1462 label = g_strdup_printf("%s:", desc); |
1465 g_free(desc); | 1463 g_free(desc); |
1466 utf8_text = utf8_validate_or_convert(text); | 1464 pan_text_alignment_add(ta, label, text); |
1465 g_free(label); | |
1467 g_free(text); | 1466 g_free(text); |
1468 pan_text_alignment_add(ta, label, utf8_text); | |
1469 g_free(label); | |
1470 g_free(utf8_text); | |
1471 } | 1467 } |
1472 | 1468 |
1473 work = g_list_last(history_list_get_by_key("exif_extras")); | 1469 work = g_list_last(history_list_get_by_key("exif_extras")); |
1474 if (work) pan_text_alignment_add(ta, "---", NULL); | 1470 if (work) pan_text_alignment_add(ta, "---", NULL); |
1475 while (work) | 1471 while (work) |
1478 gchar *text; | 1474 gchar *text; |
1479 | 1475 |
1480 name = work->data; | 1476 name = work->data; |
1481 work = work->prev; | 1477 work = work->prev; |
1482 | 1478 |
1483 text = exif_get_data_as_text(exif, name); | 1479 text = metadata_read_string(fd, name, METADATA_FORMATTED); |
1484 if (text) | 1480 if (text) |
1485 { | 1481 { |
1486 gchar *label = g_strdup_printf("%s:", name); | 1482 gchar *label = g_strdup_printf("%s:", name); |
1487 gchar *utf8_text = utf8_validate_or_convert(text); | 1483 pan_text_alignment_add(ta, label, text); |
1488 | 1484 g_free(label); |
1489 g_free(text); | 1485 g_free(text); |
1490 pan_text_alignment_add(ta, label, utf8_text); | 1486 } |
1491 g_free(label); | 1487 } |
1492 g_free(utf8_text); | |
1493 } | |
1494 } | |
1495 | |
1496 exif_free_fd(fd, exif); | |
1497 } | 1488 } |
1498 | 1489 |
1499 static void pan_info_update(PanWindow *pw, PanItem *pi) | 1490 static void pan_info_update(PanWindow *pw, PanItem *pi) |
1500 { | 1491 { |
1501 PanTextAlignment *ta; | 1492 PanTextAlignment *ta; |