nm-settings: add nm_settings_has_connection()

Useful for checking if a connection is already deleted.

https://bugzilla.gnome.org/show_bug.cgi?id=744812
https://bugzilla.redhat.com/show_bug.cgi?id=1174164
This commit is contained in:
Lubomir Rintel 2015-04-22 15:05:53 +02:00
parent cd2cef9cab
commit 8a00bb36ec
2 changed files with 17 additions and 0 deletions

View file

@ -467,6 +467,21 @@ notify (GObject *object, GParamSpec *pspec)
g_slice_free (GValue, value);
}
gboolean
nm_settings_has_connection (NMSettings *self, NMConnection *connection)
{
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
GHashTableIter iter;
gpointer data;
g_hash_table_iter_init (&iter, priv->connections);
while (g_hash_table_iter_next (&iter, NULL, &data))
if (data == connection)
return TRUE;
return FALSE;
}
const GSList *
nm_settings_get_unmanaged_specs (NMSettings *self)
{

View file

@ -111,6 +111,8 @@ NMSettingsConnection *nm_settings_get_connection_by_path (NMSettings *settings,
NMSettingsConnection *nm_settings_get_connection_by_uuid (NMSettings *settings,
const char *uuid);
gboolean nm_settings_has_connection (NMSettings *self, NMConnection *connection);
const GSList *nm_settings_get_unmanaged_specs (NMSettings *self);
char *nm_settings_get_hostname (NMSettings *self);