config: publish nm_config_keyfile_get_boolean() utility function

(cherry picked from commit f031b926c4)
This commit is contained in:
Thomas Haller 2015-05-15 17:00:31 +02:00 committed by Jiří Klimeš
parent 1429ef7249
commit a76deff2f6
2 changed files with 12 additions and 8 deletions

View file

@ -107,11 +107,11 @@ static void _set_config_data (NMConfig *self, NMConfigData *new_data);
/************************************************************************/
static gboolean
_get_bool_value (GKeyFile *keyfile,
const char *section,
const char *key,
gboolean default_value)
gboolean
nm_config_keyfile_get_boolean (GKeyFile *keyfile,
const char *section,
const char *key,
gboolean default_value)
{
gboolean value = default_value;
char *str;
@ -828,9 +828,9 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
if (!priv->plugins)
priv->plugins = g_new0 (char *, 1);
priv->monitor_connection_files = _get_bool_value (keyfile, "main", "monitor-connection-files", FALSE);
priv->monitor_connection_files = nm_config_keyfile_get_boolean (keyfile, "main", "monitor-connection-files", FALSE);
priv->auth_polkit = _get_bool_value (keyfile, "main", "auth-polkit", NM_CONFIG_DEFAULT_AUTH_POLKIT);
priv->auth_polkit = nm_config_keyfile_get_boolean (keyfile, "main", "auth-polkit", NM_CONFIG_DEFAULT_AUTH_POLKIT);
priv->dhcp_client = g_key_file_get_value (keyfile, "main", "dhcp", NULL);
@ -839,7 +839,7 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
priv->debug = g_key_file_get_value (keyfile, "main", "debug", NULL);
priv->configure_and_quit = _get_bool_value (keyfile, "main", "configure-and-quit", FALSE);
priv->configure_and_quit = nm_config_keyfile_get_boolean (keyfile, "main", "configure-and-quit", FALSE);
no_auto_default_orig_list = nm_config_get_device_match_spec (keyfile, "main", "no-auto-default");

View file

@ -89,6 +89,10 @@ NMConfig *nm_config_setup (const NMConfigCmdLineOptions *cli, GError **error);
void nm_config_reload (NMConfig *config);
GKeyFile *nm_config_create_keyfile (void);
gboolean nm_config_keyfile_get_boolean (GKeyFile *keyfile,
const char *section,
const char *key,
gboolean default_value);
GSList *nm_config_get_device_match_spec (const GKeyFile *keyfile, const char *group, const char *key);
G_END_DECLS