[log] destroy logs properly after closing, so they don't pop up again on raised events

This commit is contained in:
Hylke Bons 2010-10-05 22:22:31 +01:00
parent afac55f9a0
commit 7c6284b5cf
5 changed files with 20 additions and 12 deletions

View file

@ -154,7 +154,7 @@ namespace SparkleShare {
}
HideAll (); // TODO: destroy it
HideAll ();
}

View file

@ -30,8 +30,6 @@ namespace SparkleShare {
public class SparkleStatusIcon : StatusIcon
{
private List <SparkleLog> OpenLogs;
private Menu Menu;
private MenuItem StatusMenuItem;
private string StateText;
@ -52,7 +50,7 @@ namespace SparkleShare {
public SparkleStatusIcon () : base ()
{
OpenLogs = new List <SparkleLog> ();
SparkleUI.OpenLogs = new List <SparkleLog> ();
FolderSize = GetFolderSize (new DirectoryInfo (SparklePaths.SparklePath));
@ -129,7 +127,7 @@ namespace SparkleShare {
return delegate {
SparkleLog log = OpenLogs.Find (delegate (SparkleLog l) { return l.LocalPath.Equals (path); });
SparkleLog log = SparkleUI.OpenLogs.Find (delegate (SparkleLog l) { return l.LocalPath.Equals (path); });
// Check whether the log is already open,
// create a new one if that's not the case or
@ -139,11 +137,13 @@ namespace SparkleShare {
log = new SparkleLog (path);
log.Hidden += delegate {
OpenLogs.Remove (log);
log = null;
SparkleUI.OpenLogs.Remove (log);
log.Destroy ();
};
OpenLogs.Add (log);
SparkleUI.OpenLogs.Add (log);
}
@ -227,8 +227,10 @@ namespace SparkleShare {
// Creates the menu that is popped up when the
// user clicks the statusicon
public void CreateMenu ()
{
{int i = 0;
foreach (SparkleLog logi in SparkleUI.OpenLogs){i++;
Console.WriteLine (i + ": " + logi.LocalPath);
}
Menu = new Menu ();
// The menu item showing the status and size of the SparkleShare folder
@ -267,6 +269,10 @@ namespace SparkleShare {
IsImportant = true
};
if (repo.HasUnsyncedChanges){
folder_action.IconName = "dialog-warning";
Console.WriteLine ("FFFFFFFFFFFFFFFFFFFF");
}
folder_action.Activated += OpenLogDelegate (repo.LocalPath);
MenuItem menu_item = (MenuItem) folder_action.CreateMenuItem ();
@ -354,6 +360,7 @@ namespace SparkleShare {
private void ShowMenu (object o, EventArgs args)
{
CreateMenu ();
Menu.ShowAll ();
Menu.Popup (null, null, SetPosition, 0, Global.CurrentEventTime);

View file

@ -32,7 +32,7 @@ namespace SparkleShare {
public static List <SparkleRepo> Repositories;
public static SparkleStatusIcon StatusIcon;
public static List <SparkleLog> OpenLogs;
// Short alias for the translations
public static string _(string s)

View file

@ -28,7 +28,8 @@ app_theme_icons = \
status,document-added-16.png \
status,document-edited-16.png \
status,document-moved-16.png \
status,document-removed-16.png
status,document-removed-16.png \
status,dialog-warning-16.png
install_icon_exec = $(top_srcdir)/build/icon-theme-installer \
-t "$(theme)" \

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B