[evince] Add options to open and save attachment annotations to context menu
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evince] Add options to open and save attachment annotations to context menu
- Date: Tue, 17 Nov 2009 13:32:36 +0000 (UTC)
commit 71092ede528c45681c9130e5493308f32afc619a
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Tue Nov 17 14:31:26 2009 +0100
Add options to open and save attachment annotations to context menu
data/evince-ui.xml | 3 +++
libview/ev-view.c | 11 +++++++++--
shell/ev-window.c | 36 ++++++++++++++++++++++++++++++++++++
3 files changed, 48 insertions(+), 2 deletions(-)
---
diff --git a/data/evince-ui.xml b/data/evince-ui.xml
index bd5e947..108000c 100644
--- a/data/evince-ui.xml
+++ b/data/evince-ui.xml
@@ -77,6 +77,9 @@
<separator/>
<menuitem name="SaveImageAs" action="SaveImageAs"/>
<menuitem name="CopyImage" action="CopyImage"/>
+ <separator/>
+ <menuitem name="OpenAttachment" action="OpenAttachment"/>
+ <menuitem name="SaveAttachmentAs" action="SaveAttachmentAs"/>
</popup>
<popup name="AttachmentPopup" action="AttachmentPopupAction">
diff --git a/libview/ev-view.c b/libview/ev-view.c
index effbd36..8c59ec8 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -3209,8 +3209,9 @@ ev_view_do_popup_menu (EvView *view,
gdouble x,
gdouble y)
{
- EvLink *link;
- EvImage *image;
+ EvLink *link;
+ EvImage *image;
+ EvAnnotation *annot;
image = ev_view_get_image_at_location (view, x, y);
if (image) {
@@ -3224,6 +3225,12 @@ ev_view_do_popup_menu (EvView *view,
return TRUE;
}
+ annot = ev_view_get_annotation_at_location (view, x, y);
+ if (annot) {
+ g_signal_emit (view, signals[SIGNAL_POPUP_MENU], 0, annot);
+ return TRUE;
+ }
+
g_signal_emit (view, signals[SIGNAL_POPUP_MENU], 0, NULL);
return TRUE;
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 63d8f5c..e13fce8 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -59,6 +59,7 @@
#include "ev-document-images.h"
#include "ev-document-links.h"
#include "ev-document-thumbnails.h"
+#include "ev-document-annotations.h"
#include "ev-document-type-builtins.h"
#include "ev-file-exporter.h"
#include "ev-file-helpers.h"
@@ -4441,6 +4442,39 @@ view_menu_image_popup (EvWindow *ev_window,
gtk_action_set_visible (action, show_image);
}
+static void
+view_menu_annot_popup (EvWindow *ev_window,
+ EvAnnotation *annot)
+{
+ GtkAction *action;
+ gboolean show_annot = FALSE;
+
+ if (annot && EV_IS_ANNOTATION_ATTACHMENT (annot)) {
+ EvAttachment *attachment = EV_ANNOTATION_ATTACHMENT (annot)->attachment;
+
+ if (attachment) {
+ show_annot = TRUE;
+ if (ev_window->priv->attach_list) {
+ g_list_foreach (ev_window->priv->attach_list,
+ (GFunc) g_object_unref, NULL);
+ g_list_free (ev_window->priv->attach_list);
+ ev_window->priv->attach_list = NULL;
+ }
+ ev_window->priv->attach_list =
+ g_list_prepend (ev_window->priv->attach_list,
+ g_object_ref (attachment));
+ }
+ }
+
+ action = gtk_action_group_get_action (ev_window->priv->attachment_popup_action_group,
+ "OpenAttachment");
+ gtk_action_set_visible (action, show_annot);
+
+ action = gtk_action_group_get_action (ev_window->priv->attachment_popup_action_group,
+ "SaveAttachmentAs");
+ gtk_action_set_visible (action, show_annot);
+}
+
static gboolean
view_menu_popup_cb (EvView *view,
GObject *object,
@@ -4453,6 +4487,8 @@ view_menu_popup_cb (EvView *view,
EV_IS_LINK (object) ? EV_LINK (object) : NULL);
view_menu_image_popup (ev_window,
EV_IS_IMAGE (object) ? EV_IMAGE (object) : NULL);
+ view_menu_annot_popup (ev_window,
+ EV_IS_ANNOTATION (object) ? EV_ANNOTATION (object) : NULL);
gtk_menu_popup (GTK_MENU (ev_window->priv->view_popup),
NULL, NULL, NULL, NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]