event log: remove static property from LinkClicked method

This commit is contained in:
Hylke Bons 2012-02-13 21:27:53 +01:00
parent 1e8e6b8363
commit 99e76b1655
3 changed files with 16 additions and 4 deletions

View file

@ -55,6 +55,7 @@ namespace SparkleShare {
public SparkleEventLog () : base ()
{
Title = "Recent Events";
Delegate = new SparkleEventsDelegate ();
SetFrame (new RectangleF (0, 0, 480, 640), true);
@ -142,6 +143,12 @@ namespace SparkleShare {
ContentView.AddSubview (this.progress_indicator);
(this.web_view.PolicyDelegate as SparkleWebPolicyDelegate)
.LinkClicked += delegate (string href) {
Controller.LinkClicked (href);
};
UpdateContent (null);
UpdateChooser (null);
OrderFrontRegardless ();
@ -274,11 +281,16 @@ namespace SparkleShare {
public class SparkleWebPolicyDelegate : WebPolicyDelegate {
public event LinkClickedHandler LinkClicked;
public delegate void LinkClickedHandler (string href);
public override void DecidePolicyForNavigation (WebView web_view, NSDictionary action_info,
NSUrlRequest request, WebFrame frame, NSObject decision_token)
{
SparkleEventLogController.LinkClicked (request.Url.ToString ());
if (LinkClicked != null)
LinkClicked (request.Url.ToString ());
}
}
}

View file

@ -78,7 +78,7 @@ namespace SparkleShare {
this.web_view.NavigationRequested += delegate (object o, WebKit.NavigationRequestedArgs args) {
if (args.Request.Uri == this.link_status)
SparkleEventLogController.LinkClicked (args.Request.Uri);
Controller.LinkClicked (args.Request.Uri);
// Don't follow HREFs (as this would cause a page refresh)
if (!args.Request.Uri.Equals ("file:"))

View file

@ -178,7 +178,7 @@ namespace SparkleShare {
}
public static void LinkClicked (string url)
public void LinkClicked (string url)
{
if (url.StartsWith (Path.VolumeSeparatorChar.ToString ())) {
Program.Controller.OpenFile (url);