Commit 5b7503e9 authored by Thomas Graf's avatar Thomas Graf Committed by Dan Williams

core: use nm_connection_get_setting_<type>() whenever possible

Leads to shorter, easier to read code and improves type casting safety.
Signed-off-by: default avatarThomas Graf <tgraf@redhat.com>
parent c1344ec0
......@@ -76,7 +76,7 @@ show_connection (NMConnection *data, gpointer user_data)
char timestamp_real_str[64];
const char *val1, *val2, *val3, *val4, *val5;
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
if (s_con) {
/* Get various info from NMSettingConnection and show it */
timestamp = nm_setting_connection_get_timestamp (s_con);
......
......@@ -169,7 +169,7 @@ get_connection_bt_type (NMConnection *connection)
NMSettingBluetooth *s_bt;
const char *bt_type;
s_bt = (NMSettingBluetooth *) nm_connection_get_setting (connection, NM_TYPE_SETTING_BLUETOOTH);
s_bt = nm_connection_get_setting_bluetooth (connection);
if (!s_bt)
return NM_BT_CAPABILITY_NONE;
......
......@@ -721,7 +721,7 @@ gboolean
nm_connection_verify (NMConnection *connection, GError **error)
{
NMConnectionPrivate *priv;
NMSetting *s_con;
NMSettingConnection *s_con;
GHashTableIter iter;
gpointer value;
GSList *all_settings = NULL;
......@@ -743,7 +743,7 @@ nm_connection_verify (NMConnection *connection, GError **error)
priv = NM_CONNECTION_GET_PRIVATE (connection);
/* First, make sure there's at least 'connection' setting */
s_con = nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
if (!s_con) {
g_set_error_literal (error,
NM_CONNECTION_ERROR,
......@@ -769,7 +769,7 @@ nm_connection_verify (NMConnection *connection, GError **error)
/* Now make sure the given 'type' setting can actually be the base setting
* of the connection. Can't have type=ppp for example.
*/
ctype = nm_setting_connection_get_connection_type (NM_SETTING_CONNECTION (s_con));
ctype = nm_setting_connection_get_connection_type (s_con);
if (!ctype) {
g_set_error_literal (error,
NM_CONNECTION_ERROR,
......@@ -1286,7 +1286,7 @@ nm_connection_get_uuid (NMConnection *connection)
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
g_return_val_if_fail (s_con != NULL, NULL);
return nm_setting_connection_get_uuid (s_con);
......@@ -1308,7 +1308,7 @@ nm_connection_get_id (NMConnection *connection)
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
g_return_val_if_fail (s_con != NULL, NULL);
return nm_setting_connection_get_id (s_con);
......
......@@ -921,7 +921,7 @@ test_connection_diff_different (void)
{
NMConnection *a, *b;
GHashTable *out_diffs = NULL;
NMSetting *s_ip4;
NMSettingIP4Config *s_ip4;
gboolean same;
const DiffSetting settings[] = {
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, {
......@@ -932,7 +932,7 @@ test_connection_diff_different (void)
a = new_test_connection ();
b = nm_connection_duplicate (a);
s_ip4 = nm_connection_get_setting (a, NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (a);
g_assert (s_ip4);
g_object_set (G_OBJECT (s_ip4),
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
......@@ -973,7 +973,7 @@ test_connection_diff_no_secrets (void)
b = nm_connection_duplicate (a);
/* Add a secret to B */
s_pppoe = nm_connection_get_setting (b, NM_TYPE_SETTING_PPPOE);
s_pppoe = NM_SETTING (nm_connection_get_setting_pppoe (b));
g_assert (s_pppoe);
g_object_set (G_OBJECT (s_pppoe),
NM_SETTING_PPPOE_PASSWORD, "secretpassword",
......
......@@ -527,7 +527,7 @@ test_update_secrets_wifi_single_setting (void)
g_assert (success);
/* Make sure the secret is now in the connection */
s_wsec = (NMSettingWirelessSecurity *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY);
s_wsec = nm_connection_get_setting_wireless_security (connection);
g_assert (s_wsec);
tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 0);
g_assert_cmpstr (tmp, ==, wepkey);
......@@ -563,7 +563,7 @@ test_update_secrets_wifi_full_hash (void)
g_assert (success);
/* Make sure the secret is now in the connection */
s_wsec = (NMSettingWirelessSecurity *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY);
s_wsec = nm_connection_get_setting_wireless_security (connection);
g_assert (s_wsec);
tmp = nm_setting_wireless_security_get_wep_key (s_wsec, 0);
g_assert_cmpstr (tmp, ==, wepkey);
......
......@@ -941,7 +941,7 @@ nm_utils_complete_generic (NMConnection *connection,
const char *method;
char *id, *uuid;
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
if (!s_con) {
s_con = (NMSettingConnection *) nm_setting_connection_new ();
nm_connection_add_setting (connection, NM_SETTING (s_con));
......@@ -962,7 +962,7 @@ nm_utils_complete_generic (NMConnection *connection,
}
/* Add an 'auto' IPv4 connection if present */
s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (!s_ip4) {
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
......@@ -975,7 +975,7 @@ nm_utils_complete_generic (NMConnection *connection,
}
/* Add an 'auto' IPv6 setting if allowed and not preset */
s_ip6 = (NMSettingIP6Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG);
s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (!s_ip6 && default_enable_ipv6) {
s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
......
......@@ -169,7 +169,7 @@ create_connect_properties (NMConnection *connection)
GHashTable *properties;
const char *str;
setting = NM_SETTING_CDMA (nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA));
setting = nm_connection_get_setting_cdma (connection);
properties = value_hash_create ();
str = nm_setting_cdma_get_number (setting);
......@@ -230,7 +230,7 @@ real_get_best_auto_connection (NMModem *modem,
NMConnection *connection = NM_CONNECTION (iter->data);
NMSettingConnection *s_con;
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (!nm_setting_connection_get_autoconnect (s_con))
......@@ -252,7 +252,7 @@ real_check_connection_compatible (NMModem *modem,
NMSettingConnection *s_con;
NMSettingCdma *s_cdma;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_CDMA_SETTING_NAME)) {
......@@ -262,7 +262,7 @@ real_check_connection_compatible (NMModem *modem,
return FALSE;
}
s_cdma = NM_SETTING_CDMA (nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA));
s_cdma = nm_connection_get_setting_cdma (connection);
if (!s_cdma) {
g_set_error (error,
NM_CDMA_ERROR, NM_CDMA_ERROR_CONNECTION_INVALID,
......@@ -281,7 +281,7 @@ real_complete_connection (NMModem *modem,
{
NMSettingCdma *s_cdma;
s_cdma = (NMSettingCdma *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA);
s_cdma = nm_connection_get_setting_cdma (connection);
if (!s_cdma) {
s_cdma = (NMSettingCdma *) nm_setting_cdma_new ();
nm_connection_add_setting (connection, NM_SETTING (s_cdma));
......@@ -308,7 +308,7 @@ real_get_user_pass (NMModem *modem,
{
NMSettingCdma *s_cdma;
s_cdma = (NMSettingCdma *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA);
s_cdma = nm_connection_get_setting_cdma (connection);
if (!s_cdma)
return FALSE;
......
......@@ -349,7 +349,7 @@ create_connect_properties (NMConnection *connection)
GHashTable *properties;
const char *str;
setting = NM_SETTING_GSM (nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM));
setting = nm_connection_get_setting_gsm (connection);
properties = value_hash_create ();
str = nm_setting_gsm_get_number (setting);
......@@ -451,7 +451,7 @@ real_get_best_auto_connection (NMModem *modem,
NMConnection *connection = NM_CONNECTION (iter->data);
NMSettingConnection *s_con;
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (!nm_setting_connection_get_autoconnect (s_con))
......@@ -473,7 +473,7 @@ real_check_connection_compatible (NMModem *modem,
NMSettingConnection *s_con;
NMSettingGsm *s_gsm;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_GSM_SETTING_NAME)) {
......@@ -483,7 +483,7 @@ real_check_connection_compatible (NMModem *modem,
return FALSE;
}
s_gsm = NM_SETTING_GSM (nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM));
s_gsm = nm_connection_get_setting_gsm (connection);
if (!s_gsm) {
g_set_error (error,
NM_GSM_ERROR, NM_GSM_ERROR_CONNECTION_INVALID,
......@@ -502,7 +502,7 @@ real_complete_connection (NMModem *modem,
{
NMSettingGsm *s_gsm;
s_gsm = (NMSettingGsm *) nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM);
s_gsm = nm_connection_get_setting_gsm (connection);
if (!s_gsm || !nm_setting_gsm_get_apn (s_gsm)) {
/* Need an APN at least */
g_set_error_literal (error,
......@@ -533,7 +533,7 @@ real_get_user_pass (NMModem *modem,
{
NMSettingGsm *s_gsm;
s_gsm = (NMSettingGsm *) nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM);
s_gsm = nm_connection_get_setting_gsm (connection);
if (!s_gsm)
return FALSE;
......
......@@ -154,7 +154,7 @@ get_connection_bt_type (NMConnection *connection)
NMSettingBluetooth *s_bt;
const char *bt_type;
s_bt = (NMSettingBluetooth *) nm_connection_get_setting (connection, NM_TYPE_SETTING_BLUETOOTH);
s_bt = nm_connection_get_setting_bluetooth (connection);
if (!s_bt)
return NM_BT_CAPABILITY_NONE;
......@@ -182,7 +182,7 @@ real_get_best_auto_connection (NMDevice *device,
NMSettingConnection *s_con;
guint32 bt_type;
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (!nm_setting_connection_get_autoconnect (s_con))
......@@ -213,7 +213,7 @@ real_check_connection_compatible (NMDevice *device,
int addr_match = FALSE;
guint32 bt_type;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_BLUETOOTH_SETTING_NAME)) {
......@@ -223,7 +223,7 @@ real_check_connection_compatible (NMDevice *device,
return FALSE;
}
s_bt = NM_SETTING_BLUETOOTH (nm_connection_get_setting (connection, NM_TYPE_SETTING_BLUETOOTH));
s_bt = nm_connection_get_setting_bluetooth (connection);
if (!s_bt) {
g_set_error (error,
NM_BT_ERROR, NM_BT_ERROR_CONNECTION_INVALID,
......@@ -275,12 +275,12 @@ real_complete_connection (NMDevice *device,
NMSettingPPP *s_ppp;
const char *format = NULL, *preferred = NULL;
s_gsm = (NMSettingGsm *) nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM);
s_cdma = (NMSettingCdma *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CDMA);
s_gsm = nm_connection_get_setting_gsm (connection);
s_cdma = nm_connection_get_setting_cdma (connection);
s_serial = (NMSettingSerial *) nm_connection_get_setting (connection, NM_TYPE_SETTING_SERIAL);
s_ppp = (NMSettingPPP *) nm_connection_get_setting (connection, NM_TYPE_SETTING_PPP);
s_ppp = nm_connection_get_setting_ppp (connection);
s_bt = (NMSettingBluetooth *) nm_connection_get_setting (connection, NM_TYPE_SETTING_BLUETOOTH);
s_bt = nm_connection_get_setting_bluetooth (connection);
if (!s_bt) {
s_bt = (NMSettingBluetooth *) nm_setting_bluetooth_new ();
nm_connection_add_setting (connection, NM_SETTING (s_bt));
......
......@@ -650,7 +650,7 @@ real_get_best_auto_connection (NMDevice *dev,
const GSList *mac_blacklist, *mac_blacklist_iter;
gboolean mac_blacklist_found = FALSE;
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
connection_type = nm_setting_connection_get_connection_type (s_con);
......@@ -670,7 +670,7 @@ real_get_best_auto_connection (NMDevice *dev,
if (!nm_setting_connection_get_autoconnect (s_con))
continue;
s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
s_wired = nm_connection_get_setting_wired (connection);
/* Wired setting optional for PPPoE */
if (!is_pppoe && !s_wired)
continue;
......@@ -881,7 +881,7 @@ build_supplicant_config (NMDeviceEthernet *self)
if (!config)
return NULL;
security = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
security = nm_connection_get_setting_802_1x (connection);
if (!nm_supplicant_config_add_setting_8021x (config, security, con_path, TRUE)) {
nm_log_warn (LOGD_DEVICE, "Couldn't add 802.1X security setting to supplicant config.");
g_object_unref (config);
......@@ -1149,7 +1149,7 @@ nm_8021x_stage2_config (NMDeviceEthernet *self, NMDeviceStateReason *reason)
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
connection = nm_act_request_get_connection (nm_device_get_act_request (NM_DEVICE (self)));
security = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
security = nm_connection_get_setting_802_1x (connection);
if (!security) {
nm_log_err (LOGD_DEVICE, "Invalid or missing 802.1X security");
*reason = NM_DEVICE_STATE_REASON_CONFIG_FAILED;
......@@ -1235,7 +1235,7 @@ pppoe_stage3_ip4_config_start (NMDeviceEthernet *self, NMDeviceStateReason *reas
connection = nm_act_request_get_connection (req);
g_assert (req);
s_pppoe = (NMSettingPPPOE *) nm_connection_get_setting (connection, NM_TYPE_SETTING_PPPOE);
s_pppoe = nm_connection_get_setting_pppoe (connection);
g_assert (s_pppoe);
priv->ppp_manager = nm_ppp_manager_new (nm_device_get_iface (NM_DEVICE (self)));
......@@ -1370,7 +1370,7 @@ real_check_connection_compatible (NMDevice *device,
gboolean try_mac = TRUE;
const GSList *mac_blacklist, *mac_blacklist_iter;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
connection_type = nm_setting_connection_get_connection_type (s_con);
......@@ -1389,7 +1389,7 @@ real_check_connection_compatible (NMDevice *device,
if (!strcmp (connection_type, NM_SETTING_BOND_SETTING_NAME))
is_bond = TRUE;
s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
s_wired = nm_connection_get_setting_wired (connection);
/* Wired setting is optional for PPPoE */
if (!is_pppoe && !s_wired && !is_bond) {
g_set_error (error,
......@@ -1451,7 +1451,7 @@ real_complete_connection (NMDevice *device,
NMSettingPPPOE *s_pppoe;
const GByteArray *setting_mac;
s_pppoe = (NMSettingPPPOE *) nm_connection_get_setting (connection, NM_TYPE_SETTING_PPPOE);
s_pppoe = nm_connection_get_setting_pppoe (connection);
/* We can't telepathically figure out the service name or username, so if
* those weren't given, we can't complete the connection.
......@@ -1469,7 +1469,7 @@ real_complete_connection (NMDevice *device,
NULL,
s_pppoe ? FALSE : TRUE); /* No IPv6 by default yet for PPPoE */
s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
s_wired = nm_connection_get_setting_wired (connection);
if (!s_wired) {
s_wired = (NMSettingWired *) nm_setting_wired_new ();
nm_connection_add_setting (connection, NM_SETTING (s_wired));
......@@ -1526,7 +1526,7 @@ wired_match_config (NMDevice *self, NMConnection *connection)
const GByteArray *s_ether;
gboolean try_mac = TRUE;
s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
s_wired = nm_connection_get_setting_wired (connection);
if (!s_wired)
return FALSE;
......@@ -1556,7 +1556,7 @@ connection_match_config (NMDevice *self, const GSList *connections)
for (iter = connections; iter; iter = iter->next) {
NMConnection *candidate = NM_CONNECTION (iter->data);
s_con = (NMSettingConnection *) nm_connection_get_setting (candidate, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (candidate);
g_assert (s_con);
if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_WIRED_SETTING_NAME))
continue;
......@@ -1564,8 +1564,8 @@ connection_match_config (NMDevice *self, const GSList *connections)
/* Can't assume 802.1x or PPPoE connections; they have too much state
* that's impossible to get on-the-fly from PPPoE or the supplicant.
*/
if ( nm_connection_get_setting (candidate, NM_TYPE_SETTING_802_1X)
|| nm_connection_get_setting (candidate, NM_TYPE_SETTING_PPPOE))
if ( nm_connection_get_setting_802_1x (candidate)
|| nm_connection_get_setting_pppoe (candidate))
continue;
if (!wired_match_config (self, candidate))
......
......@@ -261,7 +261,7 @@ real_check_connection_compatible (NMDevice *device,
NMSettingConnection *s_con;
NMSettingOlpcMesh *s_mesh;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_OLPC_MESH_SETTING_NAME)) {
......@@ -271,7 +271,7 @@ real_check_connection_compatible (NMDevice *device,
return FALSE;
}
s_mesh = NM_SETTING_OLPC_MESH (nm_connection_get_setting (connection, NM_TYPE_SETTING_OLPC_MESH));
s_mesh = nm_connection_get_setting_olpc_mesh (connection);
if (!s_mesh) {
g_set_error (error,
NM_OLPC_MESH_ERROR, NM_OLPC_MESH_ERROR_CONNECTION_INVALID,
......@@ -294,7 +294,7 @@ real_complete_connection (NMDevice *device,
NMSettingOlpcMesh *s_mesh;
GByteArray *tmp;
s_mesh = (NMSettingOlpcMesh *) nm_connection_get_setting (connection, NM_TYPE_SETTING_OLPC_MESH);
s_mesh = nm_connection_get_setting_olpc_mesh (connection);
if (!s_mesh) {
s_mesh = (NMSettingOlpcMesh *) nm_setting_olpc_mesh_new ();
nm_connection_add_setting (connection, NM_SETTING (s_mesh));
......@@ -439,7 +439,7 @@ real_act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason)
connection = nm_act_request_get_connection (req);
g_assert (connection);
s_mesh = NM_SETTING_OLPC_MESH (nm_connection_get_setting (connection, NM_TYPE_SETTING_OLPC_MESH));
s_mesh = nm_connection_get_setting_olpc_mesh (connection);
g_assert (s_mesh);
channel = nm_setting_olpc_mesh_get_channel (s_mesh);
......
......@@ -975,7 +975,7 @@ real_check_connection_compatible (NMDevice *device,
const GByteArray *mac;
const GSList *mac_blacklist, *mac_blacklist_iter;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_WIRELESS_SETTING_NAME)) {
......@@ -985,7 +985,7 @@ real_check_connection_compatible (NMDevice *device,
return FALSE;
}
s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS));
s_wireless = nm_connection_get_setting_wireless (connection);
if (!s_wireless) {
g_set_error (error,
NM_WIFI_ERROR, NM_WIFI_ERROR_CONNECTION_INVALID,
......@@ -1272,7 +1272,7 @@ real_get_best_auto_connection (NMDevice *dev,
NMSettingIP4Config *s_ip4;
const char *method = NULL;
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
if (s_con == NULL)
continue;
if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_WIRELESS_SETTING_NAME))
......@@ -1280,7 +1280,7 @@ real_get_best_auto_connection (NMDevice *dev,
if (!nm_setting_connection_get_autoconnect (s_con))
continue;
s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
s_wireless = nm_connection_get_setting_wireless (connection);
if (!s_wireless)
continue;
......@@ -1308,7 +1308,7 @@ real_get_best_auto_connection (NMDevice *dev,
continue;
/* Use the connection if it's a shared connection */
s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (s_ip4)
method = nm_setting_ip4_config_get_method (s_ip4);
......@@ -1433,7 +1433,7 @@ scanning_allowed (NMDeviceWifi *self)
/* Don't scan when a shared connection is active; it makes drivers mad */
connection = nm_act_request_get_connection (req);
s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (s_ip4)
ip4_method = nm_setting_ip4_config_get_method (s_ip4);
......@@ -1444,7 +1444,7 @@ scanning_allowed (NMDeviceWifi *self)
* intra-ESS roaming (which requires periodic scanning) isn't being
* used due to the specific AP lock. (bgo #513820)
*/
s_wifi = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
s_wifi = nm_connection_get_setting_wireless (connection);
g_assert (s_wifi);
bssid = nm_setting_wireless_get_bssid (s_wifi);
if (bssid && bssid->len == ETH_ALEN)
......@@ -2347,7 +2347,7 @@ build_supplicant_config (NMDeviceWifi *self,
g_return_val_if_fail (self != NULL, NULL);
s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
s_wireless = nm_connection_get_setting_wireless (connection);
g_return_val_if_fail (s_wireless != NULL, NULL);
config = nm_supplicant_config_new ();
......@@ -2388,13 +2388,13 @@ build_supplicant_config (NMDeviceWifi *self,
goto error;
}
s_wireless_sec = (NMSettingWirelessSecurity *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY);
s_wireless_sec = nm_connection_get_setting_wireless_security (connection);
if (s_wireless_sec) {
NMSetting8021x *s_8021x;
const char *con_path = nm_connection_get_path (connection);
g_assert (con_path);
s_8021x = (NMSetting8021x *) nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X);
s_8021x = nm_connection_get_setting_802_1x (connection);
if (!nm_supplicant_config_add_setting_wireless_security (config,
s_wireless_sec,
s_8021x,
......@@ -2532,7 +2532,7 @@ real_act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
g_return_val_if_fail (connection != NULL, NM_ACT_STAGE_RETURN_FAILURE);
/* Set spoof MAC to the interface */
s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
s_wireless = nm_connection_get_setting_wireless (connection);
g_assert (s_wireless);
cloned_mac = nm_setting_wireless_get_cloned_mac_address (s_wireless);
......@@ -2608,7 +2608,7 @@ real_act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason)
connection = nm_act_request_get_connection (req);
g_assert (connection);
s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
s_wireless = nm_connection_get_setting_wireless (connection);
g_assert (s_wireless);
/* If we need secrets, get them */
......@@ -2791,7 +2791,7 @@ real_act_stage4_ip4_config_timeout (NMDevice *dev, NMDeviceStateReason *reason)
connection = nm_act_request_get_connection (req);
g_assert (connection);
s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (s_ip4)
may_fail = nm_setting_ip4_config_get_may_fail (s_ip4);
......@@ -2816,7 +2816,7 @@ real_act_stage4_ip6_config_timeout (NMDevice *dev, NMDeviceStateReason *reason)
connection = nm_act_request_get_connection (req);
g_assert (connection);
s_ip6 = (NMSettingIP6Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG);
s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (s_ip6)
may_fail = nm_setting_ip6_config_get_may_fail (s_ip6);
......
......@@ -1491,7 +1491,7 @@ dhcp4_start (NMDevice *self,
NMSettingIP4Config *s_ip4;
guint8 *anycast = NULL;
s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (priv->dhcp_anycast_address)
anycast = priv->dhcp_anycast_address->data;
......@@ -3471,7 +3471,7 @@ dispose (GObject *object)
* All IPv6 connections can be left up, so we don't have
* to check that.
*/
s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (s_ip4)
method = nm_setting_ip4_config_get_method (s_ip4);
if ( !method
......
......@@ -541,7 +541,7 @@ nm_auth_uid_in_acl (NMConnection *connection,
g_return_val_if_fail (connection != NULL, FALSE);
g_return_val_if_fail (smon != NULL, FALSE);
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
/* Reject the request if the request comes from no session at all */
......
......@@ -653,11 +653,11 @@ might_be_vpn (NMConnection *connection)
NMSettingConnection *s_con;
const char *ctype = NULL;
if (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN))
if (nm_connection_get_setting_vpn (connection))
return TRUE;
/* Make sure it's not a VPN, which we can't autocomplete yet */
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
if (s_con)
ctype = nm_setting_connection_get_connection_type (s_con);
......@@ -669,7 +669,7 @@ try_complete_vpn (NMConnection *connection, GSList *existing, GError **error)
{
g_assert (might_be_vpn (connection) == TRUE);
if (!nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN)) {
if (!nm_connection_get_setting_vpn (connection)) {
g_set_error_literal (error,