From f9915555d4e32159c793de197096253558a6fe63 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Mon, 14 Aug 2017 11:57:22 +0800 Subject: [PATCH] sync --- GitMonitor.vala | 45 +++++++++++++++++++++++++++------------------ GitRepo.vala | 4 ++-- Spawn.vala | 11 ++++------- StatusIcon.vala | 19 +++++++++++-------- 4 files changed, 44 insertions(+), 35 deletions(-) diff --git a/GitMonitor.vala b/GitMonitor.vala index 67288bbc..bf890be2 100644 --- a/GitMonitor.vala +++ b/GitMonitor.vala @@ -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 (); + 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); diff --git a/GitRepo.vala b/GitRepo.vala index 14064cc7..e962e5d1 100644 --- a/GitRepo.vala +++ b/GitRepo.vala @@ -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 ? diff --git a/Spawn.vala b/Spawn.vala index c99f962d..0d30de58 100644 --- a/Spawn.vala +++ b/Spawn.vala @@ -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; } diff --git a/StatusIcon.vala b/StatusIcon.vala index e728ff40..42bccd74 100644 --- a/StatusIcon.vala +++ b/StatusIcon.vala @@ -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 -- 2.39.2