From 2bfccab710f694c9f2d54033a305ba64533e3bc5 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Sat, 16 Aug 2014 10:13:56 -0400 Subject: [PATCH] libnm-core: drop nm_connection_create_setting() This was only used in one place, and is trivial to implement inline there. --- libnm-core/nm-connection.c | 23 ----------------------- libnm-core/nm-connection.h | 2 -- libnm/libnm.ver | 1 - src/settings/plugins/keyfile/reader.c | 11 ++++++++--- 4 files changed, 8 insertions(+), 29 deletions(-) diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c index 2b52e7a340..48d7777416 100644 --- a/libnm-core/nm-connection.c +++ b/libnm-core/nm-connection.c @@ -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, diff --git a/libnm-core/nm-connection.h b/libnm-core/nm-connection.h index bcc9cbcc49..d8c3b5e113 100644 --- a/libnm-core/nm-connection.h +++ b/libnm-core/nm-connection.h @@ -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); diff --git a/libnm/libnm.ver b/libnm/libnm.ver index 816979ffc7..986c235244 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -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; diff --git a/src/settings/plugins/keyfile/reader.c b/src/settings/plugins/keyfile/reader.c index eefa39538f..2448e5521e 100644 --- a/src/settings/plugins/keyfile/reader.c +++ b/src/settings/plugins/keyfile/reader.c @@ -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;