history: implement back button

This commit is contained in:
Hylke Bons 2012-10-15 21:26:27 +01:00
parent 6f22466eac
commit a20d377192
4 changed files with 28 additions and 22 deletions

View file

@ -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 ();

View file

@ -76,7 +76,7 @@
cursor: pointer;
}
small, small a {
small, small a, small a:hover {
font-size: <!-- $small-font-size -->;
color: <!-- $secondary-font-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;

View file

@ -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 +=

View file

@ -86,8 +86,6 @@ namespace SparkleShare {
public string HTML {
get {
this.history_view_active = false;
List<SparkleChangeSet> 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<SparkleChangeSet> change_sets = repo.GetChangeSets (path, 30);
List<SparkleChangeSet> change_sets = repo.GetChangeSets (path, 30);
if (change_sets.Count > 1) {
html += "<div class='day-entry-header'>Revisions for &ldquo;";
html += Path.GetFileName (path) + "&rdquo;</div>";
} else {
html += "<div class='day-entry-header'>No revisions yet for &ldquo;";
html += Path.GetFileName (path) + "&rdquo;</div>";
}
html += "<div class='history-header'><a href='back://'>&laquo; Back</a> &nbsp;|&nbsp; ";
html += "<b>&laquo; Back</b>";
html += "<table>";
if (change_sets.Count > 1)
html += "Revisions for &ldquo;";
else
html += "No revisions for &ldquo;";
html += Path.GetFileName (path) + "&rdquo;";
html += "</div><table>";
int count = 0;
foreach (SparkleChangeSet change_set in change_sets) {