[network-manager-vpnc/nm-1-0] properties: use libnm-gtk password menu funcs for password (bgo #731891)
- From: Jiří Klimeš <jklimes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-vpnc/nm-1-0] properties: use libnm-gtk password menu funcs for password (bgo #731891)
- Date: Thu, 9 Jul 2015 10:59:25 +0000 (UTC)
commit 6be187882ef052e8fc3a2607c8f91a04693641b7
Author: Jiří Klimeš <jklimes redhat com>
Date: Thu Apr 23 13:59:15 2015 +0200
properties: use libnm-gtk password menu funcs for password (bgo #731891)
Remove combo-boxes with password menu types.
https://bugzilla.gnome.org/show_bug.cgi?id=731891
(cherry picked from commit 2afa861dc26913a9d68e9f8f246a1735c7d31c7c)
properties/Makefile.am | 2 +
properties/nm-vpnc-dialog.ui | 188 ++++++++----------------------------------
properties/nm-vpnc.c | 189 +++++++++++++-----------------------------
properties/tests/Makefile.am | 2 +
4 files changed, 98 insertions(+), 283 deletions(-)
---
diff --git a/properties/Makefile.am b/properties/Makefile.am
index 310893c..c687667 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -19,6 +19,7 @@ libnm_vpnc_properties_la_CPPFLAGS = \
$(GTK_CFLAGS) \
$(GNOMEKEYRING_CFLAGS) \
$(NM_CFLAGS) \
+ $(NMGTK_CFLAGS) \
-DICONDIR=\""$(datadir)/pixmaps"\" \
-DUIDIR=\""$(uidir)"\" \
-DG_DISABLE_DEPRECATED \
@@ -28,6 +29,7 @@ libnm_vpnc_properties_la_CPPFLAGS = \
libnm_vpnc_properties_la_LIBADD = \
$(GTK_LIBS) \
$(NM_LIBS) \
+ $(NMGTK_LIBS) \
$(GNOMEKEYRING_LIBS)
libnm_vpnc_properties_la_LDFLAGS = \
diff --git a/properties/nm-vpnc-dialog.ui b/properties/nm-vpnc-dialog.ui
index b892413..e5a2ef6 100644
--- a/properties/nm-vpnc-dialog.ui
+++ b/properties/nm-vpnc-dialog.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.4"/>
<object class="GtkAdjustment" id="adjustment1">
@@ -12,28 +12,6 @@
<property name="can_focus">False</property>
<property name="stock">gtk-preferences</property>
</object>
- <object class="GtkListStore" id="model1">
- <columns>
- <!-- column-name gchararray -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0"> </col>
- </row>
- </data>
- </object>
- <object class="GtkListStore" id="model2">
- <columns>
- <!-- column-name gchararray -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0"> </col>
- </row>
- </data>
- </object>
<object class="GtkBox" id="vpnc-vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -74,44 +52,6 @@
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
- <object class="GtkComboBox" id="group_pass_type_combo">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="model">model1</property>
- <child>
- <object class="GtkCellRendererText" id="renderer1"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">4</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="user_pass_type_combo">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="model">model2</property>
- <child>
- <object class="GtkCellRendererText" id="renderer2"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
<object class="GtkCheckButton" id="show_passwords_checkbutton">
<property name="label" translatable="yes">Sho_w passwords</property>
<property name="use_action_appearance">False</property>
@@ -125,8 +65,6 @@
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -140,8 +78,6 @@ config: IPSec secret <group_password></property>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -156,8 +92,6 @@ config: IPSec secret <group_password></property>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -172,8 +106,6 @@ config: IPSec secret <group_password></property>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -188,8 +120,6 @@ config: IPSec secret <group_password></property>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -202,8 +132,6 @@ config: IPSec gateway <gateway></property>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -216,8 +144,6 @@ config: IPSec ID <group_name></property>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -232,8 +158,6 @@ config: IPSec ID <group_name></property>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -247,8 +171,6 @@ config: Xauth password <password></property>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -261,8 +183,6 @@ config: Xauth username <user_name></property>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -277,8 +197,6 @@ config: Xauth username <user_name></property>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -297,8 +215,7 @@ config: IKE Authmode hybrid</property>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
- <property name="width">3</property>
- <property name="height">1</property>
+ <property name="width">2</property>
</packing>
</child>
<child>
@@ -320,8 +237,6 @@ config: IKE Authmode hybrid</property>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">7</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -334,28 +249,11 @@ config: CA-File</property>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">7</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
</object>
</child>
</object>
@@ -398,6 +296,28 @@ config: CA-File</property>
</packing>
</child>
</object>
+ <object class="GtkListStore" id="model1">
+ <columns>
+ <!-- column-name gchararray -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0"> </col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkListStore" id="model2">
+ <columns>
+ <!-- column-name gchararray -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0"> </col>
+ </row>
+ </data>
+ </object>
<object class="GtkListStore" id="model3">
<columns>
<!-- column-name gchararray -->
@@ -442,6 +362,17 @@ config: CA-File</property>
</row>
</data>
</object>
+ <object class="GtkListStore" id="model7">
+ <columns>
+ <!-- column-name gchararray -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0"> </col>
+ </row>
+ </data>
+ </object>
<object class="GtkDialog" id="vpnc-advanced-dialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
@@ -531,8 +462,6 @@ config: CA-File</property>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -545,8 +474,6 @@ config: Domain <domain></property>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -566,8 +493,6 @@ config: Vendor <cisco/netscreen></property>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -582,8 +507,6 @@ config: Vendor <cisco/netscreen></property>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -597,8 +520,6 @@ config: Vendor <cisco/netscreen></property>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -611,8 +532,6 @@ config: Application version <ASCII string></property>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -686,8 +605,6 @@ config: DPD idle timeout (our side) 0</property>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">6</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -701,8 +618,6 @@ config: DPD idle timeout (our side) 0</property>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -717,8 +632,6 @@ config: DPD idle timeout (our side) 0</property>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -732,8 +645,6 @@ config: DPD idle timeout (our side) 0</property>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -747,8 +658,6 @@ config: DPD idle timeout (our side) 0</property>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -766,8 +675,6 @@ config: Local Port <0-65535></property>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -787,8 +694,6 @@ config: Perfect Forward Secrecy <nopfs/dh1/dh2/dh5/server></property>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -808,8 +713,6 @@ config: IKE DH Group <dh1/dh2/dh5></property>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -829,8 +732,6 @@ config: NAT Traversal Mode <natt/none/force-natt/cisco-udp></property>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -850,8 +751,6 @@ config: nothing for Secure, 'Enable Single DES' for Weak, 'Enable no encryption'
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -865,8 +764,6 @@ config: Interface name <name></property>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -880,8 +777,6 @@ config: Interface name <name></property>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -895,8 +790,6 @@ config: Interface name <name></property>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
</packing>
</child>
<child>
@@ -924,15 +817,4 @@ config: Interface name <name></property>
<action-widget response="0">apply_button</action-widget>
</action-widgets>
</object>
- <object class="GtkListStore" id="model7">
- <columns>
- <!-- column-name gchararray -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0"> </col>
- </row>
- </data>
- </object>
</interface>
diff --git a/properties/nm-vpnc.c b/properties/nm-vpnc.c
index 57ac61c..c842a53 100644
--- a/properties/nm-vpnc.c
+++ b/properties/nm-vpnc.c
@@ -45,6 +45,7 @@
#include <nm-setting-vpn.h>
#include <nm-setting-connection.h>
#include <nm-setting-ip4-config.h>
+#include <nm-ui-utils.h>
#include "src/nm-vpnc-service.h"
#include "nm-vpnc-helper.h"
@@ -58,10 +59,6 @@
#define ENC_TYPE_WEAK 1
#define ENC_TYPE_NONE 2
-#define PW_TYPE_SAVE 0
-#define PW_TYPE_ASK 1
-#define PW_TYPE_UNUSED 2
-
#define NM_VPNC_LOCAL_PORT_DEFAULT 500
/************** plugin class **************/
@@ -202,13 +199,9 @@ setup_password_widget (VpncPluginUiWidget *self,
gboolean new_connection)
{
VpncPluginUiWidgetPrivate *priv = VPNC_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
- NMSettingSecretFlags secret_flags = NM_SETTING_SECRET_FLAG_NONE;
GtkWidget *widget;
const char *value;
- if (new_connection)
- secret_flags = NM_SETTING_SECRET_FLAG_AGENT_OWNED;
-
widget = (GtkWidget *) gtk_builder_get_object (priv->builder, entry_name);
g_assert (widget);
gtk_size_group_add_widget (priv->group, widget);
@@ -216,10 +209,7 @@ setup_password_widget (VpncPluginUiWidget *self,
if (s_vpn) {
value = nm_setting_vpn_get_secret (s_vpn, secret_name);
gtk_entry_set_text (GTK_ENTRY (widget), value ? value : "");
- nm_setting_get_secret_flags (NM_SETTING (s_vpn), secret_name, &secret_flags, NULL);
}
- secret_flags &= ~(NM_SETTING_SECRET_FLAG_NOT_SAVED | NM_SETTING_SECRET_FLAG_NOT_REQUIRED);
- g_object_set_data (G_OBJECT (widget), "flags", GUINT_TO_POINTER (secret_flags));
g_signal_connect (widget, "changed", G_CALLBACK (stuff_changed_cb), self);
}
@@ -243,48 +233,13 @@ show_toggled_cb (GtkCheckButton *button, VpncPluginUiWidget *self)
}
static void
-pw_type_changed_helper (VpncPluginUiWidget *self, GtkWidget *combo)
-{
- VpncPluginUiWidgetPrivate *priv = VPNC_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
- const char *entry = NULL;
- GtkWidget *widget;
-
- /* If the user chose "Not required", desensitize and clear the correct
- * password entry.
- */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_pass_type_combo"));
- if (combo == widget)
- entry = "user_password_entry";
- else {
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "group_pass_type_combo"));
- if (combo == widget)
- entry = "group_password_entry";
- }
- if (!entry)
- return;
-
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, entry));
- g_assert (widget);
-
- switch (gtk_combo_box_get_active (GTK_COMBO_BOX (combo))) {
- case PW_TYPE_ASK:
- case PW_TYPE_UNUSED:
- gtk_entry_set_text (GTK_ENTRY (widget), "");
- gtk_widget_set_sensitive (widget, FALSE);
- break;
- default:
- gtk_widget_set_sensitive (widget, TRUE);
- break;
- }
-}
-
-static void
-pw_type_combo_changed_cb (GtkWidget *combo, gpointer user_data)
+password_storage_changed_cb (GObject *entry,
+ GParamSpec *pspec,
+ gpointer user_data)
{
VpncPluginUiWidget *self = VPNC_PLUGIN_UI_WIDGET (user_data);
- pw_type_changed_helper (self, combo);
- stuff_changed_cb (combo, self);
+ stuff_changed_cb (NULL, self);
}
static const char *
@@ -303,66 +258,38 @@ secret_flags_to_pw_type (NMSettingVPN *s_vpn, const char *key)
}
static void
-init_one_pw_combo (VpncPluginUiWidget *self,
- NMSettingVPN *s_vpn,
- const char *combo_name,
- const char *secret_key,
- const char *type_key,
- const char *entry_name)
+init_password_icon (VpncPluginUiWidget *self,
+ NMSettingVPN *s_vpn,
+ const char *secret_key,
+ const char *type_key,
+ const char *entry_name)
{
VpncPluginUiWidgetPrivate *priv = VPNC_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
- int active = -1;
- GtkWidget *widget;
- GtkListStore *store;
- GtkTreeIter iter;
- const char *value = NULL;
- guint32 default_idx = 1;
-
- /* If there's already a password and the password type can't be found in
- * the VPN settings, default to saving it. Otherwise, always ask for it.
- */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, entry_name));
- g_assert (widget);
- value = gtk_entry_get_text (GTK_ENTRY (widget));
- if (value && strlen (value))
- default_idx = 0;
-
- store = gtk_list_store_new (1, G_TYPE_STRING);
- if (s_vpn) {
- value = secret_flags_to_pw_type (s_vpn, secret_key);
- if (!value)
- value = nm_setting_vpn_get_data_item (s_vpn, type_key);
- }
+ GtkWidget *entry;
+ const char *value;
+ const char *flags = NULL;
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, _("Saved"), -1);
- if ((active < 0) && value) {
- if (!strcmp (value, NM_VPNC_PW_TYPE_SAVE))
- active = 0;
- }
+ entry = GTK_WIDGET (gtk_builder_get_object (priv->builder, entry_name));
+ g_assert (entry);
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, _("Always Ask"), -1);
- if ((active < 0) && value) {
- if (!strcmp (value, NM_VPNC_PW_TYPE_ASK))
- active = 1;
- }
+ nma_utils_setup_password_storage (entry, 0, (NMSetting *) s_vpn, secret_key,
+ TRUE, FALSE);
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, _("Not Required"), -1);
- if ((active < 0) && value) {
- if (!strcmp (value, NM_VPNC_PW_TYPE_UNUSED))
- active = 2;
+ /* If there's no password and no flags in the setting,
+ * initialize flags as "always-ask".
+ */
+ if (s_vpn) {
+ flags = secret_flags_to_pw_type (s_vpn, secret_key);
+ if (!flags || !strcmp (flags, NM_VPNC_PW_TYPE_SAVE))
+ flags = nm_setting_vpn_get_data_item (s_vpn, type_key);
}
+ value = gtk_entry_get_text (GTK_ENTRY (entry));
+ if ((!value || !*value) && !flags)
+ nma_utils_update_password_storage (entry, NM_SETTING_SECRET_FLAG_NOT_SAVED,
+ (NMSetting *) s_vpn, secret_key);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, combo_name));
- g_assert (widget);
- gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store));
- g_object_unref (store);
- gtk_combo_box_set_active (GTK_COMBO_BOX (widget), active < 0 ? default_idx : active);
- pw_type_changed_helper (self, widget);
-
- g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (pw_type_combo_changed_cb), self);
+ g_signal_connect (entry, "notify::secondary-icon-name",
+ G_CALLBACK (password_storage_changed_cb), self);
}
static void
@@ -538,18 +465,16 @@ init_plugin_ui (VpncPluginUiWidget *self,
NM_VPNC_KEY_SECRET,
new_connection);
- init_one_pw_combo (self,
- s_vpn,
- "user_pass_type_combo",
- NM_VPNC_KEY_XAUTH_PASSWORD,
- NM_VPNC_KEY_XAUTH_PASSWORD_TYPE,
- "user_password_entry");
- init_one_pw_combo (self,
- s_vpn,
- "group_pass_type_combo",
- NM_VPNC_KEY_SECRET,
- NM_VPNC_KEY_SECRET_TYPE,
- "group_password_entry");
+ init_password_icon (self,
+ s_vpn,
+ NM_VPNC_KEY_XAUTH_PASSWORD,
+ NM_VPNC_KEY_XAUTH_PASSWORD_TYPE,
+ "user_password_entry");
+ init_password_icon (self,
+ s_vpn,
+ NM_VPNC_KEY_SECRET,
+ NM_VPNC_KEY_SECRET_TYPE,
+ "group_password_entry");
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_entry"));
g_return_val_if_fail (widget != NULL, FALSE);
@@ -860,36 +785,32 @@ static void
save_one_password (NMSettingVPN *s_vpn,
GtkBuilder *builder,
const char *entry_name,
- const char *combo_name,
const char *secret_key,
const char *type_key)
{
- NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE;
+ NMSettingSecretFlags flags;
const char *data_val = NULL, *password;
GtkWidget *entry;
- GtkWidget *combo;
- /* Grab original password flags */
+ /* Get secret flags */
entry = GTK_WIDGET (gtk_builder_get_object (builder, entry_name));
- flags = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (entry), "flags"));
+ flags = nma_utils_menu_to_secret_flags (entry);
- /* And set new ones based on the type combo */
- combo = GTK_WIDGET (gtk_builder_get_object (builder, combo_name));
- switch (gtk_combo_box_get_active (GTK_COMBO_BOX (combo))) {
- case PW_TYPE_SAVE:
+ /* Save password and convert flags to legacy data items */
+ switch (flags) {
+ case NM_SETTING_SECRET_FLAG_NONE:
+ case NM_SETTING_SECRET_FLAG_AGENT_OWNED:
password = gtk_entry_get_text (GTK_ENTRY (entry));
if (password && strlen (password))
nm_setting_vpn_add_secret (s_vpn, secret_key, password);
data_val = NM_VPNC_PW_TYPE_SAVE;
break;
- case PW_TYPE_UNUSED:
+ case NM_SETTING_SECRET_FLAG_NOT_REQUIRED:
data_val = NM_VPNC_PW_TYPE_UNUSED;
- flags |= NM_SETTING_SECRET_FLAG_NOT_REQUIRED;
break;
- case PW_TYPE_ASK:
+ case NM_SETTING_SECRET_FLAG_NOT_SAVED:
default:
data_val = NM_VPNC_PW_TYPE_ASK;
- flags |= NM_SETTING_SECRET_FLAG_NOT_SAVED;
break;
}
@@ -1032,7 +953,6 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
save_one_password (s_vpn,
priv->builder,
"user_password_entry",
- "user_pass_type_combo",
NM_VPNC_KEY_XAUTH_PASSWORD,
NM_VPNC_KEY_XAUTH_PASSWORD_TYPE);
@@ -1040,7 +960,6 @@ update_connection (NMVpnPluginUiWidgetInterface *iface,
save_one_password (s_vpn,
priv->builder,
"group_password_entry",
- "group_pass_type_combo",
NM_VPNC_KEY_SECRET,
NM_VPNC_KEY_SECRET_TYPE);
@@ -1129,6 +1048,16 @@ dispose (GObject *object)
{
VpncPluginUiWidget *plugin = VPNC_PLUGIN_UI_WIDGET (object);
VpncPluginUiWidgetPrivate *priv = VPNC_PLUGIN_UI_WIDGET_GET_PRIVATE (plugin);
+ GtkWidget *widget;
+
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "user_password_entry"));
+ g_signal_handlers_disconnect_by_func (G_OBJECT (widget),
+ (GCallback) password_storage_changed_cb,
+ plugin);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "group_password_entry"));
+ g_signal_handlers_disconnect_by_func (G_OBJECT (widget),
+ (GCallback) password_storage_changed_cb,
+ plugin);
if (priv->group)
g_object_unref (priv->group);
diff --git a/properties/tests/Makefile.am b/properties/tests/Makefile.am
index fc1a6dd..a6b0dc7 100644
--- a/properties/tests/Makefile.am
+++ b/properties/tests/Makefile.am
@@ -12,6 +12,7 @@ test_import_export_CPPFLAGS = \
$(GTK_CFLAGS) \
$(GNOMEKEYRING_CFLAGS) \
$(NM_CFLAGS) \
+ $(NMGTK_CFLAGS) \
$(DBUS_CFLAGS)
test_import_export_LDADD = \
@@ -20,6 +21,7 @@ test_import_export_LDADD = \
$(GNOMEKEYRING_LIBS) \
$(DBUS_LIBS) \
$(NM_LIBS) \
+ $(NMGTK_LIBS) \
$(top_builddir)/properties/libnm-vpnc-properties.la
if WITH_TESTS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]