changeset 392:5a73f2e1bf79

Fix new folder feature in dirlist mode, it was broken by revision 481.
author zas_
date Wed, 16 Apr 2008 22:31:52 +0000
parents fcaf9c175742
children 8d422d424d51
files src/view_dir.c
diffstat 1 files changed, 16 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/view_dir.c	Wed Apr 16 22:23:43 2008 +0000
+++ b/src/view_dir.c	Wed Apr 16 22:31:52 2008 +0000
@@ -505,35 +505,34 @@
 	gint new_folder_active = FALSE;
 
 	active = (fd != NULL);
-	if (fd)
+	switch(vd->type)
 		{
-		switch(vd->type)
+		case DIRVIEW_LIST:
 			{
-			case DIRVIEW_LIST:
-				{
-				/* check using . (always row 0) */
-				new_folder_active = (vd->path && access_file(vd->path , W_OK | X_OK));
+			/* check using . (always row 0) */
+			new_folder_active = (vd->path && access_file(vd->path , W_OK | X_OK));
 
-				/* ignore .. and . */
-				rename_delete_active = (new_folder_active &&
-					strcmp(fd->name, ".") != 0 &&
-		  			strcmp(fd->name, "..") != 0 &&
-		  			access_file(fd->path, W_OK | X_OK));
-				};
-				break;
-			case DIRVIEW_TREE:
+			/* ignore .. and . */
+			rename_delete_active = (new_folder_active && fd &&
+				strcmp(fd->name, ".") != 0 &&
+	  			strcmp(fd->name, "..") != 0 &&
+	  			access_file(fd->path, W_OK | X_OK));
+			};
+			break;
+		case DIRVIEW_TREE:
+			{
+			if (fd)
 				{
 				gchar *parent;
-
 				new_folder_active = (fd && access_file(fd->path, W_OK | X_OK));
 				parent = remove_level_from_path(fd->path);
 				rename_delete_active = access_file(parent, W_OK | X_OK);
 				g_free(parent);
 				};
-				break;
 			}
+			break;
+		}
 
-		}
 	menu = popup_menu_short_lived();
 	g_signal_connect(G_OBJECT(menu), "destroy",
 			 G_CALLBACK(vd_popup_destroy_cb), vd);