[gimp] libgimp: gimp_image_take_selected_layers() with boolean return.



commit 3f1cae4d6bf36893610d8ac995fb69909d823e93
Author: Jehan <jehan girinstud io>
Date:   Mon Mar 8 22:40:33 2021 +0100

    libgimp: gimp_image_take_selected_layers() with boolean return.
    
    Since it can fail, we should return the success value.

 libgimp/gimpimage.c | 11 ++++++++---
 libgimp/gimpimage.h |  2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/libgimp/gimpimage.c b/libgimp/gimpimage.c
index e6c59ffb05..d158ab2bfd 100644
--- a/libgimp/gimpimage.c
+++ b/libgimp/gimpimage.c
@@ -296,23 +296,28 @@ gimp_image_list_selected_layers (GimpImage *image)
  * existing floating selection, in which case this procedure will return an
  * execution error.
  *
+ * Returns: TRUE on success.
+ *
  * Since: 3.0
  **/
-void
+gboolean
 gimp_image_take_selected_layers (GimpImage *image,
                                  GList     *layers)
 {
   GimpLayer **sel_layers;
   GList      *list;
+  gboolean    success;
   gint        i;
 
   sel_layers = g_new0 (GimpLayer *, g_list_length (layers));
   for (list = layers, i = 0; list; list = list->next, i++)
     sel_layers[i] = list->data;
 
-  gimp_image_set_selected_layers (image, g_list_length (layers),
-                                  (const GimpLayer **) sel_layers);
+  success = gimp_image_set_selected_layers (image, g_list_length (layers),
+                                            (const GimpLayer **) sel_layers);
   g_list_free (layers);
+
+  return success;
 }
 
 /**
diff --git a/libgimp/gimpimage.h b/libgimp/gimpimage.h
index 9a9f456408..0186f2aca5 100644
--- a/libgimp/gimpimage.h
+++ b/libgimp/gimpimage.h
@@ -78,7 +78,7 @@ GList        * gimp_image_list_channels      (GimpImage    *image);
 GList        * gimp_image_list_vectors       (GimpImage    *image);
 
 GList      * gimp_image_list_selected_layers (GimpImage    *image);
-void         gimp_image_take_selected_layers (GimpImage    *image,
+gboolean     gimp_image_take_selected_layers (GimpImage    *image,
                                               GList        *layers);
 
 guchar       * gimp_image_get_colormap       (GimpImage    *image,


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