Closed shermp closed 4 years ago
I did think of that idea before, but I ended up deciding against it, since many of them depend on being called from the main thread. In addition, they currently take a char*
argument rather than something more structured.
Regarding usage in other libraries, my current stance on the best option for that is to copy the code itself where needed, but if anyone has any additional things to consider, I might change my mind.
How much would you need to re-use the actions standalone? Also, if you only need certain functionality have you considered just calling the functions directly with a string argument and ignoring the return value (it will return errors the usual way).
My main issue with copying the code is likelihood of introducing 'oopsies' during the process, and keeping the code up to date.
My main hesitance to call the code directly as-is, is wanting to avoiding pulling in the nm_action_result_t
stuff. However I may end up doing that I suppose.
I don't think this is worth doing, at least for now. I might reconsider this once we figure out the details of geek1011/kobo-plugin-experiments#9.
Currently the code that actually executes nickel actions are intertwined with the menu/config code. However it could be useful to refactor them into standalone functions, such that they could easily be reused by other libraries.
From my look through the code, it looks like each segment of code is fairly self-contained already, so it doesn't look like the refactor would be too difficult.
I'm willing to take a stab at it if @geek1011 is open to the idea.