Commit 2bfccab7 authored by Dan Winship's avatar Dan Winship
Browse files

libnm-core: drop nm_connection_create_setting()

This was only used in one place, and is trivial to implement inline
there.
parent c81fb49a
......@@ -153,29 +153,6 @@ nm_connection_lookup_setting_type_by_quark (GQuark error_quark)
return _nm_setting_lookup_setting_type_by_quark (error_quark);
}
/**
* nm_connection_create_setting:
* @name: a setting name
*
* Create a new #NMSetting object of the desired type, given a setting name.
*
* Returns: (transfer full): the new setting object, or %NULL if the setting name was unknown
**/
NMSetting *
nm_connection_create_setting (const char *name)
{
GType type;
NMSetting *setting = NULL;
g_return_val_if_fail (name != NULL, NULL);
type = nm_connection_lookup_setting_type (name);
if (type)
setting = (NMSetting *) g_object_new (type, NULL);
return setting;
}
static void
setting_changed_cb (NMSetting *setting,
GParamSpec *pspec,
......
......@@ -140,8 +140,6 @@ NMConnection *nm_connection_new_from_hash (GHashTable *hash, GError **error);
NMConnection *nm_connection_duplicate (NMConnection *connection);
NMSetting *nm_connection_create_setting (const char *name);
void nm_connection_add_setting (NMConnection *connection,
NMSetting *setting);
......
......@@ -76,7 +76,6 @@ global:
nm_connection_clear_secrets;
nm_connection_clear_secrets_with_flags;
nm_connection_compare;
nm_connection_create_setting;
nm_connection_diff;
nm_connection_dump;
nm_connection_duplicate;
......
......@@ -1166,12 +1166,17 @@ read_setting (GKeyFile *file, const char *keyfile_path, const char *group)
NMSetting *setting;
ReadInfo info = { file, keyfile_path };
const char *alias;
GType type;
alias = nm_keyfile_plugin_get_setting_name_for_alias (group);
setting = nm_connection_create_setting (alias ? alias : group);
if (setting)
if (alias)
group = alias;
type = nm_connection_lookup_setting_type (group);
if (type) {
setting = g_object_new (type, NULL);
nm_setting_enumerate_values (setting, read_one_setting_value, &info);
else
} else
nm_log_warn (LOGD_SETTINGS, "Invalid setting name '%s'", group);
return setting;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment