NetworkManager r3560 - in trunk: . libnm-util
- From: tambeti svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r3560 - in trunk: . libnm-util
- Date: Tue, 15 Apr 2008 17:03:26 +0100 (BST)
Author: tambeti
Date: Tue Apr 15 17:03:26 2008
New Revision: 3560
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3560&view=rev
Log:
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.
Modified:
trunk/ChangeLog
trunk/libnm-util/nm-connection.c
trunk/libnm-util/nm-connection.h
trunk/libnm-util/nm-setting.c
trunk/libnm-util/nm-setting.h
Modified: trunk/libnm-util/nm-connection.c
==============================================================================
--- trunk/libnm-util/nm-connection.c (original)
+++ trunk/libnm-util/nm-connection.c Tue Apr 15 17:03:26 2008
@@ -194,6 +194,15 @@
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)
{
Modified: trunk/libnm-util/nm-connection.h
==============================================================================
--- trunk/libnm-util/nm-connection.h (original)
+++ trunk/libnm-util/nm-connection.h Tue Apr 15 17:03:26 2008
@@ -43,6 +43,9 @@
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);
Modified: trunk/libnm-util/nm-setting.c
==============================================================================
--- trunk/libnm-util/nm-setting.c (original)
+++ trunk/libnm-util/nm-setting.c Tue Apr 15 17:03:26 2008
@@ -125,6 +125,34 @@
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)
{
Modified: trunk/libnm-util/nm-setting.h
==============================================================================
--- trunk/libnm-util/nm-setting.h (original)
+++ trunk/libnm-util/nm-setting.h Tue Apr 15 17:03:26 2008
@@ -55,6 +55,8 @@
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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]