+static void
+sidebar_links_link_activated_cb (EvSidebarLinks *sidebar_links, EvLink *link, EvWindow *window)
+{
+ ev_view_goto_link (EV_VIEW (window->priv->view), link);
+}
+
+static void
+launch_link (EvWindow *window, EvLink *link)
+{
+ const char *filename = ev_link_get_filename (link);
+ char *uri = NULL;
+
+ if (filename && g_path_is_absolute (filename)) {
+ uri = gnome_vfs_get_uri_from_local_path (filename);
+ } else {
+ GnomeVFSURI *base_uri, *resolved_uri;
+
+ base_uri = gnome_vfs_uri_new (window->priv->uri);
+ if (base_uri && filename) {
+ resolved_uri = gnome_vfs_uri_resolve_relative (base_uri, filename);
+ if (resolved_uri) {
+ uri = gnome_vfs_uri_to_string (resolved_uri, GNOME_VFS_URI_HIDE_NONE);
+ gnome_vfs_uri_unref (resolved_uri);
+ }
+ gnome_vfs_uri_unref (base_uri);
+ }
+ }
+
+ if (uri) {
+ gnome_vfs_url_show (uri);
+ } else {
+ gnome_vfs_url_show (filename);
+ }
+
+ g_free (uri);
+
+ /* According to the PDF spec filename can be an executable. I'm not sure
+ allowing to launch executables is a good idea though. -- marco */
+}
+
+static void
+launch_external_uri (EvWindow *window, EvLink *link)
+{
+ const char *uri;
+ char *escaped;
+
+ uri = ev_link_get_uri (link);
+ escaped = gnome_vfs_escape_host_and_path_string (uri);
+
+ gnome_vfs_url_show (escaped);
+ g_free (escaped);
+}
+
+static void
+view_external_link_cb (EvView *view, EvLink *link, EvWindow *window)
+{
+ switch (ev_link_get_link_type (link)) {
+ case EV_LINK_TYPE_EXTERNAL_URI:
+ launch_external_uri (window, link);
+ break;
+ case EV_LINK_TYPE_LAUNCH:
+ launch_link (window, link);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+}
+
+static void
+ev_popup_cmd_open_link (GtkAction *action, EvWindow *window)
+{
+ ev_view_goto_link (EV_VIEW (window->priv->view), window->priv->link);
+}
+
+static void
+ev_popup_cmd_copy_link_address (GtkAction *action, EvWindow *window)
+{
+ GtkClipboard *clipboard;
+ const gchar *uri;
+
+ uri = ev_link_get_uri (window->priv->link);
+
+ clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window),
+ GDK_SELECTION_CLIPBOARD);
+ gtk_clipboard_set_text (clipboard, uri, -1);
+}
+