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)) {
|
||||
NSData image_data = NSData.FromFile (image_path);
|
||||
GrowlApplicationBridge.Notify (title, subtext,
|
||||
"Event", image_data, 0, false, null);
|
||||
"Event", image_data, 0, false, new NSString (""));
|
||||
|
||||
} else {
|
||||
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 {
|
||||
|
||||
private SparkleEventLogController controller = new SparkleEventLogController ();
|
||||
public SparkleEventLogController Controller = new SparkleEventLogController ();
|
||||
|
||||
private WebView web_view = new WebView (new RectangleF (0, 0, 480, 579), "", "") {
|
||||
PolicyDelegate = new SparkleWebPolicyDelegate ()
|
||||
|
@ -83,19 +83,19 @@ namespace SparkleShare {
|
|||
|
||||
|
||||
// Hook up the controller events
|
||||
this.controller.UpdateChooserEvent += delegate (string [] folders) {
|
||||
Controller.UpdateChooserEvent += delegate (string [] folders) {
|
||||
InvokeOnMainThread (delegate {
|
||||
UpdateChooser (folders);
|
||||
});
|
||||
};
|
||||
|
||||
this.controller.UpdateContentEvent += delegate (string html) {
|
||||
Controller.UpdateContentEvent += delegate (string html) {
|
||||
InvokeOnMainThread (delegate {
|
||||
UpdateContent (html);
|
||||
});
|
||||
};
|
||||
|
||||
this.controller.ContentLoadingEvent += delegate {
|
||||
Controller.ContentLoadingEvent += delegate {
|
||||
InvokeOnMainThread (delegate {
|
||||
if (this.web_view.Superview == ContentView)
|
||||
this.web_view.RemoveFromSuperview ();
|
||||
|
@ -109,7 +109,7 @@ namespace SparkleShare {
|
|||
public void UpdateChooser (string [] folders)
|
||||
{
|
||||
if (folders == null)
|
||||
folders = this.controller.Folders;
|
||||
folders = Controller.Folders;
|
||||
|
||||
if (this.popup_button != null)
|
||||
this.popup_button.RemoveFromSuperview ();
|
||||
|
@ -129,9 +129,9 @@ namespace SparkleShare {
|
|||
|
||||
this.popup_button.Activated += delegate {
|
||||
if (this.popup_button.IndexOfSelectedItem == 0)
|
||||
this.controller.SelectedFolder = null;
|
||||
Controller.SelectedFolder = null;
|
||||
else
|
||||
this.controller.SelectedFolder = this.popup_button.SelectedItem.Title;
|
||||
Controller.SelectedFolder = this.popup_button.SelectedItem.Title;
|
||||
};
|
||||
|
||||
ContentView.AddSubview (this.popup_button);
|
||||
|
@ -143,7 +143,7 @@ namespace SparkleShare {
|
|||
using (NSAutoreleasePool pool = new NSAutoreleasePool ()) {
|
||||
Thread thread = new Thread (new ThreadStart (delegate {
|
||||
if (html == null)
|
||||
html = this.controller.HTML;
|
||||
html = Controller.HTML;
|
||||
|
||||
html = html.Replace ("<!-- $body-font-family -->", "Lucida Grande");
|
||||
html = html.Replace ("<!-- $day-entry-header-font-size -->", "13.6px");
|
||||
|
|
|
@ -61,6 +61,7 @@ namespace SparkleShare {
|
|||
|
||||
// Needed for Growl
|
||||
GrowlApplicationBridge.WeakDelegate = this;
|
||||
GrowlApplicationBridge.Delegate = new SparkleGrowlDelegate ();
|
||||
|
||||
NSApplication.SharedApplication.ApplicationIconImage
|
||||
= NSImage.ImageNamed ("sparkleshare.icns");
|
||||
|
|
Loading…
Reference in a new issue