[statusicon] Cleanup

This commit is contained in:
Hylke Bons 2010-11-20 13:21:17 +00:00
parent c5263e771b
commit 79d4131825
2 changed files with 19 additions and 18 deletions

View file

@ -41,8 +41,8 @@ namespace SparkleShare {
public event FolderFetchErrorEventHandler FolderFetchError; public event FolderFetchErrorEventHandler FolderFetchError;
public delegate void FolderFetchErrorEventHandler (); public delegate void FolderFetchErrorEventHandler ();
public event RepositoryListChangedEventHandler RepositoryListChanged; public event FolderListChangedEventHandler FolderListChanged;
public delegate void RepositoryListChangedEventHandler (); public delegate void FolderListChangedEventHandler ();
public event FolderSizeChangedEventHandler FolderSizeChanged; public event FolderSizeChangedEventHandler FolderSizeChanged;
public delegate void FolderSizeChangedEventHandler (string folder_size); public delegate void FolderSizeChangedEventHandler (string folder_size);
@ -294,8 +294,8 @@ namespace SparkleShare {
Repositories.Add (repo); Repositories.Add (repo);
if (RepositoryListChanged != null) if (FolderListChanged != null)
RepositoryListChanged (); FolderListChanged ();
} }
@ -323,8 +323,8 @@ namespace SparkleShare {
} }
if (RepositoryListChanged != null) if (FolderListChanged != null)
RepositoryListChanged (); FolderListChanged ();
} }
@ -339,8 +339,8 @@ namespace SparkleShare {
foreach (string folder_path in Directory.GetDirectories (SparklePaths.SparklePath)) foreach (string folder_path in Directory.GetDirectories (SparklePaths.SparklePath))
AddRepository (folder_path); AddRepository (folder_path);
if (RepositoryListChanged != null) if (FolderListChanged != null)
RepositoryListChanged (); FolderListChanged ();
} }
@ -703,8 +703,8 @@ namespace SparkleShare {
if (FolderFetched != null) if (FolderFetched != null)
FolderFetched (); FolderFetched ();
if (RepositoryListChanged != null) if (FolderListChanged != null)
RepositoryListChanged (); FolderListChanged ();
}; };

View file

@ -17,6 +17,7 @@
using Gtk; using Gtk;
using Mono.Unix; using Mono.Unix;
using System; using System;
using System.IO;
using System.Timers; using System.Timers;
namespace SparkleShare { namespace SparkleShare {
@ -41,7 +42,6 @@ namespace SparkleShare {
public SparkleStatusIcon () : base () public SparkleStatusIcon () : base ()
{ {
FrameNumber = 0;
AnimationFrames = CreateAnimationFrames (); AnimationFrames = CreateAnimationFrames ();
Animation = CreateAnimation (); Animation = CreateAnimation ();
@ -51,7 +51,6 @@ namespace SparkleShare {
SetNormalState (); SetNormalState ();
CreateMenu (); CreateMenu ();
// TODO: Move all event hookups to SparkleUI
SparkleShare.Controller.FolderSizeChanged += delegate { SparkleShare.Controller.FolderSizeChanged += delegate {
Application.Invoke (delegate { Application.Invoke (delegate {
@ -59,7 +58,7 @@ namespace SparkleShare {
}); });
}; };
SparkleShare.Controller.RepositoryListChanged += delegate { SparkleShare.Controller.FolderListChanged += delegate {
Application.Invoke (delegate { Application.Invoke (delegate {
SetNormalState (); SetNormalState ();
CreateMenu (); CreateMenu ();
@ -110,6 +109,8 @@ namespace SparkleShare {
private Timer CreateAnimation () private Timer CreateAnimation ()
{ {
FrameNumber = 0;
Timer Animation = new Timer () { Timer Animation = new Timer () {
Interval = 35 Interval = 35
}; };
@ -163,7 +164,7 @@ namespace SparkleShare {
// Creates a menu item for each repository with a link to their logs // Creates a menu item for each repository with a link to their logs
foreach (string path in SparkleShare.Controller.Folders) { foreach (string path in SparkleShare.Controller.Folders) {
folder_action = new Gtk.Action ("", path) { folder_action = new Gtk.Action ("", Path.GetFileName (path)) {
IconName = "folder", IconName = "folder",
IsImportant = true IsImportant = true
}; };
@ -239,8 +240,10 @@ namespace SparkleShare {
Menu.Add (quit_item); Menu.Add (quit_item);
Menu.ShowAll (); Menu.ShowAll ();
} }
@ -290,8 +293,6 @@ namespace SparkleShare {
Menu.Add (status_menu_item); Menu.Add (status_menu_item);
Menu.ReorderChild (status_menu_item, 0); Menu.ReorderChild (status_menu_item, 0);
// TODO: relist the folders as well
Menu.ShowAll (); Menu.ShowAll ();
} }
@ -332,7 +333,7 @@ namespace SparkleShare {
if (SparkleShare.Controller.Folders.Count == 0) { if (SparkleShare.Controller.Folders.Count == 0) {
StateText = _("No folders yet"); StateText = _("Welcome to SparkleShare!");
Application.Invoke (delegate { Application.Invoke (delegate {
Pixbuf = AnimationFrames [0]; Pixbuf = AnimationFrames [0];
}); });