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
This commit is contained in:
parent
8a5de327bb
commit
7359e431d3
@ -102,6 +102,29 @@ st_icon_colors_copy (StIconColors *colors)
|
|||||||
return copy;
|
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,
|
G_DEFINE_BOXED_TYPE (StIconColors,
|
||||||
st_icon_colors,
|
st_icon_colors,
|
||||||
st_icon_colors_ref,
|
st_icon_colors_ref,
|
||||||
|
@ -35,6 +35,8 @@ StIconColors *st_icon_colors_new (void);
|
|||||||
StIconColors *st_icon_colors_ref (StIconColors *colors);
|
StIconColors *st_icon_colors_ref (StIconColors *colors);
|
||||||
void st_icon_colors_unref (StIconColors *colors);
|
void st_icon_colors_unref (StIconColors *colors);
|
||||||
StIconColors *st_icon_colors_copy (StIconColors *colors);
|
StIconColors *st_icon_colors_copy (StIconColors *colors);
|
||||||
|
gboolean st_icon_colors_equal (StIconColors *colors,
|
||||||
|
StIconColors *other);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user