~ubuntu-branches/ubuntu/oneiric/evince/oneiric-updates

« back to all changes in this revision

Viewing changes to backend/djvu/djvu-links.c

  • Committer: Bazaar Package Importer
  • Author(s): Rodrigo Moya, Josselin Mouette, Rodrigo Moya
  • Date: 2011-05-19 12:12:42 UTC
  • mfrom: (1.1.65 upstream) (1.3.6 experimental)
  • Revision ID: james.westby@ubuntu.com-20110519121242-967hbn2nh2hunp4y
Tags: 3.0.0-4ubuntu1
[ Josselin Mouette ]
* bug-presubj: please document where to report rendering bugs.
* evince.mime: dropped. We have desktop files to handle MIME 
  associations, no need to maintain an alternate system by hand.
  Closes: #619564, #627027, #551734, #581441.

[ Rodrigo Moya ]
* Rebase from Debian and GNOME3 PPA (thanks to Rico Tzschichholz).
  Remaining Ubuntu changes:
* debian/apparmor-profile:
* debian/apparmor-profile.abstraction:
* debian/evince.apport:
* debian/evince-common.dirs:
* debian/evince-common.postinst:
* debian/evince-common.postrm:
  - Add apparmor profile
* debian/control:
  - Build-Depend on debhelper (>= 7.4.20ubuntu5), gnome-common,
    hardening-includes and liblaunchpad-integration-3.0-dev
  - Standards-Version is 3.9.1
  - Depend on apparmor
* debian/rules:
  - Include hardening.make
  - Add rule to install apparmor files
* debian/watch:
  - Watch unstable series
* debian/patches/01_lpi.patch:
  - Launchpad integration patch
* debian/patches/04_gold.patch:
  - Link against libz
* debian/patches/05_library-path.patch:
  - Fix library path for g-ir-scanner

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
        }
61
61
}
62
62
 
63
 
static EvLinkDest *
64
 
get_djvu_link_dest (const DjvuDocument *djvu_document, const gchar *link_name, int base_page)
 
63
static guint64
 
64
get_djvu_link_page (const DjvuDocument *djvu_document, const gchar *link_name, int base_page)
65
65
{
66
66
        guint64 page_num = 0;
67
67
 
69
69
        if (g_str_has_prefix (link_name, "#")) {
70
70
                if (base_page > 0 && g_str_has_prefix (link_name+1, "+")) {
71
71
                        if (number_from_string_10 (link_name + 2, &page_num)) {
72
 
                                return ev_link_dest_new_page (base_page + page_num);
 
72
                                return base_page + page_num;
73
73
                        }
74
74
                } else if (base_page > 0 && g_str_has_prefix (link_name+1, "-")) {
75
75
                        if (number_from_string_10 (link_name + 2, &page_num)) {
76
 
                                return ev_link_dest_new_page (base_page - page_num);
 
76
                                return base_page - page_num;
77
77
                        }
78
78
                } else {
79
79
                        if (number_from_string_10 (link_name + 1, &page_num)) {
80
 
                                return ev_link_dest_new_page (page_num - 1);
 
80
                                return page_num - 1;
81
81
                        }
82
82
                }
83
83
        } else {
84
84
                /* FIXME: component file identifiers */
85
85
        }
86
86
 
87
 
        return NULL;
 
87
        return page_num;
 
88
}
 
89
 
 
90
static EvLinkDest *
 
91
get_djvu_link_dest (const DjvuDocument *djvu_document, const gchar *link_name, int base_page)
 
92
{
 
93
        return ev_link_dest_new_page (get_djvu_link_page (djvu_document, link_name, base_page));
88
94
}
89
95
 
90
96
static EvLinkAction *
409
415
        return ev_dest;
410
416
}
411
417
 
 
418
gint
 
419
djvu_links_find_link_page (EvDocumentLinks  *document_links,
 
420
                           const gchar      *link_name)
 
421
{
 
422
        DjvuDocument *djvu_document = DJVU_DOCUMENT (document_links);
 
423
        gint page;
 
424
 
 
425
        page = get_djvu_link_page (djvu_document, link_name, -1);
 
426
 
 
427
        if (page == -1) {
 
428
                g_warning ("DjvuLibre error: unknown link destination %s", link_name);
 
429
        }
 
430
 
 
431
        return page;
 
432
}
 
433
 
412
434
GtkTreeModel *
413
435
djvu_links_get_links_model (EvDocumentLinks *document_links)
414
436
{