From ae6b262ef58a4ae46e2ade2e5751203a3b995766 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Mon, 14 Mar 2011 02:07:14 +0000 Subject: [PATCH] keep logs in memory on linux --- SparkleShare/SparkleIntro.cs | 16 +++++++--------- SparkleShare/SparkleLog.cs | 20 ++++++++++---------- SparkleShare/SparkleStatusIcon.cs | 30 ++++++++++++------------------ 3 files changed, 29 insertions(+), 37 deletions(-) diff --git a/SparkleShare/SparkleIntro.cs b/SparkleShare/SparkleIntro.cs index 405d8248..8b189af8 100644 --- a/SparkleShare/SparkleIntro.cs +++ b/SparkleShare/SparkleIntro.cs @@ -149,12 +149,12 @@ namespace SparkleShare { } - private void PreventClose (object o, DeleteEventArgs e) + private void PreventClose (object o, DeleteEventArgs args) { // Cancel closing when the "Close" // button of the window is pressed - e.RetVal = true; + args.RetVal = true; } @@ -611,16 +611,16 @@ namespace SparkleShare { } - private ProgressBar ProgressBar; +// private ProgressBar ProgressBar; // The page shown whilst syncing private void ShowSyncingPage (string name) { Reset (); - ProgressBar = new ProgressBar () { - Fraction = 0 - }; +// ProgressBar = new ProgressBar () { +// Fraction = 0 +// }; VBox layout_vertical = new VBox (false, 0); @@ -662,7 +662,7 @@ namespace SparkleShare { table.Attach (spinner, 0, 1, 0, 1); table.Attach (header, 1, 2, 0, 1); table.Attach (information, 1, 2, 1, 2); - table.Attach (ProgressBar, 2, 3, 0, 2); + //table.Attach (ProgressBar, 2, 3, 0, 2); box.PackStart (table, false, false, 0); @@ -712,9 +712,7 @@ namespace SparkleShare { Button finish_button = new Button (_("Finish")); finish_button.Clicked += delegate (object o, EventArgs args) { - Destroy (); - }; AddButton (finish_button); diff --git a/SparkleShare/SparkleLog.cs b/SparkleShare/SparkleLog.cs index 29280f28..28f3b7e4 100644 --- a/SparkleShare/SparkleLog.cs +++ b/SparkleShare/SparkleLog.cs @@ -69,9 +69,7 @@ namespace SparkleShare { Title = String.Format(_("Events in ‘{0}’"), name); IconName = "folder-sparkleshare"; - DeleteEvent += delegate { - Close (); - }; + DeleteEvent += Close; LayoutVertical = new VBox (false, 0); @@ -102,7 +100,7 @@ namespace SparkleShare { Button close_button = new Button (Stock.Close); close_button.Clicked += delegate { - Close (); + HideAll (); }; dialog_buttons.Add (open_folder_button); @@ -138,7 +136,7 @@ namespace SparkleShare { } - // TODO: Don't close window afterwards + // FIXME: webview should stay on the same page }; @@ -175,15 +173,17 @@ namespace SparkleShare { LayoutVertical.PackStart (ScrolledWindow, true, true, 0); LayoutVertical.ReorderChild (ScrolledWindow, 0); - ShowAll (); + LayoutVertical.ShowAll (); } - public void Close () + public void Close (object o, DeleteEventArgs args) { - Destroy (); // TODO: keep logs in memory like Mac UI + HideAll (); + args.RetVal = true; + // FIXME: window positions aren't saved } @@ -209,12 +209,12 @@ namespace SparkleShare { close_1.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.W, Gdk.ModifierType.ControlMask, AccelFlags.Visible)); - close_1.Activated += delegate { Close (); }; + close_1.Activated += delegate { HideAll (); }; // Close on Ctrl+W close_2.AddAccelerator ("activate", accel_group, new AccelKey (Gdk.Key.Escape, Gdk.ModifierType.None, AccelFlags.Visible)); - close_2.Activated += delegate { Close (); }; + close_2.Activated += delegate { HideAll (); }; file_menu.Append (close_1); file_menu.Append (close_2); diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index 02cee041..33c4eabb 100644 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -153,7 +153,7 @@ namespace SparkleShare { // A menu item that provides a link to the SparkleShare folder Gtk.Action folder_action = new Gtk.Action ("", "SparkleShare") { IconName = "folder-sparkleshare", - IsImportant = true + IsImportant = true // FIXME: doesn't shot the icon on Fedora }; folder_action.Activated += delegate { @@ -177,8 +177,7 @@ namespace SparkleShare { // if (repo.HasUnsyncedChanges) // folder_action.IconName = "dialog-error"; - // TODO Open each window with a little position offset - // so they stack nicely + folder_action.Activated += OpenEventLogDelegate (path); MenuItem menu_item = (MenuItem) folder_action.CreateMenuItem (); @@ -254,9 +253,7 @@ namespace SparkleShare { Menu.Add (quit_item); - Menu.ShowAll (); - } @@ -268,28 +265,25 @@ namespace SparkleShare { return delegate { - SparkleLog log = SparkleUI.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 present it to the user if it is + // that's not the case or present it to the user if it is if (log == null) { - log = new SparkleLog (path); + SparkleUI.OpenLogs.Add (new SparkleLog (path)); + SparkleUI.OpenLogs [SparkleUI.OpenLogs.Count - 1].ShowAll (); + SparkleUI.OpenLogs [SparkleUI.OpenLogs.Count - 1].Present (); - log.Hidden += delegate { + } else { - SparkleUI.OpenLogs.Remove (log); - log.Destroy (); - - }; - - SparkleUI.OpenLogs.Add (log); + log.ShowAll (); + log.Present (); } - log.ShowAll (); - log.Present (); - }; }