diff --git a/SparkleShare/Mac/SparkleEventLog.cs b/SparkleShare/Mac/SparkleEventLog.cs index 5dc6aebc..fc6660ec 100644 --- a/SparkleShare/Mac/SparkleEventLog.cs +++ b/SparkleShare/Mac/SparkleEventLog.cs @@ -212,7 +212,7 @@ namespace SparkleShare { string note = match.Groups [3].Value; Thread thread = new Thread (new ThreadStart (delegate { - SparkleShare.Controller.AddNoteToFolder (folder_name, revision, note); + Program.Controller.AddNoteToFolder (folder_name, revision, note); })); thread.Start (); diff --git a/SparkleShare/Mac/SparkleSetup.cs b/SparkleShare/Mac/SparkleSetup.cs index 5e99adc2..d9e84f06 100644 --- a/SparkleShare/Mac/SparkleSetup.cs +++ b/SparkleShare/Mac/SparkleSetup.cs @@ -75,8 +75,8 @@ namespace SparkleShare { UserInfoForm.Cells [0].LineBreakMode = NSLineBreakMode.TruncatingTail; UserInfoForm.Cells [1].LineBreakMode = NSLineBreakMode.TruncatingTail; - UserInfoForm.Cells [0].StringValue = SparkleShare.Controller.UserName; - UserInfoForm.Cells [1].StringValue = SparkleShare.Controller.UserEmail; + UserInfoForm.Cells [0].StringValue = Program.Controller.UserName; + UserInfoForm.Cells [1].StringValue = Program.Controller.UserEmail; // TODO: Ugly hack, do properly with events timer = new Timer () { @@ -102,7 +102,7 @@ namespace SparkleShare { InvokeOnMainThread (delegate { bool name_is_valid = !UserInfoForm.Cells [0].StringValue.Trim ().Equals (""); - bool email_is_valid = SparkleShare.Controller.IsValidEmail ( + bool email_is_valid = Program.Controller.IsValidEmail ( UserInfoForm.Cells [1].StringValue.Trim ()); ContinueButton.Enabled = (name_is_valid && email_is_valid); @@ -370,7 +370,7 @@ namespace SparkleShare { }; OpenFolderButton.Activated += delegate { - SparkleShare.Controller.OpenSparkleShareFolder (Controller.SyncingFolder); + Program.Controller.OpenSparkleShareFolder (Controller.SyncingFolder); }; Buttons.Add (FinishButton); diff --git a/SparkleShare/Mac/SparkleShare.csproj b/SparkleShare/Mac/SparkleShare.csproj index e24b9224..3b398306 100644 --- a/SparkleShare/Mac/SparkleShare.csproj +++ b/SparkleShare/Mac/SparkleShare.csproj @@ -80,8 +80,8 @@ - - SparkleShare.cs + + Program.cs diff --git a/SparkleShare/Mac/SparkleStatusIcon.cs b/SparkleShare/Mac/SparkleStatusIcon.cs index 948bbd27..fa90fc84 100644 --- a/SparkleShare/Mac/SparkleStatusIcon.cs +++ b/SparkleShare/Mac/SparkleStatusIcon.cs @@ -142,7 +142,7 @@ namespace SparkleShare { }; FolderMenuItem.Activated += delegate { - SparkleShare.Controller.OpenSparkleShareFolder (); + Program.Controller.OpenSparkleShareFolder (); }; FolderMenuItem.Image = NSImage.ImageNamed ("sparkleshare-mac"); @@ -150,18 +150,18 @@ namespace SparkleShare { Menu.AddItem (FolderMenuItem); - FolderMenuItems = new NSMenuItem [SparkleShare.Controller.Folders.Count]; + FolderMenuItems = new NSMenuItem [Program.Controller.Folders.Count]; if (Controller.Folders.Length > 0) { - Tasks = new EventHandler [SparkleShare.Controller.Folders.Count]; + Tasks = new EventHandler [Program.Controller.Folders.Count]; int i = 0; - foreach (string folder_name in SparkleShare.Controller.Folders) { + foreach (string folder_name in Program.Controller.Folders) { NSMenuItem item = new NSMenuItem (); item.Title = folder_name; - if (SparkleShare.Controller.UnsyncedFolders.Contains (folder_name)) + if (Program.Controller.UnsyncedFolders.Contains (folder_name)) item.Image = NSImage.ImageNamed ("NSCaution"); else item.Image = NSImage.ImageNamed ("NSFolder"); @@ -192,7 +192,7 @@ namespace SparkleShare { Title = "Add Remote Folder…" }; - if (!SparkleShare.Controller.FirstRun) { + if (!Program.Controller.FirstRun) { SyncMenuItem.Activated += delegate { InvokeOnMainThread (delegate { NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); @@ -236,16 +236,16 @@ namespace SparkleShare { NotificationsMenuItem = new NSMenuItem (); - if (SparkleShare.Controller.NotificationsEnabled) + if (Program.Controller.NotificationsEnabled) NotificationsMenuItem.Title = "Turn Notifications Off"; else NotificationsMenuItem.Title = "Turn Notifications On"; NotificationsMenuItem.Activated += delegate { - SparkleShare.Controller.ToggleNotifications (); + Program.Controller.ToggleNotifications (); InvokeOnMainThread (delegate { - if (SparkleShare.Controller.NotificationsEnabled) + if (Program.Controller.NotificationsEnabled) NotificationsMenuItem.Title = "Turn Notifications Off"; else NotificationsMenuItem.Title = "Turn Notifications On"; @@ -285,7 +285,7 @@ namespace SparkleShare { private EventHandler OpenFolderDelegate (string name) { return delegate { - SparkleShare.Controller.OpenSparkleShareFolder (name); + Program.Controller.OpenSparkleShareFolder (name); }; } diff --git a/SparkleShare/Mac/SparkleUI.cs b/SparkleShare/Mac/SparkleUI.cs index eb3721aa..2f53d0da 100644 --- a/SparkleShare/Mac/SparkleUI.cs +++ b/SparkleShare/Mac/SparkleUI.cs @@ -65,7 +65,7 @@ namespace SparkleShare { NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed ("sparkleshare.icns"); - if (!SparkleShare.Controller.BackendIsPresent) { + if (!Program.Controller.BackendIsPresent) { this.alert = new SparkleAlert (); this.alert.RunModal (); return; @@ -79,7 +79,7 @@ namespace SparkleShare { StatusIcon = new SparkleStatusIcon (); Bubbles = new SparkleBubbles (); - if (SparkleShare.Controller.FirstRun) { + if (Program.Controller.FirstRun) { Setup = new SparkleSetup (); Setup.Controller.ShowSetupPage (); } @@ -95,7 +95,7 @@ namespace SparkleShare { NSImage folder_icon = new NSImage (folder_icon_path); NSWorkspace.SharedWorkspace.SetIconforFile (folder_icon, - SparkleShare.Controller.SparklePath, 0); + Program.Controller.SparklePath, 0); } @@ -123,7 +123,7 @@ namespace SparkleShare { public override void WillTerminate (NSNotification notification) { - SparkleShare.Controller.Quit (); + Program.Controller.Quit (); } } } diff --git a/SparkleShare/Makefile.am b/SparkleShare/Makefile.am index aadd1814..d1c946a6 100644 --- a/SparkleShare/Makefile.am +++ b/SparkleShare/Makefile.am @@ -25,7 +25,7 @@ SOURCES = \ SparkleSetup.cs \ SparkleSetupController.cs \ SparkleSetupWindow.cs \ - SparkleShare.cs \ + Program.cs \ SparkleSpinner.cs \ SparkleStatusIcon.cs \ SparkleStatusIconController.cs \ @@ -41,7 +41,7 @@ SOURCES = \ SparkleSetup.cs \ SparkleSetupController.cs \ SparkleSetupWindow.cs \ - SparkleShare.cs \ + Program.cs \ SparkleSpinner.cs \ SparkleStatusIcon.cs \ SparkleStatusIconController.cs \ diff --git a/SparkleShare/SparkleShare.cs b/SparkleShare/Program.cs similarity index 99% rename from SparkleShare/SparkleShare.cs rename to SparkleShare/Program.cs index 0002e2d8..f8368984 100644 --- a/SparkleShare/SparkleShare.cs +++ b/SparkleShare/Program.cs @@ -30,7 +30,7 @@ using SparkleLib.Options; namespace SparkleShare { // This is SparkleShare! - public class SparkleShare { + public class Program { public static SparkleController Controller; public static SparkleUI UI; diff --git a/SparkleShare/SparkleBubblesController.cs b/SparkleShare/SparkleBubblesController.cs index 14870aaf..e6983625 100644 --- a/SparkleShare/SparkleBubblesController.cs +++ b/SparkleShare/SparkleBubblesController.cs @@ -27,23 +27,23 @@ namespace SparkleShare { public SparkleBubblesController () { - SparkleShare.Controller.ConflictNotificationRaised += delegate { + Program.Controller.ConflictNotificationRaised += delegate { ShowBubble ("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, + Program.Controller.NotificationRaised += delegate (string user_name, string user_email, string message, string folder_path) { ShowBubble (user_name, message, - SparkleShare.Controller.GetAvatar (user_email, 36)); + Program.Controller.GetAvatar (user_email, 36)); }; } public void ShowBubble (string title, string subtext, string image_path) { - if (ShowBubbleEvent != null && SparkleShare.Controller.NotificationsEnabled) + if (ShowBubbleEvent != null && Program.Controller.NotificationsEnabled) ShowBubbleEvent (title, subtext, image_path); } } diff --git a/SparkleShare/SparkleEventLog.cs b/SparkleShare/SparkleEventLog.cs index 73901de1..5ab9e152 100644 --- a/SparkleShare/SparkleEventLog.cs +++ b/SparkleShare/SparkleEventLog.cs @@ -92,7 +92,7 @@ namespace SparkleShare { string note = match.Groups [3].Value; Thread thread = new Thread (new ThreadStart (delegate { - SparkleShare.Controller.AddNoteToFolder (folder_name, revision, note); + Program.Controller.AddNoteToFolder (folder_name, revision, note); })); thread.Start (); diff --git a/SparkleShare/SparkleEventLogController.cs b/SparkleShare/SparkleEventLogController.cs index fdc99f3d..98d95ded 100644 --- a/SparkleShare/SparkleEventLogController.cs +++ b/SparkleShare/SparkleEventLogController.cs @@ -69,14 +69,14 @@ namespace SparkleShare { public string HTML { get { - List change_sets = SparkleShare.Controller.GetLog (this.selected_folder); - return SparkleShare.Controller.GetHTMLLog (change_sets); + List change_sets = Program.Controller.GetLog (this.selected_folder); + return Program.Controller.GetHTMLLog (change_sets); } } public string [] Folders { get { - return SparkleShare.Controller.Folders.ToArray (); + return Program.Controller.Folders.ToArray (); } } @@ -86,19 +86,19 @@ namespace SparkleShare { public SparkleEventLogController () { - SparkleShare.Controller.AvatarFetched += delegate { + Program.Controller.AvatarFetched += delegate { if (UpdateContentEvent != null) UpdateContentEvent (HTML); }; - SparkleShare.Controller.OnIdle += delegate { + Program.Controller.OnIdle += delegate { if (UpdateContentEvent != null) UpdateContentEvent (HTML); }; - SparkleShare.Controller.FolderListChanged += delegate { + Program.Controller.FolderListChanged += delegate { if (this.selected_folder != null && - !SparkleShare.Controller.Folders.Contains (this.selected_folder)) { + !Program.Controller.Folders.Contains (this.selected_folder)) { this.selected_folder = null; } @@ -110,7 +110,7 @@ namespace SparkleShare { UpdateContentEvent (HTML); }; - SparkleShare.Controller.NotificationRaised += delegate { + Program.Controller.NotificationRaised += delegate { if (UpdateContentEvent != null) UpdateContentEvent (HTML); }; diff --git a/SparkleShare/SparkleSetup.cs b/SparkleShare/SparkleSetup.cs index 4ed163a3..5084f75d 100644 --- a/SparkleShare/SparkleSetup.cs +++ b/SparkleShare/SparkleSetup.cs @@ -77,7 +77,7 @@ namespace SparkleShare { Xalign = 0 }; - NameEntry = new Entry (SparkleShare.Controller.UserName); + NameEntry = new Entry (Program.Controller.UserName); NameEntry.Changed += delegate { CheckSetupPage (); }; @@ -149,7 +149,7 @@ namespace SparkleShare { ListStore server_store = new ListStore (typeof (string)); - foreach (string host in SparkleShare.Controller.PreviousHosts) + foreach (string host in Program.Controller.PreviousHosts) server_store.AppendValues (host); ServerEntry.Completion.Model = server_store; @@ -239,7 +239,7 @@ namespace SparkleShare { ListStore folder_store = new ListStore (typeof (string)); - //foreach (string host in SparkleShare.Controller.FolderPaths) + //foreach (string host in Program.Controller.FolderPaths) // folder_store.AppendValues (host); FolderEntry.Completion.Model = folder_store; @@ -411,7 +411,7 @@ namespace SparkleShare { Button open_folder_button = new Button (_("Open Folder")); open_folder_button.Clicked += delegate { - SparkleShare.Controller.OpenSparkleShareFolder (Controller.SyncingFolder); + Program.Controller.OpenSparkleShareFolder (Controller.SyncingFolder); }; Button finish_button = new Button (_("Finish")); @@ -441,7 +441,7 @@ namespace SparkleShare { private void CheckSetupPage () { if (NameEntry.Text.Length > 0 && - SparkleShare.Controller.IsValidEmail (EmailEntry.Text)) { + Program.Controller.IsValidEmail (EmailEntry.Text)) { NextButton.Sensitive = true; } else { diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index 3ff5e43f..5b19d896 100644 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -97,11 +97,11 @@ namespace SparkleShare { public void SetupPageCompleted (string full_name, string email) { - SparkleShare.Controller.UserName = full_name; - SparkleShare.Controller.UserEmail = email; + Program.Controller.UserName = full_name; + Program.Controller.UserEmail = email; - SparkleShare.Controller.GenerateKeyPair (); - SparkleShare.Controller.UpdateState (); + Program.Controller.GenerateKeyPair (); + Program.Controller.UpdateState (); if (ChangePageEvent != null) ChangePageEvent (PageType.Add); @@ -117,14 +117,14 @@ namespace SparkleShare { if (ChangePageEvent != null) ChangePageEvent (PageType.Syncing); - SparkleShare.Controller.FolderFetched += delegate { + Program.Controller.FolderFetched += delegate { if (ChangePageEvent != null) ChangePageEvent (PageType.Finished); this.syncing_folder = ""; }; - SparkleShare.Controller.FolderFetchError += delegate (string remote_url) { + Program.Controller.FolderFetchError += delegate (string remote_url) { this.previous_url = remote_url; if (ChangePageEvent != null) @@ -133,12 +133,12 @@ namespace SparkleShare { this.syncing_folder = ""; }; - SparkleShare.Controller.FolderFetching += delegate (double percentage) { + Program.Controller.FolderFetching += delegate (double percentage) { if (UpdateProgressBarEvent != null) UpdateProgressBarEvent (percentage); }; - SparkleShare.Controller.FetchFolder (server, folder_name); + Program.Controller.FetchFolder (server, folder_name); } @@ -151,7 +151,7 @@ namespace SparkleShare { public void SyncingCancelled () { - SparkleShare.Controller.StopFetcher (); + Program.Controller.StopFetcher (); if (ChangePageEvent != null) ChangePageEvent (PageType.Add); @@ -162,7 +162,7 @@ namespace SparkleShare { { this.previous_server = ""; this.previous_folder = ""; - SparkleShare.Controller.UpdateState (); + Program.Controller.UpdateState (); } } } diff --git a/SparkleShare/SparkleShare.csproj b/SparkleShare/SparkleShare.csproj index 373cce83..ad2795f7 100644 --- a/SparkleShare/SparkleShare.csproj +++ b/SparkleShare/SparkleShare.csproj @@ -67,7 +67,7 @@ - + diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index ae398e00..cd0e8afc 100644 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -193,18 +193,18 @@ namespace SparkleShare { }; folder_item.Activated += delegate { - SparkleShare.Controller.OpenSparkleShareFolder (); + Program.Controller.OpenSparkleShareFolder (); }; Menu.Add (folder_item); - if (SparkleShare.Controller.Folders.Count > 0) { + if (Program.Controller.Folders.Count > 0) { // Creates a menu item for each repository with a link to their logs - foreach (string folder_name in SparkleShare.Controller.Folders) { + foreach (string folder_name in Program.Controller.Folders) { Gdk.Pixbuf folder_icon; - if (SparkleShare.Controller.UnsyncedFolders.Contains (folder_name)) { + if (Program.Controller.UnsyncedFolders.Contains (folder_name)) { folder_icon = IconTheme.Default.LoadIcon ("dialog-error", 16, IconLookupFlags.GenericFallback); @@ -234,7 +234,7 @@ namespace SparkleShare { // Opens the wizard to add a new remote folder MenuItem sync_item = new MenuItem (_("Add Remote Folder…")); - if (SparkleShare.Controller.FirstRun) + if (Program.Controller.FirstRun) sync_item.Sensitive = false; sync_item.Activated += delegate { @@ -258,7 +258,7 @@ namespace SparkleShare { MenuItem recent_events_item = new MenuItem (_("Show Recent Events")); - if (SparkleShare.Controller.Folders.Count < 1) + if (Program.Controller.Folders.Count < 1) recent_events_item.Sensitive = false; recent_events_item.Activated += delegate { @@ -275,13 +275,13 @@ namespace SparkleShare { MenuItem notify_item; - if (SparkleShare.Controller.NotificationsEnabled) + if (Program.Controller.NotificationsEnabled) notify_item = new MenuItem (_("Turn Notifications Off")); else notify_item = new MenuItem (_("Turn Notifications On")); notify_item.Activated += delegate { - SparkleShare.Controller.ToggleNotifications (); + Program.Controller.ToggleNotifications (); CreateMenu (); }; @@ -308,7 +308,7 @@ namespace SparkleShare { MenuItem quit_item = new MenuItem (_("Quit")); quit_item.Activated += delegate { - SparkleShare.Controller.Quit (); + Program.Controller.Quit (); }; Menu.Add (quit_item); @@ -325,7 +325,7 @@ namespace SparkleShare { private EventHandler OpenFolderDelegate (string name) { return delegate { - SparkleShare.Controller.OpenSparkleShareFolder (name); + Program.Controller.OpenSparkleShareFolder (name); }; } diff --git a/SparkleShare/SparkleStatusIconController.cs b/SparkleShare/SparkleStatusIconController.cs index 132d6b40..6fc54782 100644 --- a/SparkleShare/SparkleStatusIconController.cs +++ b/SparkleShare/SparkleStatusIconController.cs @@ -38,29 +38,29 @@ namespace SparkleShare { public string [] Folders { get { - return SparkleShare.Controller.Folders.ToArray (); + return Program.Controller.Folders.ToArray (); } } public string FolderSize { get { - return SparkleShare.Controller.FolderSize; + return Program.Controller.FolderSize; } } public SparkleStatusIconController () { - SparkleShare.Controller.FolderSizeChanged += delegate { + Program.Controller.FolderSizeChanged += delegate { if (UpdateMenuEvent != null) UpdateMenuEvent (CurrentState); }; - SparkleShare.Controller.FolderListChanged += delegate { + Program.Controller.FolderListChanged += delegate { if (UpdateMenuEvent != null) UpdateMenuEvent (CurrentState); }; - SparkleShare.Controller.OnIdle += delegate { + Program.Controller.OnIdle += delegate { if (CurrentState != IconState.Error) CurrentState = IconState.Idle; @@ -68,7 +68,7 @@ namespace SparkleShare { UpdateMenuEvent (CurrentState); }; - SparkleShare.Controller.OnSyncing += delegate { + Program.Controller.OnSyncing += delegate { CurrentState = IconState.Syncing; // TODO up down both @@ -77,7 +77,7 @@ namespace SparkleShare { UpdateMenuEvent (IconState.Syncing); }; - SparkleShare.Controller.OnError += delegate { + Program.Controller.OnError += delegate { CurrentState = IconState.Error; if (UpdateMenuEvent != null) diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index fe3fbb8e..96ec23f2 100644 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -59,12 +59,12 @@ namespace SparkleShare { StatusIcon = new SparkleStatusIcon (); Bubbles = new SparkleBubbles (); - if (SparkleShare.Controller.FirstRun) { + if (Program.Controller.FirstRun) { Setup = new SparkleSetup (); Setup.Controller.ShowSetupPage (); } - SparkleShare.Controller.OnQuitWhileSyncing += delegate { + Program.Controller.OnQuitWhileSyncing += delegate { // TODO: Pop up a warning when quitting whilst syncing }; }