Commit 32bcd021 authored by Dan Winship's avatar Dan Winship
Browse files

Use the new typed nm_connection_get_setting_*() methods

parent f8f65ff1
......@@ -263,7 +263,7 @@ is_connection_always_ask (NMConnection *connection)
/* For the given connection type, check if the secrets for that connection
* are always-ask or not.
*/
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
ctype = nm_setting_connection_get_connection_type (s_con);
......@@ -765,7 +765,7 @@ delete_secrets (NMSecretAgent *agent,
r = request_new (agent, connection, connection_path, NULL, NULL, FALSE, NULL, NULL, callback, callback_data);
g_hash_table_insert (priv->requests, GUINT_TO_POINTER (r->id), r);
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
uuid = nm_setting_connection_get_uuid (s_con);
g_assert (uuid);
......
......@@ -194,7 +194,7 @@ bt_device_state_changed (NMDevice *device,
connection = applet_find_active_connection_for_device (device, applet, NULL);
if (connection) {
const char *id;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
id = s_con ? nm_setting_connection_get_id (s_con) : NULL;
if (id)
str = g_strdup_printf (_("You are now connected to '%s'."), id);
......@@ -222,7 +222,7 @@ bt_get_icon (NMDevice *device,
id = nm_device_get_iface (NM_DEVICE (device));
if (connection) {
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
id = nm_setting_connection_get_id (s_con);
}
......
......@@ -357,7 +357,7 @@ cdma_add_menu_item (NMDevice *device,
if (active) {
NMSettingConnection *s_con;
s_con = (NMSettingConnection *) nm_connection_get_setting (active, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (active);
g_assert (s_con);
item = nm_mb_menu_item_new (nm_setting_connection_get_id (s_con),
......@@ -435,7 +435,7 @@ cdma_device_state_changed (NMDevice *device,
if (connection) {
const char *id;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
id = s_con ? nm_setting_connection_get_id (s_con) : NULL;
if (id)
str = g_strdup_printf (_("You are now connected to '%s'."), id);
......@@ -472,7 +472,7 @@ cdma_get_icon (NMDevice *device,
id = nm_device_get_iface (NM_DEVICE (device));
if (connection) {
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
id = nm_setting_connection_get_id (s_con);
}
......@@ -540,11 +540,11 @@ get_cdma_secrets_cb (GtkDialog *dialog,
{
SecretsRequest *req = user_data;
NMCdmaSecretsInfo *info = (NMCdmaSecretsInfo *) req;
NMSetting *setting;
NMSettingCdma *setting;
GError *error = NULL;
if (response == GTK_RESPONSE_OK) {
setting = nm_connection_get_setting (req->connection, NM_TYPE_SETTING_CDMA);
setting = nm_connection_get_setting_cdma (req->connection);
if (setting) {
g_object_set (G_OBJECT (setting),
info->secret_name, gtk_entry_get_text (info->secret_entry),
......
......@@ -404,7 +404,7 @@ gsm_add_menu_item (NMDevice *device,
if (active) {
NMSettingConnection *s_con;
s_con = (NMSettingConnection *) nm_connection_get_setting (active, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (active);
g_assert (s_con);
item = nm_mb_menu_item_new (nm_setting_connection_get_id (s_con),
......@@ -482,7 +482,7 @@ gsm_device_state_changed (NMDevice *device,
if (connection) {
const char *id;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
id = s_con ? nm_setting_connection_get_id (s_con) : NULL;
if (id)
str = g_strdup_printf (_("You are now connected to '%s'."), id);
......@@ -519,7 +519,7 @@ gsm_get_icon (NMDevice *device,
id = nm_device_get_iface (NM_DEVICE (device));
if (connection) {
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
id = nm_setting_connection_get_id (s_con);
}
......@@ -589,11 +589,11 @@ get_gsm_secrets_cb (GtkDialog *dialog,
{
SecretsRequest *req = user_data;
NMGsmSecretsInfo *info = (NMGsmSecretsInfo *) req;
NMSetting *setting;
NMSettingGsm *setting;
GError *error = NULL;
if (response == GTK_RESPONSE_OK) {
setting = nm_connection_get_setting (req->connection, NM_TYPE_SETTING_GSM);
setting = nm_connection_get_setting_gsm (req->connection);
if (setting) {
g_object_set (G_OBJECT (setting),
info->secret_name, gtk_entry_get_text (info->secret_entry),
......
......@@ -602,7 +602,7 @@ create_new_ap_item (NMDeviceWifi *device,
NMSettingConnection *s_con;
GtkWidget *subitem;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
subitem = gtk_menu_item_new_with_label (nm_setting_connection_get_id (s_con));
info = g_slice_new0 (WirelessMenuItemInfo);
......@@ -943,7 +943,7 @@ notify_active_ap_changed_cb (NMDeviceWifi *device,
if (!connection)
return;
s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (NM_CONNECTION (connection), NM_TYPE_SETTING_WIRELESS));
s_wireless = nm_connection_get_setting_wireless (NM_CONNECTION (connection));
if (!s_wireless)
return;
......@@ -1055,7 +1055,7 @@ idle_check_avail_access_point_notification (gpointer datap)
NMConnection *connection = NM_CONNECTION (iter->data);
NMSettingConnection *s_con;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
if (nm_setting_connection_get_autoconnect (s_con)) {
is_autoconnect = TRUE;
break;
......@@ -1299,7 +1299,7 @@ wireless_get_icon (NMDevice *device,
id = nm_device_get_iface (device);
if (connection) {
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
id = nm_setting_connection_get_id (s_con);
}
......@@ -1469,7 +1469,7 @@ wireless_dialog_response_cb (GtkDialog *foo,
/* Entirely new connection */
/* Don't autoconnect adhoc networks by default for now */
s_wifi = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
s_wifi = nm_connection_get_setting_wireless (connection);
if (s_wifi)
mode = nm_setting_wireless_get_mode (s_wifi);
if (g_strcmp0 (mode, "adhoc") == 0) {
......@@ -1596,7 +1596,7 @@ get_secrets_dialog_response_cb (GtkDialog *foo,
}
/* Second-guess which setting NM wants secrets for. */
s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY));
s_wireless_sec = nm_connection_get_setting_wireless_security (connection);
if (!s_wireless_sec) {
g_set_error (&error,
NM_SECRET_AGENT_ERROR,
......@@ -1634,7 +1634,7 @@ get_secrets_dialog_response_cb (GtkDialog *foo,
if (!auth_alg || strcmp (auth_alg, "leap")) {
NMSetting8021x *s_8021x;
s_8021x = (NMSetting8021x *) nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X);
s_8021x = nm_connection_get_setting_802_1x (connection);
if (!s_8021x) {
g_set_error (&error,
NM_SECRET_AGENT_ERROR,
......
......@@ -179,7 +179,7 @@ get_connection_for_nsp (GSList *connections, NMWimaxNsp *nsp)
NMConnection *candidate = NM_CONNECTION (iter->data);
NMSettingWimax *s_wimax;
s_wimax = (NMSettingWimax *) nm_connection_get_setting (candidate, NM_TYPE_SETTING_WIMAX);
s_wimax = nm_connection_get_setting_wimax (candidate);
if (s_wimax) {
candidate_name = nm_setting_wimax_get_network_name (s_wimax);
if (g_strcmp0 (nsp_name, candidate_name) == 0)
......@@ -363,7 +363,7 @@ active_nsp_changed_cb (NMDeviceWimax *device,
if (!connection)
return;
s_wimax = (NMSettingWimax *) nm_connection_get_setting (NM_CONNECTION (connection), NM_TYPE_SETTING_WIMAX);
s_wimax = nm_connection_get_setting_wimax (NM_CONNECTION (connection));
if (!s_wimax)
return;
......@@ -417,7 +417,7 @@ wimax_device_state_changed (NMDevice *device,
if (connection) {
const char *id;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
id = s_con ? nm_setting_connection_get_id (s_con) : NULL;
if (id)
str = g_strdup_printf (_("You are now connected to '%s'."), id);
......@@ -449,7 +449,7 @@ wimax_get_icon (NMDevice *device,
id = nm_device_get_iface (NM_DEVICE (device));
if (connection) {
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
id = nm_setting_connection_get_id (s_con);
}
......
......@@ -263,7 +263,7 @@ wired_device_state_changed (NMDevice *device,
connection = applet_find_active_connection_for_device (device, applet, NULL);
if (connection) {
const char *id;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
id = s_con ? nm_setting_connection_get_id (s_con) : NULL;
if (id)
str = g_strdup_printf (_("You are now connected to '%s'."), id);
......@@ -291,7 +291,7 @@ wired_get_icon (NMDevice *device,
id = nm_device_get_iface (NM_DEVICE (device));
if (connection) {
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
id = nm_setting_connection_get_id (s_con);
}
......@@ -376,7 +376,7 @@ pppoe_update_ui (NMConnection *connection, NMPppoeInfo *info)
g_return_if_fail (NM_IS_CONNECTION (connection));
g_return_if_fail (info != NULL);
s_pppoe = (NMSettingPPPOE *) nm_connection_get_setting (connection, NM_TYPE_SETTING_PPPOE);
s_pppoe = nm_connection_get_setting_pppoe (connection);
g_return_if_fail (s_pppoe != NULL);
s = nm_setting_pppoe_get_username (s_pppoe);
......@@ -408,7 +408,7 @@ get_pppoe_secrets_cb (GtkDialog *dialog, gint response, gpointer user_data)
{
SecretsRequest *req = user_data;
NMPppoeInfo *info = (NMPppoeInfo *) req;
NMSetting *setting;
NMSettingPPPOE *setting;
GHashTable *settings = NULL;
GHashTable *secrets;
GError *error = NULL;
......@@ -422,10 +422,10 @@ get_pppoe_secrets_cb (GtkDialog *dialog, gint response, gpointer user_data)
goto done;
}
setting = nm_connection_get_setting (req->connection, NM_TYPE_SETTING_PPPOE);
pppoe_update_setting (NM_SETTING_PPPOE (setting), info);
setting = nm_connection_get_setting_pppoe (req->connection);
pppoe_update_setting (setting, info);
secrets = nm_setting_to_hash (setting, NM_SETTING_HASH_FLAG_ONLY_SECRETS);
secrets = nm_setting_to_hash (NM_SETTING (setting), NM_SETTING_HASH_FLAG_ONLY_SECRETS);
if (!secrets) {
g_set_error (&error,
NM_SECRET_AGENT_ERROR,
......@@ -612,7 +612,7 @@ wired_get_secrets (SecretsRequest *req, GError **error)
NMSettingConnection *s_con;
const char *ctype;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (req->connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (req->connection);
if (!s_con) {
g_set_error (error,
NM_SECRET_AGENT_ERROR,
......
......@@ -221,7 +221,7 @@ create_info_label_security (NMConnection *connection)
GtkWidget *w = NULL;
const char *connection_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);
connection_type = nm_setting_connection_get_connection_type (s_con);
......@@ -231,10 +231,9 @@ create_info_label_security (NMConnection *connection)
NMSetting8021x *s_8021x;
const char *security;
s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS));
s_wireless_sec = (NMSettingWirelessSecurity *) nm_connection_get_setting (connection,
NM_TYPE_SETTING_WIRELESS_SECURITY);
s_8021x = (NMSetting8021x *) nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X);
s_wireless = nm_connection_get_setting_wireless (connection);
s_wireless_sec = nm_connection_get_setting_wireless_security (connection);
s_8021x = nm_connection_get_setting_802_1x (connection);
security = s_wireless ? nm_setting_wireless_get_security (s_wireless) : NULL;
if (security && !strcmp (security, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME) && s_wireless_sec) {
......@@ -254,7 +253,7 @@ create_info_label_security (NMConnection *connection)
} else if (!strcmp (connection_type, NM_SETTING_WIRED_SETTING_NAME)) {
NMSetting8021x *s_8021x;
s_8021x = (NMSetting8021x *) nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X);
s_8021x = nm_connection_get_setting_802_1x (connection);
if (s_8021x)
label = get_eap_label (NULL, s_8021x);
else
......@@ -636,7 +635,7 @@ info_dialog_add_page (GtkNotebook *notebook,
0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
row++;
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)
method = nm_setting_ip6_config_get_method (s_ip6);
......@@ -988,7 +987,7 @@ applet_mobile_password_dialog_new (NMConnection *connection,
w = gtk_dialog_add_button (dialog, GTK_STOCK_OK, GTK_RESPONSE_OK);
gtk_window_set_default (GTK_WINDOW (dialog), w);
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
id = nm_setting_connection_get_id (s_con);
g_assert (id);
tmp = g_strdup_printf (_("A password is required to connect to '%s'."), id);
......
......@@ -306,7 +306,7 @@ write_connection_to_child (int fd, NMConnection *connection, GError **error)
NMSettingVPN *s_vpn;
WriteItemInfo info = { .fd = fd, .secret = FALSE, .error = error };
s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
s_vpn = nm_connection_get_setting_vpn (connection);
if (!s_vpn) {
g_set_error_literal (error,
NM_SECRET_AGENT_ERROR,
......@@ -354,14 +354,14 @@ applet_vpn_request_get_secrets (SecretsRequest *req, GError **error)
applet_secrets_request_set_free_func (req, free_vpn_secrets_info);
s_con = (NMSettingConnection *) nm_connection_get_setting (req->connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (req->connection);
g_return_val_if_fail (s_con != NULL, FALSE);
connection_type = nm_setting_connection_get_connection_type (s_con);
g_return_val_if_fail (connection_type != NULL, FALSE);
g_return_val_if_fail (strcmp (connection_type, NM_SETTING_VPN_SETTING_NAME) == 0, FALSE);
s_vpn = NM_SETTING_VPN (nm_connection_get_setting (req->connection, NM_TYPE_SETTING_VPN));
s_vpn = nm_connection_get_setting_vpn (req->connection);
g_return_val_if_fail (s_vpn != NULL, FALSE);
service_type = nm_setting_vpn_get_service_type (s_vpn);
......
......@@ -434,7 +434,7 @@ get_device_class_from_connection (NMConnection *connection, NMApplet *applet)
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (applet != NULL, 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);
ctype = nm_setting_connection_get_connection_type (s_con);
......@@ -647,7 +647,7 @@ applet_new_menu_item_helper (NMConnection *connection,
char *markup;
GtkWidget *label;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
item = gtk_image_menu_item_new_with_label ("");
if (add_active && (active == connection)) {
/* Pure evil */
......@@ -988,7 +988,7 @@ make_vpn_failure_message (NMVPNConnection *vpn,
g_return_val_if_fail (vpn != NULL, NULL);
connection = applet_get_connection_for_active (applet, NM_ACTIVE_CONNECTION (vpn));
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
switch (reason) {
case NM_VPN_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED:
......@@ -1034,7 +1034,7 @@ make_vpn_disconnection_message (NMVPNConnection *vpn,
g_return_val_if_fail (vpn != NULL, NULL);
connection = applet_get_connection_for_active (applet, NM_ACTIVE_CONNECTION (vpn));
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
switch (reason) {
case NM_VPN_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED:
......@@ -1122,7 +1122,7 @@ get_connection_id (NMConnection *connection)
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
s_con = NM_SETTING_CONNECTION (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);
......@@ -1197,7 +1197,7 @@ nma_menu_vpn_item_clicked (GtkMenuItem *item, gpointer user_data)
/* Connection already active; do nothing */
return;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
info = g_malloc0 (sizeof (VPNActivateInfo));
info->applet = applet;
info->vpn_name = g_strdup (nm_setting_connection_get_id (s_con));
......@@ -1250,7 +1250,7 @@ applet_get_first_active_vpn_connection (NMApplet *applet,
if (!connection)
continue;
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_VPN_SETTING_NAME)) {
......@@ -1618,12 +1618,12 @@ get_vpn_connections (NMApplet *applet)
NMConnection *connection = NM_CONNECTION (iter->data);
NMSettingConnection *s_con;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_VPN_SETTING_NAME))
/* Not a VPN connection */
continue;
if (!nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN)) {
if (!nm_connection_get_setting_vpn (connection)) {
g_warning ("%s: VPN connection '%s' didn't have required vpn setting.", __func__,
nm_setting_connection_get_id (s_con));
continue;
......@@ -2468,7 +2468,7 @@ get_tip_for_device_state (NMDevice *device,
id = nm_device_get_iface (device);
if (connection) {
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
id = nm_setting_connection_get_id (s_con);
}
......@@ -2549,7 +2549,7 @@ get_tip_for_vpn (NMActiveConnection *active, NMVPNConnectionState state, NMApple
NMSettingConnection *s_con;
if (!strcmp (nm_connection_get_path (candidate), path)) {
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (candidate, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (candidate);
id = nm_setting_connection_get_id (s_con);
break;
}
......@@ -2832,7 +2832,7 @@ applet_agent_get_secrets_cb (AppletAgent *agent,
GError *error = NULL;
SecretsRequest *req = NULL;
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
g_return_if_fail (s_con != NULL);
/* VPN secrets get handled a bit differently */
......
......@@ -93,7 +93,7 @@ nm_connection_editor_update_title (NMConnectionEditor *editor)
g_return_if_fail (editor != NULL);
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (editor->connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (editor->connection);
g_assert (s_con);
id = nm_setting_connection_get_id (s_con);
......@@ -154,7 +154,7 @@ update_sensitivity (NMConnectionEditor *editor)
GtkWidget *widget;
GSList *iter;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (editor->connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (editor->connection);
/* Can't modify read-only connections; can't modify anything before the
* editor is initialized either.
......@@ -205,7 +205,7 @@ connection_editor_validate (NMConnectionEditor *editor)
if (!editor_is_initialized (editor))
goto done;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (editor->connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (editor->connection);
g_assert (s_con);
if (nm_setting_connection_get_read_only (s_con))
goto done;
......@@ -504,7 +504,7 @@ populate_connection_ui (NMConnectionEditor *editor)
name = GTK_WIDGET (gtk_builder_get_object (editor->builder, "connection_name"));
autoconnect = GTK_WIDGET (gtk_builder_get_object (editor->builder, "connection_autoconnect"));
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (editor->connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (editor->connection);
if (s_con) {
const char *id = nm_setting_connection_get_id (s_con);
......@@ -722,7 +722,7 @@ nm_connection_editor_set_connection (NMConnectionEditor *editor,
editor->orig_connection = g_object_ref (orig_connection);
nm_connection_editor_update_title (editor);
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (editor->connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (editor->connection);
g_assert (s_con);
connection_type = nm_setting_connection_get_connection_type (s_con);
......
......@@ -157,7 +157,7 @@ get_model_for_connection (NMConnectionList *list, NMRemoteConnection *connection
GtkTreeModel *model;
const char *str_type;
s_con = (NMSettingConnection *) nm_connection_get_setting (NM_CONNECTION (connection), NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (NM_CONNECTION (connection));
g_assert (s_con);
str_type = nm_setting_connection_get_connection_type (s_con);
......@@ -285,7 +285,7 @@ update_connection_row (GtkListStore *store,
NMSettingConnection *s_con;
char *last_used;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (NM_CONNECTION (connection), NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (NM_CONNECTION (connection));
g_assert (s_con);
last_used = format_last_used (nm_setting_connection_get_timestamp (s_con));
......@@ -784,7 +784,7 @@ delete_clicked (GtkButton *button, gpointer user_data)
return;
}
s_con = (NMSettingConnection *) nm_connection_get_setting (NM_CONNECTION (connection), NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (NM_CONNECTION (connection));
g_assert (s_con);
id = nm_setting_connection_get_id (s_con);
......@@ -824,8 +824,7 @@ pk_button_selection_changed_cb (GtkTreeSelection *selection, gpointer user_data)
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
connection = get_active_connection (info->treeview);
if (connection) {
s_con = (NMSettingConnection *) nm_connection_get_setting (NM_CONNECTION (connection),
NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (NM_CONNECTION (connection));
g_assert (s_con);
sensitive = !nm_setting_connection_get_read_only (s_con);
......@@ -855,7 +854,7 @@ vpn_list_selection_changed_cb (GtkTreeSelection *selection, gpointer user_data)
if (!connection)
goto done;
s_vpn = NM_SETTING_VPN (nm_connection_get_setting (NM_CONNECTION (connection), NM_TYPE_SETTING_VPN));
s_vpn = nm_connection_get_setting_vpn (NM_CONNECTION (connection));
service_type = s_vpn ? nm_setting_vpn_get_service_type (s_vpn) : NULL;
if (!service_type)
......@@ -886,7 +885,7 @@ import_success_cb (NMConnection *connection, gpointer user_data)
const char *message = _("The connection editor dialog could not be initialized due to an unknown error.");
/* Basic sanity checks of the connection */
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (connection);
if (!s_con) {
s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ());
nm_connection_add_setting (connection, NM_SETTING (s_con));
......@@ -915,7 +914,7 @@ import_success_cb (NMConnection *connection, gpointer user_data)
g_free (s);
}
s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN));
s_vpn = nm_connection_get_setting_vpn (connection);
service_type = s_vpn ? nm_setting_vpn_get_service_type (s_vpn) : NULL;
if (!service_type || !strlen (service_type)) {
......@@ -1414,7 +1413,7 @@ connection_added (NMRemoteSettings *settings,
if (!store)
return;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (NM_CONNECTION (connection), NM_TYPE_SETTING_CONNECTION));
s_con = nm_connection_get_setting_connection (NM_CONNECTION (connection));
last_used = format_last_used (nm_setting_connection_get_timestamp (s_con));
......@@ -1621,7 +1620,7 @@ connections_read (NMRemoteSettings *settings, EditData *data)
const char *type;
ActionInfo *info;
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
s_con = nm_connection_get_setting_connection (connection);
type = nm_setting_connection_get_connection_type (s_con);
info = find_action_info (data->self, nm_connection_lookup_setting_type (type), "edit");
if (info != NULL)
......
......@@ -145,7 +145,7 @@ ce_page_dsl_new (NMConnection *connection,
dsl_private_init (self);
priv = CE_PAGE_DSL_GET_PRIVATE (self);
priv->setting = (NMSettingPPPOE *) nm_connection_get_setting (connection, NM_TYPE_SETTING_PPPOE);
priv->setting = nm_connection_get_setting_pppoe (connection);
if (!priv->setting) {
priv->setting = NM_SETTING_PPPOE (nm_setting_pppoe_new ());
nm_connection_add_setting (connection, NM_SETTING (priv->setting));
......@@ -195,7 +195,7 @@ validate (CEPage *page, NMConnection *connection, GError **error)
ui_to_setting (self);
foo = g_slist_append (NULL, nm_connection_get_setting (connection, NM_TYPE_SETTING_PPP));
foo = g_slist_append (NULL, nm_connection_get_setting_ppp (connection));
valid = nm_setting_verify (NM_SETTING (priv->setting), foo, error);
g_slist_free (foo);
......
......@@ -122,7 +122,7 @@ ip4_private_init (CEPageIP4 *self, NMConnection *connection)
builder = CE_PAGE (self)->builder;
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);