shermp / NickelDBus

Monitor and control kobo Nickel via dbus
MIT License
24 stars 2 forks source link

Include NM as submodule, and start using NM actions directly #1

Closed shermp closed 4 years ago

shermp commented 4 years ago

I decided to see if switching over to directly using actions from NickelMenu would work, and the experiment seems to be a success. I've ported the pfmRescanBooksFull method as a starting point.

@geek1011 do you have any concerns or potential gotchas with this approach?

pgaskin commented 4 years ago

That should work fine in general (I did make NM as modular as possible, and made sure there are as few inter-file dependencies as possible).

Just be careful with when you call certain actions (I'll check which ones later if you want a specific example), as some need to be called from the main event loop only. In general, if you're calling them from QtDBus, you should be fine, as that's integrated with the rest of Qt. Also, most of the actions shouldn't be called during a USB session, or various levels of breakage may occur.

As for the action functions themselves, remember to free the result, and also remember that some actions ignore errors. Also, make sure you keep up with any changes while NM is still v0.*, as I may still make breaking changes in the arguments (like geek1011/NickelMenu#59) until v1. I might switch to strongly-typed arguments using code generation (to generate structs, enums, and a config parser which understands types other than strings), but that's not happening for the next while anyways.

shermp commented 4 years ago

Thanks for the info.

As far as threading goes, I don't plan on doing anything outside of QtDBus, so should be safe.

Good catch on the USB session. I should probably try and detect if Nickel is serving a USB session if possible, and forbid executing Nickel actions if so.

The nice thing about using submodules is I can update to newer commits at my leisure, when I have time to make any required updates.