summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2016-06-06 17:43:14 +0200
committerBastien Nocera <hadess@hadess.net>2016-06-09 11:49:40 +0200
commit77dbecd55f14dbbc83037c23e2079b8eb79230e6 (patch)
tree1c0ab6bf3c4694b4c4d3e9f837940a41040c9f5b
parent409a172a8d6d32c3065ff4cc0b74a453cdcea965 (diff)
downloadgvfs-77dbecd55f14dbbc83037c23e2079b8eb79230e6.tar.gz
afc: Add pairing dialogue specific message
When a pairing dialogue is shown on the device, don't tell the user that the device is locked, rather that they need to click "Trust". https://bugzilla.gnome.org/show_bug.cgi?id=763605
-rw-r--r--daemon/gvfsbackendafc.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index e39b9523..dde5bd93 100644
--- a/daemon/gvfsbackendafc.c
+++ b/daemon/gvfsbackendafc.c
@@ -434,7 +434,6 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
afc_error_t aerr;
const gchar *choices[] = {_("Try again"), _("Cancel"), NULL}; /* keep in sync with the enum above */
gboolean aborted = FALSE;
- gchar *message = NULL;
gint choice;
gboolean ret;
@@ -586,6 +585,8 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
/* now, try to connect with handshake */
retries = 0;
do {
+ char *message;
+
lerr = lockdownd_client_new_with_handshake (self->dev,
&lockdown_cli,
"gvfsd-afc");
@@ -606,17 +607,30 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
break;
aborted = FALSE;
- if (!message)
- /* translators:
- * %s is the device name. 'Try again' is the caption of the button
- * shown in the dialog which is defined above. */
- message = g_strdup_printf (_("The device “%s” is locked. Enter the passcode on the device and click “Try again”."), display_name);
+ if (lerr == LOCKDOWN_E_PASSWORD_PROTECTED)
+ {
+ /* translators:
+ * %s is the device name. 'Try again' is the caption of the button
+ * shown in the dialog which is defined above. */
+ message = g_strdup_printf (_("The device “%s” is locked. Enter the passcode on the device and click “Try again”."), display_name);
+ }
+ else if (lerr == LOCKDOWN_E_PAIRING_DIALOG_RESPONSE_PENDING)
+ {
+ /* translators:
+ * %s is the device name. 'Try again' is the caption of the button
+ * shown in the dialog which is defined above. */
+ message = g_strdup_printf (_("The device “%s” is not trusted yet. Select “Trust” on the device and click “Try again”."), display_name);
+ }
+ else
+ g_assert_not_reached ();
ret = g_mount_source_ask_question (src,
message,
choices,
&aborted,
&choice);
+ g_free (message);
+
if (!ret || aborted || (choice == CHOICE_CANCEL))
break;
} while (retries++ < 10);
@@ -627,7 +641,6 @@ g_vfs_backend_afc_mount (GVfsBackend *backend,
g_free (display_name);
display_name = NULL;
- g_free (message);
if (G_UNLIKELY(g_vfs_backend_lockdownd_check (lerr, G_VFS_JOB(job))))
goto out_destroy_dev;