X-Git-Url: http://git.roojs.org/?p=gitlive;a=blobdiff_plain;f=WindowLog.vala;h=d63516c704fd9f823fa9c690d36c0a02adfd25a8;hp=a6ccbe8e408a462bd199c860f29003190deb1b11;hb=refs%2Fheads%2Fwip_alan_T5649_Example_fix_for_blog_post;hpb=bc5a9151fed626cfb312e54ff9ea2a3ca0af7972 diff --git a/WindowLog.vala b/WindowLog.vala index a6ccbe8e..d63516c7 100644 --- a/WindowLog.vala +++ b/WindowLog.vala @@ -24,9 +24,7 @@ public class WindowLog : Object { return this.getStatus(); } ); //Roo.log("Windowlog start"); - this.screen.active_window_changed.connect((pr_win) => { - this.windowChanged(); - }); + this.screen.active_window_changed.connect( this.windowChanged ); } @@ -44,7 +42,7 @@ public class WindowLog : Object { try { this.write("", "IDLE"); } catch (Error e) { - print(e.message + "\n"); + GLib.debug("%s",e.message); } } this.win = ""; @@ -53,7 +51,7 @@ public class WindowLog : Object { return true; } - public void windowChanged() + public void windowChanged(Wnck.Window? pr_win) { this.screen.force_update(); // print("window changeD"); @@ -69,7 +67,7 @@ public class WindowLog : Object { //var cmd = File.realpath('/proc/'+ pid + '/exe'); string cmd = ""; - print("/proc/%u/cmdline".printf(pid) + "\n"); + // print("/proc/%u/cmdline".printf(pid) + "\n"); if (pid > 0 ) { var cf = File.new_for_path("/proc/%u/cmdline".printf(pid)); @@ -80,7 +78,7 @@ public class WindowLog : Object { cmd = "UNKNOWN"; } // has it changed? - print(this.win +"\n" + cmd + "\n"); + //print(this.win +"\n" + cmd + "\n"); if (this.win.length < 1 || (win != this.win)) { //print((xDate.newDate()).format("Y-m-d H:i:s") + " " + win + ' - '+ cmd ); @@ -88,7 +86,7 @@ public class WindowLog : Object { this.win=win; } } catch (Error e) { - print(e.message + "\n"); + GLib.debug("%s",e.message); } @@ -102,7 +100,7 @@ public class WindowLog : Object { var now = new DateTime.now(new TimeZone.local()); var dir = this.outdir + now.format("/%Y/%m"); - print(dir + "\n"); + //print(dir + "\n"); if (this.lastdir.length < 1 || this.lastdir != dir) { @@ -115,17 +113,17 @@ public class WindowLog : Object { this.lastdir = dir; } - + var fname = now.format("/%d") + ".log"; var path = dir + "/" + fname; var time = now.format("%H:%M:%S "); - print("time: " + time + "\n"); + //print("time: " + time + "\n"); var f = File.new_for_path(path); - FileOutputStream ios = f.append_to (FileCreateFlags.NONE); + var ios = f.append_to (FileCreateFlags.NONE); var data_out = new DataOutputStream (ios); data_out.put_string("\n" +time + str + " " + cmd, null); - print(time + str + " " + cmd + "\n"); + GLib.debug("%s%s %s",time , str , cmd); data_out.close(null);