Uncommited changes synced
[gitlive] / GitMonitor.vala
index 15998d1..4c79f5e 100644 (file)
+/**
 
+The monitor suffers from various issues - basically event flows while it's running...
 
-public class GitMonitorQueue : MonitorNamePathDir {
-               // name = basename
-               // path = full path..
-               // dir = dir path
-       
-               public string gitpath;
-               public string vdir;  // relative path (within git)
-               public string vname;  // relative filename (within git)
-               public string message ; // for commit
-               public bool commit_all;
-                
-               public GitMonitorQueue(MonitorNamePathDir f) {
+normall operations
 
-                       base(f.name, f.path, f.dir);
+- monitors for file changes
+ -- adds to QUEUE when occurs.
  
-                       this.message = "";
-                       this.commit_all = false;
-                       
-                       var vpath_ar = this.dir.substring(GitMonitor.gitlive.length +1).split("/", 0);
-                       
-                       if (vpath_ar[0].length < 1) {
-
-                               this.gitpath = "";
-                               this.vdir = "";
-                               this.vname = "";
-                       }        
-
+- queue runs in background.
+ - if it's got stuff in it..
+ - COMMIT (normally)
+ - now?? - if on master - try and branch
+   == do user selection, until we have branched
+   == then start monitoring again..
+   
 
-                       this.gitpath = GitMonitor.gitlive + "/" + vpath_ar[0];
-                       
-                       string[]  vpath = {};
-                       for (var i = 1; i< vpath_ar.length; i++) {
-                               vpath += vpath_ar[i];
-                       }
 
-                       this.vdir =  string.joinv("/", vpath);
 
-                       this.vname =  this.vdir + (this.vdir.length > 0 ? "/" : "") + this.name;
-                       
-                        
-/*
-                       stdout.printf(
-                                       "NEW GitMonitorQueue\nname: %s\npath: %s\ndir: %s\n" + 
-                                       "gitpath: %s\nvdir: %s\nvname: %s\n",
-                                       this.name, this.path, this.dir,
-                                       this.gitpath, this.vdir, this.vname
-                       );
 */
 
-                       //f.repo = new imports.Scm.Git.Repo({ repopath: f.gitpath })
-               
-               
-               }
-
-               public bool shouldIgnore()
-               {
-                       
-                
-                       // vim.. what a seriously brain dead program..
-                       if (this.name == "4913") {
-                               return true;
-                       }
-                       
-                       if (this.name[0] == '.') {
-                               // except!
-                               if (this.name == ".htaccess") {
-                                       return false;
-                               }
-                               if (this.name == ".gitignore") {
-                                       return false;
-                               }
-                               return true;
-                       }
-                       
-                       
-                       if (this.name[this.name.length -1] == '~') {
-                               return true;
-                       }
-                       // netbeans / android studio.. silly temp files..
-                       
-                       if (Regex.match_simple("___jb_old___$", this.name)) {
-                           return true;
-                       }
-                       if (Regex.match_simple("___jb_bak___$", this.name)) {
-                           return true;
-                       }
-                       //if (f.name.match(/^nbproject/)) {
-                       //    return true;
-                       //}
-                       // ignore anything in top level!!!!
-                       if (this.gitpath.length < 1) {
-                               return true;
-                       }
-                       
-                       return false;
-               }
-               
-               /** -- statics --*/
-               
-               public static int indexOfAdd( Array<GitMonitorQueue> add_files, string add)
-               {
-                       for(var i =0; i < add_files.length; i++) {
-                               if (add_files.index(i).vname == add) {
-                                       return i;
-                               }
-                       }
-                       return -1;
-               }
-               public static  int indexOfMessage(Array<GitMonitorQueue> messages, string message)  {
-                       for(var i =0; i < messages.length; i++) {
-                               if (messages.index(i).message == message) {
-                                       return i;
-                               }
-                       }
-                       return -1;
-               }
-               public static string messageToString(Array<GitMonitorQueue> messages ) {
-                       string[] ret = {};
-                       for(var i =0; i < messages.length; i++) {
-                               ret+= messages.index(i).message;
-                       }
-                       return string.joinv("\n",ret);
-               }
-               public static string queueArrayToString(Array<GitMonitorQueue> list) {
-                       var ret = "";
-                       for(var i =0; i < list.length; i++) {
-                               
-                               ret += (ret.length > 0 ? ", " : "") + list.index(i).vname;
-                       }
-                       return ret;
-                       
-               }
-               
-               public static bool  queueHas(Array<GitMonitorQueue> list , GitMonitorQueue cmd_s, string action) {
-                       for(var i =0; i < list.length; i++) {
-                               var test = list.index(i);
-                               if (list.index(i).gitpath != cmd_s.gitpath) {
-                                       continue;
-                               }
-                               if (list.index(i).vname != cmd_s.vname) {
-                                       continue;
-                               }
-                               if (list.index(i).action != action) {
-                                       continue;
-                               }
-                               return true;
-                       }
-                       return false;
-               }
-               public string fullpath()
-               {
-                       return this.gitpath + "/" + this.vname;
-               }
-               
-                       
-                       
-}
 
 
 
@@ -173,31 +34,41 @@ public class GitMonitor : Monitor
        public static string gitlive;
        
        
-       public Array<GitMonitorQueue> queue ;
+       private Gee.ArrayList<GitMonitorQueue> queue ;
        public bool queueRunning = false;
        
        public DateTime lastAdd;
-       private static  Canberra.Context sound_context; 
+
+
+       public GitMonitor ()
+       {
        
-       public GitMonitor () {
-               this.queue = new Array<GitMonitorQueue>();
+               this.queue = new Gee.ArrayList<GitMonitorQueue>();
                GitMonitor.gitmonitor = this;
-               
-               Timeout.add_full(Priority.LOW, 1000, () => {
-                       
-                       //print("TIMEOUT queue length = %d, is_runing = %s\n", (int)this.queue.length , this.queueRunning ? "Y" : "N");
+               Timeout.add_full(Priority.LOW, 500, () => {
+
+                       //GLib.debug("TIMEOUT queue length = %d, is_runing = %s\n", (int)this.queue.length , this.queueRunning ? "Y" : "N");
 
                        //stdout.printf("QL %u: QR: %d\n", this.queue.length, this.queueRunning ? 1 : 0);
-                       if (this.queue.length < 1  || this.queueRunning) {
+                       if (this.queue.size < 1  || this.queueRunning) {
                                return true;
                        }
+                       var first = this.queue.get(0);
+                       var delay = true;
+                       
+                       // eg. on master.... and is_auto branch
+                       if (first.repo.is_master_branch() && first.repo.is_auto_branch()) {
+                               delay = false;
+                       }
+                       
                        
                        var last = -1 * this.lastAdd.difference(new DateTime.now(new TimeZone.local()));
  
                        // stdout.printf("LAST RUN: %s (expect %s) \n" ,
                        //         last.to_string(),   (5 * TimeSpan.SECOND).to_string() );
  
-                       if (last < 5 * TimeSpan.SECOND) { // wait 5 seconds before running. ????
+                       if (delay && last < 5 * TimeSpan.SECOND) { // wait 5 seconds before running. ????
                                return true;
                        }
                        //_this.lastAdd = new Date();
@@ -207,7 +78,6 @@ public class GitMonitor : Monitor
                        return true; //
                });
                
-               
        }
 
        public new void pauseError(string failure) 
@@ -223,14 +93,25 @@ public class GitMonitor : Monitor
                notification.set_timeout(60); // show errros for longer
                notification.show();
                
-               
+        Canberra.Context context;
+        Canberra.Proplist props;
+
+        Canberra.Context.create (out context);
+        Canberra.Proplist.create (out props);
+
+        props.sets (Canberra.PROP_EVENT_ID, "phone-outgoing-busy");
+        props.sets (Canberra.PROP_EVENT_DESCRIPTION, "Gitlive stopped on error");
+
+        context.play_full (0, props, null);
+
 
                        
        
                this.paused = true;
                this.queueRunning = false;
                // what does this do to the old one...
-               this.queue = new Array<GitMonitorQueue> ();
+               //this.queue = new Gee.ArrayList<GitMonitorQueue> ();
                this.stop();
                StatusIconA.statusicon.pauseError();
                
@@ -251,11 +132,17 @@ public class GitMonitor : Monitor
        public new void pause() {
                this.paused = true;
                // what does this do to the old one...
-               this.queue = new Array<GitMonitorQueue> ();
+               //this.queue = new Gee.ArrayList<GitMonitorQueue> ();
                StatusIconA.statusicon.pause();
 
        }
        
+       public void restoreQueue( Gee.ArrayList<GitMonitorQueue> queue)
+       {
+               //used to restore teh queue after switch branches?/ - breaks our privte queue idea..
+               this.queue = queue;
+       }
+       
        /*
        public new void resume () {
                this.paused = false;
@@ -284,24 +171,8 @@ public class GitMonitor : Monitor
 
                                this.monitor(this.top.index(i) );
                        }
-                       StatusIconA.statusicon.resume();
-                   this.paused = false;
-                  
                        
-                       try {
-
-                         
-                               var notification = new Notify.Notification(
-                                       "Git Live",
-                                       "%s\nMonitoring %u Directories".printf(GitMonitor.gitlive, this.monitors.length), 
-                                        "dialog-information"
-                               );
-               
-                               notification.set_timeout(5);
-                               notification.show();
-                       } catch(Error e) {
-                               GLib.debug("Error sending notification to screen: %s\n",e.message);
-                       }
+                       
                        return false; // do not keep doing this..
 
                });
@@ -310,7 +181,29 @@ public class GitMonitor : Monitor
                
                 
        }
+       int scanning = 0;
+       int scancomplete = 0;
+       public void updateMonitorsComplete()
+       {
+               StatusIconA.statusicon.resume();
+           this.paused = false;
+          
+               
+               try {
 
+                 
+                       var notification = new Notify.Notification(
+                               "Git Live",
+                               "%s\nMonitoring %u Directories".printf(GitMonitor.gitlive, this.monitors.length), 
+                                "dialog-information"
+                       );
+       
+                       notification.set_timeout(5);
+                       notification.show();
+               } catch(Error e) {
+                       GLib.debug("Error sending notification to screen: %s",e.message);
+               }
+       }
 
        public new void stop() {
                StatusIconA.statusicon.pause();
@@ -318,11 +211,18 @@ public class GitMonitor : Monitor
        }
        
        
-       public new void monitor (string path,  int depth = 0)
+       // this is called recursively until we end..
+       
+       public override void monitor (string path,  int depth = 0)
        {
                
+               //GLib.debug("GitMonitor : monitor %d %s", depth, path);
                //var depth = typeof(depth) == 'number'  ? depth *1 : 0;
                
+               if (depth == 0) {
+                       this.scancomplete = 0;  
+                       this.scanning = 0;      
+               }
                 
                // if we are not at top level.. and there is a .git directory  (it's a submodule .. ignore) 
                if (depth > 1 && FileUtils.test(path + "/.git" , FileTest.IS_DIR)) {
@@ -330,6 +230,21 @@ public class GitMonitor : Monitor
                }
                
                if (depth == 1) {
+               
+                       if (!FileUtils.test(path + "/.git" , FileTest.IS_DIR)) {
+                               return; // skip non-git directories..
+                       }
+                       this.scanning++;
+                       GitRepo.get.begin(path, (ojb,res) => {
+                               
+                               GitRepo.get.end(res);
+                               base.monitor(path, depth);
+                               this.scanning--;
+                               if (this.scanning == 0 && this.scancomplete == 1) {
+                                       this.updateMonitorsComplete();
+                               }
+                       });
+                       return;
                        // FIXME - check if repo is flagged as not autocommit..
                        //var repo = imports.Scm.Repo.Repo.get(path);
                        //if (!repo || !repo.autocommit()) {
@@ -343,6 +258,11 @@ public class GitMonitor : Monitor
                
                
                base.monitor(path, depth);
+               if (depth == 0) {
+                       this.scancomplete = 1;          
+               }
+               
+               
        }
 
        
@@ -358,22 +278,35 @@ public class GitMonitor : Monitor
        public void runQueue()
        {
                
-               if (this.paused) {
+               if (this.paused || this.queue.size < 1 ) {
                        return;
                }
-               GLib.debug("GitMonitor.runQueue\n");
+               
+               foreach(var q in this.queue) {
+                       if (!q.shouldIgnore() && q.repo.is_master_branch() && q.repo.is_auto_branch()) {
+                               var oldq = this.queue;
+                               this.queue =  new Gee.ArrayList<GitMonitorQueue>(); 
+                               NewBranch.singleton().show(q.repo, oldq);
+                               
+                               return;
+                       }
+               
+               }
+               
+                
+               
+               GLib.debug("GitMonitor.runQueue size =%d\n", this.queue.size);
 
                this.queueRunning = true;
 
-               var cmds = new Array<GitMonitorQueue>();
+               var cmds = new Gee.ArrayList<GitMonitorQueue>();
 
-               for(var i = 0; i < this.queue.length; i++) {
-                       cmds.append_val(this.queue.index(i));
+               for(var i = 0; i < this.queue.size; i++) {
+                       cmds.add(this.queue.get(i));
                }
 
-               this.queue = new Array<GitMonitorQueue>();// empty queue!
-
-               
+               this.queue = new Gee.ArrayList<GitMonitorQueue>();// empty queue!
                string[] success = {};
                string[] failure = {};
           //var repos = new Array<GitRepo>(); //??
@@ -389,47 +322,57 @@ public class GitMonitor : Monitor
 
                this.paused = true;
 
-               GLib.debug("GitMonitor.runQueue - creating repos\n");
+               var leave_queued = new Gee.ArrayList<GitMonitorQueue>();
+               GLib.debug("GitMonitor.runQueue - creating repos");
                
-               for(var i = 0; i < cmds.length; i++) {
+               for(var i = 0; i < cmds.size; i++) {
                   
-                       var cmd = cmds.index(i);
+                       var cmd = cmds.get(i);
                
                        var gitpath = cmd.gitpath; 
-                       GLib.debug("GitMonitor.runQueue - finding %s\n", cmd.gitpath);
+                       
+                       var repo = GitRepo.get_sync( gitpath );
+                       if ( repo.is_master_branch() && repo.is_auto_branch()) {
+                               leave_queued.add(cmd);
+                               continue;
+                       }
+                       
+                       GLib.debug("GitMonitor.runQueue - finding %s", cmd.gitpath);
                
-                       var ix  = GitRepo.indexOf(repo_list,  cmd.gitpath);
+                       var ix  = GitRepo.indexOf(repo_list,   gitpath);
                        if (ix < 0) {
-                               repo_list.append_val(new GitRepo( gitpath ));
+                               repo_list.append_val( GitRepo.get_sync( gitpath ));
                                ix = GitRepo.indexOf(repo_list,  cmd.gitpath);
                        }
-                       GLib.debug("GitMonitor.runQueue - adding to repolist %d\n", ix);
+                       GLib.debug("GitMonitor.runQueue - adding to repolist %d", ix);
 
                        //if (typeof(repo_list[gitpath]) == 'undefined') {
                        //    repo_list[gitpath] = new imports.Scm.Git.Repo.Repo( { repopath : gitpath });
                        //    repo_list[gitpath].cmds = [];
                         //   repo_list[gitpath].pull();
                        //}
-                       repo_list.index(ix).cmds.append_val(cmd);
+                       repo_list.index(ix).cmds.add(cmd);
 
                }
+               this.queue = leave_queued;
+               
                this.paused = false;
                // build add, remove and commit message list..
 
-               GLib.debug("GitMonitor.runQueue - creating actions\n");
+               GLib.debug("GitMonitor.runQueue - creating actions");
                
                for(var i = 0;i < repo_list.length;i++) {
         
                        var repo = repo_list.index(i);
 
-                       var add_files = new Array<GitMonitorQueue>();
-                       var add_files_f = new Array<GitMonitorQueue>();
-                       var remove_files = new Array<GitMonitorQueue>();
-                       var messages = new Array<GitMonitorQueue>();
+                       var add_files = new Gee.ArrayList<GitMonitorQueue>();
+                       var add_files_f = new Gee.ArrayList<GitMonitorQueue>();
+                       var remove_files = new Gee.ArrayList<GitMonitorQueue>();
+                       var messages = new Gee.ArrayList<GitMonitorQueue>();
                        //print(JSON.stringify(repo.cmds,null,4));
                        
-                       for(var ii = 0;ii < repo.cmds.length;ii++) {
-                               var cmd = repo.cmds.index(ii);
+                       for(var ii = 0;ii < repo.cmds.size;ii++) {
+                               var cmd = repo.cmds.get(ii);
        
                                if (repo.is_ignore(cmd.vname)) {
                                        continue;
@@ -443,7 +386,7 @@ public class GitMonitor : Monitor
                                                   break;
                                                }
                                                
-                                               add_files.append_val(cmd);
+                                               add_files.add(cmd);
                                                break;
                                        
                                        case "rm":
@@ -456,14 +399,14 @@ public class GitMonitor : Monitor
                                                        break;
                                                }
                                                
-                                               remove_files.append_val(cmd);
+                                               remove_files.add(cmd);
                                                break;
                                        
                                        case "commit" :
                                                if (GitMonitorQueue.indexOfMessage(messages, cmd.message) > -1 ) {
                                                   break;
                                                }
-                                               messages.append_val(cmd);
+                                               messages.add(cmd);
                                                
                                                break;
                                        default:
@@ -471,8 +414,11 @@ public class GitMonitor : Monitor
                                                break;
                                } 
                        }
-                       GLib.debug( "ADD : %s\n", GitMonitorQueue.queueArrayToString(add_files));
-                       GLib.debug( "REMOVE FILES: %s\n", GitMonitorQueue.queueArrayToString(remove_files));
+                       
+                       repo.cmds.clear(); // reset the repo's command list..
+                       
+                       GLib.debug( "ADD : %s", GitMonitorQueue.queueArrayToString(add_files));
+                       GLib.debug( "REMOVE FILES: %s", GitMonitorQueue.queueArrayToString(remove_files));
                        
                        //repo.debug = 1;
                        // these can fail... at present... as we wildcard stuff.
@@ -490,37 +436,35 @@ public class GitMonitor : Monitor
                        */
                        
                        // if file was added, then removed, 
-                       var remove_files_f = new Array<GitMonitorQueue>();
-                       for(var ii = 0;ii < remove_files.length;ii++) {
+                       var remove_files_f = new Gee.ArrayList<GitMonitorQueue>();
+                       for(var ii = 0;ii < remove_files.size;ii++) {
                                
                                
                                
-                               if (GitMonitorQueue.indexOfAdd(add_files,  remove_files.index(ii).vname) > -1 ) {
+                               if (GitMonitorQueue.indexOfAdd(add_files,  remove_files.get(ii).vname) > -1 ) {
                                        // in add and remove - do not remvove
                                        continue;
                                }
-                               remove_files_f.append_val(remove_files.index(ii));
+                               remove_files_f.add(remove_files.get(ii));
                        };
-                       for(var ii = 0;ii < add_files.length;ii++) {
-                               if (GitMonitorQueue.indexOfAdd(remove_files,  add_files.index(ii).vname) > -1 ) {
+                       for(var ii = 0;ii < add_files.size;ii++) {
+                               if (GitMonitorQueue.indexOfAdd(remove_files,  add_files.get(ii).vname) > -1 ) {
                                        // the add file is in the remove list, and it does not exist - do not add it..
-                                       print("check exists ? %s\n",add_files.index(ii).fullpath());
+                                       print("check exists ? %s\n",add_files.get(ii).fullpath());
                                        
-                                       if (!FileUtils.test(add_files.index(ii).fullpath(), FileTest.EXISTS)) {
+                                       if (!FileUtils.test(add_files.get(ii).fullpath(), FileTest.EXISTS)) {
                                                        continue;
                                        }
                                         
-                               }
-                               
-                               
+                               } 
                                
-                               add_files_f.append_val(add_files.index(ii));
+                               add_files_f.add(add_files.get(ii));
                        };
                        
-                       GLib.debug( "ADD : %s\n", GitMonitorQueue.queueArrayToString(add_files_f));
-                       GLib.debug( "REMOVE FILES: %s\n", GitMonitorQueue.queueArrayToString(remove_files_f));
+                       GLib.debug( "ADD : %s", GitMonitorQueue.queueArrayToString(add_files_f));
+                       GLib.debug( "REMOVE FILES: %s", GitMonitorQueue.queueArrayToString(remove_files_f));
                    
-                   if (add_files_f.length < 1 && remove_files_f.length < 1) {
+                   if (add_files_f.size < 1 && remove_files_f.size < 1) {
                                continue;
                    }
                    
@@ -546,7 +490,7 @@ public class GitMonitor : Monitor
                                this.pauseError(e.message);
                                return;
                                failure +=  e.message;
-                               GLib.debug("Add failed:\n");
+                               GLib.debug("Add failed:");
                        }  
                        try {
                                 repo.remove(remove_files_f);
@@ -554,10 +498,9 @@ public class GitMonitor : Monitor
                                this.pauseError(e.message);
                                return;
                                failure +=  e.message;
-                               GLib.debug("Remove failed:\n");
+                               GLib.debug("Remove failed:");
                        }  
-
-
                        try { 
                                success += repo.commit(
                                        GitMonitorQueue.messageToString(messages),
@@ -565,12 +508,13 @@ public class GitMonitor : Monitor
                                );
                                success += repo.push();
 
+
                        } catch(Error e) {
                        
                                // if the error is 'nothing to commit, working tree clean'
                                // then it's not an error, - just continue;
                                if (/nothing to commit, working tree clean/.match(e.message)) {
-                                       GLib.debug("%s\n",e.message);
+                                       GLib.debug("%s",e.message);
                                        success += e.message;
                                        this.paused = false; 
                                        continue;
@@ -652,15 +596,15 @@ public class GitMonitor : Monitor
                if (this.paused) {
                        return;
                }
-               GLib.debug("GitMonitor.onChangedHint\n");                               
+               GLib.debug("GitMonitor.onChangedHint");                         
 
                this.lastAdd = new DateTime.now(new TimeZone.local()); 
                var cmd = new GitMonitorQueue(src);
                if (cmd.shouldIgnore()) {
+                       GLib.debug("GitMonitor.onChangedHint - ignored");
                        return;
                }
                
-          
                //var add_it = false;
                /*
                if (this.is_just_created(cmd.path)) {
@@ -678,12 +622,12 @@ public class GitMonitor : Monitor
                }
                */
                cmd.action = "add";
-               this.queue.append_val(cmd);
+               this.queue.add(cmd);
 
                cmd = new GitMonitorQueue(src);
                cmd.action = "commit";
                cmd.message = cmd.vname;
-               this.queue.append_val(cmd);
+               this.queue.add(cmd);
  
                 
        }
@@ -693,7 +637,7 @@ public class GitMonitor : Monitor
                if (this.paused) {
                        return;
                }
-               GLib.debug("GitMonitor.onDeleted\n");                   
+               GLib.debug("GitMonitor.onDeleted");                     
                this.lastAdd = new DateTime.now(new TimeZone.local()); 
                var cmd = new GitMonitorQueue(src);
                if (cmd.shouldIgnore()) {
@@ -702,14 +646,14 @@ public class GitMonitor : Monitor
                // should check if monitor needs removing..
                // it should also check if it was a directory.. - so we dont have to commit all..
                cmd.action = "rm";
-               this.queue.append_val(cmd);
+               this.queue.add(cmd);
 
                cmd = new GitMonitorQueue(src);
                cmd.action = "commit";
                cmd.message = cmd.vname;
                cmd.commit_all = true;
 
-               this.queue.append_val(cmd);
+               this.queue.add(cmd);
  
        }
        public override  void onCreated(MonitorNamePathDir src) {
@@ -717,7 +661,7 @@ public class GitMonitor : Monitor
                if (this.paused) {
                        return;
                }
-               GLib.debug("GitMonitor.onCreated\n");                   
+               GLib.debug("GitMonitor.onCreated");                     
                this.lastAdd = new DateTime.now(new TimeZone.local()); 
                var cmd = new GitMonitorQueue(src);
                if (cmd.shouldIgnore()) {
@@ -743,12 +687,13 @@ public class GitMonitor : Monitor
 
        }
 
-       public  override void onAttributeChanged(MonitorNamePathDir src) { 
+       public  override void onAttributeChanged(MonitorNamePathDir src) 
+       { 
 
                if (this.paused) {
                        return;
                }
-               GLib.debug("GitMonitor.onAttributeChanged\n");                  
+               GLib.debug("GitMonitor.onAttributeChanged %s", src.name);                       
                if (src.dir == GitMonitor.gitlive) {
                   return; // attribute on top level..
                }
@@ -759,12 +704,12 @@ public class GitMonitor : Monitor
                        return;
                }
                cmd.action = "add";
-               this.queue.append_val(cmd);
+               this.queue.add(cmd);
 
                cmd = new GitMonitorQueue(src);
                cmd.action = "commit";
                cmd.message = "Attribute changed " + cmd.vname;
-               this.queue.append_val(cmd);
+               this.queue.add(cmd);
        }
  
    public  override void onMoved(MonitorNamePathDir src,MonitorNamePathDir dest)  
@@ -773,7 +718,7 @@ public class GitMonitor : Monitor
                if (this.paused) {
                        return;
                }
-               GLib.debug("GitMonitor.onMoved\n");                     
+               GLib.debug("GitMonitor.onMoved");                       
                this.lastAdd = new DateTime.now(new TimeZone.local()); 
                var cmd_s = new GitMonitorQueue(src);
 
@@ -797,21 +742,18 @@ public class GitMonitor : Monitor
                if (cmd_d.shouldIgnore()) {
                        
                        this.onDeleted(src);
-
                        return;
                }
-               
-               
-               GLib.debug("RM: %s\n", cmd_s.vname);
+                
+               GLib.debug("RM: %s", cmd_s.vname);
                cmd_s.action = "rm";
-               this.queue.append_val(cmd_s);
+               this.queue.add(cmd_s);
 
                
                
-               GLib.debug("ADD: %s\n", cmd_d.vname);
+               GLib.debug("ADD: %s", cmd_d.vname);
                cmd_d.action = "add";
-               this.queue.append_val(cmd_d);
+               this.queue.add(cmd_d);
 
 
                var cmd = new GitMonitorQueue(dest);
@@ -821,7 +763,7 @@ public class GitMonitor : Monitor
                        cmd.message = cmd_d.vname;
                }
                
-               this.queue.append_val(cmd);
+               this.queue.add(cmd);