changeset 606:b6887fbe3e11

2004-11-1 Brian Masney <masneyb@gftp.org> * src/gtk/bookmarks.c (build_bookmarks_tree) - fixes for adding toplevel folders that are empty
author masneyb
date Tue, 02 Nov 2004 01:59:23 +0000
parents b60dad25b641
children f946521bb2f2
files ChangeLog src/gtk/bookmarks.c
diffstat 2 files changed, 22 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Nov 02 01:45:20 2004 +0000
+++ b/ChangeLog	Tue Nov 02 01:59:23 2004 +0000
@@ -1,4 +1,7 @@
 2004-11-1 Brian Masney <masneyb@gftp.org>
+	* src/gtk/bookmarks.c (build_bookmarks_tree) - fixes for adding toplevel
+	folders that are empty
+
 	* lib/config_file.c (gftp_add_bookmark) - if the bookmark path ends in
 	/, then force the entry to be a folder
 
@@ -2999,7 +3002,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.355 2004/11/02 01:45:20 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.356 2004/11/02 01:59:23 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/src/gtk/bookmarks.c	Tue Nov 02 01:45:20 2004 +0000
+++ b/src/gtk/bookmarks.c	Tue Nov 02 01:59:23 2004 +0000
@@ -594,6 +594,7 @@
   gftp_bookmarks_var * tempentry, * preventry;
   char *pos, *prevpos, *text[2], *str;
   GtkCTreeNode * parent;
+  int add_child;
 
   gftp_get_pixmap (tree, "open_dir.xpm", &opendir_pixmap, &opendir_bitmap);
   gftp_get_pixmap (tree, "dir.xpm", &closedir_pixmap, &closedir_bitmap);
@@ -607,6 +608,7 @@
   tempentry = new_bookmarks->children;
   while (tempentry != NULL)
     {
+      add_child = 1;
       tempentry->cnode = NULL;
       if (tempentry->children != NULL)
 	{
@@ -617,6 +619,7 @@
 	{
           if (strchr (tempentry->path, '/') == NULL && tempentry->isfolder)
             {
+              add_child = 0;
               text[0] = text[1] = tempentry->path;
               tempentry->cnode = gtk_ctree_insert_node (GTK_CTREE (tree),
             				   tempentry->prev->cnode, NULL, text,
@@ -657,20 +660,23 @@
             }
 	}
 
-      if ((pos = strrchr (tempentry->path, '/')) == NULL)
-	pos = tempentry->path;
-      else
-	pos++;
-
-      text[0] = text[1] = pos;
-      tempentry->cnode = gtk_ctree_insert_node (GTK_CTREE (tree), 
-                               tempentry->prev->cnode, NULL,
-			       text, 5, NULL, NULL, NULL, NULL, FALSE, FALSE);
-      gtk_ctree_node_set_row_data (GTK_CTREE (tree), tempentry->cnode,
-				   tempentry);
+      if (add_child)
+        {
+          if ((pos = strrchr (tempentry->path, '/')) == NULL)
+            pos = tempentry->path;
+          else
+            pos++;
+    
+          text[0] = text[1] = pos;
+          tempentry->cnode = gtk_ctree_insert_node (GTK_CTREE (tree), 
+                                 tempentry->prev->cnode, NULL, text, 5, NULL,
+                                 NULL, NULL, NULL, FALSE, FALSE);
+          gtk_ctree_node_set_row_data (GTK_CTREE (tree), tempentry->cnode,
+                                       tempentry);
+        }
 
       while (tempentry->next == NULL && tempentry->prev != NULL)
-	tempentry = tempentry->prev;
+        tempentry = tempentry->prev;
       tempentry = tempentry->next;
     }
 }