Hi,
I looked into plugin toolbar support code in more detail, and there seem to be three simple ways to fix the item order:
1. Apply the current patch and tell the plugin authors to add/remove their items at once. They are likely to do so in the first place, because mixed adding/removing means one must keep track of the items, to be able to remove them on plugin_cleanup. It's easier to add everything at once, show/hide as needed, and remove at once. A not shown / hidden item is just as good as not added / removed item.
2. Add an item_count to GeanyAutoSeparator. We already have the means required to track items, but ref_count is for show/hide. Having item count has the advantage of being able to destroy autosep->widget when it drops to 0. ref_count should be renamed to show_count or something.
3. Add a hidden separator item after autosep and always insert before it. Will work like the current positioning, except the 1st item will be OK. May be easier/simpler to implement than #2, but I don't like it.
Related to #1, note that mixed removing of items, too, is not supported well by Geany - if you destroy a never shown / hidden item, ref_count will be decremented anyway and autosep may be hidden even if visible items exist.
--
On Wed, 09 May 2012 00:19:15 +0200 Colomban Wendling lists.ban@herbesfolles.org wrote:
def get_insert_position(plugin): [...]
def add_item(plugin, item): [...]
It will work, of course, but I think the above are simpler.