Fremantle: Coexist with a running MicroB process; don't kill MicroB at end of session if MicroB is the default browser With commit aeb836f5... ("Tweak detection of com.nokia.osso_browser acquisition slightly"), it's almost possible to support opening a new window in an already-running MicroB. All we have to do is avoid invoking a new browser process in that case, so do that here. It also turns out to be possible to take back the com.nokia.osso_browser D-Bus name from MicroB without killing it, which is interesting to us because the need to kill MicroB is what necessitates the behavior changes we force on MicroB. On the other hand, if we choose to avoid killing MicroB, we lose the ability to have MicroB take over handling osso_browser requests while a MicroB window is open, and we waste memory for users who aren't using MicroB very often. Therefore, we take a compromise approach: if MicroB is set as the default browser, we don't bother killing MicroB when the last browser window closes (which simplifies the code considerably, since we no longer need to monitor MicroB while it's running, and also means that MicroB should behave as it does when browser-switchboard isn't running). Otherwise, we act as before (watch the running MicroB and kill it when the last browser window closes, with the behavior changes this requires). For control freaks, there's also a new autostart_microb config option which allows you to override this heuristic. Setting autostart_microb to 0 forces us to kill MicroB even when MicroB is the configured default browser, and setting it to 1 forces us to leave MicroB running even when MicroB isn't the default.
Make continuous mode operation the default Continuous mode is better-tested at this point, and the ~100 KB memory footprint isn't an issue on Maemo devices. Moreover, a full fix for bug 5910 (listen on D-Bus system bus as well as session bus) on Fremantle requires continuous mode.
Remove unnecessary break statement in swb_config_load_option()
Simplify control flow in swb_config_load_option() Just return out of the loop when a match is found, and get rid of the retval variable.
Fix memory leak when repeated options are encountered in config file Caught by valgrind.
Get rid of boilerplate code in swb_config_free() We can loop over swb_config_options[] instead of identifying every string config option explicitly here.
Avoid structure copies when looping through swb_config_options
Indentation fixes
Clean up configuration again Commit ec8b58af... ("Refactor configuration") still has too much boilerplate code and leaves too many places that have to be modified to add a new config option. To fix this, add a new array of config options with name and type of information stored, and then add an array of pointers to the elements of struct swb_config with indices matching the list of config options to struct swb_config. This consolidates all the work needed to add new config options to config.h and config.c, and allows us to replace the boilerplate code with loops over the array of config options.
Refactor configuration Most of the code for loading configuration from the config file was being duplicated between the UI and the main browser-switchboard code; also, the forthcoming command-line configuration tool should share the code for loading and saving configuration with the UI. Therefore, move code for loading and saving configuration information into functions generic enough to be shared between the UIs and browser-switchboard.