summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2017-08-22 17:24:33 +0200
committerraveit65 <[email protected]>2017-08-28 16:04:01 +0200
commit5891c789db9e0d6828a4ab0a9b4c77d57138ae0f (patch)
tree0c4ebe6daa002e9ca094e32fb19b7e47b3a94c3f
parent1407d52f712f3616e9420030726e2fbd1afbb45e (diff)
downloadatril-5891c789db9e0d6828a4ab0a9b4c77d57138ae0f.tar.bz2
atril-5891c789db9e0d6828a4ab0a9b4c77d57138ae0f.tar.xz
Add an option to remove annotations to the view popup menu
https://bugzilla.gnome.org/show_bug.cgi?id=649044 inspired by: https://git.gnome.org/browse/evince/commit/?id=0f19833
-rw-r--r--data/atril-ui.xml1
-rw-r--r--shell/ev-window.c21
2 files changed, 21 insertions, 1 deletions
diff --git a/data/atril-ui.xml b/data/atril-ui.xml
index d6161396..579651e5 100644
--- a/data/atril-ui.xml
+++ b/data/atril-ui.xml
@@ -95,6 +95,7 @@
<menuitem name="SaveAttachmentAs" action="SaveAttachmentAs"/>
<separator/>
<menuitem name="AnnotProperties" action="AnnotProperties"/>
+ <menuitem name="RemoveAnnot" action="RemoveAnnot"/>
</popup>
<popup name="AttachmentPopup" action="AttachmentPopupAction">
diff --git a/shell/ev-window.c b/shell/ev-window.c
index f15a74da..13870211 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -336,6 +336,8 @@ static void ev_view_popup_cmd_copy_image (GtkAction *actio
EvWindow *window);
static void ev_view_popup_cmd_annot_properties (GtkAction *action,
EvWindow *window);
+static void ev_view_popup_cmd_remove_annotation (GtkAction *action,
+ EvWindow *window);
static void ev_attachment_popup_cmd_open_attachment (GtkAction *action,
EvWindow *window);
static void ev_attachment_popup_cmd_save_attachment_as (GtkAction *action,
@@ -5359,6 +5361,7 @@ view_menu_annot_popup (EvWindow *ev_window,
{
GtkAction *action;
gboolean show_annot = FALSE;
+ gboolean can_remove_annots;
if (ev_window->priv->document->iswebdocument == TRUE ) return ;
if (ev_window->priv->annot)
g_object_unref (ev_window->priv->annot);
@@ -5368,6 +5371,12 @@ view_menu_annot_popup (EvWindow *ev_window,
"AnnotProperties");
gtk_action_set_visible (action, (annot != NULL && EV_IS_ANNOTATION_MARKUP (annot)));
+ can_remove_annots = ev_document_annotations_can_remove_annotation (EV_DOCUMENT_ANNOTATIONS (ev_window->priv->document));
+
+ action = gtk_action_group_get_action (ev_window->priv->view_popup_action_group,
+ "RemoveAnnot");
+ gtk_action_set_visible (action, (annot != NULL && can_remove_annots));
+
if (annot && EV_IS_ANNOTATION_ATTACHMENT (annot)) {
EvAttachment *attachment;
@@ -6336,7 +6345,9 @@ static const GtkActionEntry view_popup_entries [] = {
{ "CopyImage", NULL, N_("Copy _Image"), NULL,
NULL, G_CALLBACK (ev_view_popup_cmd_copy_image) },
{ "AnnotProperties", NULL, N_("Annotation Properties…"), NULL,
- NULL, G_CALLBACK (ev_view_popup_cmd_annot_properties) }
+ NULL, G_CALLBACK (ev_view_popup_cmd_annot_properties) },
+ { "RemoveAnnot", NULL, N_("Remove Annot…"), NULL,
+ NULL, G_CALLBACK (ev_view_popup_cmd_remove_annotation) }
};
static const GtkActionEntry attachment_popup_entries [] = {
@@ -7126,6 +7137,14 @@ ev_view_popup_cmd_annot_properties (GtkAction *action,
}
static void
+ev_view_popup_cmd_remove_annotation (GtkAction *action,
+ EvWindow *window)
+{
+ ev_view_remove_annotation (EV_VIEW (window->priv->view),
+ window->priv->annot);
+}
+
+static void
ev_attachment_popup_cmd_open_attachment (GtkAction *action, EvWindow *window)
{
GList *l;