[patch NetworkManager 3/4] nm-setting-bridge: implement set_virtual_iface_name()



Signed-off-by: Jiri Pirko <jiri resnulli us>
---
 libnm-util/nm-setting-bridge.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/libnm-util/nm-setting-bridge.c b/libnm-util/nm-setting-bridge.c
index 64d3fc8..f7b362d 100644
--- a/libnm-util/nm-setting-bridge.c
+++ b/libnm-util/nm-setting-bridge.c
@@ -320,6 +320,25 @@ get_virtual_iface_name (NMSetting *setting)
 }
 
 static void
+set_interface_name (NMSettingBridge *setting, const char *iface_name)
+{
+       NMSettingBridgePrivate *priv = NM_SETTING_BRIDGE_GET_PRIVATE (setting);
+
+       g_free (priv->interface_name);
+       priv->interface_name = g_strdup (iface_name);
+}
+
+static gboolean
+set_virtual_iface_name (NMSetting *setting, const char *iface_name)
+{
+       NMSettingBridge *self = NM_SETTING_BRIDGE (setting);
+
+       set_interface_name (self, iface_name);
+
+       return TRUE;
+}
+
+static void
 nm_setting_bridge_init (NMSettingBridge *setting)
 {
        g_object_set (setting, NM_SETTING_NAME, NM_SETTING_BRIDGE_SETTING_NAME, NULL);
@@ -340,11 +359,11 @@ set_property (GObject *object, guint prop_id,
               const GValue *value, GParamSpec *pspec)
 {
        NMSettingBridgePrivate *priv = NM_SETTING_BRIDGE_GET_PRIVATE (object);
+       NMSettingBridge *setting = NM_SETTING_BRIDGE (object);
 
        switch (prop_id) {
        case PROP_INTERFACE_NAME:
-               g_free (priv->interface_name);
-               priv->interface_name = g_value_dup_string (value);
+               set_interface_name (setting, g_value_get_string (value));
                break;
        case PROP_STP:
                priv->stp = g_value_get_boolean (value);
@@ -419,6 +438,7 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *setting_class)
        object_class->finalize     = finalize;
        parent_class->verify       = verify;
        parent_class->get_virtual_iface_name = get_virtual_iface_name;
+       parent_class->set_virtual_iface_name = set_virtual_iface_name;
 
        /* Properties */
        /**
-- 
1.8.3.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]