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



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

diff --git a/libnm-util/nm-setting-team.c b/libnm-util/nm-setting-team.c
index fa0cebb..a7f45e4 100644
--- a/libnm-util/nm-setting-team.c
+++ b/libnm-util/nm-setting-team.c
@@ -154,6 +154,25 @@ get_virtual_iface_name (NMSetting *setting)
 }
 
 static void
+set_interface_name (NMSettingTeam *setting, const char *iface_name)
+{
+       NMSettingTeamPrivate *priv = NM_SETTING_TEAM_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)
+{
+       NMSettingTeam *self = NM_SETTING_TEAM (setting);
+
+       set_interface_name (self, iface_name);
+
+       return TRUE;
+}
+
+static void
 nm_setting_team_init (NMSettingTeam *setting)
 {
        g_object_set (setting, NM_SETTING_NAME, NM_SETTING_TEAM_SETTING_NAME,
@@ -176,10 +195,11 @@ set_property (GObject *object, guint prop_id,
               const GValue *value, GParamSpec *pspec)
 {
        NMSettingTeamPrivate *priv = NM_SETTING_TEAM_GET_PRIVATE (object);
+       NMSettingTeam *setting = NM_SETTING_TEAM (object);
 
        switch (prop_id) {
        case PROP_INTERFACE_NAME:
-               priv->interface_name = g_value_dup_string (value);
+               set_interface_name (setting, g_value_get_string (value));
                break;
        case PROP_CONFIG:
                priv->config = g_value_dup_string (value);
@@ -223,6 +243,7 @@ nm_setting_team_class_init (NMSettingTeamClass *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]