[gnome-commander/gcmd-1-2-8] Fixed problem with editing connections to Windows network



commit 94ca40ab87ab134981e04a3981904a3a45e7aae6
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Sun Jan 17 19:42:59 2010 +0100

    Fixed problem with editing connections to Windows network

 NEWS                        |    1 +
 doc/C/gnome-commander.xml   |    3 +++
 src/gnome-cmd-con-dialog.cc |   40 ++++++++++++++++++++++++++++++++++++----
 3 files changed, 40 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index b01f471..7c352e3 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ gnome-commander 1.2.8.5
 Bug fixes:
  * Fixed problem #604558 (cursor lost/placed in wrong position)
  * Fixed problem #604904 (build error on OpenSolaris)
+ * Fixed problem with editing connections to Windows network
  * Fixed problem with nonexistent user actions
 
 
diff --git a/doc/C/gnome-commander.xml b/doc/C/gnome-commander.xml
index f46a5aa..d53eb65 100644
--- a/doc/C/gnome-commander.xml
+++ b/doc/C/gnome-commander.xml
@@ -6028,6 +6028,9 @@
                             <para>Fixed problem #604904 (build error on OpenSolaris)</para>
                         </listitem>
                         <listitem>
+                            <para>Fixed problem with editing connections to Windows network</para>
+                        </listitem>
+                        <listitem>
                             <para>Fixed problem with nonexistent user actions</para>
                         </listitem>
                     </itemizedlist>
diff --git a/src/gnome-cmd-con-dialog.cc b/src/gnome-cmd-con-dialog.cc
index 31b9212..3db7399 100644
--- a/src/gnome-cmd-con-dialog.cc
+++ b/src/gnome-cmd-con-dialog.cc
@@ -624,10 +624,42 @@ gboolean gnome_cmd_connect_dialog_edit (GnomeCmdConFtp *server)
             gtk_entry_set_text (GTK_ENTRY (conndlg->priv->uri_entry), con->uri);
 
             gtk_entry_set_text (GTK_ENTRY (conndlg->priv->server_entry), gnome_vfs_uri_get_host_name (uri));
-            // gtk_entry_set_text (GTK_ENTRY (conndlg->priv->share_entry), ???);
-            gtk_entry_set_text (GTK_ENTRY (conndlg->priv->folder_entry), gnome_vfs_uri_get_path (uri));
-            // gtk_entry_set_text (GTK_ENTRY (conndlg->priv->domain_entry), ???);
-            gtk_entry_set_text (GTK_ENTRY (conndlg->priv->user_entry), gnome_vfs_uri_get_user_name (uri));
+
+            const gchar *path = gnome_vfs_uri_get_path (uri);
+            const gchar *user_name = gnome_vfs_uri_get_user_name (uri);
+
+            if (con->method==CON_SMB)
+            {
+                gchar **a = g_strsplit (path, "/", 3);
+
+                if (g_strv_length (a) > 2)
+                {
+                    gtk_entry_set_text (GTK_ENTRY (conndlg->priv->share_entry), a[1]);
+                    gtk_entry_set_text (GTK_ENTRY (conndlg->priv->folder_entry), a[2]);
+                }
+                else
+                    gtk_entry_set_text (GTK_ENTRY (conndlg->priv->folder_entry), path);
+
+                g_strfreev(a);
+
+                a = g_strsplit (user_name, ";", 2);
+
+                if (g_strv_length (a) > 1)
+                {
+                    gtk_entry_set_text (GTK_ENTRY (conndlg->priv->domain_entry), a[0]);
+                    gtk_entry_set_text (GTK_ENTRY (conndlg->priv->user_entry), a[1]);
+                }
+                else
+                    gtk_entry_set_text (GTK_ENTRY (conndlg->priv->user_entry), user_name);
+
+                g_strfreev(a);
+            }
+            else
+            {
+                gtk_entry_set_text (GTK_ENTRY (conndlg->priv->folder_entry), path);
+                gtk_entry_set_text (GTK_ENTRY (conndlg->priv->user_entry), user_name);
+            }
+
             gtk_entry_set_text (GTK_ENTRY (conndlg->priv->password_entry), gnome_vfs_uri_get_password (uri));
 
             guint port = gnome_vfs_uri_get_host_port (uri);



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