diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2018-05-23 18:51:57 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2018-05-31 11:50:02 +0200 |
commit | 011225306470675cd36931ef0e8bf96e28a8baf8 (patch) | |
tree | 0f6fe649a0592cec96b4208910f6926b63463bbe /src | |
parent | 8b6c998a949747c46c05b72d2be721117398e212 (diff) | |
download | NetworkManager-011225306470675cd36931ef0e8bf96e28a8baf8.tar.gz |
settings: do away with plugin capabilities
There's exactly one and not too useful -- only used only in one spot
where we can do hapilly without it.
Diffstat (limited to 'src')
-rw-r--r-- | src/settings/nm-settings.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index eb828f6278..9401873410 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -526,7 +526,7 @@ nm_settings_get_unmanaged_specs (NMSettings *self) } static NMSettingsPlugin * -get_plugin (NMSettings *self, NMSettingsPluginCapabilities capability) +get_plugin (NMSettings *self, gboolean has_add_connection) { NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self); GSList *iter; @@ -535,11 +535,13 @@ get_plugin (NMSettings *self, NMSettingsPluginCapabilities capability) /* Do any of the plugins support the given capability? */ for (iter = priv->plugins; iter; iter = iter->next) { - NMSettingsPluginCapabilities caps = NM_SETTINGS_PLUGIN_CAP_NONE; + NMSettingsPlugin *plugin = NM_SETTINGS_PLUGIN (iter->data); + + if (!has_add_connection) + return plugin; - g_object_get (G_OBJECT (iter->data), NM_SETTINGS_PLUGIN_CAPABILITIES, &caps, NULL); - if (NM_FLAGS_ALL (caps, capability)) - return NM_SETTINGS_PLUGIN (iter->data); + if (NM_SETTINGS_PLUGIN_GET_INTERFACE (iter->data)->add_connection != NULL) + return plugin; } return NULL; @@ -1273,7 +1275,7 @@ nm_settings_add_connection_dbus (NMSettings *self, } /* Do any of the plugins support adding? */ - if (!get_plugin (self, NM_SETTINGS_PLUGIN_CAP_MODIFY_CONNECTIONS)) { + if (!get_plugin (self, TRUE)) { error = g_error_new_literal (NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_NOT_SUPPORTED, "None of the registered plugins support add."); @@ -1857,7 +1859,7 @@ get_property (GObject *object, guint prop_id, : NULL); break; case PROP_CAN_MODIFY: - g_value_set_boolean (value, !!get_plugin (self, NM_SETTINGS_PLUGIN_CAP_MODIFY_CONNECTIONS)); + g_value_set_boolean (value, !!get_plugin (self, TRUE)); break; case PROP_CONNECTIONS: if (priv->connections_loaded) { |