[evince] Add support for reading underline text markup annotations



commit 4bd88ed03d0c06f191ec07f78bcbc1ce6c07a36a
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Sun Nov 16 11:47:19 2014 +0100

    Add support for reading underline text markup annotations

 backend/pdf/ev-poppler.cc      |    6 ++++--
 libdocument/ev-annotation.c    |   10 ++++++++++
 libdocument/ev-annotation.h    |   10 ++++++----
 shell/ev-sidebar-annotations.c |   11 +++++++++++
 4 files changed, 31 insertions(+), 6 deletions(-)
---
diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc
index cfc788d..be05911 100644
--- a/backend/pdf/ev-poppler.cc
+++ b/backend/pdf/ev-poppler.cc
@@ -2878,6 +2878,9 @@ ev_annot_from_poppler_annot (PopplerAnnot *poppler_annot,
                case POPPLER_ANNOT_STRIKE_OUT:
                        ev_annot = ev_annotation_text_markup_strike_out_new (page);
                        break;
+               case POPPLER_ANNOT_UNDERLINE:
+                       ev_annot = ev_annotation_text_markup_underline_new (page);
+                       break;
                case POPPLER_ANNOT_LINK:
                case POPPLER_ANNOT_WIDGET:
                        /* Ignore link and widgets annots since they are already handled */
@@ -2890,8 +2893,7 @@ ev_annot_from_poppler_annot (PopplerAnnot *poppler_annot,
                case POPPLER_ANNOT_SOUND:
                case POPPLER_ANNOT_SQUARE:
                case POPPLER_ANNOT_SQUIGGLY:
-               case POPPLER_ANNOT_STAMP:
-               case POPPLER_ANNOT_UNDERLINE: {
+               case POPPLER_ANNOT_STAMP: {
                        /* FIXME: These annotations are unimplemented, but they were already
                         * reported in Evince Bugzilla with test case.  We add a special
                         * warning to let the user know it is unimplemented, yet we do not
diff --git a/libdocument/ev-annotation.c b/libdocument/ev-annotation.c
index 7c7a49c..bb4fbd1 100644
--- a/libdocument/ev-annotation.c
+++ b/libdocument/ev-annotation.c
@@ -1350,6 +1350,16 @@ ev_annotation_text_markup_strike_out_new (EvPage *page)
         return annot;
 }
 
+EvAnnotation *
+ev_annotation_text_markup_underline_new (EvPage *page)
+{
+        EvAnnotation *annot = EV_ANNOTATION (g_object_new (EV_TYPE_ANNOTATION_TEXT_MARKUP,
+                                                           "page", page,
+                                                           "type", EV_ANNOTATION_TEXT_MARKUP_UNDERLINE,
+                                                           NULL));
+        return annot;
+}
+
 EvAnnotationTextMarkupType
 ev_annotation_text_markup_get_markup_type (EvAnnotationTextMarkup *annot)
 {
diff --git a/libdocument/ev-annotation.h b/libdocument/ev-annotation.h
index fddc6c3..b6c0d59 100644
--- a/libdocument/ev-annotation.h
+++ b/libdocument/ev-annotation.h
@@ -111,7 +111,8 @@ typedef enum {
 
 typedef enum {
         EV_ANNOTATION_TEXT_MARKUP_HIGHLIGHT,
-        EV_ANNOTATION_TEXT_MARKUP_STRIKE_OUT
+        EV_ANNOTATION_TEXT_MARKUP_STRIKE_OUT,
+        EV_ANNOTATION_TEXT_MARKUP_UNDERLINE
 } EvAnnotationTextMarkupType;
 
 /* EvAnnotation */
@@ -182,9 +183,10 @@ gboolean             ev_annotation_attachment_set_attachment (EvAnnotationAttach
 
 /* EvAnnotationTextMarkup */
 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);
+EvAnnotation              *ev_annotation_text_markup_highlight_new   (EvPage                    *page);
+EvAnnotation              *ev_annotation_text_markup_strike_out_new  (EvPage                    *page);
+EvAnnotation              *ev_annotation_text_markup_underline_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 7cd3d73..79bfbf3 100644
--- a/shell/ev-sidebar-annotations.c
+++ b/shell/ev-sidebar-annotations.c
@@ -361,6 +361,7 @@ job_finished_callback (EvJobAnnots          *job,
        GdkPixbuf *attachment_icon = NULL;
         GdkPixbuf *highlight_icon = NULL;
         GdkPixbuf *strike_out_icon = NULL;
+        GdkPixbuf *underline_icon = NULL;
 
        priv = sidebar_annots->priv;
 
@@ -463,6 +464,14 @@ job_finished_callback (EvJobAnnots          *job,
                                         }
                                         pixbuf = strike_out_icon;
                                         break;
+                                case EV_ANNOTATION_TEXT_MARKUP_UNDERLINE:
+                                        if (!underline_icon) {
+                                                underline_icon = gtk_widget_render_icon_pixbuf 
(priv->tree_view,
+                                                                                                
GTK_STOCK_UNDERLINE,
+                                                                                                
GTK_ICON_SIZE_BUTTON);
+                                        }
+                                        pixbuf = underline_icon;
+                                        break;
                                 }
                         }
 
@@ -492,6 +501,8 @@ job_finished_callback (EvJobAnnots          *job,
                 g_object_unref (highlight_icon);
         if (strike_out_icon)
                 g_object_unref (strike_out_icon);
+        if (underline_icon)
+                g_object_unref (underline_icon);
 
        g_object_unref (job);
        priv->job = NULL;


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