changeset 494:3bb9a8df6ee9

Honor Control and Shift keys while drag'n'droping files to directories. Before a menu (Copy/Move/Cancel) was always displayed, now if the user hold Shift key or Control key, the menu is not shown, but move or copy actions take place. If no modifier key is used, the menu is displayed as usual.
author zas_
date Wed, 23 Apr 2008 13:46:18 +0000
parents e994613f4bad
children c7a2471e5c4e
files src/view_dir.c
diffstat 1 files changed, 21 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/view_dir.c	Wed Apr 23 13:03:04 2008 +0000
+++ b/src/view_dir.c	Wed Apr 23 13:46:18 2008 +0000
@@ -721,6 +721,7 @@
 		{
 		GList *list;
 		gint active;
+		gint done = FALSE;
 
 		list = uri_filelist_from_text((gchar *)selection_data->data, TRUE);
 		if (!list) return;
@@ -728,8 +729,26 @@
 		active = access_file(fd->path, W_OK | X_OK);
 
 		vd_color_set(vd, fd, TRUE);
-		vd->popup = vd_drop_menu(vd, active);
-		gtk_menu_popup(GTK_MENU(vd->popup), NULL, NULL, NULL, NULL, 0, time);
+
+		if (active)
+			{
+			if (context->actions == GDK_ACTION_COPY)
+				{
+				file_util_copy_simple(list, fd->path);
+				done = TRUE;
+				}
+			else if (context->actions == GDK_ACTION_MOVE)
+				{
+				file_util_move_simple(list, fd->path);
+				done = TRUE;
+				}
+			}
+
+		if (done == FALSE)
+			{
+			vd->popup = vd_drop_menu(vd, active);
+			gtk_menu_popup(GTK_MENU(vd->popup), NULL, NULL, NULL, NULL, 0, time);
+			}
 
 		vd->drop_fd = fd;
 		vd->drop_list = list;