]> www.fi.muni.cz Git - evince.git/blobdiff - shell/ev-view.c
More renames of warning to mdvi_warning in follow up to the fix of the bug
[evince.git] / shell / ev-view.c
index 1685aee823eb8c8070111dcda836083913ed187e..41efa337be8426d89b608865e8631595f01fe2cb 100644 (file)
 #include "ev-view.h"
 #include "ev-view-private.h"
 
 #include "ev-view.h"
 #include "ev-view-private.h"
 
-#if !GTK_CHECK_VERSION (2, 11, 7)
-#include "ev-tooltip.h"
-#endif
-
 #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))
@@ -1526,33 +1522,8 @@ ev_view_handle_cursor_over_xy (EvView *view, gint x, gint y)
        }
        
        link = ev_view_get_link_at_location (view, x, y);
        }
        
        link = ev_view_get_link_at_location (view, x, y);
-       
-#if !GTK_CHECK_VERSION (2, 11, 7)
-       if (view->link_tooltip == NULL) {
-               view->link_tooltip = ev_tooltip_new (GTK_WIDGET (view));
-       }
-
-       if (view->hovered_link != link) {
-               view->hovered_link = link;
-               ev_tooltip_deactivate (EV_TOOLTIP (view->link_tooltip));
-       }
-#endif
-
         if (link) {
         if (link) {
-#if GTK_CHECK_VERSION (2, 11, 7)
                g_object_set (view, "has-tooltip", TRUE, NULL);
                g_object_set (view, "has-tooltip", TRUE, NULL);
-#else
-               char *msg = tip_from_link (view, link);
-
-               if (msg && g_utf8_validate (msg, -1, NULL)) {
-                       EvTooltip *tooltip = EV_TOOLTIP (view->link_tooltip);
-
-                       ev_tooltip_set_position (tooltip, x, y);
-                       ev_tooltip_set_text (tooltip, msg);
-                       ev_tooltip_activate (tooltip);
-               }
-               g_free (msg);
-#endif
                ev_view_set_cursor (view, EV_VIEW_CURSOR_LINK);
        } else if ((field = ev_view_get_form_field_at_location (view, x, y))) {
                if (field->is_read_only) {
                ev_view_set_cursor (view, EV_VIEW_CURSOR_LINK);
        } else if ((field = ev_view_get_form_field_at_location (view, x, y))) {
                if (field->is_read_only) {
@@ -2589,7 +2560,6 @@ ev_view_popup_menu (GtkWidget *widget)
        return ev_view_do_popup_menu (EV_VIEW (widget), x, y);
 }
 
        return ev_view_do_popup_menu (EV_VIEW (widget), x, y);
 }
 
-#if GTK_CHECK_VERSION (2, 11, 7)
 static void
 get_link_area (EvView       *view,
               gint          x,
 static void
 get_link_area (EvView       *view,
               gint          x,
@@ -2641,7 +2611,6 @@ ev_view_query_tooltip (GtkWidget         *widget,
 
        return TRUE;
 }
 
        return TRUE;
 }
-#endif /* GTK_CHECK_VERSION (2, 11, 7) */
 
 static void
 start_selection_for_event (EvView         *view,
 
 static void
 start_selection_for_event (EvView         *view,
@@ -3528,13 +3497,6 @@ ev_view_leave_notify_event (GtkWidget *widget, GdkEventCrossing   *event)
        if (view->cursor != EV_VIEW_CURSOR_NORMAL)
                ev_view_set_cursor (view, EV_VIEW_CURSOR_NORMAL);
 
        if (view->cursor != EV_VIEW_CURSOR_NORMAL)
                ev_view_set_cursor (view, EV_VIEW_CURSOR_NORMAL);
 
-#if !GTK_CHECK_VERSION (2, 11, 7)
-       if (view->link_tooltip) {
-               view->hovered_link = NULL;
-               ev_tooltip_deactivate (EV_TOOLTIP (view->link_tooltip));
-       }
-#endif
-       
        return FALSE;
 }
 
        return FALSE;
 }
 
@@ -3846,12 +3808,6 @@ ev_view_destroy (GtkObject *object)
                view->pixbuf_cache = NULL;
        }
 
                view->pixbuf_cache = NULL;
        }
 
-#if !GTK_CHECK_VERSION (2, 11, 7)
-       if (view->link_tooltip) {
-               gtk_widget_destroy (view->link_tooltip);
-               view->link_tooltip = NULL;
-       }
-#endif
        if (view->goto_window) {
                gtk_widget_destroy (view->goto_window);
                view->goto_window = NULL;
        if (view->goto_window) {
                gtk_widget_destroy (view->goto_window);
                view->goto_window = NULL;
@@ -4032,9 +3988,7 @@ ev_view_class_init (EvViewClass *class)
        widget_class->drag_motion = ev_view_drag_motion;
        widget_class->drag_data_received = ev_view_drag_data_received;
        widget_class->popup_menu = ev_view_popup_menu;
        widget_class->drag_motion = ev_view_drag_motion;
        widget_class->drag_data_received = ev_view_drag_data_received;
        widget_class->popup_menu = ev_view_popup_menu;
-#if GTK_CHECK_VERSION (2, 11, 7)
        widget_class->query_tooltip = ev_view_query_tooltip;
        widget_class->query_tooltip = ev_view_query_tooltip;
-#endif
 
        gtk_object_class->destroy = ev_view_destroy;
 
 
        gtk_object_class->destroy = ev_view_destroy;
 
@@ -4211,14 +4165,15 @@ ev_view_init (EvView *view)
 
 static void
 ev_view_change_page (EvView *view,
 
 static void
 ev_view_change_page (EvView *view,
-                    gint    new_page)
+                    gint    new_page,
+                    gboolean start_transition)
 {
        gint x, y;
 
        view->current_page = new_page;
        view->pending_scroll = SCROLL_TO_PAGE_POSITION;
 
 {
        gint x, y;
 
        view->current_page = new_page;
        view->pending_scroll = SCROLL_TO_PAGE_POSITION;
 
-       if (view->presentation)
+       if (view->presentation && start_transition)
                ev_view_presentation_transition_start (view);
 
        gtk_widget_get_pointer (GTK_WIDGET (view), &x, &y);
                ev_view_presentation_transition_start (view);
 
        gtk_widget_get_pointer (GTK_WIDGET (view), &x, &y);
@@ -4233,7 +4188,24 @@ ev_view_transition_animation_finish (EvTransitionAnimation *animation,
 {
        g_object_unref (view->animation);
        view->animation = NULL;
 {
        g_object_unref (view->animation);
        view->animation = NULL;
-       ev_view_change_page (view, view->current_page);
+       ev_view_change_page (view, view->current_page, TRUE);
+}
+
+/**
+ * ev_view_transition_animation_cancel:
+ * @animation: Animation to finish
+ * @view: An EvView
+ *
+ * Does almost the same as cancel, but without scheduling the transition.
+ */
+
+static void
+ev_view_transition_animation_cancel (EvTransitionAnimation *animation,
+                                    EvView                *view)
+{
+       g_object_unref (view->animation);
+       view->animation = NULL;
+       ev_view_change_page (view, view->current_page, FALSE);
 }
 
 static void
 }
 
 static void
@@ -4296,7 +4268,7 @@ page_changed_cb (EvPageCache *page_cache,
                if (view->presentation)
                        ev_view_presentation_animation_start (view, new_page);
 
                if (view->presentation)
                        ev_view_presentation_animation_start (view, new_page);
 
-               ev_view_change_page (view, new_page);
+               ev_view_change_page (view, new_page, TRUE);
        } else {
                gtk_widget_queue_draw (GTK_WIDGET (view));
        }
        } else {
                gtk_widget_queue_draw (GTK_WIDGET (view));
        }
@@ -4666,7 +4638,7 @@ ev_view_set_presentation (EvView   *view,
 
                if (view->animation) {
                        /* stop any running animation */
 
                if (view->animation) {
                        /* stop any running animation */
-                       ev_view_transition_animation_finish (view->animation, view);
+                       ev_view_transition_animation_cancel (view->animation, view);
                }
        }
 
                }
        }
 
@@ -5390,6 +5362,7 @@ merge_selection_region (EvView *view,
        /* Update the selection */
        old_list = ev_pixbuf_cache_get_selection_list (view->pixbuf_cache);
        g_list_foreach (view->selection_info.selections, (GFunc)selection_free, NULL);
        /* Update the selection */
        old_list = ev_pixbuf_cache_get_selection_list (view->pixbuf_cache);
        g_list_foreach (view->selection_info.selections, (GFunc)selection_free, NULL);
+       g_list_free (view->selection_info.selections);
        view->selection_info.selections = new_list;
        ev_pixbuf_cache_set_selection_list (view->pixbuf_cache, new_list);
        g_object_notify (G_OBJECT (view), "has-selection");
        view->selection_info.selections = new_list;
        ev_pixbuf_cache_set_selection_list (view->pixbuf_cache, new_list);
        g_object_notify (G_OBJECT (view), "has-selection");
@@ -5498,6 +5471,7 @@ merge_selection_region (EvView *view,
 
        /* Free the old list, now that we're done with it. */
        g_list_foreach (old_list, (GFunc) selection_free, NULL);
 
        /* Free the old list, now that we're done with it. */
        g_list_foreach (old_list, (GFunc) selection_free, NULL);
+       g_list_free (old_list);
 }
 
 static void
 }
 
 static void
@@ -5529,6 +5503,7 @@ static void
 clear_selection (EvView *view)
 {
        g_list_foreach (view->selection_info.selections, (GFunc)selection_free, NULL);
 clear_selection (EvView *view)
 {
        g_list_foreach (view->selection_info.selections, (GFunc)selection_free, NULL);
+       g_list_free (view->selection_info.selections);
        view->selection_info.selections = NULL;
        view->selection_info.in_selection = FALSE;
        if (view->pixbuf_cache)
        view->selection_info.selections = NULL;
        view->selection_info.in_selection = FALSE;
        if (view->pixbuf_cache)
@@ -5821,8 +5796,7 @@ ev_view_next_page (EvView *view)
        }
 
        if (view->animation) {
        }
 
        if (view->animation) {
-               ev_view_transition_animation_finish (view->animation, view);
-               return TRUE;
+               ev_view_transition_animation_cancel (view->animation, view);
        }
 
        ev_view_presentation_transition_stop (view);
        }
 
        ev_view_presentation_transition_stop (view);
@@ -5875,8 +5849,7 @@ ev_view_previous_page (EvView *view)
        }       
 
         if (view->animation) {
        }       
 
         if (view->animation) {
-               ev_view_transition_animation_finish (view->animation, view);
-               return TRUE;
+               ev_view_transition_animation_cancel (view->animation, view);
         }
 
        ev_view_reset_presentation_state (view);
         }
 
        ev_view_reset_presentation_state (view);