summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2026-05-13 14:50:16 -0400
committerVictor Kareh <[email protected]>2026-05-19 16:21:12 -0400
commite25add583912902b179a16431c8feeeb1e09babc (patch)
tree8c78ebaddc3aff36917a24f2e6a18b5382f17262
parent4bd2f90bbede5fddfeb9964896dcd389db28cef3 (diff)
downloadatril-e25add583912902b179a16431c8feeeb1e09babc.tar.bz2
atril-e25add583912902b179a16431c8feeeb1e09babc.tar.xz
Add support for reading strike out text markup annotations
Backported from https://gitlab.gnome.org/GNOME/evince/-/commit/9b71d67e
-rw-r--r--backend/pdf/ev-poppler.cc3
-rw-r--r--libdocument/ev-annotation.c17
-rw-r--r--libdocument/ev-annotation.h9
-rw-r--r--shell/ev-sidebar-annotations.c33
4 files changed, 52 insertions, 10 deletions
diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc
index af8a287e..5f864f97 100644
--- a/backend/pdf/ev-poppler.cc
+++ b/backend/pdf/ev-poppler.cc
@@ -2689,6 +2689,9 @@ ev_annot_from_poppler_annot (PopplerAnnot *poppler_annot,
case POPPLER_ANNOT_HIGHLIGHT:
ev_annot = ev_annotation_text_markup_highlight_new (page);
break;
+ case POPPLER_ANNOT_STRIKE_OUT:
+ ev_annot = ev_annotation_text_markup_strike_out_new (page);
+ break;
case POPPLER_ANNOT_LINK:
case POPPLER_ANNOT_WIDGET:
/* Ignore link and widgets annots since they are already handled */
diff --git a/libdocument/ev-annotation.c b/libdocument/ev-annotation.c
index d0e03ebb..1cb13010 100644
--- a/libdocument/ev-annotation.c
+++ b/libdocument/ev-annotation.c
@@ -1324,3 +1324,20 @@ ev_annotation_text_markup_highlight_new (EvPage *page)
"type", EV_ANNOTATION_TEXT_MARKUP_HIGHLIGHT,
NULL));
}
+
+EvAnnotation *
+ev_annotation_text_markup_strike_out_new (EvPage *page)
+{
+ return EV_ANNOTATION (g_object_new (EV_TYPE_ANNOTATION_TEXT_MARKUP,
+ "page", page,
+ "type", EV_ANNOTATION_TEXT_MARKUP_STRIKE_OUT,
+ NULL));
+}
+
+EvAnnotationTextMarkupType
+ev_annotation_text_markup_get_markup_type (EvAnnotationTextMarkup *annot)
+{
+ g_return_val_if_fail (EV_IS_ANNOTATION_TEXT_MARKUP (annot), 0);
+
+ return annot->type;
+}
diff --git a/libdocument/ev-annotation.h b/libdocument/ev-annotation.h
index d1c85cb5..e608ed37 100644
--- a/libdocument/ev-annotation.h
+++ b/libdocument/ev-annotation.h
@@ -111,7 +111,8 @@ typedef enum {
} EvAnnotationTextIcon;
typedef enum {
- EV_ANNOTATION_TEXT_MARKUP_HIGHLIGHT
+ EV_ANNOTATION_TEXT_MARKUP_HIGHLIGHT,
+ EV_ANNOTATION_TEXT_MARKUP_STRIKE_OUT
} EvAnnotationTextMarkupType;
/* EvAnnotation */
@@ -181,8 +182,10 @@ gboolean ev_annotation_attachment_set_attachment (EvAnnotationAttach
EvAttachment *attachment);
/* EvAnnotationTextMarkup */
-GType ev_annotation_text_markup_get_type (void) G_GNUC_CONST;
-EvAnnotation *ev_annotation_text_markup_highlight_new (EvPage *page);
+GType ev_annotation_text_markup_get_type (void) G_GNUC_CONST;
+EvAnnotation *ev_annotation_text_markup_highlight_new (EvPage *page);
+EvAnnotation *ev_annotation_text_markup_strike_out_new (EvPage *page);
+EvAnnotationTextMarkupType ev_annotation_text_markup_get_markup_type (EvAnnotationTextMarkup *annot);
G_END_DECLS
diff --git a/shell/ev-sidebar-annotations.c b/shell/ev-sidebar-annotations.c
index 24ff71ae..be6de708 100644
--- a/shell/ev-sidebar-annotations.c
+++ b/shell/ev-sidebar-annotations.c
@@ -334,6 +334,7 @@ job_finished_callback (EvJobAnnots *job,
GdkPixbuf *text_icon = NULL;
GdkPixbuf *attachment_icon = NULL;
GdkPixbuf *highlight_icon = NULL;
+ GdkPixbuf *strike_out_icon = NULL;
priv = sidebar_annots->priv;
@@ -423,14 +424,30 @@ job_finished_callback (EvJobAnnots *job,
}
pixbuf = attachment_icon;
} else if (EV_IS_ANNOTATION_TEXT_MARKUP (annot)) {
- if (!highlight_icon) {
- highlight_icon = gtk_icon_theme_load_icon (icon_theme,
- "edit-select-all",
- GTK_ICON_SIZE_BUTTON,
- GTK_ICON_LOOKUP_FORCE_REGULAR,
- NULL);
+ switch (ev_annotation_text_markup_get_markup_type (EV_ANNOTATION_TEXT_MARKUP (annot))) {
+ case EV_ANNOTATION_TEXT_MARKUP_HIGHLIGHT:
+ if (!highlight_icon) {
+ highlight_icon = gtk_icon_theme_load_icon (icon_theme,
+ "edit-select-all",
+ GTK_ICON_SIZE_BUTTON,
+ GTK_ICON_LOOKUP_FORCE_REGULAR,
+ NULL);
+ }
+ pixbuf = highlight_icon;
+ break;
+ case EV_ANNOTATION_TEXT_MARKUP_STRIKE_OUT:
+ if (!strike_out_icon) {
+ strike_out_icon = gtk_icon_theme_load_icon (icon_theme,
+ "format-text-strikethrough",
+ GTK_ICON_SIZE_BUTTON,
+ GTK_ICON_LOOKUP_FORCE_REGULAR,
+ NULL);
+ }
+ pixbuf = strike_out_icon;
+ break;
+ default:
+ break;
}
- pixbuf = highlight_icon;
}
gtk_tree_store_append (model, &child_iter, &iter);
@@ -457,6 +474,8 @@ job_finished_callback (EvJobAnnots *job,
g_object_unref (attachment_icon);
if (highlight_icon)
g_object_unref (highlight_icon);
+ if (strike_out_icon)
+ g_object_unref (strike_out_icon);
g_object_unref (job);
priv->job = NULL;