common/parse-bool.c: make parse_bool() generic

...to avoid multiple versions of a boolean-parser.

- Optionally take a default value
- Return -1 on error
- Rename get-bool.c to parse-bool.c
This commit is contained in:
Johan Malm 2023-03-26 22:34:44 +01:00 committed by Johan Malm
parent 473f0aacbd
commit fa50149525
7 changed files with 144 additions and 64 deletions

View file

@ -7,9 +7,9 @@
#include <unistd.h>
#include <wlr/util/log.h>
#include "action.h"
#include "common/get-bool.h"
#include "common/list.h"
#include "common/mem.h"
#include "common/parse-bool.h"
#include "common/spawn.h"
#include "debug.h"
#include "labwc.h"
@ -154,7 +154,7 @@ action_arg_from_xml_node(struct action *action, char *nodename, char *content)
action_arg_add_str(action, "to", content);
} else if (!strcmp(nodename, "follow.action")) {
/* SendToDesktop */
action_arg_add_bool(action, "follow", get_bool(content));
action_arg_add_bool(action, "follow", parse_bool(content, true));
} else if (!strcmp(nodename, "region.action")) {
/* SnapToRegion */
action_arg_add_str(action, NULL, content);