I've added a feature to my plugin (mainly for kiwidude
) to allow you to change the behaviour of the toolbar icon through customization. By default when you install the plugin its only a dropdown menu. But you can customize it to select any of the menu's functions to be the default action (or to just show the menu). When you restart calibre, the icon will change to the split icon/menu view if you've chosen a function, and if you click the icon it will run the function you configured. You can of course click the down arrow to get the menu as usual.
I'd like to avoid having to restart calibre. I see that if I run Preferences and add/remove another icon and save, that my icon correctly updates, so I know its possible. There are many functions in the source and after testing a few I think it might be safer to ask the right way to do this in order to avoid problems later.
So how to I get the toolbar icons to refresh without restarting?
I expect to call this either in my plugins __init__ save_settings, or possibly within the ui rebuild_menus (but I think that might be calling a refresh inside of a refresh).