[gnome-commander] GnomeCmdConRemote: Standardizes the format of the uri



commit cd3910ace587fd16e1e73f64a83432e7440f25c2
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Wed Dec 21 19:39:40 2011 +0100

    GnomeCmdConRemote: Standardizes the format of the uri

 src/gnome-cmd-con-remote.cc |    6 ++++--
 src/gnome-cmd-con.h         |    6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/gnome-cmd-con-remote.cc b/src/gnome-cmd-con-remote.cc
index b4545b9..3dbd2de 100644
--- a/src/gnome-cmd-con-remote.cc
+++ b/src/gnome-cmd-con-remote.cc
@@ -239,7 +239,9 @@ GtkType gnome_cmd_con_remote_get_type ()
 
 GnomeCmdConRemote *gnome_cmd_con_remote_new (const gchar *alias, const string &uri_str)
 {
-    GnomeVFSURI *uri = gnome_vfs_uri_new (uri_str.c_str());
+    gchar *canonical_uri = gnome_vfs_make_uri_canonical (uri_str.c_str());
+
+    GnomeVFSURI *uri = gnome_vfs_uri_new (canonical_uri);
 
     g_return_val_if_fail (uri != NULL, NULL);
 
@@ -254,7 +256,7 @@ GnomeCmdConRemote *gnome_cmd_con_remote_new (const gchar *alias, const string &u
     GnomeCmdCon *con = GNOME_CMD_CON (server);
 
     gnome_cmd_con_set_alias (con, alias);
-    gnome_cmd_con_set_uri (con, uri_str);
+    gnome_cmd_con_set_uri (con, canonical_uri);
     gnome_cmd_con_set_host_name (con, host);
     gnome_cmd_con_set_root_path (con, path);
 
diff --git a/src/gnome-cmd-con.h b/src/gnome-cmd-con.h
index bb19586..9f30e4d 100644
--- a/src/gnome-cmd-con.h
+++ b/src/gnome-cmd-con.h
@@ -171,12 +171,14 @@ inline void gnome_cmd_con_set_uri (GnomeCmdCon *con, const gchar *uri=NULL)
 {
     g_return_if_fail (GNOME_CMD_IS_CON (con));
     g_free (con->uri);
-    con->uri = g_strdup (uri);
+    con->uri = (gchar *) uri;
 }
 
 inline void gnome_cmd_con_set_uri (GnomeCmdCon *con, const std::string &uri)
 {
-    gnome_cmd_con_set_uri (con, uri.empty() ? NULL : uri.c_str());
+    g_return_if_fail (GNOME_CMD_IS_CON (con));
+    g_free (con->uri);
+    con->uri = uri.empty() ? NULL : g_strdup (uri.c_str());
 }
 
 GnomeVFSURI *gnome_cmd_con_create_uri (GnomeCmdCon *con, GnomeCmdPath *path);



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