[network-manager-pptp/danw/cleanup-bgo746693: 2/3] all: use nm_connection_get_setting_*()



commit 105763e0de9fafe03b03585a0764a0c222c42a4b
Author: Dan Winship <danw redhat com>
Date:   Tue Nov 25 17:31:59 2014 -0500

    all: use nm_connection_get_setting_*()
    
    The code was still using nm_connection_get_setting(). Use the typesafe
    setting-specific versions instead.

 properties/advanced-dialog.c |    2 +-
 properties/nm-pptp.c         |    4 ++--
 src/nm-pptp-service.c        |    8 ++++----
 3 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/properties/advanced-dialog.c b/properties/advanced-dialog.c
index b26416a..1ff0cd3 100644
--- a/properties/advanced-dialog.c
+++ b/properties/advanced-dialog.c
@@ -94,7 +94,7 @@ advanced_dialog_new_hash_from_connection (NMConnection *connection,
 
        hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
 
-       s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
+       s_vpn = nm_connection_get_setting_vpn (connection);
        nm_setting_vpn_foreach_data_item (s_vpn, copy_values, hash);
        return hash;
 }
diff --git a/properties/nm-pptp.c b/properties/nm-pptp.c
index 58cfa67..580c3a4 100644
--- a/properties/nm-pptp.c
+++ b/properties/nm-pptp.c
@@ -347,7 +347,7 @@ init_plugin_ui (PptpPluginUiWidget *self, NMConnection *connection, GError **err
        GtkWidget *widget;
        const char *value;
 
-       s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
+       s_vpn = nm_connection_get_setting_vpn (connection);
 
        priv->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
@@ -702,7 +702,7 @@ get_suggested_name (NMVpnPluginUiInterface *iface, NMConnection *connection)
 
        g_return_val_if_fail (connection != NULL, 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);
 
        id = nm_setting_connection_get_id (s_con);
diff --git a/src/nm-pptp-service.c b/src/nm-pptp-service.c
index f88532a..28f3313 100644
--- a/src/nm-pptp-service.c
+++ b/src/nm-pptp-service.c
@@ -233,7 +233,7 @@ _service_cache_credentials (NMPptpPppService *self,
        g_return_val_if_fail (self != NULL, FALSE);
        g_return_val_if_fail (connection != NULL, FALSE);
 
-       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_VPN_PLUGIN_ERROR,
@@ -1128,7 +1128,7 @@ real_connect (NMVPNPlugin   *plugin,
        NMSettingVPN *s_vpn;
        const char *gwaddr;
 
-       s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN));
+       s_vpn = nm_connection_get_setting_vpn (connection);
        g_assert (s_vpn);
 
        gwaddr = nm_setting_vpn_get_data_item (s_vpn, NM_PPTP_KEY_GATEWAY);
@@ -1176,13 +1176,13 @@ real_need_secrets (NMVPNPlugin *plugin,
                    char **setting_name,
                    GError **error)
 {
-       NMSetting *s_vpn;
+       NMSettingVPN *s_vpn;
        NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE;
 
        g_return_val_if_fail (NM_IS_VPN_PLUGIN (plugin), FALSE);
        g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
 
-       s_vpn = nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
+       s_vpn = nm_connection_get_setting_vpn (connection);
 
        nm_setting_get_secret_flags (NM_SETTING (s_vpn), NM_PPTP_KEY_PASSWORD, &flags, NULL);
 


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