changeset 605:b60dad25b641

2004-11-1 Brian Masney <masneyb@gftp.org> * lib/config_file.c (gftp_add_bookmark) - if the bookmark path ends in /, then force the entry to be a folder
author masneyb
date Tue, 02 Nov 2004 01:45:20 +0000
parents 5df5eac28f47
children b6887fbe3e11
files ChangeLog lib/config_file.c
diffstat 2 files changed, 32 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Nov 02 01:33:26 2004 +0000
+++ b/ChangeLog	Tue Nov 02 01:45:20 2004 +0000
@@ -1,4 +1,7 @@
 2004-11-1 Brian Masney <masneyb@gftp.org>
+	* lib/config_file.c (gftp_add_bookmark) - if the bookmark path ends in
+	/, then force the entry to be a folder
+
 	* src/gtk/gftp-gtk.c src/gtk/gftp-gtk.h src/gtk/misc-gtk.c - added a
 	tooltip to the button on the top left of the GUI
 
@@ -2996,7 +2999,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.354 2004/11/02 01:33:26 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.355 2004/11/02 01:45:20 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/config_file.c	Tue Nov 02 01:33:26 2004 +0000
+++ b/lib/config_file.c	Tue Nov 02 01:45:20 2004 +0000
@@ -79,29 +79,38 @@
       curpos++;
     }
 
-  /* Get the parent node */
-  if ((curpos = strrchr (newentry->path, '/')) == NULL)
-    preventry = gftp_bookmarks;
+  if (newentry->path[strlen (newentry->path) - 1] == '/')
+    {
+      newentry->path[strlen (newentry->path) - 1] = '\0';
+      newentry->isfolder = 1;
+    }
   else
     {
-      *curpos = '\0';
-      preventry = (gftp_bookmarks_var *)
-	g_hash_table_lookup (gftp_bookmarks_htable, newentry->path);
-      *curpos = '/';
-    }
+      /* Get the parent node */
+      if ((curpos = strrchr (newentry->path, '/')) == NULL)
+        preventry = gftp_bookmarks;
+      else
+        {
+          *curpos = '\0';
+          preventry = (gftp_bookmarks_var *)
+    	g_hash_table_lookup (gftp_bookmarks_htable, newentry->path);
+          *curpos = '/';
+        }
+    
+      if (preventry->children != NULL)
+        {
+          endentry = preventry->children;
+          while (endentry->next != NULL)
+    	endentry = endentry->next;
+          endentry->next = newentry;
+        }
+      else
+        preventry->children = newentry;
 
-  if (preventry->children != NULL)
-    {
-      endentry = preventry->children;
-      while (endentry->next != NULL)
-	endentry = endentry->next;
-      endentry->next = newentry;
+      newentry->prev = preventry;
+      newentry->next = NULL;
+      g_hash_table_insert (gftp_bookmarks_htable, newentry->path, newentry);
     }
-  else
-    preventry->children = newentry;
-  newentry->prev = preventry;
-  newentry->next = NULL;
-  g_hash_table_insert (gftp_bookmarks_htable, newentry->path, newentry);
 }