wmbutton: fail early on missing config
commit9f5ea8c8d75da1d45a2a7a932c1b635e1c50724f
authorWeland Treebark <weland@blinkenshell.org>
Wed, 28 May 2014 18:34:14 +0000 (28 21:34 +0300)
committerCarlos R. Mafra <crmafra@gmail.com>
Wed, 28 May 2014 20:20:02 +0000 (28 21:20 +0100)
tree118c67043032e28e47353d8b5184351da7dd88ef
parent145662ff35b0909ff9e48c8bfe71f636436de229
wmbutton: fail early on missing config

wmbutton will happily start and display what otherwise looks like a
functioning display even if none of the possible configuration files
exist. However, the application promptly exits as soon as it has to show
a tooltip. This isn't nice. It looks like a crash to an unsuspecting
user. Terminal output is shown, of course, leading to a decently quick
diagnostic, but the fail isn't early enough to be useable.

The trivial fix is to check if the local configuration file (specified
as a command line argument or defaulting to ~/.wmbutton) or the global
configuration file can be open. If neither can be open, we bail out
early.

This *still* has the problem of only really being functional in a
terminal. A graphical error box would definitely be preferable and is a
possible improvement.

Signed-off-by: Weland Treebark <weland@blinkenshell.org>
wmbutton/wmb_libs.c
wmbutton/wmbutton.c
wmbutton/wmbutton.h