public GitMonitor () {
this.queue = new Array<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");
+
+ //stdout.printf("QL %u: QR: %d\n", this.queue.length, this.queueRunning ? 1 : 0);
+ if (this.queue.length < 1 || this.queueRunning) {
+ return true;
+ }
+
+ 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. ????
+ return true;
+ }
+ //_this.lastAdd = new Date();
+ //return 1;
+
+ this.runQueue();
+ return true; //
+ });
+
+
}
public new void pauseError(string failure)
notification.set_timeout(60); // show errros for longer
notification.show();
-
+
+
+
+
this.paused = true;
+ this.queueRunning = false;
// what does this do to the old one...
this.queue = new Array<GitMonitorQueue> ();
this.stop();
StatusIconA.statusicon.pauseError();
+
+ var m = new Gtk.MessageDialog(null, Gtk.DialogFlags.MODAL,Gtk.MessageType.ERROR,Gtk.ButtonsType.CLOSE,
+ "A Serious problem occured running git, you will probably have to resolve this manually\n" +
+ "Committing is paused now, so fix the problem, close this window, then press start again\n\n\n" +
+ failure
+ );
+ m.set_keep_above(true);
+ m.show();
+ m.set_position(Gtk.WindowPosition.CENTER);
+ m.response.connect( (id_pressed) => {
+ m.hide();
+ });
+
}
public new void pause() {
});
- Timeout.add_full(Priority.LOW, 1000, () => {
- //TIMEOUT", _this.queue.length , _this.queueRunning].join(', '));
-
- //stdout.printf("QL %u: QR: %d\n", this.queue.length, this.queueRunning ? 1 : 0);
- if (this.queue.length < 1 || this.queueRunning) {
- return true;
- }
-
- 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. ????
- return true;
- }
- //_this.lastAdd = new Date();
- //return 1;
- this.runQueue();
- return true; //
- });
}
// make sure monitoring is paused so it does not recursively pick up
// deletions
+ this.paused = true;
+
+
try {
+
repo.pull();
} catch(Error e) {
this.pauseError(e.message);
//print("Pull failed:\n");
return;
}
-
-
+
// -- DO STUFF..
try {
repo.add(add_files_f);
print("Remove failed:\n");
}
- this.paused = false;
+
try {
success += repo.push();
} catch(Error e) {
+ this.paused = false;
this.pauseError(e.message);
+
return;
- failure += e.message;
- print("Push failed:\n");
+ //failure += e.message;
+ //print("Push failed:\n");
}
+ this.paused = false;
}
public override void onChanged(MonitorNamePathDir src)
{
- print("GitMonitor.onChanged\n");
+ //print("GitMonitor.onChanged\n");
return; // always ignore this..?
//this.parsePath(src);
}
*/
public override void onChangesDoneHint(MonitorNamePathDir src)
{
- print("GitMonitor.onChangedHint\n");
+
if (this.paused) {
return;
}
-
+ print("GitMonitor.onChangedHint\n");
this.lastAdd = new DateTime.now(new TimeZone.local());
var cmd = new GitMonitorQueue(src);
}
public override void onDeleted(MonitorNamePathDir src)
{
- print("GitMonitor.onDeleted\n");
+
if (this.paused) {
return;
}
+ print("GitMonitor.onDeleted\n");
this.lastAdd = new DateTime.now(new TimeZone.local());
var cmd = new GitMonitorQueue(src);
if (cmd.shouldIgnore()) {
}
public override void onCreated(MonitorNamePathDir src) {
- print("GitMonitor.onCreated\n");
+
if (this.paused) {
return;
}
+ print("GitMonitor.onCreated\n");
this.lastAdd = new DateTime.now(new TimeZone.local());
var cmd = new GitMonitorQueue(src);
if (cmd.shouldIgnore()) {
}
public override void onAttributeChanged(MonitorNamePathDir src) {
- print("GitMonitor.onAttributeChanged\n");
+
if (this.paused) {
return;
}
+ print("GitMonitor.onAttributeChanged\n");
if (src.dir == GitMonitor.gitlive) {
return; // attribute on top level..
}
public override void onMoved(MonitorNamePathDir src,MonitorNamePathDir dest)
{
- print("GitMonitor.onMoved\n");
+
if (this.paused) {
return;
}
+ print("GitMonitor.onMoved\n");
this.lastAdd = new DateTime.now(new TimeZone.local());
var cmd_s = new GitMonitorQueue(src);