~ubuntu-branches/ubuntu/hardy/eog/hardy-updates

« back to all changes in this revision

Viewing changes to src/eog-util.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-09-18 10:45:35 UTC
  • mfrom: (1.1.34 upstream)
  • Revision ID: james.westby@ubuntu.com-20070918104535-3w6ucfpgd93mqygk
Tags: 2.20.0-0ubuntu1
* New upstream version
  New features:
  - Complete rewrite of application core which means more stable, 
    maintanable, faster image viewer for GNOME 
  - New plugin system which allows developers to extend EOG's UI
    and behavior. Python support is available.
  - Editable application toolbar
  - New image collection pane with on-demand thumbnail loading, 
    polished look, and continuous scrolling side buttons.
  - Side Pane to be extended by plugins
  - New image properties dialog which replaces the image info sidepane
  - Single instance D-Bus-based activation support
  - Revamped error/warning UI 
  - "Open with" support to quickly open images on other applications
  - Mouse scrollwheel improvements: HIG compliancy and zoom factor setting
  - General UI polishing 
  - Command line options for fullscreen, slideshow and image collection
    disabling
  - Display EXIF MakerNotes
  - XMP Support 
  Misc improvements/fixes:
  - Small refactorings in metadata readers
  Bug fixes:
  - #354352, Show incomplete images
  - #394803, Fails to load .svgz 
  - #440254, Eog crashes when opening an image with invalid unicode 
    as filename (LP: #126974)
  - #447063, eog hangs when opening SVG files that include external images
    (LP: #119603)
  - #459665, opened images should take as much screen space as possible
  - #465583, thumbnails badly rotated (autorotation enabled)
  - #470521, some image is rendered with a wrong rotation
  - #471530, Confusing PyGtk configure failure message
  - #474642, ./configure is semi-broken
  - #474710, eog crashes when you try to open this .jpg file 
    (it works fine on Vista/XP) (LP: #138730)
  - #474931, factore out some code in the metadata consumer
  New and updated translation
  New and updated manual translations

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
gchar *
78
78
eog_util_make_valid_utf8 (const gchar *str)
79
79
{
80
 
        gchar *utf_str;
81
 
 
82
 
        if (g_utf8_validate (str, -1, NULL)) {
83
 
                utf_str = g_strdup (str);
84
 
        } else {
85
 
                utf_str = g_locale_to_utf8 (str, -1, NULL, NULL, NULL);
86
 
        }
87
 
 
88
 
        return utf_str;
 
80
        GString *string;
 
81
        const char *remainder, *invalid;
 
82
        int remaining_bytes, valid_bytes;
 
83
 
 
84
        string = NULL;
 
85
        remainder = str;
 
86
        remaining_bytes = strlen (str);
 
87
 
 
88
        while (remaining_bytes != 0) {
 
89
                if (g_utf8_validate (remainder, remaining_bytes, &invalid)) {
 
90
                        break;
 
91
                }
 
92
 
 
93
                valid_bytes = invalid - remainder;
 
94
 
 
95
                if (string == NULL) {
 
96
                        string = g_string_sized_new (remaining_bytes);
 
97
                }
 
98
 
 
99
                g_string_append_len (string, remainder, valid_bytes);
 
100
                g_string_append_c (string, '?');
 
101
 
 
102
                remaining_bytes -= valid_bytes + 1;
 
103
                remainder = invalid + 1;
 
104
        }
 
105
 
 
106
        if (string == NULL) {
 
107
                return g_strdup (str);
 
108
        }
 
109
 
 
110
        g_string_append (string, remainder);
 
111
        /* FIXME: Can't add this string for 2.20 anymore. Uncomment 
 
112
         * this after stable branching. */
 
113
        /* g_string_append (string, _(" (invalid Unicode)")); */
 
114
 
 
115
        g_assert (g_utf8_validate (string->str, -1, NULL));
 
116
 
 
117
        return g_string_free (string, FALSE);
89
118
}
90
119
 
91
120
GSList*