[gimp] app: remove gimp_image_get_active_drawable() usage in colormap actions.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: remove gimp_image_get_active_drawable() usage in colormap actions.
- Date: Thu, 20 Oct 2022 21:17:14 +0000 (UTC)
commit 831cb913039d289afc5dc875c420f2348e32c3db
Author: Jehan <jehan girinstud io>
Date: Thu Oct 20 00:39:10 2022 +0200
app: remove gimp_image_get_active_drawable() usage in colormap actions.
app/actions/colormap-actions.c | 10 +++++++---
app/actions/colormap-commands.c | 15 ++++++++++++++-
2 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/app/actions/colormap-actions.c b/app/actions/colormap-actions.c
index 292bfb2bca..abfab26d23 100644
--- a/app/actions/colormap-actions.c
+++ b/app/actions/colormap-actions.c
@@ -130,10 +130,14 @@ colormap_actions_update (GimpActionGroup *group,
if (indexed)
{
- GimpDrawable *drawable = gimp_image_get_active_drawable (image);
+ GList *drawables = gimp_image_get_selected_drawables (image);
- num_colors = gimp_image_get_colormap_size (image);
- drawable_indexed = gimp_drawable_is_indexed (drawable);
+ num_colors = gimp_image_get_colormap_size (image);
+
+ if (g_list_length (drawables) == 1)
+ drawable_indexed = gimp_drawable_is_indexed (drawables->data);
+
+ g_list_free (drawables);
}
}
diff --git a/app/actions/colormap-commands.c b/app/actions/colormap-commands.c
index 09a782168f..43bbc0da8a 100644
--- a/app/actions/colormap-commands.c
+++ b/app/actions/colormap-commands.c
@@ -81,6 +81,7 @@ colormap_to_selection_cmd_callback (GimpAction *action,
GimpColormapSelection *selection;
GimpColormapEditor *editor;
GimpImage *image;
+ GList *drawables;
GimpChannelOps op;
gint col_index;
@@ -92,10 +93,22 @@ colormap_to_selection_cmd_callback (GimpAction *action,
op = (GimpChannelOps) g_variant_get_int32 (value);
+ drawables = gimp_image_get_selected_drawables (image);
+ if (g_list_length (drawables) != 1)
+ {
+ /* We should not reach this anyway as colormap-actions.c normally takes
+ * care at making the action insensitive when the item selection is wrong.
+ */
+ g_warning ("This action requires exactly one selected drawable.");
+ g_list_free (drawables);
+ return;
+ }
+
gimp_channel_select_by_index (gimp_image_get_mask (image),
- gimp_image_get_active_drawable (image),
+ drawables->data,
col_index, op,
FALSE, 0.0, 0.0);
+ g_list_free (drawables);
gimp_image_flush (image);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]