bassmanitram / actions-for-nautilus

An extension to the Gnome "Files" file manager that allows you to add arbitrary actions to the file selection context menu.
Apache License 2.0
165 stars 16 forks source link

Deletion and moving of actions occasionally corrupts other actions #23

Closed bassmanitram closed 1 year ago

bassmanitram commented 1 year ago

Difficult to reproduce, but for me when I deleted a command action a menu action further down the list was interpreted as a command action and lost all its submenu configuration as well as being marked invalid.

Workaround - use the JSON editor to handle this kind of thing until a fix is available.

bassmanitram commented 1 year ago

The problem is (still) in the "min_items/max_items" cross-property validator - it corrupts the model as items are moved. This is likely because it is called on every change to the model, not just at the end of a set of changes.

bassmanitram commented 1 year ago

I was trying to be too "fine-grained" with the consistency checks! EVERY part of the model is presented to the validator, so rather than address the min and max properties individually, we can just wait until the "Basic" block of a command action is presented as a whole and then check it - this avoids having to introspect the editors and reduces the check to on (albeit long) if statement.

This tackles the persistent problem but it leaves one problem that I can't quite get a handle on yet - when you move a command action that is in error (particularly, has the min/max inconsistency) "past" a menu item, the command action in error becomes a menu action - with even more errors! I'll tackle this problem in a separate issue.

bassmanitram commented 1 year ago

OK, I take that back - another tweak to the condition for the check - making it more targetted - fixes the "moving action-in-error" issue too. I think we're good to go!