From 7c6284b5cff5996caea4d9cd60487c36cf338340 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Tue, 5 Oct 2010 22:22:31 +0100 Subject: [PATCH] [log] destroy logs properly after closing, so they don't pop up again on raised events --- SparkleShare/SparkleLog.cs | 2 +- SparkleShare/SparkleStatusIcon.cs | 25 ++++++++++++++++--------- SparkleShare/SparkleUI.cs | 2 +- data/icons/Makefile.am | 3 ++- data/icons/dialog-warning.png | Bin 0 -> 683 bytes 5 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 data/icons/dialog-warning.png diff --git a/SparkleShare/SparkleLog.cs b/SparkleShare/SparkleLog.cs index 9b465120..fe455cf5 100644 --- a/SparkleShare/SparkleLog.cs +++ b/SparkleShare/SparkleLog.cs @@ -154,7 +154,7 @@ namespace SparkleShare { } - HideAll (); // TODO: destroy it + HideAll (); } diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index 815455ed..d12f02b6 100644 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -30,8 +30,6 @@ namespace SparkleShare { public class SparkleStatusIcon : StatusIcon { - private List OpenLogs; - private Menu Menu; private MenuItem StatusMenuItem; private string StateText; @@ -52,7 +50,7 @@ namespace SparkleShare { public SparkleStatusIcon () : base () { - OpenLogs = new List (); + SparkleUI.OpenLogs = new List (); 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); diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index c78495aa..be60b0d0 100644 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -32,7 +32,7 @@ namespace SparkleShare { public static List Repositories; public static SparkleStatusIcon StatusIcon; - + public static List OpenLogs; // Short alias for the translations public static string _(string s) diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am index 7618c2ad..88e72484 100644 --- a/data/icons/Makefile.am +++ b/data/icons/Makefile.am @@ -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)" \ diff --git a/data/icons/dialog-warning.png b/data/icons/dialog-warning.png new file mode 100644 index 0000000000000000000000000000000000000000..219432c44d6d57179930a1f307e3c48e89afc4ab GIT binary patch literal 683 zcmV;c0#yBpP)9ZU- zJm)h#N36B9OZl!8l{jy(t%?rAOVLMmqg_w6eGMq>y)vcgVLftjGBlAF9eeFAD|h6A zE}R^fL{3yPr&Mn2T8*$-E~ff=U-q*n`~fdev1JxTbp*C|xhmOVUs`ok zzR29t3Uf;<=zIxfo7nVFZtFWUZGo+8;x%;gK_u#V;(Dmm5wgBRt}BAd^db=#H}1!q z5?flkA?`mwMYt95bB+$G=>9QmP@|A`C}bRLYaiV|foat+iSC#*xqblnbVV{P9i2tL!53jp$NhCXHZJksZSZf_Ci#QEQYK%adAKLHL=TMO?5xw}p?AtWG(o^r zGKvGxc)xmJ7U^GS{qOYvaThoE#u-y@^77*b3)bSc>2-_<`yxD(PT%>k`3YlFonmk< R;ST@+002ovPDHLkV1l9fDaHT* literal 0 HcmV?d00001