Integrate notes on linux

This commit is contained in:
Hylke 2011-06-24 22:58:20 +01:00
parent ef292b34cc
commit 6bc6b45a8f
3 changed files with 32 additions and 5 deletions

View file

@ -113,7 +113,7 @@ namespace SparkleShare {
if (this.selected_log != null &&
!SparkleShare.Controller.Folders.Contains (this.selected_log)) {
this.selected_log = null;// todo on linux
this.selected_log = null;
}
this.popup_button.Activated += delegate {

View file

@ -84,7 +84,6 @@ namespace SparkleShare {
LinkStatus = args.Link;
};
// FIXME: Use the right event, waiting for newer webkit bindings: NavigationPolicyDecisionRequested
WebView.NavigationRequested += delegate (object o, WebKit.NavigationRequestedArgs args) {
if (args.Request.Uri == LinkStatus) {
Process process = new Process ();
@ -92,9 +91,26 @@ namespace SparkleShare {
process.StartInfo.Arguments = args.Request.Uri.Replace (" ", "\\ "); // Escape space-characters
process.Start ();
// Don't follow HREFs (as this would cause a page refresh)
args.RetVal = 1;
} else {
Regex regex = new Regex (@"(.+)~(.+)~(.+)");
Match match = regex.Match (args.Request.Uri);
if (match.Success) {
string folder_name = match.Groups [1].Value;
string revision = match.Groups [2].Value;
string note = match.Groups [3].Value.Replace ("%20", " ");
Thread thread = new Thread (new ThreadStart (delegate {
SparkleShare.Controller.AddNoteToFolder (folder_name, revision, note);
}));
thread.Start ();
}
}
// Don't follow HREFs (as this would cause a page refresh)
if (!args.Request.Uri.Equals ("file:"))
args.RetVal = 1;
};
ScrolledWindow.Add (WebView);
@ -142,6 +158,12 @@ namespace SparkleShare {
return (item == "---");
};
if (this.selected_log != null &&
!SparkleShare.Controller.Folders.Contains (this.selected_log)) {
this.selected_log = null;
}
this.combo_box.Changed += delegate {
TreeIter iter;
this.combo_box.GetActiveIter (out iter);

View file

@ -166,8 +166,13 @@ namespace SparkleShare {
get {
string path = SparkleHelpers.CombineMore (Defines.PREFIX,
"share", "sparkleshare", "html", "event-log.html");
string html = String.Join (Environment.NewLine, File.ReadAllLines (path));
html = html.Replace ("<!-- $jquery-url -->", "file://" +
SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "html", "jquery.js"));
return String.Join (Environment.NewLine, File.ReadAllLines (path));
return html;
}
}