diff options
author | Stefano Karapetsas <[email protected]> | 2014-06-25 12:46:50 +0200 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2014-06-25 12:46:50 +0200 |
commit | 4e796748f1079ac71fc0496da49e3ee219b98d2e (patch) | |
tree | 8a656711f5c56d4b913938f226c585dc4a50b133 /backend/ps | |
parent | ff8c5fca03211db8f58368ecf35c3ab63ed876fd (diff) | |
parent | bc94b296158e036be054c5ed061af83c893f1ea9 (diff) | |
download | atril-4e796748f1079ac71fc0496da49e3ee219b98d2e.tar.bz2 atril-4e796748f1079ac71fc0496da49e3ee219b98d2e.tar.xz |
Merge pull request #77 from NiceandGently/master
create_thumbnail_frame should return NULL when source_pixbuf is NULL and width and height are not positive.
Diffstat (limited to 'backend/ps')
-rw-r--r-- | backend/ps/ev-spectre.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/backend/ps/ev-spectre.c b/backend/ps/ev-spectre.c index d28325ba..b0489b78 100644 --- a/backend/ps/ev-spectre.c +++ b/backend/ps/ev-spectre.c @@ -224,7 +224,21 @@ static char * ps_document_get_page_label (EvDocument *document, EvPage *page) { - return g_strdup (spectre_page_get_label ((SpectrePage *)page->backend_page)); + const gchar *label = spectre_page_get_label ((SpectrePage *)page->backend_page); + gchar *utf8; + + if (!label) + return NULL; + + if (g_utf8_validate (label, -1, NULL)) + return g_strdup (label); + + /* Try with latin1 and ASCII encondings */ + utf8 = g_convert (label, -1, "utf-8", "latin1", NULL, NULL, NULL); + if (!utf8) + utf8 = g_convert (label, -1, "utf-8", "ASCII", NULL, NULL, NULL); + + return utf8; } static EvDocumentInfo * |