From a2f459376027e4fa429e32ad49dd88829f40b51e Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 27 Sep 2017 17:53:55 +0800 Subject: [PATCH] sync --- Gitlive.vala | 3 + Makefile.am | 4 +- Spawn.vala | 69 +-- StatusIcon.vala | 16 +- old_seed_version/Date.js | 839 ------------------------------- old_seed_version/File.js | 262 ---------- old_seed_version/GitLogParser.js | 362 ------------- 7 files changed, 52 insertions(+), 1503 deletions(-) delete mode 100644 old_seed_version/Date.js delete mode 100644 old_seed_version/File.js delete mode 100644 old_seed_version/GitLogParser.js diff --git a/Gitlive.vala b/Gitlive.vala index 3f564eaf..40d4c461 100644 --- a/Gitlive.vala +++ b/Gitlive.vala @@ -23,6 +23,9 @@ static int main (string[] args) { + + //GLib.Log.set_always_fatal(LogLevelFlags.LEVEL_ERROR | LogLevelFlags.LEVEL_CRITICAL); + Gtk.init (ref args); GitMonitor.gitlive = Environment.get_home_dir() + "/gitlive"; diff --git a/Makefile.am b/Makefile.am index 00a88fa0..8325a2d6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,10 +29,10 @@ Gitlive_SOURCES = \ Gitlive_VALAFLAGS = \ --Xcc=-lXss \ --Xcc=-DWNCK_I_KNOW_THIS_IS_UNSTABLE \ - --thread -X -lm --target-glib=2.32 -g $(Gitlive_PKGS) + --thread -X -lm --target-glib=2.32 -g $(Gitlive_PKGS) -X -O0 Gitlive_CFLAGS = \ - -DWNCK_I_KNOW_THIS_IS_UNSTABLE -lXss -lm -lX11 $(XSCRNSAVER_CFLAGS) + -DWNCK_I_KNOW_THIS_IS_UNSTABLE -lXss -lm -lX11 $(XSCRNSAVER_CFLAGS) -O0 Gitlive_LDADD = $(GITLIVE_LIBS) $(XSCRNSAVER_LIBS) -lX11 diff --git a/Spawn.vala b/Spawn.vala index 6839d77c..704f165f 100644 --- a/Spawn.vala +++ b/Spawn.vala @@ -94,10 +94,7 @@ public class SpawnConfig { } - public void onFinish( SpawnFinish? finish ) { - this.finish = finish; - } - + public void setHandlers( SpawnOutput? output, @@ -203,6 +200,9 @@ public class Spawn : Object */ int out_src = -1; + + unowned SpawnFinish on_finished; + /** * * @method run @@ -213,7 +213,7 @@ public class Spawn : Object public void run( SpawnFinish finished_cb) throws SpawnError, GLib.SpawnError, GLib.IOChannelError { - + this.on_finished = finished_cb; err_src = -1; out_src = -1; int standard_input; @@ -266,29 +266,7 @@ public class Spawn : Object - ChildWatch.add (this.pid, (w_pid, result) => { - - this.result = result; - if (this.cfg.debug) { - stdout.printf("child_watch_add : result:%d\n", result); - } - - this.read(this.out_ch); - this.read(this.err_ch); - - - Process.close_pid(this.pid); - this.pid = -1; - if (this.ctx != null) { - this.ctx.quit(); - this.ctx = null; - } - this.tidyup(); - //print("DONE TIDYUP"); - if (this.cfg.finish != null) { - this.cfg.finish(this.result); - } - }); + ChildWatch.add (this.pid, this.on_child_watch); @@ -338,6 +316,7 @@ public class Spawn : Object } // async - if running - return.. if (this.cfg.async && this.pid > -1) { + //this.ref(); return; } @@ -348,7 +327,7 @@ public class Spawn : Object //if (this.cfg.debug) { // // } - this.ctx = MainLoop (); + this.ctx = new MainLoop (); this.ctx.run(); // wait fore exit? //print("main_loop done!"); @@ -363,7 +342,7 @@ public class Spawn : Object errstr += this.output.length > 0 ? "\n" : ""; errstr += this.stderr; //print("Throwing execute error:%s\n", errstr); - throw SpawnError.EXECUTE_ERROR(errstr); + throw new SpawnError.EXECUTE_ERROR(errstr); //this.toString = function() { return this.stderr; }; ///throw new Exception this; // we throw self... } @@ -371,6 +350,36 @@ public class Spawn : Object return; } + + void on_child_watch(GLib.Pid w_pid, int result) { + + this.result = result; + if (this.cfg.debug) { + stdout.printf("child_watch_add : result:%d\n", result); + } + + this.read(this.out_ch); + this.read(this.err_ch); + + + Process.close_pid(this.pid); + this.pid = -1; + if (this.ctx != null) { + this.ctx.quit(); + this.ctx = null; + + } + //print("child process done - running callback, then tidyup"); + this.on_finished(this.result, this.output); + // this.unref(); + this.tidyup(); + + //print("DONE TIDYUP"); + + + } + + private void tidyup() { diff --git a/StatusIcon.vala b/StatusIcon.vala index a4f5cfdd..e45c18b5 100644 --- a/StatusIcon.vala +++ b/StatusIcon.vala @@ -331,19 +331,19 @@ public class StatusIconA : StatusIcon { { this.total--; if (!Regex.match_simple ("Already up-to-date", res) ) { - - - ret_str += ret_str.length > 0 ? "\n" : ""; - ret_str += "Updated: " +repo.name + "\n" + res +"\n"; - } - if (this.total < 1) { - var notification = new Notify.Notification( + var notification = new Notify.Notification( "Pull completed ", - ret_str, + "Updated: " +repo.name + "\n" + res +"\n", "dialog-information" ); notification.set_timeout(20); notification.show(); + + + + } + if (this.total < 1) { + statusicon.set_tooltip_text("Gitlive"); diff --git a/old_seed_version/Date.js b/old_seed_version/Date.js deleted file mode 100644 index 907df59a..00000000 --- a/old_seed_version/Date.js +++ /dev/null @@ -1,839 +0,0 @@ -/* - * Based on: - * Ext JS Library 1.1.1 - * Copyright(c) 2006-2007, Ext JS, LLC. - * - * Originally Released Under LGPL - original licence link has changed is not relivant. - * - * Fork - LGPL - *