[baobab] Disconnect the signal from the right scanner object



commit 89dd510264e5be066166b75bbcb9cd52dff69ed9
Author: Paolo Borelli <pborelli gnome org>
Date:   Thu Aug 2 21:12:37 2012 +0200

    Disconnect the signal from the right scanner object
    
    Disconnect the "completed" signal *before* changing the current location object

 src/baobab-window.vala |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index 5980e47..900724c 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -224,8 +224,16 @@ namespace Baobab {
             connect_server.show ();
         }
 
-        void on_scan_location_activate (Location location) {
+        void set_active_location (Location location) {
+            if (scan_completed_handler > 0) {
+                active_location.scanner.disconnect (scan_completed_handler);
+            }
+
             active_location = location;
+        }
+
+        void on_scan_location_activate (Location location) {
+            set_active_location (location);
             if (location.is_volume) {
                 location.mount_volume.begin ((location_, res) => {
                     try {
@@ -520,10 +528,6 @@ namespace Baobab {
 
             set_model (active_location.scanner);
 
-            if (scan_completed_handler > 0) {
-                scanner.disconnect (scan_completed_handler);
-            }
-
             scan_completed_handler = scanner.completed.connect(() => {
                 try {
                     scanner.finish();
@@ -566,7 +570,7 @@ namespace Baobab {
 
             location_list.add_location (location);
 
-            active_location = location;
+            set_active_location (location);
             scan_active_location (false);
         }
     }



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