2007-10-16 Tambet Ingo <tambet@gmail.com>

Implement a generic NMSetting creator from setting name.
        While at it, get rid of all nm_setting_foo_new_from_hash()
functions and
        add a virtual function 'populate_fn'.

        * libnm-util/nm-connection.c (nm_connection_create_setting):
        * Implement.
        (register_default_creators): Register setting creators instead
of functions
        that create and then populate.
        (parse_one_setting): Use the common setting creator and then
setting specific
        poplulation function.

        * libnm-util/nm-setting.c: Get rid of
        * nm_setting_foo_new_from_hash() functions,
        they all looked exactly the same.
        Add a 'populate_fn' virtual function to NMSetting.
        Use default virtual functions in case they are not overriden.
        (nm_setting_populate_from_hash): Implement.

        * src/nm-device.c (real_act_stage3_ip_config_start): Don't hard
        * code the setting
        name, use a defined string.
        (real_act_stage4_get_ip4_config): Ditto.



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2978 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Tambet Ingo
2007-10-16 15:18:01 +00:00
parent b85dd0a01c
commit 850f441ea5
6 changed files with 89 additions and 175 deletions

View File

@@ -555,7 +555,8 @@ real_act_stage3_ip_config_start (NMDevice *self)
NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS;
req = nm_device_get_act_request (self);
setting = (NMSettingIP4Config *) nm_connection_get_setting (nm_act_request_get_connection (req), "ipv4");
setting = (NMSettingIP4Config *) nm_connection_get_setting (nm_act_request_get_connection (req),
NM_SETTING_IP4_CONFIG);
/* If we did not receive IP4 configuration information, default to DHCP */
if (!setting || setting->manual == FALSE) {
@@ -702,7 +703,8 @@ real_act_stage4_get_ip4_config (NMDevice *self,
}
req = nm_device_get_act_request (self);
setting = (NMSettingIP4Config *) nm_connection_get_setting (nm_act_request_get_connection (req), "ipv4");
setting = (NMSettingIP4Config *) nm_connection_get_setting (nm_act_request_get_connection (req),
NM_SETTING_IP4_CONFIG);
if (real_config && setting) {
/* If settings are provided, use them, even if it means overriding the values we got from DHCP */