history: implement back button
This commit is contained in:
parent
3c74466898
commit
73d0f496d2
|
@ -475,6 +475,7 @@ namespace SparkleLib.Git {
|
||||||
foreach (string line in lines) {
|
foreach (string line in lines) {
|
||||||
string conflicting_path = line.Substring (3);
|
string conflicting_path = line.Substring (3);
|
||||||
conflicting_path = EnsureSpecialCharacters (conflicting_path);
|
conflicting_path = EnsureSpecialCharacters (conflicting_path);
|
||||||
|
conflicting_path = conflicting_path.Replace ("\"", "\\\"");
|
||||||
|
|
||||||
SparkleLogger.LogInfo ("Git", Name + " | Conflict type: " + line);
|
SparkleLogger.LogInfo ("Git", Name + " | Conflict type: " + line);
|
||||||
|
|
||||||
|
@ -554,8 +555,6 @@ namespace SparkleLib.Git {
|
||||||
if (revision == null)
|
if (revision == null)
|
||||||
throw new ArgumentNullException ("revision");
|
throw new ArgumentNullException ("revision");
|
||||||
|
|
||||||
path = path.Replace ("\\", "/");
|
|
||||||
|
|
||||||
SparkleLogger.LogInfo ("Git", Name + " | Restoring \"" + path + "\" (revision " + revision + ")");
|
SparkleLogger.LogInfo ("Git", Name + " | Restoring \"" + path + "\" (revision " + revision + ")");
|
||||||
|
|
||||||
// FIXME: git-show doesn't decrypt objects, so we can't use it to retrieve
|
// FIXME: git-show doesn't decrypt objects, so we can't use it to retrieve
|
||||||
|
@ -582,6 +581,8 @@ namespace SparkleLib.Git {
|
||||||
|
|
||||||
// The correct way
|
// The correct way
|
||||||
} else {
|
} else {
|
||||||
|
path = path.Replace ("\"", "\\\"");
|
||||||
|
|
||||||
SparkleGit git = new SparkleGit (LocalPath, "show " + revision + ":\"" + path + "\"");
|
SparkleGit git = new SparkleGit (LocalPath, "show " + revision + ":\"" + path + "\"");
|
||||||
git.Start ();
|
git.Start ();
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
small, small a {
|
small, small a, small a:hover {
|
||||||
font-size: <!-- $small-font-size -->;
|
font-size: <!-- $small-font-size -->;
|
||||||
color: <!-- $secondary-font-color -->;
|
color: <!-- $secondary-font-color -->;
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,14 @@
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.history-header {
|
||||||
|
color: #aaa;
|
||||||
|
padding-top: 22px;
|
||||||
|
font-weight: bold;
|
||||||
|
float: left;
|
||||||
|
margin-left: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
.event-entry {
|
.event-entry {
|
||||||
padding: 24px 14px 14px 64px;
|
padding: 24px 14px 14px 64px;
|
||||||
margin: 0 32px 0 32px;
|
margin: 0 32px 0 32px;
|
||||||
|
|
|
@ -80,6 +80,7 @@ namespace SparkleShare {
|
||||||
new SizeF (ContentView.Frame.Width, ContentView.Frame.Height - 39))
|
new SizeF (ContentView.Frame.Width, ContentView.Frame.Height - 39))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this.hidden_close_button = new NSButton () {
|
this.hidden_close_button = new NSButton () {
|
||||||
KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask,
|
KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask,
|
||||||
KeyEquivalent = "w"
|
KeyEquivalent = "w"
|
||||||
|
@ -397,7 +398,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
this.web_view.MainFrame.LoadHtmlString (html, new NSUrl (""));
|
this.web_view.MainFrame.LoadHtmlString (html, new NSUrl (""));
|
||||||
|
|
||||||
web_view.PolicyDelegate = new SparkleWebPolicyDelegate ();
|
this.web_view.PolicyDelegate = new SparkleWebPolicyDelegate ();
|
||||||
ContentView.AddSubview (this.web_view);
|
ContentView.AddSubview (this.web_view);
|
||||||
|
|
||||||
(this.web_view.PolicyDelegate as SparkleWebPolicyDelegate).LinkClicked +=
|
(this.web_view.PolicyDelegate as SparkleWebPolicyDelegate).LinkClicked +=
|
||||||
|
|
|
@ -86,8 +86,6 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public string HTML {
|
public string HTML {
|
||||||
get {
|
get {
|
||||||
this.history_view_active = false;
|
|
||||||
|
|
||||||
List<SparkleChangeSet> change_sets = GetLog (this.selected_folder);
|
List<SparkleChangeSet> change_sets = GetLog (this.selected_folder);
|
||||||
string html = GetHTMLLog (change_sets);
|
string html = GetHTMLLog (change_sets);
|
||||||
|
|
||||||
|
@ -255,11 +253,11 @@ namespace SparkleShare {
|
||||||
|
|
||||||
ShowSaveDialogEvent (file_name, target_folder_path);
|
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://")) {
|
} else if (url.StartsWith ("history://")) {
|
||||||
this.history_view_active = true;
|
this.history_view_active = true;
|
||||||
|
@ -283,17 +281,15 @@ namespace SparkleShare {
|
||||||
|
|
||||||
List<SparkleChangeSet> change_sets = repo.GetChangeSets (path, 30);
|
List<SparkleChangeSet> change_sets = repo.GetChangeSets (path, 30);
|
||||||
|
|
||||||
if (change_sets.Count > 1) {
|
html += "<div class='history-header'><a href='back://'>« Back</a> | ";
|
||||||
html += "<div class='day-entry-header'>Revisions for “";
|
|
||||||
html += Path.GetFileName (path) + "”</div>";
|
|
||||||
|
|
||||||
} else {
|
if (change_sets.Count > 1)
|
||||||
html += "<div class='day-entry-header'>No revisions yet for “";
|
html += "Revisions for “";
|
||||||
html += Path.GetFileName (path) + "”</div>";
|
else
|
||||||
}
|
html += "No revisions for “";
|
||||||
|
|
||||||
html += "<b>« Back</b>";
|
html += Path.GetFileName (path) + "”";
|
||||||
html += "<table>";
|
html += "</div><table>";
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
foreach (SparkleChangeSet change_set in change_sets) {
|
foreach (SparkleChangeSet change_set in change_sets) {
|
||||||
|
|
Loading…
Reference in a new issue