[network-manager-applet] editor: get secrets for VPN export too
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet] editor: get secrets for VPN export too
- Date: Thu, 14 Jul 2011 22:19:48 +0000 (UTC)
commit bf2b756e2d1e8a7f9708a973dd3aa5e5bac0ef8f
Author: Dan Williams <dcbw redhat com>
Date: Thu Jul 14 17:22:39 2011 -0500
editor: get secrets for VPN export too
Let the plugin decide whether to export them or not.
src/connection-editor/nm-connection-list.c | 31 ++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 2 deletions(-)
---
diff --git a/src/connection-editor/nm-connection-list.c b/src/connection-editor/nm-connection-list.c
index cc81f0c..43f18dd 100644
--- a/src/connection-editor/nm-connection-list.c
+++ b/src/connection-editor/nm-connection-list.c
@@ -945,14 +945,41 @@ import_vpn_cb (GtkButton *button, gpointer user_data)
}
static void
+vpn_export_get_secrets_cb (NMRemoteConnection *connection,
+ GHashTable *secrets,
+ GError *error,
+ gpointer user_data)
+{
+ NMConnection *tmp;
+
+ /* We don't really care about errors; if the user couldn't authenticate
+ * then just let them export everything except secrets. Duplicate the
+ * connection so that we don't let secrets sit around in the original
+ * one.
+ */
+ tmp = nm_connection_duplicate (NM_CONNECTION (connection));
+ g_assert (tmp);
+ if (secrets)
+ nm_connection_update_secrets (tmp, NM_SETTING_VPN_SETTING_NAME, secrets, NULL);
+ vpn_export (tmp);
+ g_object_unref (tmp);
+}
+
+
+static void
export_vpn_cb (GtkButton *button, gpointer user_data)
{
ActionInfo *info = (ActionInfo *) user_data;
NMRemoteConnection *connection;
connection = get_active_connection (info->treeview);
- if (connection)
- vpn_export (NM_CONNECTION (connection));
+ if (connection) {
+ /* Grab secrets if we can */
+ nm_remote_connection_get_secrets (connection,
+ NM_SETTING_VPN_SETTING_NAME,
+ vpn_export_get_secrets_cb,
+ NULL);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]