Monitor.vala
[gitlive] / Monitor.vala
index 99cf199..2d049ca 100644 (file)
@@ -148,20 +148,20 @@ public class Monitor : Object
         //fn = fn || function (fm, f, of, event_type, uh) {
         //    _this.onEvent(fm, f, of, event_type, uh);
         //}
-       
-          
+                 
         var f = File.new_for_path(path);
             //var cancel = new Gio.Cancellable ();
         if (depth > 0) { 
   
             try {
-  
-                 var fm = f.monitor(FileMonitorFlags.SEND_MOVED,null); //Gio.FileMonitorFlags.SEND_MOVED
+                 var fm = f.monitor(FileMonitorFlags.SEND_MOVED + FileMonitorFlags.WATCH_MOVES,null);  
+                 //var fm = f.monitor(FileMonitorFlags.WATCH_MOVES,null);
  
                  fm.changed.connect( this.onEvent );
                 this.monitors.append_val(fm);
 
             } catch (Error e) {
+                  GLib.debug("Error adding monitor: %s", e.message);
                 // FIXME -- show error? do nothing..            
             }
             // print("ADD path " + depth + ' ' + path);
@@ -324,6 +324,9 @@ public class Monitor : Object
                     return;
                 
                 case FileMonitorEvent.MOVED: // eg. chmod/chatt
+                case FileMonitorEvent.MOVED_IN: // eg. chmod/chatt
+                case FileMonitorEvent.MOVED_OUT: // eg. chmod/chatt                                
+                case FileMonitorEvent.RENAMED: // eg. chmod/chatt                      
 
                       var of = this.realpath(of_orig);
                        var   dest = new MonitorNamePathDir(
@@ -331,12 +334,13 @@ public class Monitor : Object
                                     of.get_path(),  
                                     Path.get_dirname(of.get_path())
                                 );
-                        
 
                     src.action = "moved";
                     dest.action = "moved";
                     this.onMoved(src,dest);
                     return; 
+                    
                 default:
                     stdout.printf("event type not handled %u", event_type);
                     break;