Mac: Open event log when clicking Growl notification
This commit is contained in:
parent
bed2b24fff
commit
c1fd0782a9
|
@ -51,14 +51,34 @@ namespace SparkleShare {
|
||||||
if (image_path != null && File.Exists (image_path)) {
|
if (image_path != null && File.Exists (image_path)) {
|
||||||
NSData image_data = NSData.FromFile (image_path);
|
NSData image_data = NSData.FromFile (image_path);
|
||||||
GrowlApplicationBridge.Notify (title, subtext,
|
GrowlApplicationBridge.Notify (title, subtext,
|
||||||
"Event", image_data, 0, false, null);
|
"Event", image_data, 0, false, new NSString (""));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
GrowlApplicationBridge.Notify (title, subtext,
|
GrowlApplicationBridge.Notify (title, subtext,
|
||||||
"Event", null, 0, false, null);
|
"Event", null, 0, false, new NSString (""));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class SparkleGrowlDelegate : GrowlDelegate {
|
||||||
|
|
||||||
|
[Export("growlNotificationWasClicked")]
|
||||||
|
public override void GrowlNotificationWasClicked (NSObject o)
|
||||||
|
{
|
||||||
|
InvokeOnMainThread (delegate {
|
||||||
|
NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);
|
||||||
|
|
||||||
|
if (SparkleUI.EventLog == null)
|
||||||
|
SparkleUI.EventLog = new SparkleEventLog ();
|
||||||
|
|
||||||
|
SparkleUI.EventLog.Controller.SelectedFolder = null;
|
||||||
|
|
||||||
|
SparkleUI.EventLog.OrderFrontRegardless ();
|
||||||
|
SparkleUI.EventLog.MakeKeyAndOrderFront (this);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public class SparkleEventLog : NSWindow {
|
public class SparkleEventLog : NSWindow {
|
||||||
|
|
||||||
private SparkleEventLogController controller = new SparkleEventLogController ();
|
public SparkleEventLogController Controller = new SparkleEventLogController ();
|
||||||
|
|
||||||
private WebView web_view = new WebView (new RectangleF (0, 0, 480, 579), "", "") {
|
private WebView web_view = new WebView (new RectangleF (0, 0, 480, 579), "", "") {
|
||||||
PolicyDelegate = new SparkleWebPolicyDelegate ()
|
PolicyDelegate = new SparkleWebPolicyDelegate ()
|
||||||
|
@ -83,19 +83,19 @@ namespace SparkleShare {
|
||||||
|
|
||||||
|
|
||||||
// Hook up the controller events
|
// Hook up the controller events
|
||||||
this.controller.UpdateChooserEvent += delegate (string [] folders) {
|
Controller.UpdateChooserEvent += delegate (string [] folders) {
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
UpdateChooser (folders);
|
UpdateChooser (folders);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.controller.UpdateContentEvent += delegate (string html) {
|
Controller.UpdateContentEvent += delegate (string html) {
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
UpdateContent (html);
|
UpdateContent (html);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.controller.ContentLoadingEvent += delegate {
|
Controller.ContentLoadingEvent += delegate {
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
if (this.web_view.Superview == ContentView)
|
if (this.web_view.Superview == ContentView)
|
||||||
this.web_view.RemoveFromSuperview ();
|
this.web_view.RemoveFromSuperview ();
|
||||||
|
@ -109,7 +109,7 @@ namespace SparkleShare {
|
||||||
public void UpdateChooser (string [] folders)
|
public void UpdateChooser (string [] folders)
|
||||||
{
|
{
|
||||||
if (folders == null)
|
if (folders == null)
|
||||||
folders = this.controller.Folders;
|
folders = Controller.Folders;
|
||||||
|
|
||||||
if (this.popup_button != null)
|
if (this.popup_button != null)
|
||||||
this.popup_button.RemoveFromSuperview ();
|
this.popup_button.RemoveFromSuperview ();
|
||||||
|
@ -129,9 +129,9 @@ namespace SparkleShare {
|
||||||
|
|
||||||
this.popup_button.Activated += delegate {
|
this.popup_button.Activated += delegate {
|
||||||
if (this.popup_button.IndexOfSelectedItem == 0)
|
if (this.popup_button.IndexOfSelectedItem == 0)
|
||||||
this.controller.SelectedFolder = null;
|
Controller.SelectedFolder = null;
|
||||||
else
|
else
|
||||||
this.controller.SelectedFolder = this.popup_button.SelectedItem.Title;
|
Controller.SelectedFolder = this.popup_button.SelectedItem.Title;
|
||||||
};
|
};
|
||||||
|
|
||||||
ContentView.AddSubview (this.popup_button);
|
ContentView.AddSubview (this.popup_button);
|
||||||
|
@ -143,7 +143,7 @@ namespace SparkleShare {
|
||||||
using (NSAutoreleasePool pool = new NSAutoreleasePool ()) {
|
using (NSAutoreleasePool pool = new NSAutoreleasePool ()) {
|
||||||
Thread thread = new Thread (new ThreadStart (delegate {
|
Thread thread = new Thread (new ThreadStart (delegate {
|
||||||
if (html == null)
|
if (html == null)
|
||||||
html = this.controller.HTML;
|
html = Controller.HTML;
|
||||||
|
|
||||||
html = html.Replace ("<!-- $body-font-family -->", "Lucida Grande");
|
html = html.Replace ("<!-- $body-font-family -->", "Lucida Grande");
|
||||||
html = html.Replace ("<!-- $day-entry-header-font-size -->", "13.6px");
|
html = html.Replace ("<!-- $day-entry-header-font-size -->", "13.6px");
|
||||||
|
|
|
@ -61,6 +61,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
// Needed for Growl
|
// Needed for Growl
|
||||||
GrowlApplicationBridge.WeakDelegate = this;
|
GrowlApplicationBridge.WeakDelegate = this;
|
||||||
|
GrowlApplicationBridge.Delegate = new SparkleGrowlDelegate ();
|
||||||
|
|
||||||
NSApplication.SharedApplication.ApplicationIconImage
|
NSApplication.SharedApplication.ApplicationIconImage
|
||||||
= NSImage.ImageNamed ("sparkleshare.icns");
|
= NSImage.ImageNamed ("sparkleshare.icns");
|
||||||
|
|
Loading…
Reference in a new issue