[evince] shell: Reload the annotation sidebar when the type changes
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] shell: Reload the annotation sidebar when the type changes
- Date: Sat, 26 Jun 2021 20:18:12 +0000 (UTC)
commit 62c38a8b162c113a5e3820c1ab76b8d677be38d5
Author: Mads Chr. Olesen <mads mchro dk>
Date: Thu Feb 11 22:26:45 2021 +0100
shell: Reload the annotation sidebar when the type changes
* Reload the annotation sidebar when an annotation is changed
(including by the properties dialog which did not update the
sidebar before)
Fixes #1004
libview/ev-view-private.h | 2 ++
libview/ev-view.c | 10 ++++++++++
shell/ev-sidebar-annotations.c | 7 +++++++
shell/ev-sidebar-annotations.h | 2 ++
shell/ev-window.c | 14 ++++++++++++++
5 files changed, 35 insertions(+)
---
diff --git a/libview/ev-view-private.h b/libview/ev-view-private.h
index bcf66cee..bc71fa75 100644
--- a/libview/ev-view-private.h
+++ b/libview/ev-view-private.h
@@ -294,6 +294,8 @@ struct _EvViewClass {
EvSourceLink *link);
void (*annot_added) (EvView *view,
EvAnnotation *annot);
+ void (*annot_changed) (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 5aa96e47..69c5904e 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -59,6 +59,7 @@ enum {
SIGNAL_SELECTION_CHANGED,
SIGNAL_SYNC_SOURCE,
SIGNAL_ANNOT_ADDED,
+ SIGNAL_ANNOT_CHANGED,
SIGNAL_ANNOT_REMOVED,
SIGNAL_LAYERS_CHANGED,
SIGNAL_MOVE_CURSOR,
@@ -3353,6 +3354,7 @@ ev_view_annotation_save_contents (EvView *view,
ev_document_annotations_save_annotation (EV_DOCUMENT_ANNOTATIONS (view->document),
annot, EV_ANNOTATIONS_SAVE_CONTENTS);
ev_document_doc_mutex_unlock ();
+ g_signal_emit (view, signals[SIGNAL_ANNOT_CHANGED], 0, annot);
}
static GtkWidget *
@@ -8280,6 +8282,14 @@ ev_view_class_init (EvViewClass *class)
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
EV_TYPE_ANNOTATION);
+ signals[SIGNAL_ANNOT_CHANGED] = g_signal_new ("annot-changed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EvViewClass, annot_changed),
+ NULL, NULL,
+ 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,
diff --git a/shell/ev-sidebar-annotations.c b/shell/ev-sidebar-annotations.c
index cc398831..3770a097 100644
--- a/shell/ev-sidebar-annotations.c
+++ b/shell/ev-sidebar-annotations.c
@@ -233,6 +233,13 @@ ev_sidebar_annotations_annot_added (EvSidebarAnnotations *sidebar_annots,
ev_sidebar_annotations_load (sidebar_annots);
}
+void
+ev_sidebar_annotations_annot_changed (EvSidebarAnnotations *sidebar_annots,
+ EvAnnotation *annot)
+{
+ ev_sidebar_annotations_load (sidebar_annots);
+}
+
void
ev_sidebar_annotations_annot_removed (EvSidebarAnnotations *sidebar_annots)
{
diff --git a/shell/ev-sidebar-annotations.h b/shell/ev-sidebar-annotations.h
index 6d0b43ec..bb0dd96b 100644
--- a/shell/ev-sidebar-annotations.h
+++ b/shell/ev-sidebar-annotations.h
@@ -54,6 +54,8 @@ GType ev_sidebar_annotations_get_type (void) G_GNUC_CONST;
GtkWidget *ev_sidebar_annotations_new (void);
void ev_sidebar_annotations_annot_added (EvSidebarAnnotations *sidebar_annots,
EvAnnotation *annot);
+void ev_sidebar_annotations_annot_changed (EvSidebarAnnotations *sidebar_annots,
+ EvAnnotation *annot);
void ev_sidebar_annotations_annot_removed (EvSidebarAnnotations *sidebar_annots);
G_END_DECLS
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 6a4f7f7b..d5115468 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -6503,6 +6503,17 @@ view_annot_added (EvView *view,
ev_annotations_toolbar_add_annot_finished (EV_ANNOTATIONS_TOOLBAR (priv->annots_toolbar));
}
+static void
+view_annot_changed (EvView *view,
+ EvAnnotation *annot,
+ EvWindow *window)
+{
+ EvWindowPrivate *priv = GET_PRIVATE (window);
+
+ ev_sidebar_annotations_annot_changed (EV_SIDEBAR_ANNOTATIONS (priv->sidebar_annots),
+ annot);
+}
+
static void
view_annot_removed (EvView *view,
EvAnnotation *annot,
@@ -7714,6 +7725,9 @@ ev_window_init (EvWindow *ev_window)
g_signal_connect_object (priv->view, "annot-added",
G_CALLBACK (view_annot_added),
ev_window, 0);
+ g_signal_connect_object (priv->view, "annot-changed",
+ G_CALLBACK (view_annot_changed),
+ ev_window, 0);
g_signal_connect_object (priv->view, "annot-removed",
G_CALLBACK (view_annot_removed),
ev_window, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]