[gthumb] added keybindings to delete files in catalog view



commit 8314cbefb03c3f71d37137de89b2bbe5eda88b5a
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Jan 20 13:27:17 2013 +0100

    added keybindings to delete files in catalog view
    
    control+delete => move to trash
    shift+delete => delete from disk

 extensions/file_manager/callbacks.c |   30 ++++++++++++++++++++++++++----
 1 files changed, 26 insertions(+), 4 deletions(-)
---
diff --git a/extensions/file_manager/callbacks.c b/extensions/file_manager/callbacks.c
index 41eff44..b4520b1 100644
--- a/extensions/file_manager/callbacks.c
+++ b/extensions/file_manager/callbacks.c
@@ -1180,12 +1180,34 @@ fm__gth_browser_file_list_key_press_cb (GthBrowser  *browser,
 		break;
 
 	case GDK_KEY_Delete:
-		if (((event->state & modifiers) == 0) || ((event->state & modifiers) == GDK_SHIFT_MASK)) {
-			if (gth_browser_get_location_source (browser) != NULL) {
+		if (((event->state & modifiers) == 0)
+		    || ((event->state & modifiers) == GDK_SHIFT_MASK)
+		    || ((event->state & modifiers) == GDK_CONTROL_MASK))
+		{
+			GthFileSource *source;
+			GthFileData   *location;
+
+			if ((event->state & modifiers) == 0) {
+				/* Removes the files from the current location,
+				 * for example: when viewing a catalog removes
+				 * the files from the catalog; when viewing a
+				 * folder removes the files from the folder. */
+				source = gth_browser_get_location_source (browser);
+				location = gth_browser_get_location_data (browser);
+			}
+			else {
+				/* When a key modifier is active, use the VFS
+				 * file source to delete the files from the
+				 * disk. */
+				source = gth_main_get_file_source_for_uri ("file:///");
+				location = NULL;
+			}
+
+			if (source != NULL) {
 				items = gth_file_selection_get_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
 				file_data_list = gth_file_list_get_files (GTH_FILE_LIST (gth_browser_get_file_list (browser)), items);
-				gth_file_source_remove (gth_browser_get_location_source (browser),
-							gth_browser_get_location_data (browser),
+				gth_file_source_remove (source,
+							location,
 							file_data_list,
 							(event->state & modifiers) == GDK_SHIFT_MASK,
 							GTK_WINDOW (browser));



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