]> www.fi.muni.cz Git - evince.git/blobdiff - shell/ev-view.c
Fix critical warnings when there is no document loaded.
[evince.git] / shell / ev-view.c
index 072ca0822336eb1439dbd257f5ea4c674bb6a244..27a2149a2b63b16a65cb2b5f42abb622aa7ce29d 100644 (file)
@@ -1348,7 +1348,6 @@ ev_view_handle_link (EvView *view, EvLink *link)
        if (!action)
                return;
 
-       
        type = ev_link_action_get_action_type (action);
 
        switch (type) {
@@ -1983,6 +1982,9 @@ ev_view_button_press_event (GtkWidget      *widget,
                            GdkEventButton *event)
 {
        EvView *view = EV_VIEW (widget);
+
+       if (!view->document)
+               return FALSE;
        
        if (!GTK_WIDGET_HAS_FOCUS (widget)) {
                gtk_widget_grab_focus (widget);
@@ -2005,7 +2007,8 @@ ev_view_button_press_event (GtkWidget      *widget,
                                }
                                
                                gtk_widget_queue_draw (widget);
-                       } else if ((image = ev_view_get_image_at_location (view, event->x, event->y))) {
+                       } else if (!location_in_text (view, event->x + view->scroll_x, event->y + view->scroll_y) &&
+                                  (image = ev_view_get_image_at_location (view, event->x, event->y))) {
                                if (view->image_dnd_info.image)
                                        g_object_unref (view->image_dnd_info.image);
                                view->image_dnd_info.image = g_object_ref (image);
@@ -2584,6 +2587,9 @@ ev_view_key_press_event (GtkWidget   *widget,
        EvView *view = EV_VIEW (widget);
        EvPresentationState current;
 
+       if (!view->document)
+               return FALSE;
+       
        if (!view->presentation ||
            view->presentation_state == EV_PRESENTATION_END)
                return gtk_bindings_activate_event (GTK_OBJECT (widget), event);
@@ -3782,6 +3788,9 @@ ev_view_zoom_in (EvView *view)
 {
        g_return_if_fail (view->sizing_mode == EV_SIZING_FREE);
 
+       if (view->presentation)
+               return;
+       
        view->pending_scroll = SCROLL_TO_CENTER;
        ev_view_set_zoom (view, ZOOM_IN_FACTOR, TRUE);
 }
@@ -3791,6 +3800,9 @@ ev_view_zoom_out (EvView *view)
 {
        g_return_if_fail (view->sizing_mode == EV_SIZING_FREE);
 
+       if (view->presentation)
+               return;
+       
        view->pending_scroll = SCROLL_TO_CENTER;
        ev_view_set_zoom (view, ZOOM_OUT_FACTOR, TRUE);
 }