[nautilus] nautilus-window: Don't create notification if user cancelled



commit 3e69570a70a9fd7b5cd966ef950441ff0b30b474
Author: Carlos Soriano <csoriano gnome org>
Date:   Wed Feb 4 13:57:40 2015 +0100

    nautilus-window: Don't create notification if user cancelled
    
    Don't create a delete notification if the user cancelled the operation.

 src/nautilus-window.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 166f5bc..53fdf5d 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1469,6 +1469,7 @@ nautilus_window_on_undo_changed (NautilusFileUndoManager *manager,
        NautilusNotificationDelete *notification;
        NautilusFileUndoInfo *undo_info;
        NautilusFileUndoManagerState state;
+       GList *files;
 
        nautilus_notification_manager_remove_all (NAUTILUS_NOTIFICATION_MANAGER 
(window->details->notification_manager));
        undo_info = nautilus_file_undo_manager_get_action ();
@@ -1477,9 +1478,15 @@ nautilus_window_on_undo_changed (NautilusFileUndoManager *manager,
        if (undo_info != NULL &&
             state == NAUTILUS_FILE_UNDO_MANAGER_STATE_UNDO &&
             nautilus_file_undo_info_get_op_type (undo_info) == NAUTILUS_FILE_UNDO_OP_MOVE_TO_TRASH) {
-               notification = nautilus_notification_delete_new (window);
-               nautilus_notification_manager_add_notification (NAUTILUS_NOTIFICATION_MANAGER 
(window->details->notification_manager),
-                                                                GTK_WIDGET (notification));
+               files = nautilus_file_undo_info_trash_get_files (NAUTILUS_FILE_UNDO_INFO_TRASH (undo_info));
+
+               /* Don't pop up a notification if user canceled the operation */
+               if (g_list_length (files) > 0) {
+                       notification = nautilus_notification_delete_new (window);
+                       nautilus_notification_manager_add_notification (NAUTILUS_NOTIFICATION_MANAGER 
(window->details->notification_manager),
+                                                                       GTK_WIDGET (notification));
+               }
+               g_list_free (files);
        }
 }
 


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