Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/backend/ev-link.c
diff options
context:
space:
mode:
authorJonathan Blandford <jrb@redhat.com>2005-03-31 15:34:35 (GMT)
committer Jonathan Blandford <jrb@src.gnome.org>2005-03-31 15:34:35 (GMT)
commite8096c18ba580156072e8c84103bee6f6d3f0bfc (patch)
tree4da3a4264a48a6830e7b12ec734ee4dc34de2b65 /backend/ev-link.c
parent52ba586fff36cceccb753342a38deff970b18107 (diff)
Remove pixbuf backend for now
Thu Mar 31 01:21:58 2005 Jonathan Blandford <jrb@redhat.com> * Makefile.am: Remove pixbuf backend for now * configure.ac: Require poppler-glib instead of just poppler. * backend/ev-document-thumbnails.h: Add a comment * backend/ev-document.h: * backend/ev-document.c: (ev_document_class_init), (ev_document_load), (ev_document_get_link), (ev_document_get_links): Remove 3 methods and add get_links. Also, made 0 based. * backend/ev-jobs.c: (ev_job_render_new), (ev_job_render_run): * backend/ev-jobs.h: now EvJobRender can grab the links for a document. * backend/ev-link.c: (ev_link_set_title), (ev_link_mapping_free_foreach), (ev_link_mapping_free), (ev_link_mapping_find): * backend/ev-link.h: Allow NULL titles. Also, introduce a mapping link. * backend/ev-page-cache.c: (ev_page_cache_init), (_ev_page_cache_new), (ev_page_cache_set_current_page), (ev_page_cache_get_size), (ev_page_cache_next_page), (ev_page_cache_prev_page): Fix to be 0 based. * pdf/Makefile.am: * pdf/ev-poppler.h: * pdf/ev-poppler.cc: New backend. * ps/ps-document.c: (ps_document_init), (ps_document_set_page), (ps_document_get_page), (ps_document_document_iface_init): * shell/ev-pixbuf-cache.h: * shell/ev-pixbuf-cache.c: (ev_pixbuf_cache_init), (dispose_cache_job_info), (job_finished_cb), (move_one_job), (ev_pixbuf_cache_update_range), (copy_job_to_job_info), (add_job_if_needed), (ev_pixbuf_cache_set_page_range), (ev_pixbuf_cache_get_pixbuf), (ev_pixbuf_cache_get_link_mapping): Fix up code to grab a page cache per each doc. Also, fix to be 0 based. * shell/ev-sidebar-thumbnails.c: (ev_sidebar_tree_selection_changed), (page_changed_cb), (ev_sidebar_thumbnails_set_document): Fix to be 0 based. * shell/ev-view.c: (status_message_from_link), (find_page_at_location), (get_link_at_location), (ev_view_motion_notify_event), (ev_view_button_release_event), (ev_view_init): Use the new link code. Fix to be 0 based. * shell/ev-window.c: (update_action_sensitivity), (document_supports_sidebar): 0 based.
Diffstat (limited to 'backend/ev-link.c')
-rw-r--r--backend/ev-link.c54
1 files changed, 51 insertions, 3 deletions
diff --git a/backend/ev-link.c b/backend/ev-link.c
index 7e6eb52..7e26a58 100644
--- a/backend/ev-link.c
+++ b/backend/ev-link.c
@@ -85,13 +85,14 @@ void
ev_link_set_title (EvLink* self, const char *title)
{
g_assert (EV_IS_LINK (self));
- g_assert (title != NULL);
if (self->priv->title != NULL) {
g_free (self->priv->title);
}
-
- self->priv->title = g_strdup (title);
+ if (title)
+ self->priv->title = g_strdup (title);
+ else
+ self->priv->title = NULL;
g_object_notify (G_OBJECT (self), "title");
}
@@ -314,3 +315,50 @@ ev_link_new_external (const char *title, const char *uri)
"type", EV_LINK_TYPE_EXTERNAL_URI,
NULL));
}
+
+
+
+static void
+ev_link_mapping_free_foreach (EvLinkMapping *mapping)
+{
+ g_object_unref (G_OBJECT (mapping->link));
+ g_free (mapping);
+}
+
+void
+ev_link_mapping_free (GList *link_mapping)
+{
+ if (link_mapping == NULL)
+ return;
+
+ g_list_foreach (link_mapping, (GFunc) (ev_link_mapping_free_foreach), NULL);
+ g_list_free (link_mapping);
+}
+
+
+EvLink *
+ev_link_mapping_find (GList *link_mapping,
+ gdouble x,
+ gdouble y)
+{
+ GList *list;
+ EvLink *link = NULL;
+ int i;
+
+ i = 0;
+ for (list = link_mapping; list; list = list->next) {
+ EvLinkMapping *mapping = list->data;
+
+ i++;
+ if ((x >= mapping->x1) &&
+ (y >= mapping->y1) &&
+ (x <= mapping->x2) &&
+ (y <= mapping->y2)) {
+ link = mapping->link;
+ break;
+ }
+ }
+
+ return link;
+}
+