X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=backend%2Fdjvu%2Fdjvu-links.c;h=d54c410bb79586090f930a63ba4d4f0abce542fe;hb=776a6fe02961d8901d21e172633d3c8d1c85dc93;hp=6a516fc3f13e85a48c953ac64a33d6cd63ee278a;hpb=195db8ebaed712d5e6d7913d0450af34532754eb;p=evince.git diff --git a/backend/djvu/djvu-links.c b/backend/djvu/djvu-links.c index 6a516fc3..d54c410b 100644 --- a/backend/djvu/djvu-links.c +++ b/backend/djvu/djvu-links.c @@ -169,16 +169,16 @@ build_tree (const DjvuDocument *djvu_document, /* The (bookmarks) cons */ iter = miniexp_cdr (iter); } else if ( miniexp_length (iter) >= 2 ) { + gchar *utf8_title = NULL; + /* An entry */ if (!string_from_miniexp (miniexp_car (iter), &title)) goto unknown_entry; if (!string_from_miniexp (miniexp_cadr (iter), &link_dest)) goto unknown_entry; + if (!g_utf8_validate (title, -1, NULL)) { - gchar *utf8_title; - utf8_title = str_to_utf8 (title); title_markup = g_markup_escape_text (utf8_title, -1); - g_free (utf8_title); } else { title_markup = g_markup_escape_text (title, -1); } @@ -188,7 +188,7 @@ build_tree (const DjvuDocument *djvu_document, if (g_str_has_suffix (link_dest, ".djvu")) { /* FIXME: component file identifiers */ } else if (ev_action) { - ev_link = ev_link_new (title, ev_action); + ev_link = ev_link_new (utf8_title ? utf8_title : title, ev_action); gtk_tree_store_append (GTK_TREE_STORE (model), &tree_iter, parent); gtk_tree_store_set (GTK_TREE_STORE (model), &tree_iter, EV_DOCUMENT_LINKS_COLUMN_MARKUP, title_markup, @@ -205,7 +205,7 @@ build_tree (const DjvuDocument *djvu_document, } g_free (title_markup); - + g_free (utf8_title); iter = miniexp_cddr (iter); parent = &tree_iter; } else { @@ -344,7 +344,7 @@ djvu_links_has_document_links (EvDocumentLinks *document_links) miniexp_t outline; while ((outline = ddjvu_document_get_outline (djvu_document->d_document)) == miniexp_dummy) - djvu_handle_events (djvu_document, TRUE); + djvu_handle_events (djvu_document, TRUE, NULL); if (outline) { ddjvu_miniexp_release (djvu_document->d_document, outline); @@ -367,10 +367,10 @@ djvu_links_get_links (EvDocumentLinks *document_links, ddjvu_pageinfo_t page_info; while ((page_annotations = ddjvu_document_get_pageanno (djvu_document->d_document, page)) == miniexp_dummy) - djvu_handle_events (djvu_document, TRUE); + djvu_handle_events (djvu_document, TRUE, NULL); while (ddjvu_document_get_pageinfo (djvu_document->d_document, page, &page_info) < DDJVU_JOB_OK) - djvu_handle_events(djvu_document, TRUE); + djvu_handle_events(djvu_document, TRUE, NULL); if (page_annotations) { hyperlinks = ddjvu_anno_get_hyperlinks (page_annotations); @@ -417,7 +417,7 @@ djvu_links_get_links_model (EvDocumentLinks *document_links) miniexp_t outline = miniexp_nil; while ((outline = ddjvu_document_get_outline (djvu_document->d_document)) == miniexp_dummy) - djvu_handle_events (djvu_document, TRUE); + djvu_handle_events (djvu_document, TRUE, NULL); if (outline) { model = (GtkTreeModel *) gtk_tree_store_new (EV_DOCUMENT_LINKS_COLUMN_NUM_COLUMNS,