]> www.fi.muni.cz Git - evince.git/commitdiff
[libview] Handle file attachment annotations
authorCarlos Garcia Campos <carlosgc@gnome.org>
Mon, 16 Nov 2009 13:27:44 +0000 (14:27 +0100)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Mon, 16 Nov 2009 13:28:50 +0000 (14:28 +0100)
Attachment is opened when annotation is clicked.

libview/ev-view.c

index 6417a43c6f949032c9c3e0bc64f4adc812a843e4..effbd362e0eb44af5f2b979df543e8a4379540ca 100644 (file)
@@ -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);