[gimp] app: remove boolean return value from gimp_edit_clear() and gimp_edit_fill()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: remove boolean return value from gimp_edit_clear() and gimp_edit_fill()
- Date: Fri, 11 Mar 2016 21:41:56 +0000 (UTC)
commit 3b6ab62c1e5caf7b8e86cd3bf92493f0b267a288
Author: Michael Natterer <mitch gimp org>
Date: Fri Mar 11 22:41:25 2016 +0100
app: remove boolean return value from gimp_edit_clear() and gimp_edit_fill()
app/core/gimp-edit.c | 30 ++++++++++++------------------
app/core/gimp-edit.h | 4 ++--
app/pdb/edit-cmds.c | 18 ++++++++++--------
app/tools/gimpbucketfilltool.c | 19 ++++++-------------
tools/pdbgen/pdb/edit.pdb | 18 ++++++++++--------
5 files changed, 40 insertions(+), 49 deletions(-)
---
diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c
index 02fc914..fed139a 100644
--- a/app/core/gimp-edit.c
+++ b/app/core/gimp-edit.c
@@ -395,18 +395,17 @@ gimp_edit_named_copy_visible (GimpImage *image,
return NULL;
}
-gboolean
+void
gimp_edit_clear (GimpImage *image,
GimpDrawable *drawable,
GimpContext *context)
{
GimpFillOptions *options;
- gboolean success;
- g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
- g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
- g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
- g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
+ g_return_if_fail (GIMP_IS_IMAGE (image));
+ g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
+ g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
+ g_return_if_fail (GIMP_IS_CONTEXT (context));
options = gimp_fill_options_new (context->gimp);
@@ -417,15 +416,12 @@ gimp_edit_clear (GimpImage *image,
gimp_fill_options_set_by_fill_type (options, context,
GIMP_FILL_BACKGROUND, NULL);
- success = gimp_edit_fill (image, drawable, options,
- C_("undo-type", "Clear"));
+ gimp_edit_fill (image, drawable, options, C_("undo-type", "Clear"));
g_object_unref (options);
-
- return success;
}
-gboolean
+void
gimp_edit_fill (GimpImage *image,
GimpDrawable *drawable,
GimpFillOptions *options,
@@ -437,13 +433,13 @@ gimp_edit_fill (GimpImage *image,
const Babl *format;
gint x, y, width, height;
- g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
- g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
- g_return_val_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)), FALSE);
- g_return_val_if_fail (GIMP_IS_FILL_OPTIONS (options), FALSE);
+ g_return_if_fail (GIMP_IS_IMAGE (image));
+ g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
+ g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
+ g_return_if_fail (GIMP_IS_FILL_OPTIONS (options));
if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
- return TRUE; /* nothing to do, but the fill succeeded */
+ return; /* nothing to do, but the fill succeeded */
switch (gimp_fill_options_get_style (options))
{
@@ -498,8 +494,6 @@ gimp_edit_fill (GimpImage *image,
g_object_unref (dest_buffer);
gimp_drawable_update (drawable, x, y, width, height);
-
- return TRUE;
}
gboolean
diff --git a/app/core/gimp-edit.h b/app/core/gimp-edit.h
index d22f392..7c0fda5 100644
--- a/app/core/gimp-edit.h
+++ b/app/core/gimp-edit.h
@@ -54,10 +54,10 @@ const gchar * gimp_edit_named_copy_visible (GimpImage *image,
GimpContext *context,
GError **error);
-gboolean gimp_edit_clear (GimpImage *image,
+void gimp_edit_clear (GimpImage *image,
GimpDrawable *drawable,
GimpContext *context);
-gboolean gimp_edit_fill (GimpImage *image,
+void gimp_edit_fill (GimpImage *image,
GimpDrawable *drawable,
GimpFillOptions *options,
const gchar *undo_desc);
diff --git a/app/pdb/edit-cmds.c b/app/pdb/edit-cmds.c
index 24b1d58..d0db221 100644
--- a/app/pdb/edit-cmds.c
+++ b/app/pdb/edit-cmds.c
@@ -520,7 +520,7 @@ edit_clear_invoker (GimpProcedure *procedure,
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
- success = gimp_edit_clear (image, drawable, context);
+ gimp_edit_clear (image, drawable, context);
}
else
success = FALSE;
@@ -554,11 +554,13 @@ edit_fill_invoker (GimpProcedure *procedure,
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpFillOptions *options = gimp_fill_options_new (gimp);
- success = gimp_fill_options_set_by_fill_type (options, context,
- fill_type, error);
-
- if (success)
- success = gimp_edit_fill (image, drawable, options, NULL);
+ if (gimp_fill_options_set_by_fill_type (options, context,
+ fill_type, error))
+ {
+ gimp_edit_fill (image, drawable, options, NULL);
+ }
+ else
+ success = FALSE;
g_object_unref (options);
}
@@ -617,7 +619,7 @@ edit_bucket_fill_invoker (GimpProcedure *procedure,
if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
{
- success = gimp_edit_fill (image, drawable, options, NULL);
+ gimp_edit_fill (image, drawable, options, NULL);
}
else
{
@@ -694,7 +696,7 @@ edit_bucket_fill_full_invoker (GimpProcedure *procedure,
if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
{
- success = gimp_edit_fill (image, drawable, options, NULL);
+ gimp_edit_fill (image, drawable, options, NULL);
}
else
{
diff --git a/app/tools/gimpbucketfilltool.c b/app/tools/gimpbucketfilltool.c
index b0a20c6..b12c0a4 100644
--- a/app/tools/gimpbucketfilltool.c
+++ b/app/tools/gimpbucketfilltool.c
@@ -31,7 +31,6 @@
#include "core/gimpfilloptions.h"
#include "core/gimpimage.h"
#include "core/gimpitem.h"
-#include "core/gimppickable.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpwidgets-utils.h"
@@ -175,16 +174,13 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool,
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
GimpContext *context = GIMP_CONTEXT (options);
GimpFillOptions *fill_options;
- gboolean success;
GError *error = NULL;
fill_options = gimp_fill_options_new (image->gimp);
- success = gimp_fill_options_set_by_fill_mode (fill_options, context,
- options->fill_mode,
- &error);
-
- if (success)
+ if (gimp_fill_options_set_by_fill_mode (fill_options, context,
+ options->fill_mode,
+ &error))
{
gimp_context_set_opacity (GIMP_CONTEXT (fill_options),
gimp_context_get_opacity (context));
@@ -193,7 +189,7 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool,
if (options->fill_selection)
{
- success = gimp_edit_fill (image, drawable, fill_options, NULL);
+ gimp_edit_fill (image, drawable, fill_options, NULL);
}
else
{
@@ -218,12 +214,7 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool,
options->diagonal_neighbors,
x, y);
}
- }
-
- g_object_unref (fill_options);
- if (success)
- {
gimp_image_flush (image);
}
else
@@ -232,6 +223,8 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool,
GIMP_MESSAGE_WARNING, error->message);
g_clear_error (&error);
}
+
+ g_object_unref (fill_options);
}
GIMP_TOOL_CLASS (parent_class)->button_release (tool, coords, time, state,
diff --git a/tools/pdbgen/pdb/edit.pdb b/tools/pdbgen/pdb/edit.pdb
index 96b08e7..0401f66 100644
--- a/tools/pdbgen/pdb/edit.pdb
+++ b/tools/pdbgen/pdb/edit.pdb
@@ -525,7 +525,7 @@ HELP
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
- success = gimp_edit_clear (image, drawable, context);
+ gimp_edit_clear (image, drawable, context);
}
else
success = FALSE;
@@ -568,11 +568,13 @@ HELP
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpFillOptions *options = gimp_fill_options_new (gimp);
- success = gimp_fill_options_set_by_fill_type (options, context,
- fill_type, error);
-
- if (success)
- success = gimp_edit_fill (image, drawable, options, NULL);
+ if (gimp_fill_options_set_by_fill_type (options, context,
+ fill_type, error))
+ {
+ gimp_edit_fill (image, drawable, options, NULL);
+ }
+ else
+ success = FALSE;
g_object_unref (options);
}
@@ -655,7 +657,7 @@ HELP
if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
{
- success = gimp_edit_fill (image, drawable, options, NULL);
+ gimp_edit_fill (image, drawable, options, NULL);
}
else
{
@@ -760,7 +762,7 @@ HELP
if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
{
- success = gimp_edit_fill (image, drawable, options, NULL);
+ gimp_edit_fill (image, drawable, options, NULL);
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]