On Wed, 09 May 2012 00:19:15 +0200 Colomban Wendling lists.ban@herbesfolles.org wrote:
Le 29/04/2012 20:26, Dimitar Zhekov a écrit :
Actually there is 1/2 error. The plugin toolbar items are inserted improperly, but added to plugin_items list in the right order. So using "Customize Toolbar" and adding/removing items or otherwise changing them fixes the order.
Patch attached. Not in git format, sorry.
If I read the thing correctly, the patch is wrong because it would possibly mixup tool items from different plugins if they aren't added at the same time, wouldn't it?
Yes. But Geany does not really support mixed add order: the items are put in toolbar.c's plugin_items exactly in their add_toolbar_item order, so a recreation of the toolbar will mix them if not added at once.
BTW, I placed a git patch in tracker bug item 3522755.
But you're right that there is a problem. Currently, it creates:
| Plugin_1_Item_2 Plugin_1_Item_1 | Plugin_2_Item_1 | Quit
It creates Plugin_1_Item_2..N | Plugin_1_Item_1 for each plugin, so:
Plugin_1_Item_2 | Plugin_1_Item_1 | Plugin_2_Item_1 | Quit
And for 2 plugins and 2 items:
Plugin_1_Item_2 | Plugin_1_Item_1 Plugin_2_Item_2 | Plugin_2_Item_1 | Quit.
However with your patch, if plugins are added in the order Plugin_1_Item_1, Plugin_2_Item_1, Plugin_1_Item_2, it would give:
| Plugin_1_Item_1 | Plugin_2_Item_1 Plugin_1_Item_2 | Quit
Which is also wrong (more wrong if I could say).
With the patch, we have a proper order if the plugins add their 2+ items at once, and that order matches toolbar.c plugin_items.
With the current code, the order of 2+ items is always wrong. They are kept together, allright, unless the toolbar is rebuilt, but the separators are wrong too.