static GimpValueArray * palette_delete_entry_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GimpValueArray *args, GError **error) { gboolean success = TRUE; const gchar *name; gint32 entry_num; name = g_value_get_string (gimp_value_array_index (args, 0)); entry_num = g_value_get_int (gimp_value_array_index (args, 1)); if (success) { GimpPalette *palette = gimp_pdb_get_palette (gimp, name, TRUE, error); if (palette) { GimpPaletteEntry *entry = gimp_palette_get_entry (palette, entry_num); if (entry) gimp_palette_delete_entry (palette, entry); else success = FALSE; } else success = FALSE; } return gimp_procedure_get_return_values (procedure, success, error ? *error : NULL); }
void palette_editor_delete_color_cmd_callback (GtkAction *action, gpointer data) { GimpPaletteEditor *editor = GIMP_PALETTE_EDITOR (data); GimpDataEditor *data_editor = GIMP_DATA_EDITOR (data); if (data_editor->data_editable && editor->color) { GimpPalette *palette = GIMP_PALETTE (data_editor->data); gimp_palette_delete_entry (palette, editor->color); } }
static GValueArray * palette_delete_entry_invoker (GimpProcedure *procedure, Gimp *gimp, GimpContext *context, GimpProgress *progress, const GValueArray *args) { gboolean success = TRUE; const gchar *name; gint32 entry_num; name = g_value_get_string (&args->values[0]); entry_num = g_value_get_int (&args->values[1]); if (success) { GimpPalette *palette = (GimpPalette *) gimp_container_get_child_by_name (gimp->palette_factory->container, name); if (palette && GIMP_DATA (palette)->writable) { if (entry_num >= 0 && entry_num < palette->n_colors) { GimpPaletteEntry *entry = g_list_nth_data (palette->colors, entry_num); gimp_palette_delete_entry (palette, entry); } else success = FALSE; } else success = FALSE; } return gimp_procedure_get_return_values (procedure, success); }