summaryrefslogtreecommitdiff
path: root/libview
diff options
context:
space:
mode:
authorGiselle Machado <[email protected]>2014-06-22 18:39:58 +0200
committerraveit65 <[email protected]>2017-08-28 16:04:01 +0200
commit4fc9b355075c0298b0306f43e5b73d136dcdf939 (patch)
tree2a15ae1a3e3519cae56d320a490618855a71b304 /libview
parentd16ebefe945ddca508e2e7c7e360f671078cf5d3 (diff)
downloadatril-4fc9b355075c0298b0306f43e5b73d136dcdf939.tar.bz2
atril-4fc9b355075c0298b0306f43e5b73d136dcdf939.tar.xz
Refreshing annotations' sidebar upon deletion
When an annotation is deleted, the sidebar needs to be refreshed so that the annotation is removed from the list See item 3 in this comment: https://bugzilla.gnome.org/show_bug.cgi?id=649044#c33 origin commit: https://git.gnome.org/browse/evince/commit/?id=13defb2
Diffstat (limited to 'libview')
-rw-r--r--libview/ev-view-private.h2
-rw-r--r--libview/ev-view.c14
2 files changed, 16 insertions, 0 deletions
diff --git a/libview/ev-view-private.h b/libview/ev-view-private.h
index 4711e8f9..02219641 100644
--- a/libview/ev-view-private.h
+++ b/libview/ev-view-private.h
@@ -242,6 +242,8 @@ struct _EvViewClass {
EvSourceLink *link);
void (*annot_added) (EvView *view,
EvAnnotation *annot);
+ void (*annot_removed) (EvView *view,
+ EvAnnotation *annot);
void (*layers_changed) (EvView *view);
};
diff --git a/libview/ev-view.c b/libview/ev-view.c
index f409a2e5..b898286e 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -57,6 +57,7 @@ enum {
SIGNAL_SELECTION_CHANGED,
SIGNAL_SYNC_SOURCE,
SIGNAL_ANNOT_ADDED,
+ SIGNAL_ANNOT_REMOVED,
SIGNAL_LAYERS_CHANGED,
N_SIGNALS
};
@@ -3102,6 +3103,8 @@ ev_view_remove_annotation (EvView *view,
g_return_if_fail (EV_IS_VIEW (view));
g_return_if_fail (EV_IS_ANNOTATION (annot));
+ g_object_ref (annot);
+
page = ev_annotation_get_page_index (annot);
if (EV_IS_ANNOTATION_MARKUP (annot)) {
@@ -3125,6 +3128,9 @@ ev_view_remove_annotation (EvView *view,
/* FIXME: only redraw the annot area */
ev_view_reload_page (view, page, NULL);
+
+ g_signal_emit (view, signals[SIGNAL_ANNOT_REMOVED], 0, annot);
+ g_object_unref (annot);
}
static gboolean
@@ -5189,6 +5195,14 @@ ev_view_class_init (EvViewClass *class)
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
EV_TYPE_ANNOTATION);
+ signals[SIGNAL_ANNOT_REMOVED] = g_signal_new ("annot-removed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EvViewClass, annot_removed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ EV_TYPE_ANNOTATION);
signals[SIGNAL_LAYERS_CHANGED] = g_signal_new ("layers-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,