]> www.fi.muni.cz Git - evince.git/blobdiff - shell/ev-view.c
Updated French translation by Robert-André Mauchin.
[evince.git] / shell / ev-view.c
index 5944e348305db28d0e60026f86090b3a48e4969f..750ee5e4d3c5c5b26a2a92500914329b1edf1d76 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
  */
 
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#include <config.h>
+#include "config.h"
+
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
-#include <gtk/gtkalignment.h>
+
 #include <glib/gi18n.h>
 #include <glib/gi18n.h>
-#include <gtk/gtkbindings.h>
-#include <gtk/gtkselection.h>
-#include <gtk/gtkclipboard.h>
+#include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
 #include <gdk/gdkkeysyms.h>
 
-#include "ev-marshal.h"
-#include "ev-view.h"
-#include "ev-view-private.h"
-#include "ev-utils.h"
-#include "ev-document-links.h"
-#include "ev-document-images.h"
-#include "ev-document-find.h"
-#include "ev-document-transition.h"
+#include "ev-application.h"
 #include "ev-document-forms.h"
 #include "ev-document-forms.h"
+#include "ev-document-images.h"
+#include "ev-document-links.h"
 #include "ev-document-misc.h"
 #include "ev-document-misc.h"
-#include "ev-job-queue.h"
+#include "ev-document-transition.h"
+#include "ev-marshal.h"
 #include "ev-page-cache.h"
 #include "ev-pixbuf-cache.h"
 #include "ev-page-cache.h"
 #include "ev-pixbuf-cache.h"
+#include "ev-transition-animation.h"
+#include "ev-utils.h"
+#include "ev-view.h"
+#include "ev-view-private.h"
+
 #if !GTK_CHECK_VERSION (2, 11, 7)
 #include "ev-tooltip.h"
 #endif
 #if !GTK_CHECK_VERSION (2, 11, 7)
 #include "ev-tooltip.h"
 #endif
-#include "ev-application.h"
 
 #define EV_VIEW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), EV_TYPE_VIEW, EvViewClass))
 #define EV_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EV_TYPE_VIEW))
 #define EV_VIEW_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), EV_TYPE_VIEW, EvViewClass))
 
 
 #define EV_VIEW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), EV_TYPE_VIEW, EvViewClass))
 #define EV_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EV_TYPE_VIEW))
 #define EV_VIEW_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), EV_TYPE_VIEW, EvViewClass))
 
-
 enum {
        PROP_0,
 enum {
        PROP_0,
-       PROP_FIND_STATUS,
        PROP_CONTINUOUS,
        PROP_DUAL_PAGE,
        PROP_FULLSCREEN,
        PROP_CONTINUOUS,
        PROP_DUAL_PAGE,
        PROP_FULLSCREEN,
@@ -229,9 +226,6 @@ static void   draw_loading_text                          (EvView             *view,
                                                              GdkRectangle       *expose_area);
 
 /*** Callbacks ***/
                                                              GdkRectangle       *expose_area);
 
 /*** Callbacks ***/
-static void       find_changed_cb                            (EvDocument         *document,
-                                                             int                 page,
-                                                             EvView             *view);
 static void       job_finished_cb                            (EvPixbufCache      *pixbuf_cache,
                                                              GdkRegion          *region,
                                                              EvView             *view);
 static void       job_finished_cb                            (EvPixbufCache      *pixbuf_cache,
                                                              GdkRegion          *region,
                                                              EvView             *view);
@@ -304,10 +298,11 @@ static void       ev_view_handle_cursor_over_xy              (EvView *view,
                                                              gint y);
 
 /*** Find ***/
                                                              gint y);
 
 /*** Find ***/
-static void       update_find_status_message                 (EvView             *view,
-                                                             gboolean            this_page);
-static void       ev_view_set_find_status                    (EvView             *view,
-                                                             const char         *message);
+static gint         ev_view_find_get_n_results               (EvView             *view,
+                                                             gint                page);
+static EvRectangle *ev_view_find_get_result                  (EvView             *view,
+                                                             gint                page,
+                                                             gint                result);
 static void       jump_to_find_result                        (EvView             *view);
 static void       jump_to_find_page                          (EvView             *view, 
                                                              EvViewFindDirection direction,
 static void       jump_to_find_result                        (EvView             *view);
 static void       jump_to_find_page                          (EvView             *view, 
                                                              EvViewFindDirection direction,
@@ -319,6 +314,7 @@ static void       compute_selections                         (EvView
                                                              GdkPoint           *start,
                                                              GdkPoint           *stop);
 static void       clear_selection                            (EvView             *view);
                                                              GdkPoint           *start,
                                                              GdkPoint           *stop);
 static void       clear_selection                            (EvView             *view);
+static void       clear_link_selected                        (EvView             *view);
 static void       selection_free                             (EvViewSelection    *selection);
 static char*      get_selected_text                          (EvView             *ev_view);
 static void       ev_view_primary_get_cb                     (GtkClipboard       *clipboard,
 static void       selection_free                             (EvViewSelection    *selection);
 static char*      get_selected_text                          (EvView             *ev_view);
 static void       ev_view_primary_get_cb                     (GtkClipboard       *clipboard,
@@ -1574,7 +1570,8 @@ ev_view_handle_cursor_over_xy (EvView *view, gint x, gint y)
        } else {
                if (view->cursor == EV_VIEW_CURSOR_LINK ||
                    view->cursor == EV_VIEW_CURSOR_IBEAM ||
        } else {
                if (view->cursor == EV_VIEW_CURSOR_LINK ||
                    view->cursor == EV_VIEW_CURSOR_IBEAM ||
-                   view->cursor == EV_VIEW_CURSOR_DRAG)
+                   view->cursor == EV_VIEW_CURSOR_DRAG ||
+                   view->cursor == EV_VIEW_CURSOR_AUTOSCROLL)
                        ev_view_set_cursor (view, EV_VIEW_CURSOR_NORMAL);
        }
 }
                        ev_view_set_cursor (view, EV_VIEW_CURSOR_NORMAL);
        }
 }
@@ -1656,9 +1653,9 @@ ev_view_form_field_get_region (EvView      *view,
        GList       *forms_mapping;
 
        forms_mapping = ev_pixbuf_cache_get_form_field_mapping (view->pixbuf_cache,
        GList       *forms_mapping;
 
        forms_mapping = ev_pixbuf_cache_get_form_field_mapping (view->pixbuf_cache,
-                                                               field->page);
+                                                               field->page->index);
        ev_form_field_mapping_get_area (forms_mapping, field, &field_area);
        ev_form_field_mapping_get_area (forms_mapping, field, &field_area);
-       doc_rect_to_view_rect (view, field->page, &field_area, &view_area);
+       doc_rect_to_view_rect (view, field->page->index, &field_area, &view_area);
        view_area.x -= view->scroll_x;
        view_area.y -= view->scroll_y;
 
        view_area.x -= view->scroll_x;
        view_area.y -= view->scroll_y;
 
@@ -1709,7 +1706,7 @@ ev_view_form_field_button_create_widget (EvView      *view,
                         * we need to update also the region for the current selected item
                         */
                        forms_mapping = ev_pixbuf_cache_get_form_field_mapping (view->pixbuf_cache,
                         * we need to update also the region for the current selected item
                         */
                        forms_mapping = ev_pixbuf_cache_get_form_field_mapping (view->pixbuf_cache,
-                                                                               field->page);
+                                                                               field->page->index);
                        for (l = forms_mapping; l; l = g_list_next (l)) {
                                EvFormField *button = ((EvFormFieldMapping *)(l->data))->field;
                                GdkRegion   *button_region;
                        for (l = forms_mapping; l; l = g_list_next (l)) {
                                EvFormField *button = ((EvFormFieldMapping *)(l->data))->field;
                                GdkRegion   *button_region;
@@ -1737,7 +1734,7 @@ ev_view_form_field_button_create_widget (EvView      *view,
 
        ev_pixbuf_cache_reload_page (view->pixbuf_cache,
                                     field_region,
 
        ev_pixbuf_cache_reload_page (view->pixbuf_cache,
                                     field_region,
-                                    field->page,
+                                    field->page->index,
                                     view->rotation,
                                     view->scale);
        gdk_region_destroy (field_region);
                                     view->rotation,
                                     view->scale);
        gdk_region_destroy (field_region);
@@ -1767,7 +1764,7 @@ ev_view_form_field_text_save (EvView    *view,
                field->changed = FALSE;
                ev_pixbuf_cache_reload_page (view->pixbuf_cache,
                                             field_region,
                field->changed = FALSE;
                ev_pixbuf_cache_reload_page (view->pixbuf_cache,
                                             field_region,
-                                            field->page,
+                                            field->page->index,
                                             view->rotation,
                                             view->scale);
                gdk_region_destroy (field_region);
                                             view->rotation,
                                             view->scale);
                gdk_region_destroy (field_region);
@@ -1888,7 +1885,7 @@ ev_view_form_field_choice_save (EvView    *view,
                field->changed = FALSE;
                ev_pixbuf_cache_reload_page (view->pixbuf_cache,
                                             field_region,
                field->changed = FALSE;
                ev_pixbuf_cache_reload_page (view->pixbuf_cache,
                                             field_region,
-                                            field->page,
+                                            field->page->index,
                                             view->rotation,
                                             view->scale);
                gdk_region_destroy (field_region);
                                             view->rotation,
                                             view->scale);
                gdk_region_destroy (field_region);
@@ -1905,7 +1902,8 @@ ev_view_form_field_choice_changed (GtkWidget   *widget,
                gint item;
                
                item = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
                gint item;
                
                item = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
-               if (GPOINTER_TO_INT (field_choice->selected_items->data) != item) {
+               if (!field_choice->selected_items ||
+                   GPOINTER_TO_INT (field_choice->selected_items->data) != item) {
                        g_list_free (field_choice->selected_items);
                        field_choice->selected_items = NULL;
                        field_choice->selected_items = g_list_prepend (field_choice->selected_items,
                        g_list_free (field_choice->selected_items);
                        field_choice->selected_items = NULL;
                        field_choice->selected_items = g_list_prepend (field_choice->selected_items,
@@ -2104,10 +2102,10 @@ ev_view_handle_form_field (EvView      *view,
                                g_object_ref (field),
                                (GDestroyNotify)g_object_unref);
 
                                g_object_ref (field),
                                (GDestroyNotify)g_object_unref);
 
-       form_field_mapping = ev_pixbuf_cache_get_form_field_mapping (view->pixbuf_cache, field->page);
+       form_field_mapping = ev_pixbuf_cache_get_form_field_mapping (view->pixbuf_cache, field->page->index);
        ev_form_field_mapping_get_area (form_field_mapping, field, &field_area);
        
        ev_form_field_mapping_get_area (form_field_mapping, field, &field_area);
        
-       doc_rect_to_view_rect (view, field->page, &field_area, &view_area);
+       doc_rect_to_view_rect (view, field->page->index, &field_area, &view_area);
        view_area.x -= view->scroll_x;
        view_area.y -= view->scroll_y;
 
        view_area.x -= view->scroll_x;
        view_area.y -= view->scroll_y;
 
@@ -2307,10 +2305,10 @@ ev_view_size_allocate (GtkWidget      *widget,
                        continue;
 
                form_field_mapping = ev_pixbuf_cache_get_form_field_mapping (view->pixbuf_cache,
                        continue;
 
                form_field_mapping = ev_pixbuf_cache_get_form_field_mapping (view->pixbuf_cache,
-                                                                            field->page);
+                                                                            field->page->index);
                ev_form_field_mapping_get_area (form_field_mapping, field, &field_area);
 
                ev_form_field_mapping_get_area (form_field_mapping, field, &field_area);
 
-               doc_rect_to_view_rect (view, field->page, &field_area, &view_area);
+               doc_rect_to_view_rect (view, field->page->index, &field_area, &view_area);
                view_area.x -= view->scroll_x;
                view_area.y -= view->scroll_y;
 
                view_area.x -= view->scroll_x;
                view_area.y -= view->scroll_y;
 
@@ -2384,15 +2382,16 @@ ev_view_scroll_event (GtkWidget *widget, GdkEventScroll *event)
        }
 
        view->jump_to_find_result = FALSE;
        }
 
        view->jump_to_find_result = FALSE;
+
        /* Shift+Wheel scrolls the in the perpendicular direction */
        if (state & GDK_SHIFT_MASK) {
                if (event->direction == GDK_SCROLL_UP)
                        event->direction = GDK_SCROLL_LEFT;
        /* Shift+Wheel scrolls the in the perpendicular direction */
        if (state & GDK_SHIFT_MASK) {
                if (event->direction == GDK_SCROLL_UP)
                        event->direction = GDK_SCROLL_LEFT;
-               if (event->direction == GDK_SCROLL_LEFT)
+               else if (event->direction == GDK_SCROLL_LEFT)
                        event->direction = GDK_SCROLL_UP;
                        event->direction = GDK_SCROLL_UP;
-               if (event->direction == GDK_SCROLL_DOWN)
+               else if (event->direction == GDK_SCROLL_DOWN)
                        event->direction = GDK_SCROLL_RIGHT;
                        event->direction = GDK_SCROLL_RIGHT;
-               if (event->direction == GDK_SCROLL_RIGHT)
+               else if (event->direction == GDK_SCROLL_RIGHT)
                        event->direction = GDK_SCROLL_DOWN;
 
                event->state &= ~GDK_SHIFT_MASK;
                        event->direction = GDK_SCROLL_DOWN;
 
                event->state &= ~GDK_SHIFT_MASK;
@@ -2479,6 +2478,24 @@ ev_view_expose_event (GtkWidget      *widget,
        cairo_t *cr;
        gint     i;
 
        cairo_t *cr;
        gint     i;
 
+       if (view->animation && ev_transition_animation_ready (view->animation)) {
+               GdkRectangle page_area;
+               GtkBorder    border;
+
+               if (get_page_extents (view, view->current_page, &page_area, &border)) {
+                       cr = gdk_cairo_create (view->layout.bin_window);
+
+                       /* normalize to x=0, y=0 */
+                       cairo_translate (cr, page_area.x, page_area.y);
+                       page_area.x = page_area.y = 0;
+
+                       ev_transition_animation_paint (view->animation, cr, page_area);
+                       cairo_destroy (cr);
+               }
+
+               return TRUE;
+       }
+
        if (view->presentation) {
                switch (view->presentation_state) {
                        case EV_PRESENTATION_END: {
        if (view->presentation) {
                switch (view->presentation_state) {
                        case EV_PRESENTATION_END: {
@@ -2526,7 +2543,7 @@ ev_view_expose_event (GtkWidget      *widget,
 
                draw_one_page (view, i, cr, &page_area, &border, &(event->area), &page_ready);
 
 
                draw_one_page (view, i, cr, &page_area, &border, &(event->area), &page_ready);
 
-               if (page_ready && EV_IS_DOCUMENT_FIND (view->document) && view->highlight_find_results)
+               if (page_ready && view->find_pages && view->highlight_find_results)
                        highlight_find_results (view, i);
        }
 
                        highlight_find_results (view, i);
        }
 
@@ -2667,15 +2684,12 @@ ev_view_button_press_event (GtkWidget      *widget,
        
        view->pressed_button = event->button;
        view->selection_info.in_drag = FALSE;
        
        view->pressed_button = event->button;
        view->selection_info.in_drag = FALSE;
+
+       if (view->scroll_info.autoscrolling)
+               return TRUE;
        
        switch (event->button) {
                case 1: {
        
        switch (event->button) {
                case 1: {
-
-                       if (view->scroll_info.autoscrolling == TRUE) {
-                               view->scroll_info.autoscrolling = FALSE;
-                               return TRUE;
-                       }
-
                        EvImage *image;
                        EvFormField *field;
 
                        EvImage *image;
                        EvFormField *field;
 
@@ -2714,10 +2728,6 @@ ev_view_button_press_event (GtkWidget      *widget,
                case 2:
                        /* use root coordinates as reference point because
                         * scrolling changes window relative coordinates */
                case 2:
                        /* use root coordinates as reference point because
                         * scrolling changes window relative coordinates */
-                       if (view->scroll_info.autoscrolling == TRUE) {
-                               view->scroll_info.autoscrolling = FALSE;
-                               return TRUE;
-                       }
                        view->drag_info.start.x = event->x_root;
                        view->drag_info.start.y = event->y_root;
                        view->drag_info.hadj = gtk_adjustment_get_value (view->hadjustment);
                        view->drag_info.start.x = event->x_root;
                        view->drag_info.start.y = event->y_root;
                        view->drag_info.hadj = gtk_adjustment_get_value (view->hadjustment);
@@ -2727,8 +2737,7 @@ ev_view_button_press_event (GtkWidget      *widget,
 
                        return TRUE;
                case 3:
 
                        return TRUE;
                case 3:
-                       if (!view->scroll_info.autoscrolling)
-                               view->scroll_info.start_y = event->y;
+                       view->scroll_info.start_y = event->y;
                        return ev_view_do_popup_menu (view, event->x, event->y);
        }
        
                        return ev_view_do_popup_menu (view, event->x, event->y);
        }
        
@@ -2775,16 +2784,28 @@ ev_view_drag_data_get (GtkWidget        *widget,
                        if (view->image_dnd_info.image) {
                                GdkPixbuf *pixbuf;
 
                        if (view->image_dnd_info.image) {
                                GdkPixbuf *pixbuf;
 
-                               pixbuf = ev_image_get_pixbuf (view->image_dnd_info.image);
+                               ev_document_doc_mutex_lock ();
+                               pixbuf = ev_document_images_get_image (EV_DOCUMENT_IMAGES (view->document),
+                                                                      view->image_dnd_info.image);
+                               ev_document_doc_mutex_unlock ();
+                               
                                gtk_selection_data_set_pixbuf (selection_data, pixbuf);
                                gtk_selection_data_set_pixbuf (selection_data, pixbuf);
+                               g_object_unref (pixbuf);
                        }
                        break;
                case TARGET_DND_URI:
                        if (view->image_dnd_info.image) {
                        }
                        break;
                case TARGET_DND_URI:
                        if (view->image_dnd_info.image) {
+                               GdkPixbuf   *pixbuf;
                                const gchar *tmp_uri;
                                gchar      **uris;
 
                                const gchar *tmp_uri;
                                gchar      **uris;
 
-                               tmp_uri = ev_image_save_tmp (view->image_dnd_info.image);
+                               ev_document_doc_mutex_lock ();
+                               pixbuf = ev_document_images_get_image (EV_DOCUMENT_IMAGES (view->document),
+                                                                      view->image_dnd_info.image);
+                               ev_document_doc_mutex_unlock ();
+                               
+                               tmp_uri = ev_image_save_tmp (view->image_dnd_info.image, pixbuf);
+                               g_object_unref (pixbuf);
 
                                uris = g_new0 (gchar *, 2);
                                uris[0] = (gchar *)tmp_uri;
 
                                uris = g_new0 (gchar *, 2);
                                uris[0] = (gchar *)tmp_uri;
@@ -2973,6 +2994,7 @@ ev_view_motion_notify_event (GtkWidget      *widget,
 
        if (view->scroll_info.autoscrolling) {
                view->scroll_info.last_y = y;
 
        if (view->scroll_info.autoscrolling) {
                view->scroll_info.last_y = y;
+               return TRUE;
        }
 
        if (view->selection_info.in_drag) {
        }
 
        if (view->selection_info.in_drag) {
@@ -3106,19 +3128,30 @@ ev_view_button_release_event (GtkWidget      *widget,
        EvView *view = EV_VIEW (widget);
        EvLink *link = NULL;
 
        EvView *view = EV_VIEW (widget);
        EvLink *link = NULL;
 
-       view->drag_info.in_drag = FALSE;
        view->image_dnd_info.in_drag = FALSE;
        view->image_dnd_info.in_drag = FALSE;
-       
-       view->drag_info.release_timeout_id = g_timeout_add (20,
-                       (GSourceFunc)ev_view_scroll_drag_release, view);
 
 
-       if (view->pressed_button == 2) {
-               ev_view_handle_cursor_over_xy (view, event->x, event->y);
+       if (view->scroll_info.autoscrolling) {
+               ev_view_autoscroll_stop (view);
+               view->pressed_button = -1;
+
+               return TRUE;
+       } 
+
+       if (view->drag_info.in_drag) {
+               view->drag_info.release_timeout_id =
+                       g_timeout_add (20,
+                                      (GSourceFunc)ev_view_scroll_drag_release, view);
        }
 
        }
 
-       if (view->document && view->pressed_button != 3) {
+       if (view->document && !view->drag_info.in_drag && view->pressed_button != 3) {
                link = ev_view_get_link_at_location (view, event->x, event->y);
        }
                link = ev_view_get_link_at_location (view, event->x, event->y);
        }
+       
+       view->drag_info.in_drag = FALSE;
+
+       if (view->pressed_button == 2) {
+               ev_view_handle_cursor_over_xy (view, event->x, event->y);
+       }
 
        view->pressed_button = -1;
 
 
        view->pressed_button = -1;
 
@@ -3140,6 +3173,7 @@ ev_view_button_release_event (GtkWidget      *widget,
        }
 
        if (view->selection_info.selections) {
        }
 
        if (view->selection_info.selections) {
+               clear_link_selected (view);
                ev_view_update_primary_selection (view);
                
                if (view->selection_info.in_drag) {
                ev_view_update_primary_selection (view);
                
                if (view->selection_info.in_drag) {
@@ -3340,7 +3374,7 @@ ev_view_goto_window_create (EvView *view)
        g_signal_connect (view->goto_entry, "activate",
                          G_CALLBACK (ev_view_goto_entry_activate),
                          view);
        g_signal_connect (view->goto_entry, "activate",
                          G_CALLBACK (ev_view_goto_entry_activate),
                          view);
-       gtk_box_pack_start_defaults (GTK_BOX (hbox), view->goto_entry);
+       gtk_box_pack_start (GTK_BOX (hbox), view->goto_entry, TRUE, TRUE, 0);
        gtk_widget_show (view->goto_entry);
        gtk_widget_realize (view->goto_entry);
 }
        gtk_widget_show (view->goto_entry);
        gtk_widget_realize (view->goto_entry);
 }
@@ -3400,6 +3434,8 @@ ev_view_key_press_event (GtkWidget   *widget,
        switch (event->keyval) {
                case GDK_b:
                case GDK_B:
        switch (event->keyval) {
                case GDK_b:
                case GDK_B:
+               case GDK_period:
+               case GDK_KP_Decimal:
                        view->presentation_state =
                                (view->presentation_state == EV_PRESENTATION_BLACK) ?
                                EV_PRESENTATION_NORMAL : EV_PRESENTATION_BLACK;
                        view->presentation_state =
                                (view->presentation_state == EV_PRESENTATION_BLACK) ?
                                EV_PRESENTATION_NORMAL : EV_PRESENTATION_BLACK;
@@ -3568,15 +3604,12 @@ draw_rubberband (GtkWidget *widget, GdkWindow *window,
 static void
 highlight_find_results (EvView *view, int page)
 {
 static void
 highlight_find_results (EvView *view, int page)
 {
-       EvDocumentFind *find;
-       int i, results = 0;
+       gint i, n_results = 0;
 
 
-       find = EV_DOCUMENT_FIND (view->document);
+       n_results = ev_view_find_get_n_results (view, page);
 
 
-       results = ev_document_find_get_n_results (find, page);
-
-       for (i = 0; i < results; i++) {
-               EvRectangle rectangle;
+       for (i = 0; i < n_results; i++) {
+               EvRectangle *rectangle;
                GdkRectangle view_rectangle;
                guchar alpha;
 
                GdkRectangle view_rectangle;
                guchar alpha;
 
@@ -3586,8 +3619,8 @@ highlight_find_results (EvView *view, int page)
                        alpha = 0x20;
                }
 
                        alpha = 0x20;
                }
 
-               ev_document_find_get_result (find, page, i, &rectangle);
-               doc_rect_to_view_rect (view, page, &rectangle, &view_rectangle);
+               rectangle = ev_view_find_get_result (view, page, i);
+               doc_rect_to_view_rect (view, page, rectangle, &view_rectangle);
                draw_rubberband (GTK_WIDGET (view), view->layout.bin_window,
                                 &view_rectangle, alpha);
         }
                draw_rubberband (GTK_WIDGET (view), view->layout.bin_window,
                                 &view_rectangle, alpha);
         }
@@ -3601,12 +3634,6 @@ draw_loading_text (EvView       *view,
        cairo_t *cr;
        gint     width, height;
 
        cairo_t *cr;
        gint     width, height;
 
-       /* Don't annoy users with loading messages during presentations.
-        * FIXME: Temporary "workaround" for
-        * http://bugzilla.gnome.org/show_bug.cgi?id=320352 */
-       if (view->presentation)
-               return;
-
        if (!view->loading_text) {
                const gchar *loading_text = _("Loading...");
                PangoLayout *layout;
        if (!view->loading_text) {
                const gchar *loading_text = _("Loading...");
                PangoLayout *layout;
@@ -3707,9 +3734,12 @@ draw_one_page (EvView       *view,
                page_surface = ev_pixbuf_cache_get_surface (view->pixbuf_cache, page);
 
                if (!page_surface) {
                page_surface = ev_pixbuf_cache_get_surface (view->pixbuf_cache, page);
 
                if (!page_surface) {
-                       draw_loading_text (view,
-                                          &real_page_area,
-                                          expose_area);
+                       if (!view->presentation) {
+                               draw_loading_text (view,
+                                                  &real_page_area,
+                                                  expose_area);
+                       }
+
                        *page_ready = FALSE;
 
                        return;
                        *page_ready = FALSE;
 
                        return;
@@ -3725,7 +3755,7 @@ draw_one_page (EvView       *view,
 
                cairo_save (cr);
                cairo_translate (cr, overlap.x, overlap.y);
 
                cairo_save (cr);
                cairo_translate (cr, overlap.x, overlap.y);
-               
+
                if (width != page_width || height != page_height) {
                        cairo_pattern_set_filter (cairo_get_source (cr),
                                                  CAIRO_FILTER_FAST);
                if (width != page_width || height != page_height) {
                        cairo_pattern_set_filter (cairo_get_source (cr),
                                                  CAIRO_FILTER_FAST);
@@ -3785,9 +3815,8 @@ ev_view_finalize (GObject *object)
 {
        EvView *view = EV_VIEW (object);
 
 {
        EvView *view = EV_VIEW (object);
 
-       g_free (view->find_status);
-
        clear_selection (view);
        clear_selection (view);
+       clear_link_selected (view);
 
        if (view->image_dnd_info.image)
                g_object_unref (view->image_dnd_info.image);
 
        if (view->image_dnd_info.image)
                g_object_unref (view->image_dnd_info.image);
@@ -3935,9 +3964,6 @@ ev_view_get_property (GObject *object,
        EvView *view = EV_VIEW (object);
 
        switch (prop_id) {
        EvView *view = EV_VIEW (object);
 
        switch (prop_id) {
-               case PROP_FIND_STATUS:
-                       g_value_set_string (value, view->find_status);
-                       break;
                case PROP_CONTINUOUS:
                        g_value_set_boolean (value, view->continuous);
                        break;
                case PROP_CONTINUOUS:
                        g_value_set_boolean (value, view->continuous);
                        break;
@@ -4053,14 +4079,6 @@ ev_view_class_init (EvViewClass *class)
                         G_TYPE_OBJECT);
 
 
                         G_TYPE_OBJECT);
 
 
-       g_object_class_install_property (object_class,
-                                        PROP_FIND_STATUS,
-                                        g_param_spec_string ("find-status",
-                                                             "Find Status Message",
-                                                             "The find status message",
-                                                             NULL,
-                                                             G_PARAM_READABLE));
-
        g_object_class_install_property (object_class,
                                         PROP_CONTINUOUS,
                                         g_param_spec_boolean ("continuous",
        g_object_class_install_property (object_class,
                                         PROP_CONTINUOUS,
                                         g_param_spec_boolean ("continuous",
@@ -4186,22 +4204,61 @@ ev_view_init (EvView *view)
 /*** Callbacks ***/
 
 static void
 /*** Callbacks ***/
 
 static void
-find_changed_cb (EvDocument *document, int page, EvView *view)
+ev_view_change_page (EvView *view,
+                    gint    new_page)
 {
 {
-       double percent;
-       int n_pages;
+       gint x, y;
 
 
-       percent = ev_document_find_get_progress
-                       (EV_DOCUMENT_FIND (view->document)); 
-       n_pages = ev_page_cache_get_n_pages (view->page_cache);
-       
-       if (view->jump_to_find_result == TRUE) {
-               jump_to_find_page (view, EV_VIEW_FIND_NEXT, 0);
-               jump_to_find_result (view);
-       }
-       update_find_status_message (view, percent * n_pages >= n_pages - 1 );
-       if (view->current_page == page)
-               gtk_widget_queue_draw (GTK_WIDGET (view));
+       view->current_page = new_page;
+       view->pending_scroll = SCROLL_TO_PAGE_POSITION;
+
+       if (view->presentation)
+               ev_view_presentation_transition_start (view);
+
+       gtk_widget_get_pointer (GTK_WIDGET (view), &x, &y);
+       ev_view_handle_cursor_over_xy (view, x, y);
+
+       gtk_widget_queue_resize (GTK_WIDGET (view));
+}
+
+static void
+ev_view_transition_animation_finish (EvTransitionAnimation *animation,
+                                    EvView                *view)
+{
+       g_object_unref (view->animation);
+       view->animation = NULL;
+       ev_view_change_page (view, view->current_page);
+}
+
+static void
+ev_view_transition_animation_frame (EvTransitionAnimation *animation,
+                                   gdouble                progress,
+                                   EvView                *view)
+{
+       gtk_widget_queue_draw (GTK_WIDGET (view));
+}
+
+static void
+ev_view_presentation_animation_start (EvView *view,
+                                      int     new_page)
+{
+       EvTransitionEffect *effect = NULL;
+       cairo_surface_t *surface;
+
+        if (EV_IS_DOCUMENT_TRANSITION (view->document))
+               effect = ev_document_transition_get_effect (EV_DOCUMENT_TRANSITION (view->document),
+                                                           view->current_page);
+       if (!effect)
+               return;
+
+       surface = ev_pixbuf_cache_get_surface (view->pixbuf_cache, view->current_page);
+       view->animation = ev_transition_animation_new (effect);
+       ev_transition_animation_set_origin_surface (view->animation, surface);
+               
+       g_signal_connect (view->animation, "frame",
+                         G_CALLBACK (ev_view_transition_animation_frame), view);
+       g_signal_connect (view->animation, "finished",
+                         G_CALLBACK (ev_view_transition_animation_finish), view);
 }
 
 static void
 }
 
 static void
@@ -4209,6 +4266,13 @@ job_finished_cb (EvPixbufCache *pixbuf_cache,
                 GdkRegion     *region,
                 EvView        *view)
 {
                 GdkRegion     *region,
                 EvView        *view)
 {
+       if (view->animation) {
+               cairo_surface_t *surface;
+
+               surface = ev_pixbuf_cache_get_surface (pixbuf_cache, view->current_page);
+               ev_transition_animation_set_dest_surface (view->animation, surface);
+       }
+
        if (region) {
                gdk_window_invalidate_region (view->layout.bin_window,
                                              region, TRUE);
        if (region) {
                gdk_window_invalidate_region (view->layout.bin_window,
                                              region, TRUE);
@@ -4223,26 +4287,15 @@ page_changed_cb (EvPageCache *page_cache,
                 EvView      *view)
 {
        if (view->current_page != new_page) {
                 EvView      *view)
 {
        if (view->current_page != new_page) {
-               gint x, y;
-               
-               view->current_page = new_page;
-               view->pending_scroll = SCROLL_TO_PAGE_POSITION;
-
                if (view->presentation)
                if (view->presentation)
-                       ev_view_presentation_transition_start (view);
-               
-               gtk_widget_get_pointer (GTK_WIDGET (view), &x, &y);
-               ev_view_handle_cursor_over_xy (view, x, y);
-               
-               gtk_widget_queue_resize (GTK_WIDGET (view));
+                       ev_view_presentation_animation_start (view, new_page);
+
+               ev_view_change_page (view, new_page);
        } else {
                gtk_widget_queue_draw (GTK_WIDGET (view));
        }
 
        } else {
                gtk_widget_queue_draw (GTK_WIDGET (view));
        }
 
-       if (EV_IS_DOCUMENT_FIND (view->document)) {
-               view->find_result = 0;
-               update_find_status_message (view, TRUE);
-       }
+       view->find_result = 0;
 }
 
 static void
 }
 
 static void
@@ -4339,7 +4392,8 @@ ev_view_set_loading (EvView         *view,
        gtk_widget_queue_draw (GTK_WIDGET (view));
 }
 
        gtk_widget_queue_draw (GTK_WIDGET (view));
 }
 
-static gboolean ev_view_autoscroll_cb (EvView *view)
+static gboolean
+ev_view_autoscroll_cb (EvView *view)
 {
        gdouble speed, value;
 
 {
        gdouble speed, value;
 
@@ -4372,10 +4426,43 @@ static gboolean ev_view_autoscroll_cb (EvView *view)
 
 }
 
 
 }
 
-void ev_view_autoscroll(EvView *view)
+void
+ev_view_autoscroll_start (EvView *view)
 {
 {
+       gint x, y;
+       
+       g_return_if_fail (EV_IS_VIEW (view));
+
+       if (view->scroll_info.autoscrolling)
+               return;
+       
        view->scroll_info.autoscrolling = TRUE;
        view->scroll_info.autoscrolling = TRUE;
-       view->scroll_info.timeout_id = g_timeout_add (20, (GSourceFunc)(ev_view_autoscroll_cb), view);
+       view->scroll_info.timeout_id =
+               g_timeout_add (20, (GSourceFunc)ev_view_autoscroll_cb,
+                              view);
+       
+       gtk_widget_get_pointer (GTK_WIDGET (view), &x, &y);
+       ev_view_handle_cursor_over_xy (view, x, y);
+}
+
+void
+ev_view_autoscroll_stop (EvView *view)
+{
+       gint x, y;
+       
+       g_return_if_fail (EV_IS_VIEW (view));
+
+       if (!view->scroll_info.autoscrolling)
+               return;
+
+       view->scroll_info.autoscrolling = FALSE;
+       if (view->scroll_info.timeout_id) {
+               g_source_remove (view->scroll_info.timeout_id);
+               view->scroll_info.timeout_id = 0;
+       }
+
+       gtk_widget_get_pointer (GTK_WIDGET (view), &x, &y);
+       ev_view_handle_cursor_over_xy (view, x, y);
 }
 
 void
 }
 
 void
@@ -4390,12 +4477,8 @@ ev_view_set_document (EvView     *view,
                clear_caches (view);
 
                if (view->document) {
                clear_caches (view);
 
                if (view->document) {
-                        g_signal_handlers_disconnect_by_func (view->document,
-                                                              find_changed_cb,
-                                                              view);
                        g_object_unref (view->document);
                        view->page_cache = NULL;
                        g_object_unref (view->document);
                        view->page_cache = NULL;
-
                 }
 
                view->document = document;
                 }
 
                view->document = document;
@@ -4403,13 +4486,6 @@ ev_view_set_document (EvView     *view,
 
                if (view->document) {
                        g_object_ref (view->document);
 
                if (view->document) {
                        g_object_ref (view->document);
-                       if (EV_IS_DOCUMENT_FIND (view->document)) {
-                               g_signal_connect (view->document,
-                                                 "find_changed",
-                                                 G_CALLBACK (find_changed_cb),
-                                                 view);
-                       }
-
                        setup_caches (view);
                 }
 
                        setup_caches (view);
                 }
 
@@ -4579,9 +4655,15 @@ ev_view_set_presentation (EvView   *view,
 
        if (presentation)
                ev_view_presentation_transition_start (view);
 
        if (presentation)
                ev_view_presentation_transition_start (view);
-       else
+       else {
                ev_view_presentation_transition_stop (view);
 
                ev_view_presentation_transition_stop (view);
 
+               if (view->animation) {
+                       /* stop any running animation */
+                       ev_view_transition_animation_finish (view->animation, view);
+               }
+       }
+
        if (GTK_WIDGET_REALIZED (view)) {
                if (view->presentation)
                        gdk_window_set_background (view->layout.bin_window,
        if (GTK_WIDGET_REALIZED (view)) {
                if (view->presentation)
                        gdk_window_set_background (view->layout.bin_window,
@@ -4631,17 +4713,10 @@ ev_view_presentation_transition_start (EvView *view)
        duration = ev_document_transition_get_page_duration (EV_DOCUMENT_TRANSITION (view->document),
                                                             view->current_page);
        if (duration > 0) {
        duration = ev_document_transition_get_page_duration (EV_DOCUMENT_TRANSITION (view->document),
                                                             view->current_page);
        if (duration > 0) {
-#if GLIB_CHECK_VERSION (2, 13, 0)
                view->trans_timeout_id =
                        g_timeout_add_seconds (duration,
                                               (GSourceFunc) transition_next_page,
                                               view);
                view->trans_timeout_id =
                        g_timeout_add_seconds (duration,
                                               (GSourceFunc) transition_next_page,
                                               view);
-#else
-               view->trans_timeout_id =
-                       g_timeout_add (duration * 1000,
-                                      (GSourceFunc) transition_next_page,
-                                      view);
-#endif
        }
 }
 
        }
 }
 
@@ -5011,71 +5086,32 @@ ev_view_set_zoom_for_size (EvView *view,
 }
 
 /*** Find ***/
 }
 
 /*** Find ***/
-static void
-update_find_status_message (EvView *view, gboolean this_page)
-{
-       char *message;
-
-       if (this_page) {
-               int results;
-
-               results = ev_document_find_get_n_results
-                               (EV_DOCUMENT_FIND (view->document),
-                                view->current_page);
-               /* TRANS: Sometimes this could be better translated as
-                  "%d hit(s) on this page".  Therefore this string
-                  contains plural cases. */
-               message = g_strdup_printf (ngettext ("%d found on this page",
-                                                    "%d found on this page",
-                                                    results),
-                                          results);
-       } else {
-               double percent;
-
-               percent = ev_document_find_get_progress
-                               (EV_DOCUMENT_FIND (view->document));
-               message = g_strdup_printf (_("%3d%% remaining to search"),
-                                          (int) ((1.0 - percent) * 100));
-               
-       }
-       ev_view_set_find_status (view, message);
-       g_free (message);
-}
-
-const char *
-ev_view_get_find_status (EvView *view)
+static gint
+ev_view_find_get_n_results (EvView *view, gint page)
 {
 {
-       g_return_val_if_fail (EV_IS_VIEW (view), NULL);
-
-       return view->find_status;
+       return view->find_pages ? g_list_length (view->find_pages[page]) : 0;
 }
 
 }
 
-static void
-ev_view_set_find_status (EvView *view, const char *message)
+static EvRectangle *
+ev_view_find_get_result (EvView *view, gint page, gint result)
 {
 {
-       g_return_if_fail (EV_IS_VIEW (view));
-
-       g_free (view->find_status);
-       view->find_status = g_strdup (message);
-       g_object_notify (G_OBJECT (view), "find-status");
+       return view->find_pages ? (EvRectangle *) g_list_nth_data (view->find_pages[page], result) : NULL;
 }
 
 static void
 jump_to_find_result (EvView *view)
 {
 }
 
 static void
 jump_to_find_result (EvView *view)
 {
-       EvDocumentFind *find = EV_DOCUMENT_FIND (view->document);
-       EvRectangle rect;
-       GdkRectangle view_rect;
-       int n_results;
-       int page = view->current_page;
+       gint n_results;
+       gint page = view->current_page;
 
 
-       n_results = ev_document_find_get_n_results (find, page);
+       n_results = ev_view_find_get_n_results (view, page);
 
 
-       if (n_results > 0  && view->find_result < n_results) {
-               ev_document_find_get_result
-                       (find, page, view->find_result, &rect);
+       if (n_results > 0 && view->find_result < n_results) {
+               EvRectangle *rect;
+               GdkRectangle view_rect;
 
 
-               doc_rect_to_view_rect (view, page, &rect, &view_rect);
+               rect = ev_view_find_get_result (view, page, view->find_result);
+               doc_rect_to_view_rect (view, page, rect, &view_rect);
                ensure_rectangle_is_visible (view, &view_rect);
        }
 }
                ensure_rectangle_is_visible (view, &view_rect);
        }
 }
@@ -5098,7 +5134,6 @@ jump_to_find_page (EvView *view, EvViewFindDirection direction, gint shift)
        n_pages = ev_page_cache_get_n_pages (view->page_cache);
 
        for (i = 0; i < n_pages; i++) {
        n_pages = ev_page_cache_get_n_pages (view->page_cache);
 
        for (i = 0; i < n_pages; i++) {
-               int has_results;
                int page;
                
                if (direction == EV_VIEW_FIND_NEXT)
                int page;
                
                if (direction == EV_VIEW_FIND_NEXT)
@@ -5109,53 +5144,39 @@ jump_to_find_page (EvView *view, EvViewFindDirection direction, gint shift)
                
                if (page >= n_pages) {
                        page = page - n_pages;
                
                if (page >= n_pages) {
                        page = page - n_pages;
-               }
-               if (page < 0) 
+               } else if (page < 0) 
                        page = page + n_pages;
                        page = page + n_pages;
-               
-               has_results = ev_document_find_page_has_results
-                               (EV_DOCUMENT_FIND (view->document), page);
-               if (has_results == -1) {
-                       break;
-               } else if (has_results == 1) {
+
+               if (ev_view_find_get_n_results (view, page) > 0) {
                        ev_page_cache_set_current_page (view->page_cache, page);
                        break;
                }
        }
 }
 
                        ev_page_cache_set_current_page (view->page_cache, page);
                        break;
                }
        }
 }
 
-gboolean
-ev_view_can_find_next (EvView *view)
+void
+ev_view_find_changed (EvView *view, GList **results, gint page)
 {
 {
-       if (EV_IS_DOCUMENT_FIND (view->document)) {
-               EvDocumentFind *find = EV_DOCUMENT_FIND (view->document);
-               int i, n_pages;
-
-               n_pages = ev_page_cache_get_n_pages (view->page_cache);
-               for (i = 0; i < n_pages; i++) {
-                       if (ev_document_find_get_n_results (find, i) > 0) {
-                               return TRUE;
-                       }
-               }
+       view->find_pages = results;
+       
+       if (view->jump_to_find_result == TRUE) {
+               jump_to_find_page (view, EV_VIEW_FIND_NEXT, 0);
+               jump_to_find_result (view);
        }
 
        }
 
-       return FALSE;
+       if (view->current_page == page)
+               gtk_widget_queue_draw (GTK_WIDGET (view));
 }
 
 void
 ev_view_find_next (EvView *view)
 {
 }
 
 void
 ev_view_find_next (EvView *view)
 {
-       int n_results, n_pages;
-       EvDocumentFind *find = EV_DOCUMENT_FIND (view->document);
-
-       n_results = ev_document_find_get_n_results (find, view->current_page);
-
-       n_pages = ev_page_cache_get_n_pages (view->page_cache);
+       gint n_results;
 
 
+       n_results = ev_view_find_get_n_results (view, view->current_page);
        view->find_result++;
 
        if (view->find_result >= n_results) {
        view->find_result++;
 
        if (view->find_result >= n_results) {
-
                view->find_result = 0;
                jump_to_find_page (view, EV_VIEW_FIND_NEXT, 1);
                jump_to_find_result (view);
                view->find_result = 0;
                jump_to_find_page (view, EV_VIEW_FIND_NEXT, 1);
                jump_to_find_result (view);
@@ -5165,42 +5186,14 @@ ev_view_find_next (EvView *view)
        }
 }
 
        }
 }
 
-gboolean
-ev_view_can_find_previous (EvView *view)
-{
-       if (EV_IS_DOCUMENT_FIND (view->document)) {
-               EvDocumentFind *find = EV_DOCUMENT_FIND (view->document);
-               int i, n_pages;
-
-               n_pages = ev_page_cache_get_n_pages (view->page_cache);
-               for (i = n_pages - 1; i >= 0; i--) {
-                       if (ev_document_find_get_n_results (find, i) > 0) {
-                               return TRUE;
-                       }
-               }
-       }
-
-       return FALSE;
-}
 void
 ev_view_find_previous (EvView *view)
 {
 void
 ev_view_find_previous (EvView *view)
 {
-       int n_results, n_pages;
-       EvDocumentFind *find = EV_DOCUMENT_FIND (view->document);
-       EvPageCache *page_cache;
-
-       page_cache = ev_page_cache_get (view->document);
-
-       n_results = ev_document_find_get_n_results (find, view->current_page);
-
-       n_pages = ev_page_cache_get_n_pages (page_cache);
-
        view->find_result--;
 
        if (view->find_result < 0) {
        view->find_result--;
 
        if (view->find_result < 0) {
-
                jump_to_find_page (view, EV_VIEW_FIND_PREV, -1);
                jump_to_find_page (view, EV_VIEW_FIND_PREV, -1);
-               view->find_result = ev_document_find_get_n_results (find, view->current_page) - 1;
+               view->find_result = ev_view_find_get_n_results (view, view->current_page) - 1;
                jump_to_find_result (view);
        } else {
                jump_to_find_result (view);
                jump_to_find_result (view);
        } else {
                jump_to_find_result (view);
@@ -5208,18 +5201,27 @@ ev_view_find_previous (EvView *view)
        }
 }
 
        }
 }
 
-void ev_view_search_changed (EvView *view)
+void
+ev_view_find_search_changed (EvView *view)
 {
        /* search string has changed, focus on new search result */
        view->jump_to_find_result = TRUE;
 {
        /* search string has changed, focus on new search result */
        view->jump_to_find_result = TRUE;
+       view->find_pages = NULL;
 }
 
 }
 
-void ev_view_set_highlight_search (EvView *view, gboolean value)
+void
+ev_view_find_set_highlight_search (EvView *view, gboolean value)
 {
        view->highlight_find_results = value;
        gtk_widget_queue_draw (GTK_WIDGET (view));
 }
 
 {
        view->highlight_find_results = value;
        gtk_widget_queue_draw (GTK_WIDGET (view));
 }
 
+void
+ev_view_find_cancel (EvView *view)
+{
+       view->find_pages = NULL;
+}
+
 /*** Selections ***/
 
 /* compute_new_selection_rect/text calculates the area currently selected by
 /*** Selections ***/
 
 /* compute_new_selection_rect/text calculates the area currently selected by
@@ -5579,15 +5581,19 @@ get_selected_text (EvView *view)
        EvRenderContext *rc;
 
        text = g_string_new (NULL);
        EvRenderContext *rc;
 
        text = g_string_new (NULL);
-       rc = ev_render_context_new (view->rotation, 1, view->scale);
+       rc = ev_render_context_new (NULL, view->rotation, view->scale);
 
        ev_document_doc_mutex_lock ();
 
        for (l = view->selection_info.selections; l != NULL; l = l->next) {
                EvViewSelection *selection = (EvViewSelection *)l->data;
 
        ev_document_doc_mutex_lock ();
 
        for (l = view->selection_info.selections; l != NULL; l = l->next) {
                EvViewSelection *selection = (EvViewSelection *)l->data;
+               EvPage *page;
                gchar *tmp;
 
                gchar *tmp;
 
-               ev_render_context_set_page (rc, selection->page);
+               page = ev_document_get_page (view->document, selection->page);
+               ev_render_context_set_page (rc, page);
+               g_object_unref (page);
+               
                tmp = ev_selection_get_selected_text (EV_SELECTION (view->document),
                                                      rc, selection->style,
                                                      &(selection->rect));
                tmp = ev_selection_get_selected_text (EV_SELECTION (view->document),
                                                      rc, selection->style,
                                                      &(selection->rect));
@@ -5596,28 +5602,36 @@ get_selected_text (EvView *view)
                g_free (tmp);
        }
 
                g_free (tmp);
        }
 
-       ev_document_doc_mutex_unlock ();
-
        g_object_unref (rc);
        
        g_object_unref (rc);
        
+       ev_document_doc_mutex_unlock ();
+       
        normalized_text = g_utf8_normalize (text->str, text->len, G_NORMALIZE_NFKC);
        g_string_free (text, TRUE);
        return normalized_text;
 }
 
        normalized_text = g_utf8_normalize (text->str, text->len, G_NORMALIZE_NFKC);
        g_string_free (text, TRUE);
        return normalized_text;
 }
 
+static void
+ev_view_clipboard_copy (EvView      *view,
+                       const gchar *text)
+{
+       GtkClipboard *clipboard;
+
+       clipboard = gtk_widget_get_clipboard (GTK_WIDGET (view),
+                                             GDK_SELECTION_CLIPBOARD);
+       gtk_clipboard_set_text (clipboard, text, -1);
+}
+
 void
 ev_view_copy (EvView *ev_view)
 {
 void
 ev_view_copy (EvView *ev_view)
 {
-       GtkClipboard *clipboard;
        char *text;
 
        if (!EV_IS_SELECTION (ev_view->document))
                return;
 
        text = get_selected_text (ev_view);
        char *text;
 
        if (!EV_IS_SELECTION (ev_view->document))
                return;
 
        text = get_selected_text (ev_view);
-       clipboard = gtk_widget_get_clipboard (GTK_WIDGET (ev_view),
-                                             GDK_SELECTION_CLIPBOARD);
-       gtk_clipboard_set_text (clipboard, text, -1);
+       ev_view_clipboard_copy (ev_view, text);
        g_free (text);
 }
 
        g_free (text);
 }
 
@@ -5628,15 +5642,20 @@ ev_view_primary_get_cb (GtkClipboard     *clipboard,
                        gpointer          data)
 {
        EvView *ev_view = EV_VIEW (data);
                        gpointer          data)
 {
        EvView *ev_view = EV_VIEW (data);
-       char *text;
 
 
-       if (!EV_IS_SELECTION (ev_view->document))
-               return;
-
-       text = get_selected_text (ev_view);
-       if (text) {
-               gtk_selection_data_set_text (selection_data, text, -1);
-               g_free (text);
+       if (ev_view->link_selected) {
+               gtk_selection_data_set_text (selection_data,
+                                            ev_link_action_get_uri (ev_view->link_selected),
+                                            -1);
+       } else if (EV_IS_SELECTION (ev_view->document) &&
+                  ev_view->selection_info.selections) {
+               gchar *text;
+               
+               text = get_selected_text (ev_view);
+               if (text) {
+                       gtk_selection_data_set_text (selection_data, text, -1);
+                       g_free (text);
+               }
        }
 }
 
        }
 }
 
@@ -5647,6 +5666,7 @@ ev_view_primary_clear_cb (GtkClipboard *clipboard,
        EvView *view = EV_VIEW (data);
 
        clear_selection (view);
        EvView *view = EV_VIEW (data);
 
        clear_selection (view);
+       clear_link_selected (view);
 }
 
 static void
 }
 
 static void
@@ -5657,7 +5677,7 @@ ev_view_update_primary_selection (EvView *ev_view)
        clipboard = gtk_widget_get_clipboard (GTK_WIDGET (ev_view),
                                               GDK_SELECTION_PRIMARY);
 
        clipboard = gtk_widget_get_clipboard (GTK_WIDGET (ev_view),
                                               GDK_SELECTION_PRIMARY);
 
-       if (ev_view->selection_info.selections) {
+       if (ev_view->selection_info.selections || ev_view->link_selected) {
                if (!gtk_clipboard_set_with_owner (clipboard,
                                                   clipboard_targets,
                                                   G_N_ELEMENTS (clipboard_targets),
                if (!gtk_clipboard_set_with_owner (clipboard,
                                                   clipboard_targets,
                                                   G_N_ELEMENTS (clipboard_targets),
@@ -5671,6 +5691,27 @@ ev_view_update_primary_selection (EvView *ev_view)
        }
 }
 
        }
 }
 
+static void
+clear_link_selected (EvView *view)
+{
+       if (view->link_selected) {
+               g_object_unref (view->link_selected);
+               view->link_selected = NULL;
+       }
+}
+
+void
+ev_view_copy_link_address (EvView       *view,
+                          EvLinkAction *action)
+{
+       clear_link_selected (view);
+       
+       ev_view_clipboard_copy (view, ev_link_action_get_uri (action));
+       
+       view->link_selected = g_object_ref (action);
+       ev_view_update_primary_selection (view);
+}
+
 /*** Cursor operations ***/
 
 static GdkCursor *
 /*** Cursor operations ***/
 
 static GdkCursor *
@@ -5771,7 +5812,12 @@ ev_view_next_page (EvView *view)
             view->presentation_state == EV_PRESENTATION_WHITE)) {
                ev_view_reset_presentation_state (view);
                return FALSE; 
             view->presentation_state == EV_PRESENTATION_WHITE)) {
                ev_view_reset_presentation_state (view);
                return FALSE; 
-       }       
+       }
+
+       if (view->animation) {
+               ev_view_transition_animation_finish (view->animation, view);
+               return TRUE;
+       }
 
        ev_view_presentation_transition_stop (view);
        ev_view_reset_presentation_state (view);
 
        ev_view_presentation_transition_stop (view);
        ev_view_reset_presentation_state (view);
@@ -5822,6 +5868,11 @@ ev_view_previous_page (EvView *view)
                return FALSE; 
        }       
 
                return FALSE; 
        }       
 
+        if (view->animation) {
+               ev_view_transition_animation_finish (view->animation, view);
+               return TRUE;
+        }
+
        ev_view_reset_presentation_state (view);
 
        page = ev_page_cache_get_current_page (view->page_cache);
        ev_view_reset_presentation_state (view);
 
        page = ev_page_cache_get_current_page (view->page_cache);