mirror of https://github.com/GNOME/gimp.git
app: remove boolean return value from gimp_edit_clear() and gimp_edit_fill()
This commit is contained in:
parent
d71f53dfe9
commit
3b6ab62c1e
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue