status/keyboard: Async public function to get currentSource
Introduce public async function to get currentSource and inputSources
These insure that
- a. activateInputSource() has been called at least once.
- b. Will not resolve till the above function has finished to give the latest correct currentSource and inputSources.
- c. Will never return a null value, so calling code is assured a non null value.
- d. Will only resolve after the async ibus setEngine() call has completed, so that the calling code is assured that the engine is at least correctly set in the gnome-shell javascript code. (Though possibly not in the underlying dbus C code called from the javascript code)
Can be used and called indirectly from constructors of other classes to prevent null values of currentSource and inputSource at initiation, and delay initialization till the source is correctly set with async/await to prevent crashes from a null source.
Preserves the current sync method API to get currentSource and inputSource. All subsequent sync calls should complete successfully if the async call has returned once, although they may return not the source being set currently, but at least the last set source.
Their use can however be expanded slowly in future to take over the sync getter functions, and replace them with async/await as necessary.
Use the async function to get the correct, non null currentSource to prevent a use before initialization error in ui/keyboard.js.
Alternate and much less intrusive, potentially backportable fix for #7912 (closed) than my earlier attempt!