[evince/wip/annotation_support: 6/7] shell: Add RemoveAnnot action to the view popup.



commit e8c42734e7d3c78db810dc3557ffe343fd1bd2ec
Author: Josà Aliste <jaliste gnome org>
Date:   Wed Jun 27 08:58:59 2012 -0400

    shell: Add RemoveAnnot action to the view popup.

 data/evince-ui.xml |    1 +
 shell/ev-window.c  |   27 ++++++++++++++++++++++++++-
 2 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/data/evince-ui.xml b/data/evince-ui.xml
index 8bfe033..9cf5b91 100644
--- a/data/evince-ui.xml
+++ b/data/evince-ui.xml
@@ -97,6 +97,7 @@
     <menuitem name="SaveAttachmentAs" action="SaveAttachmentAs"/>
     <separator/>
     <menuitem name="AnnotProperties" action="AnnotProperties"/>
+    <menuitem name="AnnotRemove" action="AnnotRemove"/>
     <menuitem name="FileOpenContainingFolder" action="FileOpenContainingFolder"/>
   </popup>
 
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 1973776..f9b1ebf 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -332,6 +332,8 @@ static void     ev_view_popup_cmd_save_image_as         (GtkAction        *actio
 							 EvWindow         *window);
 static void     ev_view_popup_cmd_copy_image            (GtkAction        *action,
 							 EvWindow         *window);
+static void     ev_view_popup_cmd_remove_annot          (GtkAction        *action,
+                                                         EvWindow         *window);
 static void     ev_view_popup_cmd_annot_properties      (GtkAction        *action,
 							 EvWindow         *window);
 static void	ev_attachment_popup_cmd_open_attachment (GtkAction        *action,
@@ -5136,6 +5138,13 @@ view_menu_annot_popup (EvWindow     *ev_window,
 					      "AnnotProperties");
 	gtk_action_set_visible (action, (annot != NULL && EV_IS_ANNOTATION_MARKUP (annot)));
 
+	action = gtk_action_group_get_action (ev_window->priv->view_popup_action_group,
+					      "AnnotRemove");
+	show_annot = ev_document_annotations_can_remove_annotation (EV_DOCUMENT_ANNOTATIONS (ev_window->priv->document));
+	
+	gtk_action_set_visible (action, (annot != NULL) && show_annot);
+	show_annot = FALSE;
+
 	if (annot && EV_IS_ANNOTATION_ATTACHMENT (annot)) {
 		EvAttachment *attachment;
 
@@ -6003,7 +6012,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) },
+	{ "AnnotRemove", NULL, N_("Remove Annotation"), NULL,
+	  NULL, G_CALLBACK (ev_view_popup_cmd_remove_annot) }
 };
 
 static const GtkActionEntry attachment_popup_entries [] = {
@@ -6699,6 +6710,20 @@ ev_view_popup_cmd_copy_image (GtkAction *action, EvWindow *window)
 }
 
 static void
+ev_view_popup_cmd_remove_annot (GtkAction *action,
+			       EvWindow  *window)
+{
+	guint page = ev_annotation_get_page_index (window->priv->annot);
+
+	ev_document_doc_mutex_lock ();
+        ev_document_annotations_remove_annotation (EV_DOCUMENT_ANNOTATIONS (window->priv->document),
+                                                         window->priv->annot);
+
+        ev_document_doc_mutex_unlock ();
+	ev_view_reload_page (EV_VIEW (window->priv->view), page, NULL);
+}
+
+static void
 ev_view_popup_cmd_annot_properties (GtkAction *action,
 				    EvWindow  *window)
 {



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