network-manager-applet r988 - in trunk: . src src/connection-editor src/gconf-helpers
- From: tambeti svn gnome org
- To: svn-commits-list gnome org
- Subject: network-manager-applet r988 - in trunk: . src src/connection-editor src/gconf-helpers
- Date: Wed, 29 Oct 2008 09:16:54 +0000 (UTC)
Author: tambeti
Date: Wed Oct 29 09:16:54 2008
New Revision: 988
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=988&view=rev
Log:
2008-10-29 Tambet Ingo <tambet gmail com>
* src/connection-editor/nm-connection-list.c
src/connection-editor/page-vpn.c
src/connection-editor/vpn-helpers.c
src/gconf-helpers/gconf-upgrade.c
src/gconf-helpers/nma-gconf-connection.c
src/vpn-password-dialog.c
- Use VPN setting accessors.
Modified:
trunk/ChangeLog
trunk/src/connection-editor/nm-connection-list.c
trunk/src/connection-editor/page-vpn.c
trunk/src/connection-editor/vpn-helpers.c
trunk/src/gconf-helpers/gconf-upgrade.c
trunk/src/gconf-helpers/nma-gconf-connection.c
trunk/src/vpn-password-dialog.c
Modified: trunk/src/connection-editor/nm-connection-list.c
==============================================================================
--- trunk/src/connection-editor/nm-connection-list.c (original)
+++ trunk/src/connection-editor/nm-connection-list.c Wed Oct 29 09:16:54 2008
@@ -419,7 +419,7 @@
if (!strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_VPN_SETTING_NAME)) {
s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
if (s_vpn) {
- plugin = vpn_get_plugin_by_service (s_vpn->service_type);
+ plugin = vpn_get_plugin_by_service (nm_setting_vpn_get_service_type (s_vpn));
if (plugin)
if (!nm_vpn_plugin_ui_interface_delete_connection (plugin, connection, &error)) {
g_warning ("%s: couldn't clean up VPN connection on delete: (%d) %s",
@@ -885,7 +885,8 @@
type_setting = nm_setting_vpn_new ();
s_vpn = NM_SETTING_VPN (type_setting);
- s_vpn->service_type = service;
+ g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, service, NULL);
+ g_free (service);
}
} else if (ctype == NM_TYPE_SETTING_PPPOE) {
id = get_next_available_name (list, _("DSL connection %d"));
@@ -1135,6 +1136,7 @@
NMExportedConnection *exported;
NMConnection *connection = NULL;
NMSettingVPN *s_vpn;
+ const char *service_type;
GtkTreeIter iter;
GtkTreeModel *model;
guint32 caps;
@@ -1150,10 +1152,12 @@
goto done;
s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN));
- if (!s_vpn || !s_vpn->service_type)
+ service_type = s_vpn ? nm_setting_vpn_get_service_type (s_vpn) : NULL;
+
+ if (!service_type)
goto done;
- plugin = vpn_get_plugin_by_service (s_vpn->service_type);
+ plugin = vpn_get_plugin_by_service (service_type);
if (!plugin)
goto done;
@@ -1172,6 +1176,7 @@
NMConnectionEditor *editor;
NMSettingConnection *s_con;
NMSettingVPN *s_vpn;
+ const char *service_type;
char *s;
/* Basic sanity checks of the connection */
@@ -1200,7 +1205,9 @@
}
s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN));
- if (!s_vpn || !s_vpn->service_type || !strlen (s_vpn->service_type)) {
+ service_type = s_vpn ? nm_setting_vpn_get_service_type (s_vpn) : NULL;
+
+ if (!service_type || !strlen (service_type)) {
GtkWidget *dialog;
dialog = gtk_message_dialog_new (NULL,
Modified: trunk/src/connection-editor/page-vpn.c
==============================================================================
--- trunk/src/connection-editor/page-vpn.c (original)
+++ trunk/src/connection-editor/page-vpn.c Wed Oct 29 09:16:54 2008
@@ -61,6 +61,7 @@
CEPage *parent;
GError *error = NULL;
NMVpnPluginUiInterface *plugin;
+ const char *service_type;
self = CE_PAGE_VPN (g_object_new (CE_TYPE_PAGE_VPN, NULL));
parent = CE_PAGE (self);
@@ -70,12 +71,14 @@
priv->setting = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
g_assert (priv->setting);
- g_assert (priv->setting->service_type);
- plugin = vpn_get_plugin_by_service (priv->setting->service_type);
+ service_type = nm_setting_vpn_get_service_type (priv->setting);
+ g_assert (service_type);
+
+ plugin = vpn_get_plugin_by_service (service_type);
if (!plugin) {
g_warning ("%s: couldn't find VPN plugin for service '%s'!",
- __func__, priv->setting->service_type);
+ __func__, service_type);
g_object_unref (self);
return NULL;
}
@@ -83,7 +86,7 @@
priv->ui = nm_vpn_plugin_ui_interface_ui_factory (plugin, connection, &error);
if (!priv->ui) {
g_warning ("%s: couldn't create VPN UI for service '%s': %s",
- __func__, priv->setting->service_type, error->message);
+ __func__, service_type, error->message);
g_error_free (error);
g_object_unref (self);
return NULL;
Modified: trunk/src/connection-editor/vpn-helpers.c
==============================================================================
--- trunk/src/connection-editor/vpn-helpers.c (original)
+++ trunk/src/connection-editor/vpn-helpers.c Wed Oct 29 09:16:54 2008
@@ -283,6 +283,7 @@
NMVpnPluginUiInterface *plugin;
NMSettingConnection *s_con = NULL;
NMSettingVPN *s_vpn = NULL;
+ const char *service_type;
const char *id = NULL;
gboolean success = FALSE;
@@ -325,12 +326,14 @@
}
s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN));
- if (!s_vpn || !s_vpn->service_type) {
+ service_type = s_vpn ? nm_setting_vpn_get_service_type (s_vpn) : NULL;
+
+ if (service_type) {
g_set_error (&error, 0, 0, "VPN setting invalid");
goto done;
}
- plugin = vpn_get_plugin_by_service (s_vpn->service_type);
+ plugin = vpn_get_plugin_by_service (service_type);
if (plugin)
success = nm_vpn_plugin_ui_interface_export (plugin, filename, connection, &error);
@@ -369,9 +372,12 @@
GtkWidget *dialog;
NMVpnPluginUiInterface *plugin;
NMSettingVPN *s_vpn = NULL;
+ const char *service_type;
s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN));
- if (!s_vpn || !s_vpn->service_type) {
+ service_type = s_vpn ? nm_setting_vpn_get_service_type (s_vpn) : NULL;
+
+ if (!service_type) {
g_warning ("%s: invalid VPN connection!", __func__);
return;
}
@@ -383,7 +389,7 @@
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL);
- plugin = vpn_get_plugin_by_service (s_vpn->service_type);
+ plugin = vpn_get_plugin_by_service (service_type);
if (plugin) {
char *suggested = NULL;
Modified: trunk/src/gconf-helpers/gconf-upgrade.c
==============================================================================
--- trunk/src/gconf-helpers/gconf-upgrade.c (original)
+++ trunk/src/gconf-helpers/gconf-upgrade.c Wed Oct 29 09:16:54 2008
@@ -461,10 +461,10 @@
if (*value) {
/* A string value */
- g_hash_table_insert (s_vpn->data, g_strdup (key), g_strdup (value));
+ nm_setting_vpn_add_data_item (s_vpn, key, value);
} else {
/* A boolean; 0.6 treated key-without-value as "true" */
- g_hash_table_insert (s_vpn->data, g_strdup (key), g_strdup ("yes"));
+ nm_setting_vpn_add_data_item (s_vpn, key, "yes");
}
}
}
@@ -480,21 +480,21 @@
if (!strcmp (key, "connection-type")) {
if (!strcmp (value, "x509"))
- g_hash_table_insert (s_vpn->data, g_strdup (key), g_strdup ("tls"));
+ nm_setting_vpn_add_data_item (s_vpn, key, "tls");
else if (!strcmp (value, "shared-key"))
- g_hash_table_insert (s_vpn->data, g_strdup (key), g_strdup ("static-key"));
+ nm_setting_vpn_add_data_item (s_vpn, key, "static-key");
else if (!strcmp (value, "password"))
- g_hash_table_insert (s_vpn->data, g_strdup (key), g_strdup ("password"));
+ nm_setting_vpn_add_data_item (s_vpn, key, "password");
} else if (!strcmp (key, "comp-lzo")) {
- g_hash_table_insert (s_vpn->data, g_strdup (key), g_strdup ("yes"));
+ nm_setting_vpn_add_data_item (s_vpn, key, "yes");
} else if (!strcmp (key, "dev")) {
if (!strcmp (value, "tap"))
- g_hash_table_insert (s_vpn->data, g_strdup ("tap-dev"), g_strdup ("yes"));
+ nm_setting_vpn_add_data_item (s_vpn, "tap-dev", "yes");
} else if (!strcmp (key, "proto")) {
if (!strcmp (value, "tcp"))
- g_hash_table_insert (s_vpn->data, g_strdup ("proto-tcp"), g_strdup ("yes"));
+ nm_setting_vpn_add_data_item (s_vpn, "proto-tcp", "yes");
} else
- g_hash_table_insert (s_vpn->data, g_strdup (key), g_strdup (value));
+ nm_setting_vpn_add_data_item (s_vpn, key, value);
}
}
@@ -585,7 +585,7 @@
g_free (id);
s_vpn = (NMSettingVPN *)nm_setting_vpn_new ();
- s_vpn->service_type = service_name;
+ g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, service_name, NULL);
if (!strcmp (service_name, "org.freedesktop.NetworkManager.vpnc"))
nm_gconf_0_6_vpnc_settings (s_vpn, vpn_data);
@@ -597,6 +597,7 @@
free_slist (vpn_data);
g_free (path);
g_free (network);
+ g_free (service_name);
if (str_routes) {
s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
Modified: trunk/src/gconf-helpers/nma-gconf-connection.c
==============================================================================
--- trunk/src/gconf-helpers/nma-gconf-connection.c (original)
+++ trunk/src/gconf-helpers/nma-gconf-connection.c Wed Oct 29 09:16:54 2008
@@ -111,10 +111,9 @@
if (!s_vpn)
return;
- g_free (s_vpn->user_name);
user_name = g_get_user_name ();
g_assert (g_utf8_validate (user_name, -1, NULL));
- s_vpn->user_name = g_strdup (user_name);
+ g_object_set (s_vpn, NM_SETTING_VPN_USER_NAME, user_name, NULL);
}
gboolean
Modified: trunk/src/vpn-password-dialog.c
==============================================================================
--- trunk/src/vpn-password-dialog.c (original)
+++ trunk/src/vpn-password-dialog.c Wed Oct 29 09:16:54 2008
@@ -192,6 +192,7 @@
NMConnection *connection;
const char *id;
const char *connection_type;
+ const char *service_type;
g_return_val_if_fail (NM_IS_EXPORTED_CONNECTION (exported), FALSE);
@@ -208,14 +209,16 @@
s_vpn = NM_SETTING_VPN (nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN));
g_return_val_if_fail (s_vpn != NULL, FALSE);
- g_return_val_if_fail (s_vpn->service_type != NULL, FALSE);
+
+ service_type = nm_setting_vpn_get_service_type (s_vpn);
+ g_return_val_if_fail (service_type != NULL, FALSE);
/* find the auth-dialog binary */
- auth_dialog_binary = find_auth_dialog_binary (s_vpn->service_type, id);
+ auth_dialog_binary = find_auth_dialog_binary (service_type, id);
if (!auth_dialog_binary) {
g_set_error (&error, NM_SETTINGS_ERROR, 1,
"%s.%d (%s): couldn't find VPN auth dialog helper program '%s'.",
- __FILE__, __LINE__, __func__, s_vpn->service_type);
+ __FILE__, __LINE__, __func__, service_type);
goto out;
}
@@ -223,7 +226,7 @@
argv[0] = auth_dialog_binary;
argv[2] = nm_setting_connection_get_uuid (s_con);
argv[4] = id;
- argv[6] = s_vpn->service_type;
+ argv[6] = service_type;
if (!retry)
argv[7] = NULL;
@@ -251,7 +254,7 @@
id);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
_("There was a problem launching the authentication dialog for VPN connection type '%s'. Contact your system administrator."),
- s_vpn->service_type);
+ service_type);
gtk_window_present (GTK_WINDOW (dialog));
g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
g_set_error (&error, NM_SETTINGS_ERROR, 1,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]