private void ApplicationActivatedDelegate(object sender, EventArgs args) { if (this.application.Windows.Length > 0) { bool has_visible_windows = false; foreach (Window window in this.application.Windows) { if (window.Visible) { window.Present(); has_visible_windows = true; } } if (!has_visible_windows) { Program.Controller.HandleReopen(); } } else { Setup = new SparkleSetup(); EventLog = new SparkleEventLog(); About = new SparkleAbout(); Bubbles = new SparkleBubbles(); StatusIcon = new SparkleStatusIcon(); Setup.Application = this.application; EventLog.Application = this.application; About.Application = this.application; Program.Controller.UIHasLoaded(); } }
public SparkleUI() { if (Environment.OSVersion.Version.Major < 14) { FontName = "Lucida Grande"; } Program.Controller.Invoke(() => { if (Environment.OSVersion.Version.Major >= 14) { NSWorkspace.SharedWorkspace.SetIconforFile( NSImage.ImageNamed("sparkleshare-folder-yosemite.icns"), Program.Controller.FoldersPath, 0); } else { NSWorkspace.SharedWorkspace.SetIconforFile( NSImage.ImageNamed("sparkleshare-folder.icns"), Program.Controller.FoldersPath, 0); } NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed("sparkleshare-app.icns"); Setup = new SparkleSetup(); EventLog = new SparkleEventLog(); About = new SparkleAbout(); Note = new SparkleNote(); Bubbles = new SparkleBubbles(); StatusIcon = new SparkleStatusIcon(); }); Program.Controller.UIHasLoaded(); }
public SparkleUI () { if (Environment.OSVersion.Version.Major < 14) FontName = "Lucida Grande"; Program.Controller.Invoke (() => { if (Environment.OSVersion.Version.Major >= 14) { NSWorkspace.SharedWorkspace.SetIconforFile ( NSImage.ImageNamed ("sparkleshare-folder-yosemite.icns"), Program.Controller.FoldersPath, 0); } else { NSWorkspace.SharedWorkspace.SetIconforFile ( NSImage.ImageNamed ("sparkleshare-folder.icns"), Program.Controller.FoldersPath, 0); } NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed ("sparkleshare-app.icns"); Setup = new SparkleSetup (); EventLog = new SparkleEventLog (); About = new SparkleAbout (); Note = new SparkleNote (); Bubbles = new SparkleBubbles (); StatusIcon = new SparkleStatusIcon (); }); Program.Controller.UIHasLoaded (); }
public SparkleUI() { // Use translations Catalog.Init("sparkleshare", Path.Combine(NSBundle.MainBundle.ResourcePath, "Translations")); using (NSAutoreleasePool pool = new NSAutoreleasePool()) { // Needed for Growl GrowlApplicationBridge.WeakDelegate = this; GrowlApplicationBridge.Delegate = new SparkleGrowlDelegate(); NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed("sparkleshare.icns"); SetFolderIcon(); Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 13); BoldFont = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Bold, 0, 13); StatusIcon = new SparkleStatusIcon(); Bubbles = new SparkleBubbles(); if (Program.Controller.FirstRun) { Setup = new SparkleSetup(); Setup.Controller.ShowSetupPage(); } } }
private void ApplicationActivatedDelegate (object sender, EventArgs args) { if (this.application.Windows.Length > 0) { bool has_visible_windows = false; foreach (Window window in this.application.Windows) { if (window.Visible) { window.Present (); has_visible_windows = true; } } if (!has_visible_windows) Program.Controller.HandleReopen (); } else { Setup = new SparkleSetup (); EventLog = new SparkleEventLog (); About = new SparkleAbout (); Bubbles = new SparkleBubbles (); StatusIcon = new SparkleStatusIcon (); Setup.Application = this.application; EventLog.Application = this.application; About.Application = this.application; Program.Controller.UIHasLoaded (); } }
public SparkleUI() { NSApplication.Init (); NSApplication.SharedApplication.applicationIconImage = NSImage.ImageNamed ("sparkleshare.icns"); OpenLogs = new List <SparkleLog> (); StatusIcon = new SparkleStatusIcon (); }
public SparkleUI() { Application.Init (); Setup = new SparkleSetup (); EventLog = new SparkleEventLog (); About = new SparkleAbout (); Bubbles = new SparkleBubbles (); StatusIcon = new SparkleStatusIcon (); Program.Controller.UIHasLoaded (); }
public SparkleUI() { Application.Init(); Setup = new SparkleSetup(); EventLog = new SparkleEventLog(); About = new SparkleAbout(); Bubbles = new SparkleBubbles(); StatusIcon = new SparkleStatusIcon(); Program.Controller.UIHasLoaded(); }
public SparkleUI() { // FIXME: The second time windows are shown, the windows // don't have the smooth ease in animation, but appear abruptly. // The ease out animation always seems to work Setup = new SparkleSetup(); EventLog = new SparkleEventLogWindow(); About = new SparkleAbout(); Bubbles = new SparkleBubbles(); StatusIcon = new SparkleStatusIcon(); Program.Controller.UIHasLoaded(); }
public SparkleUI() { // FIXME: The second time windows are shown, the windows // don't have the smooth ease in animation, but appear abruptly. // The ease out animation always seems to work Setup = new SparkleSetup (); EventLog = new SparkleEventLog (); About = new SparkleAbout (); Bubbles = new SparkleBubbles (); StatusIcon = new SparkleStatusIcon (); Program.Controller.UIHasLoaded (); }
public SparkleUI() { Application.Init (); // Use translations Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR); Setup = new SparkleSetup (); EventLog = new SparkleEventLog (); About = new SparkleAbout (); Bubbles = new SparkleBubbles (); StatusIcon = new SparkleStatusIcon (); Program.Controller.UIHasLoaded (); }
public SparkleUI() { Application.Init(); // Use translations Catalog.Init(Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR); Setup = new SparkleSetup(); EventLog = new SparkleEventLog(); About = new SparkleAbout(); Bubbles = new SparkleBubbles(); StatusIcon = new SparkleStatusIcon(); Program.Controller.UIHasLoaded(); }
public SparkleUI () { Program.Controller.Invoke (() => { NSWorkspace.SharedWorkspace.SetIconforFile ( NSImage.ImageNamed ("sparkleshare-folder.icns"), Program.Controller.FoldersPath, 0); NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed ("sparkleshare-app.icns"); Setup = new SparkleSetup (); EventLog = new SparkleEventLog (); About = new SparkleAbout (); Bubbles = new SparkleBubbles (); StatusIcon = new SparkleStatusIcon (); }); Program.Controller.UIHasLoaded (); }
public SparkleUI() { Program.Controller.Invoke(() => { NSWorkspace.SharedWorkspace.SetIconforFile( NSImage.ImageNamed("sparkleshare-folder.icns"), Program.Controller.FoldersPath, 0); NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed("sparkleshare-app.icns"); Setup = new SparkleSetup(); EventLog = new SparkleEventLog(); About = new SparkleAbout(); Bubbles = new SparkleBubbles(); StatusIcon = new SparkleStatusIcon(); }); Program.Controller.UIHasLoaded(); }
public SparkleUI() { // Initialize the application Application.Init (); // Use translations Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR); Setup = new SparkleSetup (); EventLog = new SparkleEventLog (); About = new SparkleAbout (); Bubbles = new SparkleBubbles (); StatusIcon = new SparkleStatusIcon (); if (Program.Controller.FirstRun) Program.Controller.ShowSetupWindow (PageType.Setup); }
public SparkleUI() { using (var a = new NSAutoreleasePool ()) { GrowlApplicationBridge.WeakDelegate = this; GrowlApplicationBridge.Delegate = new SparkleGrowlDelegate (); NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed ("sparkleshare-app.icns"); SetFolderIcon (); Setup = new SparkleSetup (); EventLog = new SparkleEventLog (); About = new SparkleAbout (); Bubbles = new SparkleBubbles (); StatusIcon = new SparkleStatusIcon (); Program.Controller.UIHasLoaded (); } }
public SparkleUI() { using (var a = new NSAutoreleasePool()) { GrowlApplicationBridge.WeakDelegate = this; GrowlApplicationBridge.Delegate = new SparkleGrowlDelegate(); NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed("sparkleshare-app.icns"); SetFolderIcon(); Setup = new SparkleSetup(); EventLog = new SparkleEventLog(); About = new SparkleAbout(); Bubbles = new SparkleBubbles(); StatusIcon = new SparkleStatusIcon(); Program.Controller.UIHasLoaded(); } }
public SparkleUI() { // Initialize the application Application.Init (); // Use translations Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR); // Create the statusicon StatusIcon = new SparkleStatusIcon (); if (SparkleShare.Controller.FirstRun) { Setup = new SparkleSetup (); Setup.Controller.ShowSetupPage (); } SparkleShare.Controller.OnQuitWhileSyncing += delegate { // TODO: Pop up a warning when quitting whilst syncing }; }
public SparkleUI() { // Initialize the application Application.Init(); // Use translations Catalog.Init(Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR); StatusIcon = new SparkleStatusIcon(); Bubbles = new SparkleBubbles(); if (Program.Controller.FirstRun) { Setup = new SparkleSetup(); Setup.Controller.ShowSetupPage(); } Program.Controller.OnQuitWhileSyncing += delegate { // TODO: Pop up a warning when quitting whilst syncing }; }
public SparkleUI() { using (var a = new NSAutoreleasePool()) { Catalog.Init("sparkleshare", Path.Combine(NSBundle.MainBundle.ResourcePath, "Translations")); GrowlApplicationBridge.WeakDelegate = this; GrowlApplicationBridge.Delegate = new SparkleGrowlDelegate(); NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed("sparkleshare.icns"); SetFolderIcon(); Setup = new SparkleSetup(); EventLog = new SparkleEventLog(); About = new SparkleAbout(); Bubbles = new SparkleBubbles(); StatusIcon = new SparkleStatusIcon(); Program.Controller.UIHasLoaded(); } }
public SparkleUI() { // Initialize the application Application.Init (); // Create the statusicon StatusIcon = new SparkleStatusIcon (); // Keep track of which event logs are open OpenLogs = new List <SparkleLog> (); if (SparkleShare.Controller.FirstRun) { Intro = new SparkleIntro (); Intro.ShowAccountForm (); } SparkleShare.Controller.OnQuitWhileSyncing += delegate { // TODO: Pop up a warning when quitting whilst syncing }; SparkleShare.Controller.OnInvitation += delegate (string server, string folder, string token) { Application.Invoke (delegate { SparkleIntro intro = new SparkleIntro (); intro.ShowInvitationPage (server, folder, token); }); }; // Show a bubble when there are new changes SparkleShare.Controller.NotificationRaised += delegate (string user_name, string user_email, string message, string repository_path) { Application.Invoke (delegate { foreach (SparkleLog log in OpenLogs) { if (log.LocalPath.Equals (repository_path)) log.UpdateEventLog (); } if (!SparkleShare.Controller.NotificationsEnabled) return; SparkleBubble bubble = new SparkleBubble (user_name, message); string avatar_file_path = SparkleUIHelpers.GetAvatar (user_email, 32); if (avatar_file_path != null) bubble.Icon = new Gdk.Pixbuf (avatar_file_path); else bubble.Icon = SparkleUIHelpers.GetIcon ("avatar-default", 32); bubble.AddAction ("", "Show Events", delegate { AddEventLog (repository_path); }); bubble.Show (); }); }; // Show a bubble when there was a conflict SparkleShare.Controller.ConflictNotificationRaised += delegate { Application.Invoke (delegate { string title = _("Ouch! Mid-air collision!"); string subtext = _("Don't worry, SparkleShare made a copy of each conflicting file."); new SparkleBubble (title, subtext).Show (); }); }; SparkleShare.Controller.AvatarFetched += delegate { Application.Invoke (delegate { foreach (SparkleLog log in OpenLogs) log.UpdateEventLog (); }); }; SparkleShare.Controller.OnIdle += delegate { Application.Invoke (delegate { foreach (SparkleLog log in OpenLogs) log.UpdateEventLog (); }); }; }
public SparkleUI() { NSApplication.Init(); SetSparkleIcon(); // TODO: Getting crashes when I remove this NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed("sparkleshare.icns"); if (!SparkleShare.Controller.BackendIsPresent) { Alert = new SparkleAlert(); Alert.RunModal(); return; } Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 13); // new SparkleAbout (); OpenLogs = new List <SparkleLog> (); StatusIcon = new SparkleStatusIcon(); SparkleShare.Controller.NotificationRaised += delegate(string user_name, string user_email, string message, string repository_path) { InvokeOnMainThread(delegate { foreach (SparkleLog log in OpenLogs) { if (log.LocalPath.Equals(repository_path)) { log.UpdateEventLog(); } } 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(); } NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.InformationalRequest); } }); }; SparkleShare.Controller.AvatarFetched += delegate { InvokeOnMainThread(delegate { foreach (SparkleLog log in SparkleUI.OpenLogs) { log.UpdateEventLog(); } }); }; SparkleShare.Controller.OnIdle += delegate { InvokeOnMainThread(delegate { foreach (SparkleLog log in SparkleUI.OpenLogs) { log.UpdateEventLog(); } }); }; if (SparkleShare.Controller.FirstRun) { Intro = new SparkleIntro(); Intro.ShowAccountForm(); } }
public SparkleUI() { // Use translations Catalog.Init ("sparkleshare", Path.Combine (NSBundle.MainBundle.ResourcePath, "Translations")); using (NSAutoreleasePool pool = new NSAutoreleasePool ()) { // Needed for Growl GrowlApplicationBridge.WeakDelegate = this; GrowlApplicationBridge.Delegate = new SparkleGrowlDelegate (); NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed ("sparkleshare.icns"); SetFolderIcon (); Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 13); BoldFont = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Bold, 0, 13); StatusIcon = new SparkleStatusIcon (); Bubbles = new SparkleBubbles (); if (Program.Controller.FirstRun) { Setup = new SparkleSetup (); Setup.Controller.ShowSetupPage (); } } }
public SparkleUI() { NSApplication.Init (); SetSparkleIcon (); // TODO: Getting crashes when I remove this NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed ("sparkleshare.icns"); Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 13); OpenLogs = new List <SparkleLog> (); StatusIcon = new SparkleStatusIcon (); NewEvents = 0; SparkleShare.Controller.NotificationRaised += delegate { InvokeOnMainThread (delegate { NewEvents++; NSApplication.SharedApplication.DockTile.BadgeLabel = NewEvents.ToString (); foreach (SparkleLog log in SparkleUI.OpenLogs) log.UpdateEventLog (); NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.InformationalRequest); }); }; SparkleShare.Controller.AvatarFetched += delegate { InvokeOnMainThread (delegate { foreach (SparkleLog log in SparkleUI.OpenLogs) log.UpdateEventLog (); }); }; SparkleShare.Controller.OnIdle += delegate { InvokeOnMainThread (delegate { foreach (SparkleLog log in SparkleUI.OpenLogs) log.UpdateEventLog (); }); }; if (SparkleShare.Controller.FirstRun) { Intro = new SparkleIntro (); Intro.ShowAccountForm (); } }
public SparkleUI() { using (var a = new NSAutoreleasePool ()) { Catalog.Init ("sparkleshare", Path.Combine (NSBundle.MainBundle.ResourcePath, "Translations")); GrowlApplicationBridge.WeakDelegate = this; GrowlApplicationBridge.Delegate = new SparkleGrowlDelegate (); NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed ("sparkleshare-app.icns"); SetFolderIcon (); Setup = new SparkleSetup (); EventLog = new SparkleEventLog (); About = new SparkleAbout (); Bubbles = new SparkleBubbles (); StatusIcon = new SparkleStatusIcon (); Program.Controller.UIHasLoaded (); } }
public SparkleUI() { // Initialize the application Application.Init (); // Create the statusicon StatusIcon = new SparkleStatusIcon (); // Keep track of which event logs are open OpenLogs = new List <SparkleLog> (); if (SparkleShare.Controller.FirstRun) { Intro = new SparkleIntro (); Intro.ShowAccountForm (); } SparkleShare.Controller.OnQuitWhileSyncing += delegate { // TODO: Pop up a warning when quitting whilst syncing }; SparkleShare.Controller.OnInvitation += delegate (string server, string folder, string token) { Application.Invoke (delegate { SparkleIntro intro = new SparkleIntro (); intro.ShowInvitationPage (server, folder, token); }); }; // Show a bubble when there are new changes SparkleShare.Controller.NotificationRaised += delegate (SparkleCommit commit, string repository_path) { foreach (SparkleLog log in OpenLogs) { if (log.LocalPath.Equals (repository_path)) { Application.Invoke (delegate { log.UpdateEventLog (); }); } } // TODO: move to controller and do translation here if (!SparkleShare.Controller.NotificationsEnabled) return; string file_name = ""; string message = null; if (commit.Added.Count > 0) { foreach (string added in commit.Added) { file_name = added; break; } message = String.Format (_("added ‘{0}’"), file_name); } if (commit.Edited.Count > 0) { foreach (string modified in commit.Edited) { file_name = modified; break; } message = String.Format (_("edited ‘{0}’"), file_name); } if (commit.Deleted.Count > 0) { foreach (string removed in commit.Deleted) { file_name = removed; break; } message = String.Format (_("deleted ‘{0}’"), file_name); } int changes_count = (commit.Added.Count + commit.Edited.Count + commit.Deleted.Count); if (changes_count > 1) message += " + " + (changes_count - 1); Application.Invoke (delegate { SparkleBubble bubble = new SparkleBubble (commit.UserName, message); string avatar_file_path = SparkleUIHelpers.GetAvatar (commit.UserEmail, 32); if (avatar_file_path != null) bubble.Icon = new Gdk.Pixbuf (avatar_file_path); else bubble.Icon = SparkleUIHelpers.GetIcon ("avatar-default", 32); bubble.AddAction ("", "Show Events", delegate { AddEventLog (repository_path); }); bubble.Show (); }); }; // Show a bubble when there was a conflict SparkleShare.Controller.ConflictNotificationRaised += delegate { Application.Invoke (delegate { string title = _("Ouch! Mid-air collision!"); string subtext = _("Don't worry, SparkleShare made a copy of each conflicting file."); new SparkleBubble (title, subtext).Show (); }); }; SparkleShare.Controller.AvatarFetched += delegate { Application.Invoke (delegate { foreach (SparkleLog log in OpenLogs) log.UpdateEventLog (); }); }; SparkleShare.Controller.OnIdle += delegate { Application.Invoke (delegate { foreach (SparkleLog log in OpenLogs) log.UpdateEventLog (); }); }; }
public SparkleUI() { // Initialize the application Application.Init (); foreach (SparkleChangeSet change_set in SparkleShare.Controller.GetLog ()) { Console.WriteLine (change_set.Timestamp.ToString ()); } // Create the statusicon StatusIcon = new SparkleStatusIcon (); if (SparkleShare.Controller.FirstRun) { Intro = new SparkleIntro (); Intro.ShowAccountForm (); } SparkleShare.Controller.OnQuitWhileSyncing += delegate { // TODO: Pop up a warning when quitting whilst syncing }; SparkleShare.Controller.OnInvitation += delegate (string server, string folder, string token) { Application.Invoke (delegate { SparkleIntro intro = new SparkleIntro (); intro.ShowInvitationPage (server, folder, token); }); }; // Show a bubble when there are new changes SparkleShare.Controller.NotificationRaised += delegate (string user_name, string user_email, string message, string repository_path) { Application.Invoke (delegate { if (EventLog != null) EventLog.UpdateEvents (); if (!SparkleShare.Controller.NotificationsEnabled) return; SparkleBubble bubble = new SparkleBubble (user_name, message); string avatar_file_path = SparkleShare.Controller.GetAvatar (user_email, 32); if (avatar_file_path != null) bubble.Icon = new Gdk.Pixbuf (avatar_file_path); else bubble.Icon = SparkleUIHelpers.GetIcon ("avatar-default", 32); bubble.Show (); }); }; // Show a bubble when there was a conflict SparkleShare.Controller.ConflictNotificationRaised += delegate { Application.Invoke (delegate { string title = _("Ouch! Mid-air collision!"); string subtext = _("Don't worry, SparkleShare made a copy of each conflicting file."); new SparkleBubble (title, subtext).Show (); }); }; SparkleShare.Controller.AvatarFetched += delegate { Application.Invoke (delegate { if (EventLog != null) EventLog.UpdateEvents (); }); }; SparkleShare.Controller.OnIdle += delegate { Application.Invoke (delegate { if (EventLog != null) EventLog.UpdateEvents (); }); }; SparkleShare.Controller.FolderListChanged += delegate { Application.Invoke (delegate { if (EventLog != null) EventLog.UpdateChooser (); }); }; }
public SparkleUI() { string content_path = Directory.GetParent ( System.AppDomain.CurrentDomain.BaseDirectory).ToString (); string app_path = Directory.GetParent (content_path).ToString (); string growl_path = Path.Combine (app_path, "Frameworks", "Growl.framework", "Growl"); // Needed for Growl Dlfcn.dlopen (growl_path, 0); NSApplication.Init (); using (NSAutoreleasePool pool = new NSAutoreleasePool ()) { // Needed for Growl GrowlApplicationBridge.WeakDelegate = this; NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed ("sparkleshare.icns"); SetFolderIcon (); if (!SparkleShare.Controller.BackendIsPresent) { this.alert = new SparkleAlert (); this.alert.RunModal (); return; } 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 (EventLog != null) EventLog.UpdateEvents (); 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 (); if (GrowlApplicationBridge.IsGrowlRunning ()) { SparkleBubble bubble = new SparkleBubble (user_name, message) { ImagePath = SparkleShare.Controller.GetAvatar (user_email, 36) }; bubble.Show (); } else { NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.InformationalRequest); } } }); }; SparkleShare.Controller.ConflictNotificationRaised += delegate { string title = "Ouch! Mid-air collision!"; string subtext = "Don't worry, SparkleShare made a copy of each conflicting file."; new SparkleBubble (title, subtext).Show (); }; SparkleShare.Controller.AvatarFetched += delegate { InvokeOnMainThread (delegate { if (EventLog != null) EventLog.UpdateEvents (); }); }; SparkleShare.Controller.OnIdle += delegate { InvokeOnMainThread (delegate { if (EventLog != null) EventLog.UpdateEvents (); }); }; SparkleShare.Controller.FolderListChanged += delegate { InvokeOnMainThread (delegate { if (EventLog != null) { EventLog.UpdateChooser (); EventLog.UpdateEvents (); } }); }; if (SparkleShare.Controller.FirstRun) { Intro = new SparkleIntro (); Intro.ShowAccountForm (); } }
public SparkleUI() { // Initialize the application Application.Init(); // Create the statusicon StatusIcon = new SparkleStatusIcon(); // Keep track of which event logs are open OpenLogs = new List <SparkleLog> (); if (SparkleShare.Controller.FirstRun) { Intro = new SparkleIntro(); Intro.ShowAccountForm(); } SparkleShare.Controller.OnQuitWhileSyncing += delegate { // TODO: Pop up a warning when quitting whilst syncing }; SparkleShare.Controller.OnInvitation += delegate(string server, string folder, string token) { Application.Invoke(delegate { SparkleIntro intro = new SparkleIntro(); intro.ShowInvitationPage(server, folder, token); }); }; // Show a bubble when there are new changes SparkleShare.Controller.NotificationRaised += delegate(string user_name, string user_email, string message, string repository_path) { foreach (SparkleLog log in OpenLogs) { if (log.LocalPath.Equals(repository_path)) { Application.Invoke(delegate { log.UpdateEventLog(); }); } } // TODO: move to controller and do translation here if (!SparkleShare.Controller.NotificationsEnabled) { return; } Application.Invoke(delegate { SparkleBubble bubble = new SparkleBubble(user_name, message); string avatar_file_path = SparkleUIHelpers.GetAvatar(user_email, 32); if (avatar_file_path != null) { bubble.Icon = new Gdk.Pixbuf(avatar_file_path); } else { bubble.Icon = SparkleUIHelpers.GetIcon("avatar-default", 32); } bubble.AddAction("", "Show Events", delegate { AddEventLog(repository_path); }); bubble.Show(); }); }; // Show a bubble when there was a conflict SparkleShare.Controller.ConflictNotificationRaised += delegate { Application.Invoke(delegate { string title = _("Ouch! Mid-air collision!"); string subtext = _("Don't worry, SparkleShare made a copy of each conflicting file."); new SparkleBubble(title, subtext).Show(); }); }; SparkleShare.Controller.AvatarFetched += delegate { Application.Invoke(delegate { foreach (SparkleLog log in OpenLogs) { log.UpdateEventLog(); } }); }; SparkleShare.Controller.OnIdle += delegate { Application.Invoke(delegate { foreach (SparkleLog log in OpenLogs) { log.UpdateEventLog(); } }); }; }
public SparkleUI() { NSApplication.Init (); SetSparkleIcon (); // TODO: Getting crashes when I remove this NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed ("sparkleshare.icns"); if (!SparkleShare.Controller.BackendIsPresent) { Alert = new SparkleAlert (); Alert.RunModal (); return; } Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 13); OpenLogs = new List <SparkleLog> (); StatusIcon = new SparkleStatusIcon (); SparkleShare.Controller.NotificationRaised += delegate { InvokeOnMainThread (delegate { foreach (SparkleLog log in SparkleUI.OpenLogs) log.UpdateEventLog (); 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 (); NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.InformationalRequest); } }); }; SparkleShare.Controller.AvatarFetched += delegate { InvokeOnMainThread (delegate { foreach (SparkleLog log in SparkleUI.OpenLogs) log.UpdateEventLog (); }); }; SparkleShare.Controller.OnIdle += delegate { InvokeOnMainThread (delegate { foreach (SparkleLog log in SparkleUI.OpenLogs) log.UpdateEventLog (); }); }; if (SparkleShare.Controller.FirstRun) { Intro = new SparkleIntro (); Intro.ShowAccountForm (); } }
public SparkleUI() { // Initialize the application Application.Init (); // Create the statusicon StatusIcon = new SparkleStatusIcon (); // Keep track of event logs are open SparkleUI.OpenLogs = new List <SparkleLog> (); SparkleShare.Controller.OnFirstRun += delegate { Application.Invoke (delegate { SparkleIntro intro = new SparkleIntro (); intro.ShowAll (); }); }; SparkleShare.Controller.OnInvitation += delegate (string invitation_file_path) { Application.Invoke (delegate { SparkleInvitation invitation = new SparkleInvitation (invitation_file_path); invitation.Present (); }); }; // Show a bubble when there are new changes SparkleShare.Controller.NotificationRaised += delegate (string author, string email, string message, string repository_path) { Application.Invoke (delegate { SparkleBubble bubble = new SparkleBubble (author, message) { Icon = SparkleUIHelpers.GetAvatar (email, 32) }; bubble.AddAction ("", "Show Events", delegate { SparkleLog log = new SparkleLog (repository_path); log.ShowAll (); }); bubble.Show (); }); }; // Show a bubble when there was a conflict SparkleShare.Controller.ConflictNotificationRaised += delegate { Application.Invoke (delegate { string title = _("Ouch! Mid-air collision!"); string subtext = _("Don't worry, SparkleShare made a copy of each conflicting file."); SparkleBubble bubble = new SparkleBubble(title, subtext); bubble.Show (); }); }; }
public SparkleUI(bool HideUI) { BusG.Init (); Gtk.Application.Init (); SetProcessName ("sparkleshare"); // The list of repositories Repositories = new List <SparkleRepo> (); EnableSystemAutostart (); InstallLauncher (); // Create the SparkleShare folder and add it to the bookmarks if (!Directory.Exists (SparklePaths.SparklePath)) { CreateSparkleShareFolder (); AddToBookmarks (); } // Watch the SparkleShare folder and update the repo list // when a deletion occurs. FileSystemWatcher watcher = new FileSystemWatcher (SparklePaths.SparklePath) { IncludeSubdirectories = false, EnableRaisingEvents = true, Filter = "*" }; // Remove the repository when a delete event occurs watcher.Deleted += delegate (object o, FileSystemEventArgs args) { RemoveRepository (args.FullPath); }; // Add the repository when a create event occurs watcher.Created += delegate (object o, FileSystemEventArgs args) { // Handle invitations when the user saves an // invitation into the SparkleShare folder if (args.Name.EndsWith ("sparkleshare.invitation")) { SparkleInvitation invitation; invitation = new SparkleInvitation (args.FullPath); Application.Invoke (delegate { invitation.PresentInvitation (); }); } else if (Directory.Exists (args.FullPath)) { AddRepository (args.FullPath); } }; CreateConfigurationFolders (); // Don't create the window and status icon when // the --disable-gui command line argument was given if (!HideUI) { string global_config_file_path = SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath, "config"); // Show the introduction screen if SparkleShare isn't configured if (!File.Exists (global_config_file_path)) { SparkleIntro intro = new SparkleIntro (); intro.ShowAll (); } else { SparkleShare.UserName = SparkleShare.GetUserName (); SparkleShare.UserEmail = SparkleShare.GetUserEmail (); SparkleShare.AddKey (); } // Create the statusicon NotificationIcon = new SparkleStatusIcon (); } PopulateRepositories (); }
public SparkleUI() { string content_path = Directory.GetParent ( System.AppDomain.CurrentDomain.BaseDirectory).ToString (); string app_path = Directory.GetParent (content_path).ToString (); string growl_path = Path.Combine (app_path, "Frameworks", "Growl.framework", "Growl"); // Needed for Growl Dlfcn.dlopen (growl_path, 0); NSApplication.Init (); // Use translations Catalog.Init ("sparkleshare", Path.Combine (NSBundle.MainBundle.ResourcePath, "Translations")); using (NSAutoreleasePool pool = new NSAutoreleasePool ()) { // Needed for Growl GrowlApplicationBridge.WeakDelegate = this; NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed ("sparkleshare.icns"); if (!Program.Controller.BackendIsPresent) { this.alert = new SparkleAlert (); this.alert.RunModal (); return; } SetFolderIcon (); Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 13); StatusIcon = new SparkleStatusIcon (); Bubbles = new SparkleBubbles (); if (Program.Controller.FirstRun) { Setup = new SparkleSetup (); Setup.Controller.ShowSetupPage (); } } }