From: Carlos Garcia Campos Date: Mon, 16 Nov 2009 13:27:44 +0000 (+0100) Subject: [libview] Handle file attachment annotations X-Git-Tag: EVINCE_2_29_2~2 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=786629e9bcbb8790973cc8ec083bd9d8be704b8f;p=evince.git [libview] Handle file attachment annotations Attachment is opened when annotation is clicked. --- diff --git a/libview/ev-view.c b/libview/ev-view.c index 6417a43c..effbd362 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);