2008-04-15 Tambet Ingo <tambet@gmail.com>

* libnm-util/nm-setting.c (nm_setting_duplicate): Implement.

	* libnm-util/nm-connection.c (nm_connection_remove_setting): Implement.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3560 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Tambet Ingo 2008-04-15 16:03:26 +00:00
parent 84011a9a5c
commit 0d91f460d6
5 changed files with 48 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2008-04-15 Tambet Ingo <tambet@gmail.com>
* libnm-util/nm-setting.c (nm_setting_duplicate): Implement.
* libnm-util/nm-connection.c (nm_connection_remove_setting): Implement.
2008-04-15 Dan Williams <dcbw@redhat.com>
* nm-setting-ip4-config.c

View file

@ -194,6 +194,15 @@ nm_connection_add_setting (NMConnection *connection, NMSetting *setting)
g_strdup (G_OBJECT_TYPE_NAME (setting)), setting);
}
void
nm_connection_remove_setting (NMConnection *connection, GType type)
{
g_return_if_fail (NM_IS_CONNECTION (connection));
g_return_if_fail (g_type_is_a (type, NM_TYPE_SETTING));
g_hash_table_remove (NM_CONNECTION_GET_PRIVATE (connection)->settings, g_type_name (type));
}
NMSetting *
nm_connection_get_setting (NMConnection *connection, GType type)
{

View file

@ -43,6 +43,9 @@ NMConnection *nm_connection_new_from_hash (GHashTable *hash);
void nm_connection_add_setting (NMConnection *connection,
NMSetting *setting);
void nm_connection_remove_setting (NMConnection *connection,
GType setting_type);
NMSetting *nm_connection_get_setting (NMConnection *connection,
GType setting_type);

View file

@ -125,6 +125,34 @@ nm_setting_from_hash (GType setting_type,
return setting;
}
static void
duplicate_setting (NMSetting *setting,
const char *name,
const GValue *value,
gboolean secret,
gpointer user_data)
{
GObject *dup = (GObject *) user_data;
g_object_set_property (dup, name, value);
}
NMSetting *
nm_setting_duplicate (NMSetting *setting)
{
GObject *dup;
g_return_val_if_fail (NM_IS_SETTING (setting), NULL);
dup = g_object_new (G_OBJECT_TYPE (setting), NULL);
g_object_freeze_notify (dup);
nm_setting_enumerate_values (setting, duplicate_setting, dup);
g_object_thaw_notify (dup);
return NM_SETTING (dup);
}
const char *
nm_setting_get_name (NMSetting *setting)
{

View file

@ -55,6 +55,8 @@ GHashTable *nm_setting_to_hash (NMSetting *setting);
NMSetting *nm_setting_from_hash (GType setting_type,
GHashTable *hash);
NMSetting *nm_setting_duplicate (NMSetting *setting);
const char *nm_setting_get_name (NMSetting *setting);
gboolean nm_setting_verify (NMSetting *setting,