From 42d8039de6978194db07a9f2dc068619eafbf323 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Tue, 21 Jun 2011 01:04:21 +0100 Subject: [PATCH] make adding a note work --- SparkleLib/Git/SparkleRepoGit.cs | 6 +++--- SparkleShare/Mac/SparkleEventLog.cs | 13 +++++++++++-- data/html/event-log.html | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index 5ab92c41..61cc2b54 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -546,16 +546,16 @@ namespace SparkleLib { " " + SparkleConfig.DefaultConfig.UserName + "" + n + " " + SparkleConfig.DefaultConfig.UserEmail + "" + n + " " + n + - " " + (DateTime.UtcNow - new DateTime (1970, 1, 1)).TotalSeconds + "" + n + + " " + (int) (DateTime.UtcNow - new DateTime (1970, 1, 1)).TotalSeconds + "" + n + " " + note + "" + n + ""; - SparkleGit git = new SparkleGit (LocalPath, "note append -m " + note); + SparkleGit git = new SparkleGit (LocalPath, "notes append -m '" + note + "'"); git.Start (); git.WaitForExit (); while (Status != SyncStatus.Idle) { - Thread.Sleep (5 * 20); + System.Threading.Thread.Sleep (5 * 20); } SyncUp (); diff --git a/SparkleShare/Mac/SparkleEventLog.cs b/SparkleShare/Mac/SparkleEventLog.cs index f7ace84f..21677687 100644 --- a/SparkleShare/Mac/SparkleEventLog.cs +++ b/SparkleShare/Mac/SparkleEventLog.cs @@ -213,8 +213,17 @@ namespace SparkleShare { public override void DecidePolicyForNavigation (WebView web_view, NSDictionary action_info, NSUrlRequest request, WebFrame frame, NSObject decision_token) - {Console.WriteLine ("fffffffffffff"); - Console.WriteLine (request.Url.ToString ()); + { + string url = request.Url.ToString (); + Console.WriteLine (url); + string id = url.Substring (0, url.IndexOf ("%20")); + string note = url.Substring (url.IndexOf ("%20") + 3); + Console.WriteLine (id + " " + note); + + SparkleShare.Controller.Repositories [0].AddNote (id, note); + return; + + string file_path = request.Url.ToString (); file_path = file_path.Replace ("%20", " "); diff --git a/data/html/event-log.html b/data/html/event-log.html index a74f757e..af2dae75 100644 --- a/data/html/event-log.html +++ b/data/html/event-log.html @@ -21,7 +21,7 @@ table.html (comments); - location = '?' + this.id + '&text=' + text; + location = this.id + ' ' + text; }); });