[evince] [libview] Handle file attachment annotations



commit 786629e9bcbb8790973cc8ec083bd9d8be704b8f
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Mon Nov 16 14:27:44 2009 +0100

    [libview] Handle file attachment annotations
    
    Attachment is opened when annotation is clicked.

 libview/ev-view.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 6417a43..effbd36 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -2701,7 +2701,8 @@ static void
 ev_view_handle_annotation (EvView       *view,
 			   EvAnnotation *annot,
 			   gdouble       x,
-			   gdouble       y)
+			   gdouble       y,
+			   guint32       timestamp)
 {
 	if (EV_IS_ANNOTATION_MARKUP (annot)) {
 		GtkWidget *window;
@@ -2718,6 +2719,24 @@ ev_view_handle_annotation (EvView       *view,
 			}
 		}
 	}
+
+	if (EV_IS_ANNOTATION_ATTACHMENT (annot)) {
+		EvAttachment *attachment = EV_ANNOTATION_ATTACHMENT (annot)->attachment;
+
+		if (attachment) {
+			GError *error = NULL;
+
+			ev_attachment_open (attachment,
+					    gtk_widget_get_screen (GTK_WIDGET (view)),
+					    timestamp,
+					    &error);
+
+			if (error) {
+				g_warning ("%s", error->message);
+				g_error_free (error);
+			}
+		}
+	}
 }
 
 /*** GtkWidget implementation ***/
@@ -3380,7 +3399,7 @@ ev_view_button_press_event (GtkWidget      *widget,
 
 				gtk_widget_queue_draw (widget);
 			} else if ((annot = ev_view_get_annotation_at_location (view, event->x, event->y))) {
-				ev_view_handle_annotation (view, annot, event->x, event->y);
+				ev_view_handle_annotation (view, annot, event->x, event->y, event->time);
 			} else if ((field = ev_view_get_form_field_at_location (view, event->x, event->y))) {
 				ev_view_remove_all (view);
 				ev_view_handle_form_field (view, field, event->x, event->y);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]