[network-manager-applet/lr/cert-chooser-fixes: 2/3] nma/pkcs11-cert-chooser: escape mnemonic in cert/key title
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/lr/cert-chooser-fixes: 2/3] nma/pkcs11-cert-chooser: escape mnemonic in cert/key title
- Date: Mon, 18 Feb 2019 14:07:30 +0000 (UTC)
commit 66e0d34e76765e9d20a0dddb70d07b24ff543cea
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Fri Feb 15 11:20:31 2019 +0100
nma/pkcs11-cert-chooser: escape mnemonic in cert/key title
In an unlikely event someone picks a title with an underscore in it,
like I've just done in a test case.
src/libnma/nma-pkcs11-cert-chooser.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/libnma/nma-pkcs11-cert-chooser.c b/src/libnma/nma-pkcs11-cert-chooser.c
index 927b13cf..1d4fb4f7 100644
--- a/src/libnma/nma-pkcs11-cert-chooser.c
+++ b/src/libnma/nma-pkcs11-cert-chooser.c
@@ -371,17 +371,23 @@ static void
set_title (NMACertChooser *cert_chooser, const gchar *title)
{
NMAPkcs11CertChooserPrivate *priv = NMA_PKCS11_CERT_CHOOSER_GET_PRIVATE (cert_chooser);
+ gs_free gchar *mnemonic_escaped = NULL;
gchar *text;
+ char **split;
+
+ split = g_strsplit (title, "_", -1);
+ mnemonic_escaped = g_strjoinv("__", split);
+ g_strfreev (split);
text = g_strdup_printf (_("Choose a key for %s Certificate"), title);
nma_cert_chooser_button_set_title (NMA_CERT_CHOOSER_BUTTON (priv->key_button), text);
g_free (text);
- text = g_strdup_printf (_("%s private _key"), title);
+ text = g_strdup_printf (_("%s private _key"), mnemonic_escaped);
gtk_label_set_text_with_mnemonic (GTK_LABEL (priv->key_button_label), text);
g_free (text);
- text = g_strdup_printf (_("%s key _password"), title);
+ text = g_strdup_printf (_("%s key _password"), mnemonic_escaped);
gtk_label_set_text_with_mnemonic (GTK_LABEL (priv->key_password_label), text);
g_free (text);
@@ -389,11 +395,11 @@ set_title (NMACertChooser *cert_chooser, const gchar *title)
nma_cert_chooser_button_set_title (NMA_CERT_CHOOSER_BUTTON (priv->cert_button), text);
g_free (text);
- text = g_strdup_printf (_("%s _certificate"), title);
+ text = g_strdup_printf (_("%s _certificate"), mnemonic_escaped);
gtk_label_set_text_with_mnemonic (GTK_LABEL (priv->cert_button_label), text);
g_free (text);
- text = g_strdup_printf (_("%s certificate _password"), title);
+ text = g_strdup_printf (_("%s certificate _password"), mnemonic_escaped);
gtk_label_set_text_with_mnemonic (GTK_LABEL (priv->cert_password_label), text);
g_free (text);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]