Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/ev-view.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2005-01-13 17:49:01 (GMT)
committer Marco Pesenti Gritti <marco@src.gnome.org>2005-01-13 17:49:01 (GMT)
commite0ca7880392b3d064e55406f270e2f68779e3cdc (patch)
tree684585ef2bc8531c2471490ffb5b130b7cc34f23 /shell/ev-view.c
parentddc0ad5b3bd75a640ba362cdccde7449654bae61 (diff)
Add support for document links
2005-01-13 Marco Pesenti Gritti <marco@gnome.org> * backend/ev-document.c: (ev_document_get_link): * backend/ev-document.h: * pdf/xpdf/pdf-document.cc: * shell/ev-application.c: (ev_application_open): * shell/ev-application.h: * shell/ev-sidebar-links.c: (selection_changed_cb): * shell/ev-view.c: (ev_view_button_release_event), (go_to_link), (ev_view_go_to_link): Add support for document links
Diffstat (limited to 'shell/ev-view.c')
-rw-r--r--shell/ev-view.c40
1 files changed, 34 insertions, 6 deletions
diff --git a/shell/ev-view.c b/shell/ev-view.c
index 4750b4d..9d1bef3 100644
--- a/shell/ev-view.c
+++ b/shell/ev-view.c
@@ -24,6 +24,7 @@
#include <gtk/gtkselection.h>
#include <gtk/gtkclipboard.h>
#include <gdk/gdkkeysyms.h>
+#include <libgnomevfs/gnome-vfs-utils.h>
#include "ev-marshal.h"
#include "ev-view.h"
@@ -547,7 +548,19 @@ ev_view_button_release_event (GtkWidget *widget,
{
EvView *view = EV_VIEW (widget);
- ev_view_update_primary_selection (view);
+ if (view->has_selection) {
+ ev_view_update_primary_selection (view);
+ } else {
+ EvLink *link;
+
+ link = ev_document_get_link (view->document,
+ event->x,
+ event->y);
+ if (link) {
+ ev_view_go_to_link (view, link);
+ g_object_unref (link);
+ }
+ }
return FALSE;
}
@@ -927,21 +940,36 @@ static void
go_to_link (EvView *view, EvLink *link)
{
EvLinkType type;
+ const char *uri;
int page;
type = ev_link_get_link_type (link);
-
- if (type == EV_LINK_TYPE_PAGE) {
- page = ev_link_get_page (link);
- set_document_page (view, page);
+
+ switch (type) {
+ case EV_LINK_TYPE_TITLE:
+ break;
+ case EV_LINK_TYPE_PAGE:
+ page = ev_link_get_page (link);
+ set_document_page (view, page);
+ break;
+ case EV_LINK_TYPE_EXTERNAL_URI:
+ uri = ev_link_get_uri (link);
+ gnome_vfs_url_show (uri);
+ break;
}
}
void
ev_view_go_to_link (EvView *view, EvLink *link)
{
+ EvLinkType type;
+
go_to_link (view, link);
- ev_history_add_link (view->history, link);
+
+ type = ev_link_get_link_type (link);
+ if (type == EV_LINK_TYPE_PAGE) {
+ ev_history_add_link (view->history, link);
+ }
}
static void