X-Git-Url: http://git.roojs.org/?p=gitlive;a=blobdiff_plain;f=Monitor.vala;h=b8e3bced5af31644aac55c3c2d0bb61437960309;hp=5b12963d5972dd94f8f87a77fa2f0f8bf7d3d1fb;hb=41d00310fa27851e4f7ba827f1587a3cf397cc99;hpb=7a27f168cb9f240824d180266c59997931cc3eb1 diff --git a/Monitor.vala b/Monitor.vala index 5b12963d..b8e3bced 100644 --- a/Monitor.vala +++ b/Monitor.vala @@ -281,25 +281,9 @@ public class Monitor : gitMonitorBase MonitorNamePathDir src = new MonitorNamePathDir( f.get_basename(), f.get_path() , Path.get_dirname(f.get_path())); - - - - //string event_name = "UKNOWN"; - - - // extract the event names ... - not sure if introspection is feasible in vala.. - //for(var i in Gio.FileMonitorEvent) { - // if (Gio.FileMonitorEvent[i] == event_type) { - // event_name = i; - // } - //} - - - - - //print (JSON.stringify([event_name , f.get_path(), of ? of.get_path() : false ] )); - //print ("got src: " + src.toString()); - //print ("got event: " + src.toString()); + + GLib.debug("onEvent src: %s", f.get_path()); + try { @@ -333,14 +317,23 @@ public class Monitor : gitMonitorBase 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); + if (of_orig == null) { // move from outside of monitoring? + this.onChanged(src); + return; + } + + + var of = this.realpath(of_orig); var dest = new MonitorNamePathDir( of.get_basename(), of.get_path(), Path.get_dirname(of.get_path()) ); - + + if (dest == null) { + + return; + } src.action = "moved"; dest.action = "moved"; this.onMoved(src,dest);