[nautilus] progress-persistence-handler: Display file transfer notification



commit ac1ae036962db559a4401fedb507bfec065025e1
Author: Sachin Daluja <30343-sachindaluja users noreply gitlab gnome org>
Date:   Sat Mar 28 13:31:25 2020 -0400

    progress-persistence-handler: Display file transfer notification
    
    On completion of long file transfer operation. We currently show a
    notification on completion of file transfer only if there are no open
    windows.
    
    To make Files more intuitive show all operations completed notification
    even if there are open windows but none of them has focus.
    
    Closes https://gitlab.gnome.org/GNOME/nautilus/-/issues/998

 src/nautilus-progress-persistence-handler.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/nautilus-progress-persistence-handler.c b/src/nautilus-progress-persistence-handler.c
index 77ffdcdd8..64f45e91d 100644
--- a/src/nautilus-progress-persistence-handler.c
+++ b/src/nautilus-progress-persistence-handler.c
@@ -169,22 +169,26 @@ static void
 progress_info_finished_cb (NautilusProgressInfo               *info,
                            NautilusProgressPersistenceHandler *self)
 {
-    GList *windows;
+    GtkWindow *last_active_window;
 
     self->active_infos--;
 
-    windows = nautilus_application_get_windows (self->app);
+    last_active_window = gtk_application_get_active_window (GTK_APPLICATION (self->app));
+
     if (self->active_infos > 0)
     {
-        if (windows == NULL)
+        if (last_active_window == NULL)
         {
             progress_persistence_handler_update_notification (self);
         }
     }
-    else if (windows == NULL)
+    else
     {
-        progress_persistence_handler_hide_notification (self);
-        progress_persistence_handler_show_complete_notification (self);
+        if ((last_active_window == NULL) || !gtk_window_has_toplevel_focus (last_active_window))
+        {
+            progress_persistence_handler_hide_notification (self);
+            progress_persistence_handler_show_complete_notification (self);
+        }
     }
 }
 


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