Mercurial > geeqie
changeset 1189:9e424170e958
Do not hardcode exif formatted prefix.
author | zas_ |
---|---|
date | Thu, 27 Nov 2008 19:10:59 +0000 |
parents | e3eb00ea097c |
children | a4ea0c74a6e2 |
files | src/bar_exif.c src/exif-common.c src/exif.h |
diffstat | 3 files changed, 23 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/bar_exif.c Thu Nov 27 12:34:39 2008 +0000 +++ b/src/bar_exif.c Thu Nov 27 19:10:59 2008 +0000 @@ -30,24 +30,24 @@ #define BAR_EXIF_DATA_COLUMN_WIDTH 250 ExifUI ExifUIList[]={ - { 0, 0, EXIF_UI_IFSET, "formatted.Camera"}, - { 0, 0, EXIF_UI_IFSET, "formatted.DateTime"}, - { 0, 0, EXIF_UI_IFSET, "formatted.ShutterSpeed"}, - { 0, 0, EXIF_UI_IFSET, "formatted.Aperture"}, - { 0, 0, EXIF_UI_IFSET, "formatted.ExposureBias"}, - { 0, 0, EXIF_UI_IFSET, "formatted.ISOSpeedRating"}, - { 0, 0, EXIF_UI_IFSET, "formatted.FocalLength"}, - { 0, 0, EXIF_UI_IFSET, "formatted.FocalLength35mmFilm"}, - { 0, 0, EXIF_UI_IFSET, "formatted.Flash"}, + { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("Camera")}, + { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("DateTime")}, + { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("ShutterSpeed")}, + { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("Aperture")}, + { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("ExposureBias")}, + { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("ISOSpeedRating")}, + { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("FocalLength")}, + { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("FocalLength35mmFilm")}, + { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("Flash")}, { 0, 0, EXIF_UI_IFSET, "Exif.Photo.ExposureProgram"}, { 0, 0, EXIF_UI_IFSET, "Exif.Photo.MeteringMode"}, { 0, 0, EXIF_UI_IFSET, "Exif.Photo.LightSource"}, - { 0, 0, EXIF_UI_IFSET, "formatted.ColorProfile"}, - { 0, 0, EXIF_UI_IFSET, "formatted.SubjectDistance"}, - { 0, 0, EXIF_UI_IFSET, "formatted.Resolution"}, + { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("ColorProfile")}, + { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("SubjectDistance")}, + { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("Resolution")}, { 0, 0, EXIF_UI_IFSET, "Exif.Image.Orientation"}, - { 0, 0, EXIF_UI_IFSET, "formatted.GPSPosition"}, - { 0, 0, EXIF_UI_IFSET, "formatted.GPSAltitude"}, + { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("GPSPosition")}, + { 0, 0, EXIF_UI_IFSET, EXIF_FORMATTED("GPSAltitude")}, { 0, 0, EXIF_UI_IFSET, "Exif.Image.ImageDescription"}, { 0, 0, EXIF_UI_IFSET, "Exif.Image.Copyright"}, { 0, 0, EXIF_UI_OFF, NULL}
--- a/src/exif-common.c Thu Nov 27 12:34:39 2008 +0000 +++ b/src/exif-common.c Thu Nov 27 19:10:59 2008 +0000 @@ -503,7 +503,7 @@ /* List of custom formatted pseudo-exif tags */ -#define EXIF_FORMATTED_TAG(name, label) { "formatted."#name, label, exif_build_formatted##_##name } +#define EXIF_FORMATTED_TAG(name, label) { EXIF_FORMATTED()#name, label, exif_build_formatted##_##name } ExifFormattedText ExifFormattedList[] = { EXIF_FORMATTED_TAG(Camera, N_("Camera")), @@ -525,15 +525,15 @@ gchar *exif_get_formatted_by_key(ExifData *exif, const gchar *key, gint *key_valid) { - if (strncmp(key, "formatted.", 10) == 0) + if (strncmp(key, EXIF_FORMATTED(), EXIF_FORMATTED_LEN) == 0) { gint i; if (key_valid) *key_valid = TRUE; - key += 10; + key += EXIF_FORMATTED_LEN; for (i = 0; ExifFormattedList[i].key; i++) - if (strcmp(key, ExifFormattedList[i].key + 10) == 0) + if (strcmp(key, ExifFormattedList[i].key + EXIF_FORMATTED_LEN) == 0) return ExifFormattedList[i].build_func(exif); } @@ -545,13 +545,13 @@ { if (!key) return NULL; - if (strncmp(key, "formatted.", 10) == 0) + if (strncmp(key, EXIF_FORMATTED(), EXIF_FORMATTED_LEN) == 0) { gint i; - key += 10; + key += EXIF_FORMATTED_LEN; for (i = 0; ExifFormattedList[i].key; i++) - if (strcmp(key, ExifFormattedList[i].key + 10) == 0) + if (strcmp(key, ExifFormattedList[i].key + EXIF_FORMATTED_LEN) == 0) return g_strdup(_(ExifFormattedList[i].description)); }
--- a/src/exif.h Thu Nov 27 12:34:39 2008 +0000 +++ b/src/exif.h Thu Nov 27 19:10:59 2008 +0000 @@ -27,6 +27,8 @@ #ifndef __EXIF_H #define __EXIF_H +#define EXIF_FORMATTED(x) "formatted."x +#define EXIF_FORMATTED_LEN (sizeof(EXIF_FORMATTED()) - 1) /* *-----------------------------------------------------------------------------