From a20d377192c57c4a0216d143aa2d898aa91cd2f7 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Mon, 15 Oct 2012 21:26:27 +0100 Subject: [PATCH] history: implement back button --- SparkleLib/Git/SparkleRepoGit.cs | 5 ++-- SparkleShare/Common/HTML/event-log.html | 10 ++++++- SparkleShare/Mac/SparkleEventLog.cs | 3 ++- SparkleShare/SparkleEventLogController.cs | 32 ++++++++++------------- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index b24e0e1e..26d76760 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -475,6 +475,7 @@ namespace SparkleLib.Git { foreach (string line in lines) { string conflicting_path = line.Substring (3); conflicting_path = EnsureSpecialCharacters (conflicting_path); + conflicting_path = conflicting_path.Replace ("\"", "\\\""); SparkleLogger.LogInfo ("Git", Name + " | Conflict type: " + line); @@ -553,8 +554,6 @@ namespace SparkleLib.Git { if (revision == null) throw new ArgumentNullException ("revision"); - - path = path.Replace ("\\", "/"); SparkleLogger.LogInfo ("Git", Name + " | Restoring \"" + path + "\" (revision " + revision + ")"); @@ -582,6 +581,8 @@ namespace SparkleLib.Git { // The correct way } else { + path = path.Replace ("\"", "\\\""); + SparkleGit git = new SparkleGit (LocalPath, "show " + revision + ":\"" + path + "\""); git.Start (); diff --git a/SparkleShare/Common/HTML/event-log.html b/SparkleShare/Common/HTML/event-log.html index cef0f3b2..6d250211 100755 --- a/SparkleShare/Common/HTML/event-log.html +++ b/SparkleShare/Common/HTML/event-log.html @@ -76,7 +76,7 @@ cursor: pointer; } - small, small a { + small, small a, small a:hover { font-size: ; color: ; } @@ -107,6 +107,14 @@ font-weight: bold; } + .history-header { + color: #aaa; + padding-top: 22px; + font-weight: bold; + float: left; + margin-left: 32px; + } + .event-entry { padding: 24px 14px 14px 64px; margin: 0 32px 0 32px; diff --git a/SparkleShare/Mac/SparkleEventLog.cs b/SparkleShare/Mac/SparkleEventLog.cs index 92f36b7f..b65801b6 100755 --- a/SparkleShare/Mac/SparkleEventLog.cs +++ b/SparkleShare/Mac/SparkleEventLog.cs @@ -80,6 +80,7 @@ namespace SparkleShare { new SizeF (ContentView.Frame.Width, ContentView.Frame.Height - 39)) }; + this.hidden_close_button = new NSButton () { KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask, KeyEquivalent = "w" @@ -397,7 +398,7 @@ namespace SparkleShare { this.web_view.MainFrame.LoadHtmlString (html, new NSUrl ("")); - web_view.PolicyDelegate = new SparkleWebPolicyDelegate (); + this.web_view.PolicyDelegate = new SparkleWebPolicyDelegate (); ContentView.AddSubview (this.web_view); (this.web_view.PolicyDelegate as SparkleWebPolicyDelegate).LinkClicked += diff --git a/SparkleShare/SparkleEventLogController.cs b/SparkleShare/SparkleEventLogController.cs index b427bbfb..ffba7da5 100755 --- a/SparkleShare/SparkleEventLogController.cs +++ b/SparkleShare/SparkleEventLogController.cs @@ -86,8 +86,6 @@ namespace SparkleShare { public string HTML { get { - this.history_view_active = false; - List change_sets = GetLog (this.selected_folder); string html = GetHTMLLog (change_sets); @@ -255,12 +253,12 @@ namespace SparkleShare { ShowSaveDialogEvent (file_name, target_folder_path); - } else { - // TODO: remove - Program.UI.Bubbles.Controller.ShowBubble ("no match", url, ""); } - - + + } else if (url.StartsWith ("back://")) { + this.history_view_active = false; + SelectedFolder = this.selected_folder; // TODO: Return to the same position on the page + } else if (url.StartsWith ("history://")) { this.history_view_active = true; @@ -281,19 +279,17 @@ namespace SparkleShare { watch.Start (); - List change_sets = repo.GetChangeSets (path, 30); + List change_sets = repo.GetChangeSets (path, 30); - if (change_sets.Count > 1) { - html += "
Revisions for “"; - html += Path.GetFileName (path) + "”
"; - - } else { - html += "
No revisions yet for “"; - html += Path.GetFileName (path) + "”
"; - } + html += "
« Back  |  "; - html += "« Back"; - html += ""; + if (change_sets.Count > 1) + html += "Revisions for “"; + else + html += "No revisions for “"; + + html += Path.GetFileName (path) + "”"; + html += "
"; int count = 0; foreach (SparkleChangeSet change_set in change_sets) {