We are not allowed to free a string that we get back from the config APIs. So
strdup it instead to be compatible with Linux in that respect.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The default file name is OS specific and tries to follow the customs on
each of the OSs. It can be configured through the preferences dialog.
On MacOS we get a strange warning which appears to be a well documented
Gtk bug on MacOS.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We have removed a menu separator from the gtk gui and that was still
referenced in the Macos code. And just in case, we are now testing
for the widget for the other separator to be non-NULL before
destroying it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On Linux and MacOS the subsurface_close_conf() doesn't really close the
config file (it flushes writes on MacOS), but on Windows it does
actually close the registry hkey.
Which is bad, if you change the settings multiple times - we assume that
the config file is open the whole time.
So add a "subsurface_flush_conf()" function, and call *that* when
changing configuration parameters. And call the close function only at
the very end.
Alternatively, maybe we should just open the config file separately
every time. I don't much care, maybe somebody else does.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Move the About and Preferences menu item to the App menu.
Switch the accelerator key to be Meta (i.e., Command) instead of Control
This required a bit of restructuring of the code, but it's all for a good
cause.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
CFPreferences* seems to be the proper way to handle preferences on MacOSX.
This approach also eliminates a problem where the hard coded preferences
path couldn't be read.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
[ fixed small coding style issues ]
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
To do this a few things needed to move into the os specific files, but the
overall change is fairly small and the difference on the Mac is amazing.
Subsurface now becomes a Mac app with Mac toolbar and useful default
fonts.
Changed the CFBundleIdentifier to be the reverse DNS of the subsurface
site (sadly, 'torvalds' is not yet a TLD).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
So far we hard coded /dev/ttyUSB0 - which is a good starting point in
Linux but not so useful on Windows or MacOS. This was now moved into one
of our OS helper functions with (somewhat) reasonable defaults.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds tested code for Linux and Mac OS, implementing the api that
Linus suggested.
The Windows code was moved into its own file, but hasn't even been compile
tested, yet.
In order to have just one interface to set or get a preference value we
encode TRUE as (void *) 1 and FALSE as NULL. This works consistently on
all platforms and regardless of whether we have 32 or 64 bit.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>