summaryrefslogtreecommitdiff
path: root/libview/ev-view.c
diff options
context:
space:
mode:
authorGermán Poo-Caamaño <[email protected]>2014-05-02 18:25:30 -0700
committerraveit65 <[email protected]>2017-08-28 16:04:01 +0200
commit1407d52f712f3616e9420030726e2fbd1afbb45e (patch)
tree2a0a4b0f70dd0b5654794d28852463f9937f750b /libview/ev-view.c
parent4a24be7eb05f971e77064fb22d7a649bf959d90b (diff)
downloadatril-1407d52f712f3616e9420030726e2fbd1afbb45e.tar.bz2
atril-1407d52f712f3616e9420030726e2fbd1afbb45e.tar.xz
libview: add ev_view_remove_annotation
Hide annotation windows if necessary and unset selected element before removing an annotation. https://bugzilla.gnome.org/show_bug.cgi?id=649044 origin commit: https://git.gnome.org/browse/evince/commit/?id=927e956
Diffstat (limited to 'libview/ev-view.c')
-rw-r--r--libview/ev-view.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 6258ea33..6f7f2470 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -3093,6 +3093,40 @@ ev_view_cancel_add_annotation (EvView *view)
ev_view_handle_cursor_over_xy (view, x, y);
}
+void
+ev_view_remove_annotation (EvView *view,
+ EvAnnotation *annot)
+{
+ guint page;
+
+ g_return_if_fail (EV_IS_VIEW (view));
+ g_return_if_fail (EV_IS_ANNOTATION (annot));
+
+ page = ev_annotation_get_page_index (annot);
+
+ if (EV_IS_ANNOTATION_MARKUP (annot)) {
+ EvViewWindowChild *child;
+
+ child = ev_view_find_window_child_for_annot (view, page, annot);
+ if (child) {
+ view->window_children = g_list_remove (view->window_children, child);
+ gtk_widget_destroy (child->window);
+ g_free (child);
+ }
+ }
+ _ev_view_set_focused_element (view, NULL, -1);
+
+ ev_document_doc_mutex_lock ();
+ ev_document_annotations_remove_annotation (EV_DOCUMENT_ANNOTATIONS (view->document),
+ annot);
+ ev_document_doc_mutex_unlock ();
+
+ ev_page_cache_mark_dirty (view->page_cache, page);
+
+ /* FIXME: only redraw the annot area */
+ ev_view_reload_page (view, page, NULL);
+}
+
static gboolean
ev_view_synctex_backward_search (EvView *view,
gdouble x,