[evince/wip/gpoo/gtk4-rebase-port: 3/72] libdocument: remove usage of deprecated GdkColor




commit d84d1cf04c953016e31cea39ef39dfbebeccf905
Author: Qiu Wenbo <qiuwenbo kylinos com cn>
Date:   Thu Dec 2 11:14:19 2021 +0800

    libdocument: remove usage of deprecated GdkColor
    
    Signed-off-by: Qiu Wenbo <qiuwenbo kylinos com cn>

 libdocument/ev-annotation.c | 91 ---------------------------------------------
 libdocument/ev-annotation.h |  8 ----
 libdocument/ev-selection.c  |  4 +-
 libdocument/ev-selection.h  |  8 ++--
 4 files changed, 6 insertions(+), 105 deletions(-)
---
diff --git a/libdocument/ev-annotation.c b/libdocument/ev-annotation.c
index 739625083..aee5548a0 100644
--- a/libdocument/ev-annotation.c
+++ b/libdocument/ev-annotation.c
@@ -89,7 +89,6 @@ enum {
        PROP_ANNOT_CONTENTS,
        PROP_ANNOT_NAME,
        PROP_ANNOT_MODIFIED,
-       PROP_ANNOT_COLOR,
         PROP_ANNOT_RGBA,
         PROP_ANNOT_AREA
 };
@@ -199,9 +198,6 @@ ev_annotation_set_property (GObject      *object,
        case PROP_ANNOT_MODIFIED:
                ev_annotation_set_modified (annot, g_value_get_string (value));
                break;
-       case PROP_ANNOT_COLOR:
-               ev_annotation_set_color (annot, g_value_get_pointer (value));
-               break;
         case PROP_ANNOT_RGBA:
                 ev_annotation_set_rgba (annot, g_value_get_boxed (value));
                 break;
@@ -231,13 +227,6 @@ ev_annotation_get_property (GObject    *object,
        case PROP_ANNOT_MODIFIED:
                g_value_set_string (value, ev_annotation_get_modified (annot));
                break;
-       case PROP_ANNOT_COLOR: {
-                GdkColor color;
-
-                ev_annotation_get_color (annot, &color);
-               g_value_set_pointer (value, &color);
-               break;
-        }
         case PROP_ANNOT_RGBA:
                 g_value_set_boxed (value, &annot->rgba);
                 break;
@@ -290,20 +279,6 @@ ev_annotation_class_init (EvAnnotationClass *klass)
                                                              NULL,
                                                              G_PARAM_READWRITE |
                                                               G_PARAM_STATIC_STRINGS));
-        /**
-         * EvAnnotation:color:
-         *
-         * The colour of the annotation as a #GdkColor.
-         *
-         * Deprecated: 3.6: Use #EvAnnotation:rgba instead.
-         */
-       g_object_class_install_property (g_object_class,
-                                        PROP_ANNOT_COLOR,
-                                        g_param_spec_pointer ("color",
-                                                              "Color",
-                                                              "The annotation color",
-                                                              G_PARAM_READWRITE |
-                                                               G_PARAM_STATIC_STRINGS));
 
         /**
          * EvAnnotation:rgba:
@@ -614,71 +589,6 @@ ev_annotation_set_modified_from_time_t (EvAnnotation *annot,
        return TRUE;
 }
 
-/**
- * ev_annotation_get_color:
- * @annot: an #EvAnnotation
- * @color: (out): a #GdkColor to be filled with the Annotation color.
- *
- * Get the color of @annot.
- *
- * Deprecated: 3.6: Use ev_annotation_get_rgba() instead.
- */
-void
-ev_annotation_get_color (EvAnnotation *annot,
-                        GdkColor     *color)
-{
-        GdkRGBA rgba;
-
-       g_return_if_fail (EV_IS_ANNOTATION (annot));
-        g_return_if_fail (color != NULL);
-
-        ev_annotation_get_rgba (annot, &rgba);
-
-        color->pixel = 0;
-        color->red = CLAMP (rgba.red * 65535. + 0.5, 0, 65535);
-        color->green = CLAMP (rgba.green * 65535. + 0.5, 0, 65535);
-        color->blue = CLAMP (rgba.blue * 65535. + 0.5, 0, 65535);
-}
-
-/**
- * ev_annotation_set_color:
- * @annot: an #Evannotation
- * @color: a #GdkColor
- *
- * Set the color of the annotation to @color. You can monitor
- * changes to the annotation's color by connecting to
- * notify::color signal on @annot.
- *
- * Returns: %TRUE  when the color has been changed, %FALSE otherwise.
- *
- * Deprecated: 3.6: Use ev_annotation_set_rgba() instead.
- */
-gboolean
-ev_annotation_set_color (EvAnnotation   *annot,
-                        const GdkColor *color)
-{
-        GdkColor annot_color;
-        GdkRGBA rgba;
-
-       g_return_val_if_fail (EV_IS_ANNOTATION (annot), FALSE);
-
-        ev_annotation_get_color (annot, &annot_color);
-       if (color == NULL ||
-           ((color->red == annot_color.red) &&
-           (color->green == annot_color.green) &&
-           (color->blue == annot_color.blue)))
-               return FALSE;
-
-        rgba.red = color->red / 65535.;
-        rgba.green = color->green / 65535.;
-        rgba.blue = color->blue / 65535.;
-        rgba.alpha = 1.;
-
-        ev_annotation_set_rgba (annot, &rgba);
-
-       return TRUE;
-}
-
 /**
  * ev_annotation_get_rgba:
  * @annot: an #EvAnnotation
@@ -721,7 +631,6 @@ ev_annotation_set_rgba (EvAnnotation  *annot,
 
         annot->rgba = *rgba;
         g_object_notify (G_OBJECT (annot), "rgba");
-       g_object_notify (G_OBJECT (annot), "color");
 
         return TRUE;
 }
diff --git a/libdocument/ev-annotation.h b/libdocument/ev-annotation.h
index ab5c96245..75105030d 100644
--- a/libdocument/ev-annotation.h
+++ b/libdocument/ev-annotation.h
@@ -150,14 +150,6 @@ EV_DEPRECATED_FOR(ev_annotaion_set_modified_from_time_t)
 EV_PUBLIC
 gboolean             ev_annotation_set_modified_from_time    (EvAnnotation           *annot,
                                                              GTime                   utime);
-EV_DEPRECATED_FOR(ev_annotaion_get_rgba)
-EV_PUBLIC
-void                 ev_annotation_get_color                 (EvAnnotation           *annot,
-                                                             GdkColor               *color);
-EV_DEPRECATED_FOR(ev_annotaion_set_rgba)
-EV_PUBLIC
-gboolean             ev_annotation_set_color                 (EvAnnotation           *annot,
-                                                             const GdkColor         *color);
 G_GNUC_END_IGNORE_DEPRECATIONS
 
 EV_PUBLIC
diff --git a/libdocument/ev-selection.c b/libdocument/ev-selection.c
index 49e56eb43..2ab6298d5 100644
--- a/libdocument/ev-selection.c
+++ b/libdocument/ev-selection.c
@@ -36,8 +36,8 @@ ev_selection_render_selection (EvSelection      *selection,
                               EvRectangle      *points,
                               EvRectangle      *old_points,
                               EvSelectionStyle  style,
-                              GdkColor         *text,
-                              GdkColor         *base)
+                              GdkRGBA          *text,
+                              GdkRGBA          *base)
 {
        EvSelectionInterface *iface = EV_SELECTION_GET_IFACE (selection);
 
diff --git a/libdocument/ev-selection.h b/libdocument/ev-selection.h
index 8dabc2f77..e6b858f8f 100644
--- a/libdocument/ev-selection.h
+++ b/libdocument/ev-selection.h
@@ -59,8 +59,8 @@ struct _EvSelectionInterface
                                                   EvRectangle      *points,
                                                   EvRectangle      *old_points,
                                                   EvSelectionStyle  style,
-                                                  GdkColor         *text,
-                                                  GdkColor         *base);
+                                                  GdkRGBA          *text,
+                                                  GdkRGBA          *base);
        gchar          * (* get_selected_text)    (EvSelection      *selection,
                                                   EvPage           *page,
                                                   EvSelectionStyle  style,
@@ -80,8 +80,8 @@ void            ev_selection_render_selection     (EvSelection      *selection,
                                                   EvRectangle      *points,
                                                   EvRectangle      *old_points,
                                                   EvSelectionStyle  style,
-                                                  GdkColor         *text,
-                                                  GdkColor         *base);
+                                                  GdkRGBA          *text,
+                                                  GdkRGBA          *base);
 EV_PUBLIC
 gchar          *ev_selection_get_selected_text    (EvSelection      *selection,
                                                   EvPage           *page,


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