Disable toolbar buttons

I want to know the function to disable the buttons on the tab toolbar, like when i enter in add mode, or edit mode, like this image. What is exactly the function i have to use?

Hi! pentamasi, we have an open issue for this

you can see in