[gnome-commander] Set base path and hostname in the GnomeCmdCon object from the connection dialog



commit 4f02d8aa304124866f740ea99ca9a61fccfc0ac9
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Wed Dec 15 23:51:13 2021 +0100

    Set base path and hostname in the GnomeCmdCon object from the connection dialog

 src/dialogs/gnome-cmd-con-dialog.cc | 5 ++++-
 src/gnome-cmd-con.cc                | 4 ++--
 src/gnome-cmd-con.h                 | 3 ++-
 3 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/dialogs/gnome-cmd-con-dialog.cc b/src/dialogs/gnome-cmd-con-dialog.cc
index a7ed0ff0..19b90958 100644
--- a/src/dialogs/gnome-cmd-con-dialog.cc
+++ b/src/dialogs/gnome-cmd-con-dialog.cc
@@ -25,6 +25,7 @@
 #include "gnome-cmd-data.h"
 #include "utils.h"
 #include "dialogs/gnome-cmd-con-dialog.h"
+#include "gnome-cmd-plain-path.h"
 
 using namespace std;
 
@@ -601,7 +602,7 @@ gboolean gnome_cmd_connect_dialog_edit (GnomeCmdConRemote *server)
             if (!strcmp(scheme, "smb"))
             {
                 auto uriString = path
-                    ? g_strdup_printf("%s://%s/%s/", scheme, host, path)
+                    ? g_strdup_printf("%s://%s%s/", scheme, host, path)
                     : g_strdup_printf("%s://%s/", scheme, host);
                 gnome_cmd_con_set_uri (con, uriString);
                 g_free(uriString);
@@ -630,7 +631,9 @@ gboolean gnome_cmd_connect_dialog_edit (GnomeCmdConRemote *server)
         gnome_cmd_con_set_alias (con, alias);
 
         gnome_cmd_con_set_scheme(con, scheme);
+        gnome_cmd_con_set_base_path(con, path ? new GnomeCmdPlainPath(path) : new 
GnomeCmdPlainPath(G_DIR_SEPARATOR_S));
         gnome_cmd_con_set_root_path(con, path);
+        gnome_cmd_con_set_host_name (con, host);
         if (port != -1)
             gnome_cmd_con_set_port(con, port);
 
diff --git a/src/gnome-cmd-con.cc b/src/gnome-cmd-con.cc
index f61157fe..11e07777 100644
--- a/src/gnome-cmd-con.cc
+++ b/src/gnome-cmd-con.cc
@@ -292,7 +292,7 @@ static gboolean check_con_open_progress (GnomeCmdCon *con)
 }
 
 
-static void set_con_base_path(GnomeCmdCon *con, GnomeCmdPath *path)
+void gnome_cmd_con_set_base_path(GnomeCmdCon *con, GnomeCmdPath *path)
 {
     g_return_if_fail (con != nullptr);
     g_return_if_fail (GNOME_CMD_IS_CON (con));
@@ -316,7 +316,7 @@ void set_con_base_path_for_gmount(GnomeCmdCon *con, GMount *gMount)
     auto pathString = g_file_get_path(gFile);
     g_object_unref(gFile);
 
-    set_con_base_path(con, new GnomeCmdPlainPath(pathString));
+    gnome_cmd_con_set_base_path(con, new GnomeCmdPlainPath(pathString));
 
     g_free(pathString);
 }
diff --git a/src/gnome-cmd-con.h b/src/gnome-cmd-con.h
index b0c2ced1..17437c16 100644
--- a/src/gnome-cmd-con.h
+++ b/src/gnome-cmd-con.h
@@ -132,6 +132,7 @@ struct GnomeCmdConClass
 
 GtkType gnome_cmd_con_get_type ();
 
+void gnome_cmd_con_set_base_path(GnomeCmdCon *con, GnomeCmdPath *path);
 void set_con_base_path_for_gmount(GnomeCmdCon *con, GMount *gMount);
 gboolean set_con_base_gfileinfo(GnomeCmdCon *con);
 
@@ -160,7 +161,7 @@ inline const gchar *gnome_cmd_con_get_uri (GnomeCmdCon *con)
     return con->uri;
 }
 
-inline void gnome_cmd_con_set_uri (GnomeCmdCon *con, const gchar *uri=NULL)
+inline void gnome_cmd_con_set_uri (GnomeCmdCon *con, const gchar *uri = nullptr)
 {
     g_return_if_fail (GNOME_CMD_IS_CON (con));
     g_free (con->uri);


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