[gvfs] Provide more information in the SSH dialog.



commit 6602cae4e39ef092a3b40fae502e4db16f4b3d10
Author: Marcus Carlson <gnomebugzilla mejlamej nu>
Date:   Thu Jul 1 12:57:16 2010 +0200

    Provide more information in the SSH dialog.
    
    Adds host and username information when mounting a SSH share, instead of
    just "Enter password".
    
    https://bugzilla.gnome.org/show_bug.cgi?id=621583

 daemon/gvfsbackendsftp.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/daemon/gvfsbackendsftp.c b/daemon/gvfsbackendsftp.c
index 342b996..401484d 100644
--- a/daemon/gvfsbackendsftp.c
+++ b/daemon/gvfsbackendsftp.c
@@ -851,6 +851,7 @@ handle_login (GVfsBackend *backend,
   gboolean password_in_keyring = FALSE;
   const gchar *authtype = NULL;
   gchar *object = NULL;
+  char *prompt;
   
   if (op_backend->client_vendor == SFTP_VENDOR_SSH) 
     prompt_fd = stderr_fd;
@@ -953,11 +954,21 @@ handle_login (GVfsBackend *backend,
 
               g_free (new_password);
               
+              if (op_backend->user_specified)
+                /* Translators: the first %s is the username, the second the host name */
+                if (strcmp (authtype, "publickey") == 0)
+                  prompt = g_strdup_printf (_("Enter passphrase for key for ssh as %s on %s"), op_backend->user, op_backend->host);
+                else
+                  prompt = g_strdup_printf (_("Enter password for ssh as %s on %s"), op_backend->user, op_backend->host);
+              else
+                /* translators: %s here is the hostname */
+                if (strcmp (authtype, "publickey") == 0)
+                  prompt = g_strdup_printf (_("Enter passphrase for key for ssh on %s"), op_backend->host);
+                else
+                  prompt = g_strdup_printf (_("Enter password for ssh on %s"), op_backend->host);
+
               if (!g_mount_source_ask_password (mount_source,
-                                                strcmp (authtype, "publickey") == 0 ?
-                                                _("Enter passphrase for key")
-                                                :
-                                                _("Enter password"),
+                                                prompt,
                                                 op_backend->user,
                                                 NULL,
                                                 flags,
@@ -975,6 +986,7 @@ handle_login (GVfsBackend *backend,
                   ret_val = FALSE;
                   break;
                 }
+                g_free (prompt);
             }
 	  else if (op_backend->tmp_password)
 	    {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]