Move UI events to controllers
This commit is contained in:
parent
ca8ad5dc96
commit
9f63b5e565
|
@ -6,15 +6,11 @@
|
|||
<integer>1</integer>
|
||||
<key>AllNotifications</key>
|
||||
<array>
|
||||
<string>Start</string>
|
||||
<string>Stop</string>
|
||||
<string>Info</string>
|
||||
<string>Event</string>
|
||||
</array>
|
||||
<key>DefaultNotifications</key>
|
||||
<array>
|
||||
<string>Start</string>
|
||||
<string>Stop</string>
|
||||
<string>Info</string>
|
||||
<string>Event</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -40,14 +40,22 @@ namespace SparkleShare {
|
|||
return;
|
||||
}
|
||||
|
||||
if (NSApplication.SharedApplication.DockTile.BadgeLabel == null) {
|
||||
NSApplication.SharedApplication.DockTile.BadgeLabel = "1";
|
||||
|
||||
} else {
|
||||
int events = int.Parse (NSApplication.SharedApplication.DockTile.BadgeLabel);
|
||||
NSApplication.SharedApplication.DockTile.BadgeLabel = (events + 1).ToString ();
|
||||
}
|
||||
|
||||
if (image_path != null && File.Exists (image_path)) {
|
||||
NSData image_data = NSData.FromFile (image_path);
|
||||
GrowlApplicationBridge.Notify (title, subtext,
|
||||
"Start", image_data, 0, false, null);
|
||||
"Event", image_data, 0, false, null);
|
||||
|
||||
} else {
|
||||
GrowlApplicationBridge.Notify (title, subtext,
|
||||
"Start", null, 0, false, null);
|
||||
"Event", null, 0, false, null);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -28,14 +28,15 @@ namespace SparkleShare {
|
|||
public SparkleBubblesController ()
|
||||
{
|
||||
SparkleShare.Controller.ConflictNotificationRaised += delegate {
|
||||
if (ShowBubbleEvent != null)
|
||||
if (ShowBubbleEvent != null && SparkleShare.Controller.NotificationsEnabled)
|
||||
ShowBubbleEvent ("Ouch! Mid-air collision!",
|
||||
"Don't worry, SparkleShare made a copy of each conflicting file.", null);
|
||||
};
|
||||
|
||||
SparkleShare.Controller.NotificationRaised += delegate (string user_name, string user_email,
|
||||
string message, string folder_path) {
|
||||
if (ShowBubbleEvent != null)
|
||||
|
||||
if (ShowBubbleEvent != null && SparkleShare.Controller.NotificationsEnabled)
|
||||
ShowBubbleEvent (user_name, message,
|
||||
SparkleShare.Controller.GetAvatar (user_email, 36));
|
||||
};
|
|
@ -91,8 +91,8 @@
|
|||
<Compile Include="SparkleEventLog.cs" />
|
||||
<Compile Include="SparkleBadger.cs" />
|
||||
<Compile Include="SparkleEventLogController.cs" />
|
||||
<Compile Include="SparkleBubbleController.cs" />
|
||||
<Compile Include="SparkleBubbles.cs" />
|
||||
<Compile Include="SparkleBubblesController.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="MainMenu.xib" />
|
||||
|
|
|
@ -29,25 +29,12 @@ using MonoMac.Growl;
|
|||
|
||||
namespace SparkleShare {
|
||||
|
||||
public partial class AppDelegate : NSApplicationDelegate {
|
||||
|
||||
public override void WillBecomeActive (NSNotification notification)
|
||||
{
|
||||
NSApplication.SharedApplication.DockTile.BadgeLabel = null;
|
||||
}
|
||||
|
||||
public override void WillTerminate (NSNotification notification)
|
||||
{
|
||||
SparkleShare.Controller.Quit ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class SparkleUI : AppDelegate {
|
||||
|
||||
public static SparkleStatusIcon StatusIcon;
|
||||
public static SparkleEventLog EventLog;
|
||||
public static SparkleIntro Intro;
|
||||
public static SparkleBubbles Bubbles;
|
||||
public static SparkleAbout About;
|
||||
public static NSFont Font;
|
||||
|
||||
|
@ -70,7 +57,6 @@ namespace SparkleShare {
|
|||
Catalog.Init ("sparkleshare",
|
||||
Path.Combine (NSBundle.MainBundle.ResourcePath, "Translations"));
|
||||
|
||||
|
||||
using (NSAutoreleasePool pool = new NSAutoreleasePool ()) {
|
||||
|
||||
// Needed for Growl
|
||||
|
@ -79,47 +65,26 @@ namespace SparkleShare {
|
|||
NSApplication.SharedApplication.ApplicationIconImage
|
||||
= NSImage.ImageNamed ("sparkleshare.icns");
|
||||
|
||||
SetFolderIcon ();
|
||||
|
||||
if (!SparkleShare.Controller.BackendIsPresent) {
|
||||
this.alert = new SparkleAlert ();
|
||||
this.alert.RunModal ();
|
||||
return;
|
||||
}
|
||||
|
||||
SetFolderIcon ();
|
||||
|
||||
Font = NSFontManager.SharedFontManager.FontWithFamily
|
||||
("Lucida Grande", NSFontTraitMask.Condensed, 0, 13);
|
||||
|
||||
StatusIcon = new SparkleStatusIcon ();
|
||||
}
|
||||
|
||||
SparkleShare.Controller.NotificationRaised += delegate (string user_name, string user_email,
|
||||
string message, string repository_path) {
|
||||
InvokeOnMainThread (delegate {
|
||||
|
||||
if (SparkleShare.Controller.NotificationsEnabled) {
|
||||
if (NSApplication.SharedApplication.DockTile.BadgeLabel == null)
|
||||
NSApplication.SharedApplication.DockTile.BadgeLabel = "1";
|
||||
else
|
||||
NSApplication.SharedApplication.DockTile.BadgeLabel =
|
||||
(int.Parse (NSApplication.SharedApplication.DockTile.BadgeLabel) + 1).ToString ();
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Bubbles = new SparkleBubbles ();
|
||||
|
||||
if (SparkleShare.Controller.FirstRun) {
|
||||
Intro = new SparkleIntro ();
|
||||
Intro.ShowAccountForm ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SetFolderIcon ()
|
||||
|
@ -147,4 +112,18 @@ namespace SparkleShare {
|
|||
return NSDictionary.FromFile (path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public partial class AppDelegate : NSApplicationDelegate {
|
||||
|
||||
public override void WillBecomeActive (NSNotification notification)
|
||||
{
|
||||
NSApplication.SharedApplication.DockTile.BadgeLabel = null;
|
||||
}
|
||||
|
||||
public override void WillTerminate (NSNotification notification)
|
||||
{
|
||||
SparkleShare.Controller.Quit ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue