[gnome-shell] st: Add st_icon_colors_equal()



commit 7359e431d3418b65093a2e02271cd7e5646cd605
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu May 2 20:27:05 2019 +0200

    st: Add st_icon_colors_equal()
    
    This is a small convenience wrapper around clutter_color_equal()
    for the different color components, which also handles the case
    where one (or both) of the icon colors are %NULL.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/1212

 src/st/st-icon-colors.c | 23 +++++++++++++++++++++++
 src/st/st-icon-colors.h |  2 ++
 2 files changed, 25 insertions(+)
---
diff --git a/src/st/st-icon-colors.c b/src/st/st-icon-colors.c
index 21bec6ee3..8c5b8d35a 100644
--- a/src/st/st-icon-colors.c
+++ b/src/st/st-icon-colors.c
@@ -102,6 +102,29 @@ st_icon_colors_copy (StIconColors *colors)
   return copy;
 }
 
+/**
+ * st_icon_colors_equal:
+ * @colors: a #StIconColors
+ * @other: another #StIconColors
+ *
+ * Returns: %TRUE if the #StIconColors are equal
+ */
+gboolean
+st_icon_colors_equal (StIconColors *colors,
+                      StIconColors *other)
+{
+  if (colors == other)
+    return TRUE;
+
+  if (colors == NULL || other == NULL)
+    return FALSE;
+
+  return clutter_color_equal (&colors->foreground, &other->foreground) &&
+         clutter_color_equal (&colors->warning, &other->warning) &&
+         clutter_color_equal (&colors->error, &other->error) &&
+         clutter_color_equal (&colors->success, &other->success);
+}
+
 G_DEFINE_BOXED_TYPE (StIconColors,
                      st_icon_colors,
                      st_icon_colors_ref,
diff --git a/src/st/st-icon-colors.h b/src/st/st-icon-colors.h
index b582308a5..e994a7522 100644
--- a/src/st/st-icon-colors.h
+++ b/src/st/st-icon-colors.h
@@ -35,6 +35,8 @@ StIconColors *st_icon_colors_new   (void);
 StIconColors *st_icon_colors_ref   (StIconColors *colors);
 void          st_icon_colors_unref (StIconColors *colors);
 StIconColors *st_icon_colors_copy  (StIconColors *colors);
+gboolean      st_icon_colors_equal (StIconColors *colors,
+                                    StIconColors *other);
 
 G_END_DECLS
 


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