sync
authorAlan Knowles <alan@roojs.com>
Mon, 14 Aug 2017 03:57:22 +0000 (11:57 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 14 Aug 2017 03:57:22 +0000 (11:57 +0800)
GitMonitor.vala
GitRepo.vala
Spawn.vala
StatusIcon.vala

index 67288bb..bf890be 100644 (file)
@@ -179,14 +179,26 @@ public class GitMonitor : Monitor
                GitMonitor.gitmonitor = this;
        }
 
-       public new void pauseError() {
+       public new void pauseError(string failure) 
+       {
+       
+               var notification = new Notify.Notification(
+                         "Git Live ERROR!!",
+                       failure,
+                       "dialog-information"
+                       
+               );
+                       
+               notification.set_timeout(60); // show errros for longer
+               notification.show();
+                               
+       
                this.paused = true;
                // what does this do to the old one...
                this.queue = new Array<GitMonitorQueue> ();
+               this.stop();
                StatusIconA.statusicon.pauseError();
-
        }
-
  
        public new void pause() {
                this.paused = true;
@@ -427,6 +439,7 @@ public class GitMonitor : Monitor
                        }
                        print( "ADD : %s\n", GitMonitorQueue.queueArrayToString(add_files));
                        print( "REMOVE FILES: %s\n", GitMonitorQueue.queueArrayToString(remove_files));
+                       
                        //repo.debug = 1;
                        // these can fail... at present... as we wildcard stuff.
                   
@@ -481,7 +494,7 @@ public class GitMonitor : Monitor
                        } catch(Error e) {
                                this.pauseError(e.message);
                                //failure +=  e.message;
-                               ..print("Pull failed:\n");
+                               //print("Pull failed:\n");
                                return;
                        }
                        
@@ -490,12 +503,16 @@ public class GitMonitor : Monitor
                        try {
                                repo.add(add_files_f);
                        } catch(Error e) {
+                               this.pauseError(e.message);
+                               return;
                                failure +=  e.message;
                                print("Add failed:\n");
                        }  
                        try {
                                 repo.remove(remove_files_f);
                        } catch(Error e) {
+                               this.pauseError(e.message);
+                               return;
                                failure +=  e.message;
                                print("Remove failed:\n");
                        }  
@@ -511,6 +528,8 @@ public class GitMonitor : Monitor
                                success += repo.push();
 
                        } catch(Error e) {
+                               this.pauseError(e.message);
+                               return;
                                failure += e.message;
                                print("Push failed:\n");
                                
@@ -536,21 +555,11 @@ public class GitMonitor : Monitor
                                notification.show();   
                        }
                        
-                       if (failure.length > 0) {
+                       //if (failure.length > 0) {
 
-                               var notification = new Notify.Notification(
-                                         "Git Live ERROR!!",
-                                       string.joinv("\n",failure),
-                                       "dialog-information"
-                                       
-                               );
-                               
-       
-                               notification.set_timeout(10); // show errros for longer
-                               notification.show();
-                               
-                               this.pauseError();   
-                       }
+                               // should never get this far...
+                       //      this.pauseError();   
+                       //}
                } catch(Error e) {
                        print(e.message);
                        
index 14064cc..e962e5d 100644 (file)
@@ -275,13 +275,12 @@ public class GitRepo : Object
     {
         // convert arguments.
         
-
         string[]  args = { "git" };
         //args +=  "--git-dir";
         //args +=  this.gitdir;
         args +=  "--no-pager";
  
-
         //if (this.gitdir != this.repopath) {
         //    args +=   "--work-tree";
          //   args += this.repopath; 
@@ -310,6 +309,7 @@ public class GitRepo : Object
 
        // may throw error...
         var sp = new Spawn(cfg);
+      
 
         stdout.printf( "GOT: %s\n" , sp.output);
         // parse output for some commands ?
index c99f962..0d30de5 100644 (file)
@@ -352,19 +352,16 @@ public class Spawn : Object
         
         
         if (this.cfg.exceptions && this.result != 0) {
-                       
-                       var errstr = this.output;
-                       errstr += errstr.length > 0 ? "\n" : "";
+                       var errstr = string.joinv(" ", this.cfg.args) + "\n";
+                       errstr += this.output;
+                       errstr += this.output.length > 0 ? "\n" : "";
                        errstr += this.stderr;
-                       print("Throwing execute error:%s\n", errstr);
+                       //print("Throwing execute error:%s\n", errstr);
             throw new SpawnError.EXECUTE_ERROR(errstr);
             //this.toString = function() { return this.stderr; };
             ///throw new Exception this; // we throw self...
         }
-        
-        
         // finally throw, or return self..
-        
         return;
     
     }
index e728ff4..42bccd7 100644 (file)
@@ -98,27 +98,30 @@ public class StatusIconA : StatusIcon {
         
     }
     
-    void pause()
+    public void pause()
     {
                this.set_from_stock( Gtk.Stock.MEDIA_PAUSE );
+               this.paused = true;
     }
-    void resume()
+    
+    public void resume()
     {
                this.set_from_stock( Gtk.Stock.MEDIA_PLAY );
-               this.error_animate= false;
+               this.paused = false;
     }
     
-    void refreshing()
+    public void refreshing()
     {
                this.set_from_stock( Gtk.Stock.REFRESH );
     }
-    void pauseError()
+    
+    public void pauseError()
     {
-                this.error_animate = true;
+                this.paused = true;
                 var flag = true;
                 Timeout.add_full(Priority.LOW, 500, () => {
                 
-                       if (!this.error_animate) {
+                       if (!this.paused) {
                                return false;
                        }
                        this.set_from_stock( flag == true ? Gtk.Stock.MEDIA_RECORD  
@@ -364,4 +367,4 @@ public class StatusIconA : StatusIcon {
 }
       
                 
-                  
+                  
\ No newline at end of file