Change behaviour of WmudConfiguration.update_from_file()
filename can be NULL now, in which case it will use the already set config file.
This commit is contained in:
parent
6eb1e09cc3
commit
ee4050c5f6
@ -200,7 +200,6 @@ main(int argc, char **argv)
|
||||
GError *err = NULL;
|
||||
GSList *game_menu = NULL;
|
||||
WmudConfiguration *current_config = NULL;
|
||||
gchar *filename = NULL;
|
||||
|
||||
g_log_set_handler(G_LOG_DOMAIN, G_LOG_LEVEL_MASK, wmud_logger, NULL);
|
||||
|
||||
@ -214,12 +213,8 @@ main(int argc, char **argv)
|
||||
|
||||
/* TODO: Create signal handlers! */
|
||||
|
||||
if ((filename = wmud_configuration_get_filename(current_config)) == NULL) {
|
||||
filename = WMUD_CONFDIR "/wmud.conf";
|
||||
}
|
||||
|
||||
// Process configuration file
|
||||
wmud_configuration_update_from_file(current_config, filename, NULL);
|
||||
wmud_configuration_update_from_file(current_config, NULL, NULL);
|
||||
|
||||
if (!wmud_config_init(&active_config, &err)) {
|
||||
if (err) {
|
||||
|
@ -98,8 +98,12 @@ wmud_configuration_update_from_file(WmudConfiguration *configuration,
|
||||
WmudConfigurationPrivate *priv = wmud_configuration_get_instance_private(
|
||||
configuration);
|
||||
|
||||
// Save the file name for possible later use
|
||||
if (filename != NULL) {
|
||||
g_free(priv->file_name);
|
||||
priv->file_name = g_strdup(filename);
|
||||
} else if (priv->file_name == NULL) {
|
||||
priv->file_name = g_strdup(WMUD_CONFDIR "/wmud.conf");
|
||||
}
|
||||
|
||||
priv->key_file = g_key_file_new();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user