From df921e74c51b787cc97cfd8d62ec7ae4009bd6f5 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 7 Nov 2007 18:22:04 +0000 Subject: [PATCH] 2007-11-07 Dan Williams * auth-dialog/main.c properties/nm-vpnc.c src/nm-vpnc-service.c - Fix for new NMSetting API changes git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3071 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- vpn-daemons/vpnc/ChangeLog | 7 +++++++ vpn-daemons/vpnc/auth-dialog/main.c | 9 ++++++--- vpn-daemons/vpnc/properties/nm-vpnc.c | 24 ++++++++++++++---------- vpn-daemons/vpnc/src/nm-vpnc-service.c | 12 +++++++----- 4 files changed, 34 insertions(+), 18 deletions(-) diff --git a/vpn-daemons/vpnc/ChangeLog b/vpn-daemons/vpnc/ChangeLog index 505a17f1e0..080c793bff 100644 --- a/vpn-daemons/vpnc/ChangeLog +++ b/vpn-daemons/vpnc/ChangeLog @@ -1,3 +1,10 @@ +2007-11-07 Dan Williams + + * auth-dialog/main.c + properties/nm-vpnc.c + src/nm-vpnc-service.c + - Fix for new NMSetting API changes + 2007-10-26 Dan Williams * properties/nm-vpnc.c diff --git a/vpn-daemons/vpnc/auth-dialog/main.c b/vpn-daemons/vpnc/auth-dialog/main.c index 754e4cdc0e..f6ddbe6765 100644 --- a/vpn-daemons/vpnc/auth-dialog/main.c +++ b/vpn-daemons/vpnc/auth-dialog/main.c @@ -29,6 +29,9 @@ #include #include +#include +#include + #include "../src/nm-vpnc-service.h" #include "gnome-two-password-dialog.h" @@ -50,7 +53,7 @@ find_one_password (const char *vpn_name, vpn_name, "setting-name", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING, - NM_SETTING_VPN_PROPERTIES, + NM_SETTING_VPN_PROPERTIES_SETTING_NAME, "setting-key", GNOME_KEYRING_ATTRIBUTE_TYPE_STRING, secret_name, @@ -106,7 +109,7 @@ save_vpn_password (const char *vpn_name, GnomeKeyringAttributeList *attrs = NULL; guint32 id = 0; - display_name = g_strdup_printf ("VPN %s secret for %s/%s/" NM_SETTING_VPN_PROPERTIES, + display_name = g_strdup_printf ("VPN %s secret for %s/%s/" NM_SETTING_VPN_PROPERTIES_SETTING_NAME, secret_name, vpn_name, vpn_service); @@ -117,7 +120,7 @@ save_vpn_password (const char *vpn_name, vpn_name); gnome_keyring_attribute_list_append_string (attrs, "setting-name", - NM_SETTING_VPN_PROPERTIES); + NM_SETTING_VPN_PROPERTIES_SETTING_NAME); gnome_keyring_attribute_list_append_string (attrs, "setting-key", secret_name); diff --git a/vpn-daemons/vpnc/properties/nm-vpnc.c b/vpn-daemons/vpnc/properties/nm-vpnc.c index 01a0a4f1e2..5038cf27d3 100644 --- a/vpn-daemons/vpnc/properties/nm-vpnc.c +++ b/vpn-daemons/vpnc/properties/nm-vpnc.c @@ -34,6 +34,10 @@ #define NM_VPN_API_SUBJECT_TO_CHANGE #include +#include +#include +#include + #include "../src/nm-vpnc-service.h" #include "pcf-file.h" @@ -177,13 +181,13 @@ impl_fill_connection (NetworkManagerVpnUI *self, NMConnection *connection) g_return_if_fail (NM_IS_CONNECTION (connection)); - s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_SETTING_CONNECTION); + s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); g_assert (s_con); - s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_SETTING_VPN); + s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN)); g_assert (s_vpn); - s_vpn_props = (NMSettingVPNProperties *) nm_connection_get_setting (connection, NM_SETTING_VPN_PROPERTIES); + s_vpn_props = NM_SETTING_VPN_PROPERTIES (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN_PROPERTIES)); g_assert (s_vpn_props); /* Connection name */ @@ -272,15 +276,15 @@ impl_get_widget (NetworkManagerVpnUI *self, NMConnection *connection) goto out; /* Populate UI bits from the NMConnection */ - s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_SETTING_CONNECTION); + s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); g_assert (s_con); g_assert (s_con->name); gtk_entry_set_text (impl->w_connection_name, s_con->name); - s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_SETTING_VPN); + s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN)); g_assert (s_vpn); - s_vpn_props = (NMSettingVPNProperties *) nm_connection_get_setting (connection, NM_SETTING_VPN_PROPERTIES); + s_vpn_props = NM_SETTING_VPN_PROPERTIES (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN_PROPERTIES)); g_assert (s_vpn_props); if (s_vpn_props->data) @@ -751,13 +755,13 @@ export_to_file (NetworkManagerVpnUIImpl *impl, char *routes_str = NULL; gboolean ret = TRUE; - s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_SETTING_CONNECTION); + s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); g_assert (s_con); - s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_SETTING_VPN); + s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN)); g_assert (s_vpn); - s_vpn_props = (NMSettingVPNProperties *) nm_connection_get_setting (connection, NM_SETTING_VPN_PROPERTIES); + s_vpn_props = NM_SETTING_VPN_PROPERTIES (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN_PROPERTIES)); g_assert (s_vpn_props); val = (GValue *) g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_GATEWAY); @@ -888,7 +892,7 @@ impl_export (NetworkManagerVpnUI *self, NMConnection *connection) GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL); - s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_SETTING_CONNECTION); + s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION)); g_assert (s_con); g_assert (s_con->name); diff --git a/vpn-daemons/vpnc/src/nm-vpnc-service.c b/vpn-daemons/vpnc/src/nm-vpnc-service.c index 779c4dac8a..29bd5d4109 100644 --- a/vpn-daemons/vpnc/src/nm-vpnc-service.c +++ b/vpn-daemons/vpnc/src/nm-vpnc-service.c @@ -9,6 +9,8 @@ #include #include +#include +#include #include "nm-vpnc-service.h" #include "nm-utils.h" @@ -269,7 +271,7 @@ real_connect (NMVPNPlugin *plugin, NMSettingVPNProperties *properties; gint vpnc_fd; - properties = (NMSettingVPNProperties *) nm_connection_get_setting (connection, NM_SETTING_VPN_PROPERTIES); + properties = NM_SETTING_VPN_PROPERTIES (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN_PROPERTIES)); if (!properties || !nm_vpnc_properties_validate (properties->data)) { g_set_error (err, NM_VPN_PLUGIN_ERROR, @@ -279,7 +281,7 @@ real_connect (NMVPNPlugin *plugin, return FALSE; } - s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_SETTING_VPN); + s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN)); g_assert (s_vpn); if ((vpnc_fd = nm_vpnc_start_vpnc_binary (NM_VPNC_PLUGIN (plugin))) >= 0) @@ -309,7 +311,7 @@ real_need_secrets (NMVPNPlugin *plugin, g_return_val_if_fail (NM_IS_VPN_PLUGIN (plugin), FALSE); g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE); - s_vpn_props = (NMSettingVPNProperties *) nm_connection_get_setting (connection, NM_SETTING_VPN_PROPERTIES); + s_vpn_props = NM_SETTING_VPN_PROPERTIES (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN_PROPERTIES)); if (!s_vpn_props) { g_set_error (error, NM_VPN_PLUGIN_ERROR, @@ -322,11 +324,11 @@ real_need_secrets (NMVPNPlugin *plugin, // FIXME: there are some configurations where both passwords are not // required. Make sure they work somehow. if (!g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_SECRET)) { - *setting_name = NM_SETTING_VPN_PROPERTIES; + *setting_name = NM_SETTING_VPN_PROPERTIES_SETTING_NAME; return TRUE; } if (!g_hash_table_lookup (s_vpn_props->data, NM_VPNC_KEY_XAUTH_PASSWORD)) { - *setting_name = NM_SETTING_VPN_PROPERTIES; + *setting_name = NM_SETTING_VPN_PROPERTIES_SETTING_NAME; return TRUE; }