[nautilus] connect-server: strip the scheme if it matches the chosen method



commit f5e967f964b88ad7e4cc81818e9c0092d842e0a8
Author: Stefano Teso <stefano teso gmail com>
Date:   Mon May 23 11:20:26 2011 -0400

    connect-server: strip the scheme if it matches the chosen method
    
    If e.g. ftp://ftp.example.com is specified as an address, and the FTP
    method is chosen, we should strip "ftp://"; automatically from the
    address before connecting.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=643608

 src/nautilus-connect-server-dialog.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-connect-server-dialog.c b/src/nautilus-connect-server-dialog.c
index 11d9fec..f1aa337 100644
--- a/src/nautilus-connect-server-dialog.c
+++ b/src/nautilus-connect-server-dialog.c
@@ -513,6 +513,7 @@ connect_dialog_connect_to_server (NautilusConnectServerDialog *dialog)
 	GtkTreeIter iter;
 	char *user, *initial_path, *server, *folder, *domain, *port_str;
 	char *t, *join, *uri;
+	char *temp, *stripped_server;
 	double port;
 
 	/* Get our method info */
@@ -524,6 +525,14 @@ connect_dialog_connect_to_server (NautilusConnectServerDialog *dialog)
 
 	server = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->server_entry), 0, -1);
 
+	temp = g_strconcat (meth->scheme, "://", NULL);
+	if (g_str_has_prefix (server, temp)) {
+		stripped_server = g_strdup (server + strlen (temp));
+		g_free (server);
+		server = stripped_server;
+	}
+	g_free (temp);
+
 	user = NULL;
 	initial_path = g_strdup ("");
 	domain = NULL;



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