mirror of https://github.com/GNOME/gimp.git
app: add gimp_image_equal_selected_drawables().
This can be used in various places where we want to check whether a previously saved list of drawables is still the same list of selected drawables. It used to be easily done with an equality test with a single active drawable, but not anymore with a list of selected drawables.
This commit is contained in:
parent
8bf8eb9dc0
commit
661f057603
|
@ -4479,6 +4479,42 @@ gimp_image_set_active_vectors (GimpImage *image,
|
||||||
return active_vectors;
|
return active_vectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_image_equal_selected_drawables:
|
||||||
|
* @image:
|
||||||
|
* @drawables:
|
||||||
|
*
|
||||||
|
* Compare the list of @drawables with the selected drawables in @image
|
||||||
|
* (i.e. the result of gimp_image_equal_selected_drawables()).
|
||||||
|
* The order of the @drawables does not matter, only if the size and
|
||||||
|
* contents of the list is the same.
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gimp_image_equal_selected_drawables (GimpImage *image,
|
||||||
|
GList *drawables)
|
||||||
|
{
|
||||||
|
GList *selected_drawables;
|
||||||
|
GList *iter;
|
||||||
|
gboolean equal = FALSE;
|
||||||
|
|
||||||
|
selected_drawables = gimp_image_get_selected_drawables (image);
|
||||||
|
|
||||||
|
if (g_list_length (drawables) == g_list_length (selected_drawables))
|
||||||
|
{
|
||||||
|
equal = TRUE;
|
||||||
|
|
||||||
|
for (iter = drawables; iter; iter = iter->next)
|
||||||
|
if (! g_list_find (selected_drawables, iter->data))
|
||||||
|
{
|
||||||
|
equal = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g_list_free (selected_drawables);
|
||||||
|
|
||||||
|
return equal;
|
||||||
|
}
|
||||||
|
|
||||||
GList *
|
GList *
|
||||||
gimp_image_get_selected_drawables (GimpImage *image)
|
gimp_image_get_selected_drawables (GimpImage *image)
|
||||||
{
|
{
|
||||||
|
|
|
@ -379,6 +379,9 @@ void gimp_image_unset_selected_channels (GimpImage *image);
|
||||||
GimpVectors * gimp_image_set_active_vectors (GimpImage *image,
|
GimpVectors * gimp_image_set_active_vectors (GimpImage *image,
|
||||||
GimpVectors *vectors);
|
GimpVectors *vectors);
|
||||||
|
|
||||||
|
gboolean gimp_image_equal_selected_drawables (GimpImage *image,
|
||||||
|
GList *drawables);
|
||||||
|
|
||||||
GList * gimp_image_get_selected_drawables (GimpImage *image);
|
GList * gimp_image_get_selected_drawables (GimpImage *image);
|
||||||
GList * gimp_image_get_selected_layers (GimpImage *image);
|
GList * gimp_image_get_selected_layers (GimpImage *image);
|
||||||
GList * gimp_image_get_selected_channels (GimpImage *image);
|
GList * gimp_image_get_selected_channels (GimpImage *image);
|
||||||
|
|
Loading…
Reference in New Issue