[gnome-commander] Add methods for setting the port and the hostname of a remote connection



commit ee20060d31c00824e6ef0f74f5f8833459fa6328
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Sat Sep 25 23:27:47 2021 +0200

    Add methods for setting the port and the hostname of a remote connection

 src/gnome-cmd-con.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
---
diff --git a/src/gnome-cmd-con.h b/src/gnome-cmd-con.h
index d32074f2..127e176c 100644
--- a/src/gnome-cmd-con.h
+++ b/src/gnome-cmd-con.h
@@ -89,6 +89,8 @@ struct GnomeCmdCon
     ConnectionMethodID  method;
     Authentication      auth;
 
+    gchar               *hostname;
+    guint16             port;
     gchar               *open_msg;
     GnomeCmdPath        *base_path;
     GnomeVFSFileInfo    *base_info;
@@ -211,13 +213,33 @@ inline void gnome_cmd_con_set_alias (GnomeCmdCon *con, const gchar *alias=NULL)
     con->close_text = g_strdup_printf (_("Disconnect from: %s"), alias);
 }
 
+inline const char *gnome_cmd_con_get_host_name (GnomeCmdCon *con)
+{
+    g_return_val_if_fail (GNOME_CMD_IS_CON (con), nullptr);
+    return con->hostname;
+}
+
 inline void gnome_cmd_con_set_host_name (GnomeCmdCon *con, const gchar *host)
 {
     g_return_if_fail (GNOME_CMD_IS_CON (con));
     g_free (con->open_msg);
+    g_free (con->hostname);
+    con->hostname = g_strdup(host);
     con->open_msg = g_strdup_printf (_("Connecting to %s\n"), host ? host : "<?>");
 }
 
+inline void gnome_cmd_con_set_port (GnomeCmdCon *con, guint16 port)
+{
+    g_return_if_fail (GNOME_CMD_IS_CON (con));
+    con->port = port;
+}
+
+inline guint16 gnome_cmd_con_get_port (GnomeCmdCon *con)
+{
+    g_return_val_if_fail (GNOME_CMD_IS_CON (con), 0);
+    return con->port;
+}
+
 inline void gnome_cmd_con_set_host_name (GnomeCmdCon *con, const std::string &host)
 {
     gnome_cmd_con_set_host_name (con, host.empty() ? NULL : host.c_str());


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