[eog-plugins] Make exif-display plugin work with eog 2.27
- From: Felix Riemann <friemann src gnome org>
- To: svn-commits-list gnome org
- Subject: [eog-plugins] Make exif-display plugin work with eog 2.27
- Date: Fri, 12 Jun 2009 15:20:59 -0400 (EDT)
commit 41f48f971bfc2f348b6cf6c682e600fe1889efa9
Author: Felix Riemann <friemann svn gnome org>
Date: Fri Jun 12 21:18:54 2009 +0200
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.
ChangeLog | 8 ++++
configure.ac | 3 +-
plugins/exif-display/eog-exif-display-plugin.c | 44 +++++++++++++++++++++++-
3 files changed, 52 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9c03b98..250a6af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
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:
* plugins/exif-display/eog-exif-display-plugin.c:
* plugins/exif-display/eog-exif-display-plugin.h:
diff --git a/configure.ac b/configure.ac
index 4ead97e..1b18728 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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)
diff --git a/plugins/exif-display/eog-exif-display-plugin.c b/plugins/exif-display/eog-exif-display-plugin.c
index c04179f..3bce2ee 100644
--- a/plugins/exif-display/eog-exif-display-plugin.c
+++ b/plugins/exif-display/eog-exif-display-plugin.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]