2008-06-20 Tambet Ingo <tambet@gmail.com>
* libnm-util/nm-connection.c (nm_connection_duplicate): Implement. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3759 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
2008-06-20 Tambet Ingo <tambet@gmail.com>
|
||||
|
||||
* libnm-util/nm-connection.c (nm_connection_duplicate): Implement.
|
||||
|
||||
2008-06-17 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* libnm-glib/nm-vpn-plugin-ui-interface.c
|
||||
|
@@ -699,6 +699,26 @@ nm_connection_new_from_hash (GHashTable *hash, GError **error)
|
||||
return connection;
|
||||
}
|
||||
|
||||
static void
|
||||
duplicate_cb (gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
nm_connection_add_setting (NM_CONNECTION (user_data), nm_setting_duplicate (NM_SETTING (value)));
|
||||
}
|
||||
|
||||
NMConnection *
|
||||
nm_connection_duplicate (NMConnection *connection)
|
||||
{
|
||||
NMConnection *dup;
|
||||
|
||||
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
|
||||
|
||||
dup = nm_connection_new ();
|
||||
nm_connection_set_scope (dup, nm_connection_get_scope (connection));
|
||||
g_hash_table_foreach (NM_CONNECTION_GET_PRIVATE (connection)->settings, duplicate_cb, dup);
|
||||
|
||||
return dup;
|
||||
}
|
||||
|
||||
static void
|
||||
nm_connection_init (NMConnection *connection)
|
||||
{
|
||||
|
@@ -42,6 +42,8 @@ NMConnection *nm_connection_new (void);
|
||||
|
||||
NMConnection *nm_connection_new_from_hash (GHashTable *hash, GError **error);
|
||||
|
||||
NMConnection *nm_connection_duplicate (NMConnection *connection);
|
||||
|
||||
void nm_connection_add_setting (NMConnection *connection,
|
||||
NMSetting *setting);
|
||||
|
||||
|
Reference in New Issue
Block a user