[gnome-commander] Remove option to enter share in smb connection



commit 6a24080e66b546c924a2ae22fa88c5369c7e8849
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Sat Dec 18 00:33:42 2021 +0100

    Remove option to enter share in smb connection

 src/dialogs/gnome-cmd-con-dialog.cc | 47 ++++---------------------------------
 src/gnome-cmd-con.cc                |  4 ++--
 src/gnome-cmd-con.h                 |  6 ++---
 3 files changed, 9 insertions(+), 48 deletions(-)
---
diff --git a/src/dialogs/gnome-cmd-con-dialog.cc b/src/dialogs/gnome-cmd-con-dialog.cc
index 19b90958..01c6b277 100644
--- a/src/dialogs/gnome-cmd-con-dialog.cc
+++ b/src/dialogs/gnome-cmd-con-dialog.cc
@@ -71,7 +71,6 @@ struct GnomeCmdConnectDialog::Private
     GtkWidget *alias_entry;
     GtkWidget *uri_entry;
     GtkWidget *server_entry;
-    GtkWidget *share_entry;
     GtkWidget *port_entry;
     GtkWidget *folder_entry;
     GtkWidget *domain_entry;
@@ -89,7 +88,6 @@ inline GnomeCmdConnectDialog::Private::Private()
     alias_entry = gtk_entry_new ();
     uri_entry = gtk_entry_new ();
     server_entry = gtk_entry_new ();
-    share_entry = gtk_entry_new ();
     port_entry = gtk_entry_new ();
     folder_entry = gtk_entry_new ();
     domain_entry = gtk_entry_new ();
@@ -97,7 +95,6 @@ inline GnomeCmdConnectDialog::Private::Private()
     gtk_entry_set_activates_default (GTK_ENTRY (alias_entry), TRUE);
     gtk_entry_set_activates_default (GTK_ENTRY (uri_entry), TRUE);
     gtk_entry_set_activates_default (GTK_ENTRY (server_entry), TRUE);
-    gtk_entry_set_activates_default (GTK_ENTRY (share_entry), TRUE);
     gtk_entry_set_activates_default (GTK_ENTRY (port_entry), TRUE);
     gtk_entry_set_activates_default (GTK_ENTRY (folder_entry), TRUE);
 
@@ -105,7 +102,6 @@ inline GnomeCmdConnectDialog::Private::Private()
     g_object_ref (alias_entry);
     g_object_ref (uri_entry);
     g_object_ref (server_entry);
-    g_object_ref (share_entry);
     g_object_ref (port_entry);
     g_object_ref (folder_entry);
     g_object_ref (domain_entry);
@@ -117,7 +113,6 @@ inline GnomeCmdConnectDialog::Private::~Private()
     g_object_unref (alias_entry);
     g_object_unref (uri_entry);
     g_object_unref (server_entry);
-    g_object_unref (share_entry);
     g_object_unref (port_entry);
     g_object_unref (folder_entry);
     g_object_unref (domain_entry);
@@ -139,9 +134,6 @@ void GnomeCmdConnectDialog::Private::setup_for_type()
     if (server_entry->parent)
         gtk_container_remove (GTK_CONTAINER (required_table), server_entry);
 
-    if (share_entry->parent)
-        gtk_container_remove (GTK_CONTAINER (optional_table), share_entry);
-
     if (port_entry->parent)
         gtk_container_remove (GTK_CONTAINER (optional_table), port_entry);
 
@@ -157,7 +149,7 @@ void GnomeCmdConnectDialog::Private::setup_for_type()
     gint i = 1;
     GtkWidget *table = required_table;
 
-    gboolean show_share, show_port, show_domain;
+    gboolean show_port, show_domain;
 
     show_entry (table, alias_entry, _("_Alias:"), i);
 
@@ -172,20 +164,17 @@ void GnomeCmdConnectDialog::Private::setup_for_type()
         case CON_FTP:
         case CON_DAV:
         case CON_DAVS:
-            show_share = FALSE;
             show_port = TRUE;
             show_domain = FALSE;
             break;
 
        case CON_ANON_FTP:
-            show_share = FALSE;
             show_port = TRUE;
             show_domain = FALSE;
             break;
 
 #ifdef HAVE_SAMBA
         case CON_SMB:
-            show_share = TRUE;
             show_port = FALSE;
             show_domain = TRUE;
             break;
@@ -226,9 +215,6 @@ void GnomeCmdConnectDialog::Private::setup_for_type()
 
     i = 0;
 
-    if (show_share)
-        show_entry (table, share_entry, _("S_hare:"), i);
-
     if (show_port)
         show_entry (table, port_entry, _("_Port:"), i);
 
@@ -260,7 +246,6 @@ gboolean GnomeCmdConnectDialog::verify_uri()
 {
     string uri;
     string server;
-    string share;
     string port;
     string folder;
     string domain;
@@ -271,9 +256,6 @@ gboolean GnomeCmdConnectDialog::verify_uri()
     if (priv->server_entry->parent)
         stringify (server, gtk_editable_get_chars (GTK_EDITABLE (priv->server_entry), 0, -1));
 
-    if (priv->share_entry->parent)
-        stringify (share, gtk_editable_get_chars (GTK_EDITABLE (priv->share_entry), 0, -1));
-
     if (priv->port_entry->parent)
         stringify (port, gtk_editable_get_chars (GTK_EDITABLE (priv->port_entry), 0, -1));
 
@@ -292,7 +274,7 @@ gboolean GnomeCmdConnectDialog::verify_uri()
         return FALSE;
     }
 
-    gnome_cmd_con_make_uri (uri, (ConnectionMethodID) type, uri, server, share, port, folder, domain);
+    gnome_cmd_con_make_uri (uri, (ConnectionMethodID) type, uri, server, port, folder, domain);
 
     if (type==CON_URI && !uri_is_valid(uri.c_str()))
     {
@@ -541,29 +523,8 @@ gboolean gnome_cmd_connect_dialog_edit (GnomeCmdConRemote *server)
 
         gtk_entry_set_text (GTK_ENTRY (dialog->priv->server_entry), host);
 
-#ifdef HAVE_SAMBA
-            if (con->method==CON_SMB)
-            {
-                gchar **a = g_strsplit (path, "/", 3);
-
-                if (g_strv_length (a) > 2)
-                {
-                    gtk_entry_set_text (GTK_ENTRY (dialog->priv->share_entry), a[1]);
-                    gtk_entry_set_text (GTK_ENTRY (dialog->priv->folder_entry), a[2]);
-                }
-                else
-                    gtk_entry_set_text (GTK_ENTRY (dialog->priv->folder_entry), path);
-
-                g_strfreev (a);
-            }
-            else
-            {
-#endif
-                if (path)
-                    gtk_entry_set_text (GTK_ENTRY (dialog->priv->folder_entry), path);
-#ifdef HAVE_SAMBA
-            }
-#endif
+        if (path)
+            gtk_entry_set_text (GTK_ENTRY (dialog->priv->folder_entry), path);
 
         if (port != -1)
             gtk_entry_set_text (GTK_ENTRY (dialog->priv->port_entry), stringify(port).c_str());
diff --git a/src/gnome-cmd-con.cc b/src/gnome-cmd-con.cc
index 11e07777..ad16ff4c 100644
--- a/src/gnome-cmd-con.cc
+++ b/src/gnome-cmd-con.cc
@@ -634,11 +634,11 @@ string &__gnome_cmd_con_make_uri (string &s, const gchar *method, string &server
 }
 
 #ifdef HAVE_SAMBA
-std::string &gnome_cmd_con_make_smb_uri (std::string &uriString, std::string &server, std::string &share, 
std::string &folder, std::string &domain)
+std::string &gnome_cmd_con_make_smb_uri (std::string &uriString, std::string &server, std::string &folder, 
std::string &domain)
 {
     const gchar *joinSign = !folder.empty() && folder[0] != '/' ? "/" : "";
 
-    folder = share + joinSign + folder;
+    folder = joinSign + folder;
     // remove initial '/' character
     if (folder.length() > 0 && folder[0] == '/')
     {
diff --git a/src/gnome-cmd-con.h b/src/gnome-cmd-con.h
index 17437c16..194d8667 100644
--- a/src/gnome-cmd-con.h
+++ b/src/gnome-cmd-con.h
@@ -503,7 +503,7 @@ inline std::string &gnome_cmd_con_make_ftp_uri (std::string &s, std::string &ser
 }
 
 #ifdef HAVE_SAMBA
-std::string &gnome_cmd_con_make_smb_uri (std::string &s, std::string &server, std::string &share, 
std::string &folder, std::string &domain);
+std::string &gnome_cmd_con_make_smb_uri (std::string &s, std::string &server, std::string &folder, 
std::string &domain);
 #endif
 
 inline std::string &gnome_cmd_con_make_dav_uri (std::string &s, std::string &server, std::string &port, 
std::string &folder)
@@ -516,7 +516,7 @@ inline std::string &gnome_cmd_con_make_davs_uri (std::string &s, std::string &se
     return __gnome_cmd_con_make_uri (s, "davs://", server, port, folder);
 }
 
-inline std::string &gnome_cmd_con_make_uri (std::string &s, ConnectionMethodID method, std::string &uri, 
std::string &server, std::string &share, std::string &port, std::string &folder, std::string &domain)
+inline std::string &gnome_cmd_con_make_uri (std::string &s, ConnectionMethodID method, std::string &uri, 
std::string &server, std::string &port, std::string &folder, std::string &domain)
 {
     switch (method)
     {
@@ -526,7 +526,7 @@ inline std::string &gnome_cmd_con_make_uri (std::string &s, ConnectionMethodID m
         case CON_SSH:       return gnome_cmd_con_make_ssh_uri (s, server, port, folder);
 
 #ifdef HAVE_SAMBA
-        case CON_SMB:       return gnome_cmd_con_make_smb_uri (s, server, share, folder, domain);
+        case CON_SMB:       return gnome_cmd_con_make_smb_uri (s, server, folder, domain);
 #endif
 
         case CON_DAV:       return gnome_cmd_con_make_dav_uri (s, server, port, folder);


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