From 60273631f36320b31b0e6248d86e36d24cbbef28 Mon Sep 17 00:00:00 2001 From: wimh Date: Sun, 21 Aug 2011 01:18:03 +0200 Subject: [PATCH 1/4] avoid crash if remote folder is deleted by user. When all files including the .git folder are removed from a remote folder, but that folder is not removed from the SparkleShare config, SparkleShare crashes at startup, and when showing the log for that folder. This commit should avoid a crash. --- SparkleLib/Git/SparkleRepoGit.cs | 3 +++ SparkleShare/SparkleEventLog.cs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index a81fad71..4e9b582c 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -45,6 +45,9 @@ namespace SparkleLib { string output = git.StandardOutput.ReadToEnd (); git.WaitForExit (); + if (output.Length < 40) + return null; + return output.Substring (0, 40); } } diff --git a/SparkleShare/SparkleEventLog.cs b/SparkleShare/SparkleEventLog.cs index 5d73998a..73901de1 100644 --- a/SparkleShare/SparkleEventLog.cs +++ b/SparkleShare/SparkleEventLog.cs @@ -203,6 +203,9 @@ namespace SparkleShare { if (html == null) html = Controller.HTML; + if (html == null) + return; + html = html.Replace ("", (double) (Style.FontDescription.Size / 1024 + 3) + "px"); html = html.Replace ("", (Style.FontDescription.Size / 1024 + 3) + "px"); html = html.Replace ("", "#0085cf"); From 1e32374e81692511a81417a73a36972234cf55c9 Mon Sep 17 00:00:00 2001 From: wimh Date: Fri, 26 Aug 2011 22:00:33 +0200 Subject: [PATCH 2/4] fix crash if file was renamed remote see #8 (https://github.com/wimh/SparkleShare/issues/8) --- SparkleLib/Git/SparkleRepoGit.cs | 3 ++- SparkleLib/SparkleRepoBase.cs | 27 +++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index 4e9b582c..c2b67245 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -493,7 +493,8 @@ namespace SparkleLib { if ((change_set.Added.Count + change_set.Edited.Count + - change_set.Deleted.Count) > 0) { + change_set.Deleted.Count + + change_set.MovedFrom.Count) > 0) { change_set.Notes.AddRange (GetNotes (change_set.Revision)); change_sets.Add (change_set); diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs index 70cb9808..6d724859 100644 --- a/SparkleLib/SparkleRepoBase.cs +++ b/SparkleLib/SparkleRepoBase.cs @@ -444,22 +444,25 @@ namespace SparkleLib { if (SyncStatusChanged != null) SyncStatusChanged (SyncStatus.Idle); - SparkleChangeSet change_set = GetChangeSets (1) [0]; + List change_sets = GetChangeSets (1); + if (change_sets != null && change_sets.Count > 0) { + SparkleChangeSet change_set = change_sets [0]; - bool note_added = false; - foreach (string added in change_set.Added) { - if (added.Contains (".notes")) { - if (NewNote != null) - NewNote (change_set.User.Name, change_set.User.Email); + bool note_added = false; + foreach (string added in change_set.Added) { + if (added.Contains (".notes")) { + if (NewNote != null) + NewNote (change_set.User.Name, change_set.User.Email); - note_added = true; - break; + note_added = true; + break; + } } - } - if (!note_added) { - if (NewChangeSet != null) - NewChangeSet (change_set); + if (!note_added) { + if (NewChangeSet != null) + NewChangeSet (change_set); + } } // There could be changes from a resolved From 79e96b3bf0fd40b2ab1a7707b5a88f6a13344d8e Mon Sep 17 00:00:00 2001 From: wimh Date: Fri, 26 Aug 2011 22:10:33 +0200 Subject: [PATCH 3/4] default path to git avoid it stays null when not found in paths[] --- SparkleLib/SparkleBackend.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/SparkleLib/SparkleBackend.cs b/SparkleLib/SparkleBackend.cs index 248cd3f6..c916fa83 100644 --- a/SparkleLib/SparkleBackend.cs +++ b/SparkleLib/SparkleBackend.cs @@ -32,6 +32,7 @@ namespace SparkleLib { public SparkleBackend (string name, string [] paths) { Name = name; + Path = "git"; foreach (string path in paths) { if (File.Exists (path)) { From f78d1c53943479c1f3260cff431aeece1a157996 Mon Sep 17 00:00:00 2001 From: wimh Date: Sat, 3 Sep 2011 22:23:45 +0200 Subject: [PATCH 4/4] rename SparkleShare.SparkleShare to SparkleShare.Program naming a class the same as the namespace causes problems http://blogs.msdn.com/b/ericlippert/archive/2010/03/09/do-not-name-a-class-the-same-as-its-namespace-part-one.aspx --- SparkleShare/Mac/SparkleEventLog.cs | 2 +- SparkleShare/Mac/SparkleSetup.cs | 8 ++++---- SparkleShare/Mac/SparkleShare.csproj | 4 ++-- SparkleShare/Mac/SparkleStatusIcon.cs | 20 ++++++++++---------- SparkleShare/Mac/SparkleUI.cs | 8 ++++---- SparkleShare/Makefile.am | 4 ++-- SparkleShare/{SparkleShare.cs => Program.cs} | 2 +- SparkleShare/SparkleBubblesController.cs | 8 ++++---- SparkleShare/SparkleEventLog.cs | 2 +- SparkleShare/SparkleEventLogController.cs | 16 ++++++++-------- SparkleShare/SparkleSetup.cs | 10 +++++----- SparkleShare/SparkleSetupController.cs | 20 ++++++++++---------- SparkleShare/SparkleShare.csproj | 2 +- SparkleShare/SparkleStatusIcon.cs | 20 ++++++++++---------- SparkleShare/SparkleStatusIconController.cs | 14 +++++++------- SparkleShare/SparkleUI.cs | 4 ++-- 16 files changed, 72 insertions(+), 72 deletions(-) rename SparkleShare/{SparkleShare.cs => Program.cs} (99%) 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 }; }