Allow checking for duplicate bindings with -C

- Having both parse_configuration and parse_file is excessive now
- We detect if we are parsing only by checking if conn is NULL, not with
use_nagbar
- font.pattern needs to be set to NULL because it is freed in
free_font()

Fixes #3660
This commit is contained in:
Orestis Floros
2019-03-29 02:36:24 +02:00
parent 7754de900a
commit 08cdc3a6ae
6 changed files with 68 additions and 56 deletions

View File

@ -400,19 +400,11 @@ struct tray_output_t {
tray_outputs;
};
/**
* Finds the configuration file to use (either the one specified by
* override_configpath), the users one or the system default) and calls
* parse_file().
*
* If you specify override_configpath, only this path is used to look for a
* configuration file.
*
* If use_nagbar is false, don't try to start i3-nagbar but log the errors to
* stdout/stderr instead.
*
*/
bool parse_configuration(const char *override_configpath, bool use_nagbar);
typedef enum {
C_VALIDATE,
C_LOAD,
C_RELOAD,
} config_load_t;
/**
* (Re-)loads the configuration file (sets useful defaults before).
@ -420,8 +412,12 @@ bool parse_configuration(const char *override_configpath, bool use_nagbar);
* If you specify override_configpath, only this path is used to look for a
* configuration file.
*
* load_type specifies the type of loading: C_VALIDATE is used to only verify
* the correctness of the config file (used with the flag -C). C_LOAD will load
* the config for normal use and display errors in the nagbar. C_RELOAD will
* also clear the previous config.
*/
void load_configuration(const char *override_configfile, bool reload);
bool load_configuration(const char *override_configfile, config_load_t load_type);
/**
* Ungrabs all keys, to be called before re-grabbing the keys because of a