Commit 41f48f97 authored by Felix Riemann's avatar Felix Riemann

Make exif-display plugin work with eog 2.27

Eog 2.27 does not export private functions, like eog_util_make_valid_utf8,
anymore. Duplicate the missing function into the plugin.
parent afd7507b
2009-06-12 Felix Riemann <friemann@svn.gnome.org>
* configure.ac:
* plugins/exif-display/eog-exif-display-plugin.c
(_eog_util_make_valid_utf8), (eog_exif_set_label):
Duplicate eog_util_make_valid_utf8 into the plugin as it is not
exported anymore by the current eog version.
2009-06-12 Felix Riemann <friemann@svn.gnome.org>
* plugins/exif-display/Makefile.am:
......
......@@ -314,8 +314,7 @@ if test "$?" = 1
then
PKG_CHECK_MODULES(EXIFDISPLAY,
[ libexif >= 0.6.16,
eog < 2.27.1 ],
[ libexif >= 0.6.16 ],
[],[have_exifdisplay=no])
AC_SUBST(EXIFDISPLAY_LIBS)
AC_SUBST(EXIFDISPLAY_CFLAGS)
......
......@@ -99,6 +99,48 @@ eog_exif_display_plugin_init (EogExifDisplayPlugin *plugin)
{
}
/* eog_util_make_valid_utf8 is not exported so it's duped here */
gchar *
_eog_util_make_valid_utf8 (const gchar *str)
{
GString *string;
const char *remainder, *invalid;
int remaining_bytes, valid_bytes;
string = NULL;
remainder = str;
remaining_bytes = strlen (str);
while (remaining_bytes != 0) {
if (g_utf8_validate (remainder, remaining_bytes, &invalid)) {
break;
}
valid_bytes = invalid - remainder;
if (string == NULL) {
string = g_string_sized_new (remaining_bytes);
}
g_string_append_len (string, remainder, valid_bytes);
g_string_append_c (string, '?');
remaining_bytes -= valid_bytes + 1;
remainder = invalid + 1;
}
if (string == NULL) {
return g_strdup (str);
}
g_string_append (string, remainder);
g_string_append (string, _(" (invalid Unicode)"));
g_assert (g_utf8_validate (string->str, -1, NULL));
return g_string_free (string, FALSE);
}
/* stolen from eog-properties-dialog.c*/
static void
eog_exif_set_label (GtkWidget *w, ExifData *exif_data, gint tag_id)
......@@ -114,7 +156,7 @@ eog_exif_set_label (GtkWidget *w, ExifData *exif_data, gint tag_id)
if (tag_id == EXIF_TAG_DATE_TIME_ORIGINAL && buf_ptr)
label_text = eog_exif_util_format_date (buf_ptr);
else
label_text = eog_util_make_valid_utf8 (buf_ptr);
label_text = _eog_util_make_valid_utf8 (buf_ptr);
}
gtk_label_set_text (GTK_LABEL (w), label_text);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment