From 79d41318255955443f965b3fb535e293b719c8a1 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 20 Nov 2010 13:21:17 +0000 Subject: [PATCH] [statusicon] Cleanup --- SparkleShare/SparkleController.cs | 20 ++++++++++---------- SparkleShare/SparkleStatusIcon.cs | 17 +++++++++-------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index 1c6ef117..36b54749 100644 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -41,8 +41,8 @@ namespace SparkleShare { public event FolderFetchErrorEventHandler FolderFetchError; public delegate void FolderFetchErrorEventHandler (); - public event RepositoryListChangedEventHandler RepositoryListChanged; - public delegate void RepositoryListChangedEventHandler (); + public event FolderListChangedEventHandler FolderListChanged; + public delegate void FolderListChangedEventHandler (); public event FolderSizeChangedEventHandler FolderSizeChanged; public delegate void FolderSizeChangedEventHandler (string folder_size); @@ -294,8 +294,8 @@ namespace SparkleShare { Repositories.Add (repo); - if (RepositoryListChanged != null) - RepositoryListChanged (); + if (FolderListChanged != null) + FolderListChanged (); } @@ -323,8 +323,8 @@ namespace SparkleShare { } - if (RepositoryListChanged != null) - RepositoryListChanged (); + if (FolderListChanged != null) + FolderListChanged (); } @@ -339,8 +339,8 @@ namespace SparkleShare { foreach (string folder_path in Directory.GetDirectories (SparklePaths.SparklePath)) AddRepository (folder_path); - if (RepositoryListChanged != null) - RepositoryListChanged (); + if (FolderListChanged != null) + FolderListChanged (); } @@ -703,8 +703,8 @@ namespace SparkleShare { if (FolderFetched != null) FolderFetched (); - if (RepositoryListChanged != null) - RepositoryListChanged (); + if (FolderListChanged != null) + FolderListChanged (); }; diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index 0a800501..af377d4e 100644 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -17,6 +17,7 @@ using Gtk; using Mono.Unix; using System; +using System.IO; using System.Timers; namespace SparkleShare { @@ -41,7 +42,6 @@ namespace SparkleShare { public SparkleStatusIcon () : base () { - FrameNumber = 0; AnimationFrames = CreateAnimationFrames (); Animation = CreateAnimation (); @@ -51,7 +51,6 @@ namespace SparkleShare { SetNormalState (); CreateMenu (); - // TODO: Move all event hookups to SparkleUI SparkleShare.Controller.FolderSizeChanged += delegate { Application.Invoke (delegate { @@ -59,7 +58,7 @@ namespace SparkleShare { }); }; - SparkleShare.Controller.RepositoryListChanged += delegate { + SparkleShare.Controller.FolderListChanged += delegate { Application.Invoke (delegate { SetNormalState (); CreateMenu (); @@ -110,6 +109,8 @@ namespace SparkleShare { private Timer CreateAnimation () { + FrameNumber = 0; + Timer Animation = new Timer () { Interval = 35 }; @@ -163,7 +164,7 @@ namespace SparkleShare { // Creates a menu item for each repository with a link to their logs foreach (string path in SparkleShare.Controller.Folders) { - folder_action = new Gtk.Action ("", path) { + folder_action = new Gtk.Action ("", Path.GetFileName (path)) { IconName = "folder", IsImportant = true }; @@ -239,7 +240,9 @@ namespace SparkleShare { Menu.Add (quit_item); - Menu.ShowAll (); + + Menu.ShowAll (); + } @@ -290,8 +293,6 @@ namespace SparkleShare { Menu.Add (status_menu_item); Menu.ReorderChild (status_menu_item, 0); - // TODO: relist the folders as well - Menu.ShowAll (); } @@ -332,7 +333,7 @@ namespace SparkleShare { if (SparkleShare.Controller.Folders.Count == 0) { - StateText = _("No folders yet"); + StateText = _("Welcome to SparkleShare!"); Application.Invoke (delegate { Pixbuf = AnimationFrames [0]; });