[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 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 ();
};

View file

@ -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];
});