diff --git a/NEWS b/NEWS index 185fe956..902fb621 100755 --- a/NEWS +++ b/NEWS @@ -1,23 +1,23 @@ 0.8.3 for Linux and Mac (Sun Mar 4 2012): Hylke: - - Invites feature: link to a host with one click - - Implement sparklshare:// protocol handlers for invites - - "Add SparkleShare to login items" checkbox on the last tutorial page - - Text entries aren't being reset when selecting plugins in the setup dialog - - A variety of new default avatars (GNOME style) - - More useful hints below the entries in the setup dialog - - Breadcrumbs for paths in the event log: directories can be clicked - - Allow backends to be in separate binaries (by Shish) - - If the dock icon is visible and has a count badge, open event log on click - - Add previously successfully used hosts as plugins + - Invites feature: link to a host with one click + - Implement sparklshare:// protocol handlers for invites + - "Add SparkleShare to login items" checkbox on the last tutorial page + - Text entries aren't being reset when selecting plugins in the setup dialog + - A variety of new default avatars (GNOME style) + - More useful hints below the entries in the setup dialog + - Breadcrumbs for paths in the event log: directories can be clicked + - Allow backends to be in separate binaries (by Shish) + - If the dock icon is visible and has a count badge, open event log on click + - Add previously successfully used hosts as plugins 0.8.2 for Linux and Mac (Sat Feb 11 2012): Hylke: - Use the more reliable and less resource intensive FSEvents on Mac. - - Improvements to the reconnect mechanism of the notification system + - Improvements to the reconnect mechanism of the notification system 0.8.1 for Linux and Mac (Sun Jan 29 2012): diff --git a/SparkleLib/windows/SparkleLib.csproj b/SparkleLib/windows/SparkleLib.csproj index dcc64040..528142c3 100644 --- a/SparkleLib/windows/SparkleLib.csproj +++ b/SparkleLib/windows/SparkleLib.csproj @@ -1,4 +1,4 @@ - + Debug @@ -58,7 +58,7 @@ 3.5 - + @@ -146,8 +146,8 @@ - - + + diff --git a/SparkleShare/Windows/Notification.cs b/SparkleShare/Windows/Notification.cs deleted file mode 100644 index e7f7bc3e..00000000 --- a/SparkleShare/Windows/Notification.cs +++ /dev/null @@ -1,128 +0,0 @@ -// SparkleShare, an instant update workflow to Git. -// Copyright (C) 2010 Hylke Bons -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - - -using System; -using System.Windows.Forms; -using System.Drawing; -using System.IO; - - -namespace Notifications -{ - public partial class Notification : Form - { - private Timer animationTimer; - private int startPosX; - private int startPosY; - - //public new Gdk.Pixbuf Icon; - - public Notification () - { - InitializeComponent (); - - TopMost = true; - ShowInTaskbar = false; - - animationTimer = new Timer (); - animationTimer.Interval = 50; - animationTimer.Tick += timer_Tick; - } - - public Notification (string title, string subtext) - : this() - { - this.title.Text = title; - this.subtext.Text = subtext; - } - - protected override void OnLoad (EventArgs e) - { - // Move window out of screen - startPosX = Screen.PrimaryScreen.WorkingArea.Width - Width; - startPosY = Screen.PrimaryScreen.WorkingArea.Height; - SetDesktopLocation (startPosX, startPosY); - base.OnLoad (e); - // Begin animation - animationTimer.Start (); - } - - protected override void OnShown (EventArgs e) - { - base.OnShown (e); - - // hacky way to move the image from a Gdk.Pixbuf to a winforms bitmap - string Filename = Path.GetTempFileName (); - File.Delete (Filename); - - Filename = Path.ChangeExtension (Filename, "bmp"); - if (File.Exists (Filename)) - File.Delete (Filename); - //this.Icon.Save (Filename, "bmp"); - using (Stream s = File.OpenRead (Filename)) - pictureBox1.Image = Bitmap.FromStream (s); - File.Delete (Filename); - } - - void timer_Tick (object sender, EventArgs e) - { - startPosY -= 5; - - if (startPosY < Screen.PrimaryScreen.WorkingArea.Height - Height) - animationTimer.Stop (); - else - SetDesktopLocation (startPosX, startPosY); - } - - public void AddAction (string action, string label, ActionHandler handler) - { - } - - public void RemoveAction (string action) - { - } - - public void ClearActions () - { - } - - } - - public enum Urgency : byte - { - Low = 0, - Normal, - Critical - } - - public class ActionArgs : EventArgs - { - private string action; - public string Action - { - get { return action; } - } - - public ActionArgs (string action) - { - this.action = action; - } - } - - public delegate void ActionHandler (object o, ActionArgs args); - -} diff --git a/SparkleShare/Windows/Notification.designer.cs b/SparkleShare/Windows/Notification.designer.cs deleted file mode 100644 index a3d36c82..00000000 --- a/SparkleShare/Windows/Notification.designer.cs +++ /dev/null @@ -1,96 +0,0 @@ -namespace Notifications -{ - partial class Notification - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.pictureBox1 = new System.Windows.Forms.PictureBox (); - this.title = new System.Windows.Forms.Label (); - this.subtext = new System.Windows.Forms.Label (); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit (); - this.SuspendLayout (); - // - // pictureBox1 - // - this.pictureBox1.Location = new System.Drawing.Point (12, 12); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size (40, 42); - this.pictureBox1.TabIndex = 0; - this.pictureBox1.TabStop = false; - // - // title - // - this.title.AutoSize = true; - this.title.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.title.Location = new System.Drawing.Point (58, 9); - this.title.Name = "title"; - this.title.Size = new System.Drawing.Size (28, 13); - this.title.TabIndex = 1; - this.title.Text = "title"; - // - // subtext - // - this.subtext.AutoSize = true; - this.subtext.Location = new System.Drawing.Point (58, 22); - this.subtext.MaximumSize = new System.Drawing.Size (171, 0); - this.subtext.Name = "subtext"; - this.subtext.Size = new System.Drawing.Size (41, 13); - this.subtext.TabIndex = 2; - this.subtext.Text = "subtext"; - // - // Notification - // - this.AutoScaleDimensions = new System.Drawing.SizeF (6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size (241, 64); - this.ControlBox = false; - this.Controls.Add (this.subtext); - this.Controls.Add (this.title); - this.Controls.Add (this.pictureBox1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "Notification"; - this.Opacity = 0.8; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit (); - this.ResumeLayout (false); - this.PerformLayout (); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.Label title; - private System.Windows.Forms.Label subtext; - - } -} - diff --git a/SparkleShare/Windows/Notification.resx b/SparkleShare/Windows/Notification.resx deleted file mode 100644 index 19dc0dd8..00000000 --- a/SparkleShare/Windows/Notification.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/SparkleShare/Windows/SparkleEventLog.cs b/SparkleShare/Windows/SparkleEventLog.cs index 2804754e..aec2bff3 100644 --- a/SparkleShare/Windows/SparkleEventLog.cs +++ b/SparkleShare/Windows/SparkleEventLog.cs @@ -70,7 +70,7 @@ namespace SparkleShare { public void UpdateChooser () { - this.combo_box.Items.Add (_ ("All Folders")); + this.combo_box.Items.Add (_ ("All Projects")); this.combo_box.Items.Add (""); foreach (string folder_name in Program.Controller.Folders) diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj index 065690cf..6ed932f4 100644 --- a/SparkleShare/Windows/SparkleShare.csproj +++ b/SparkleShare/Windows/SparkleShare.csproj @@ -1,4 +1,4 @@ - + Debug @@ -31,8 +31,6 @@ false true ..\..\data\icons\sparkleshare.ico - - true @@ -44,7 +42,6 @@ 4 x86 AllRules.ruleset - false none @@ -65,14 +62,14 @@ ..\..\tools\gettext-cs-utils\Gettext.CsUtils\Core\Gettext.Cs\bin\Release\Gettext.Cs.dll - 3.5 - + + @@ -130,9 +127,6 @@ SparkleAbout.cs - - Form - @@ -163,15 +157,15 @@ - + {2C914413-B31C-4362-93C7-1AE34F09112A} SparkleLib - - + + diff --git a/SparkleShare/Windows/SparkleShareInviteOpen/SparkleShareInviteOpen.csproj b/SparkleShare/Windows/SparkleShareInviteOpen/SparkleShareInviteOpen.csproj index 9e49f1df..974378f1 100644 --- a/SparkleShare/Windows/SparkleShareInviteOpen/SparkleShareInviteOpen.csproj +++ b/SparkleShare/Windows/SparkleShareInviteOpen/SparkleShareInviteOpen.csproj @@ -1,4 +1,4 @@ - + Debug @@ -35,9 +35,6 @@ - - sparkleshare-invite-open.cs - diff --git a/SparkleShare/Windows/SparkleShareInviteOpen/SparkleShareInviteOpener.csproj b/SparkleShare/Windows/SparkleShareInviteOpen/SparkleShareInviteOpener.csproj new file mode 100644 index 00000000..9e49f1df --- /dev/null +++ b/SparkleShare/Windows/SparkleShareInviteOpen/SparkleShareInviteOpener.csproj @@ -0,0 +1,51 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {1DB5492D-B897-4A5E-8DD7-175EC65F52F2} + Exe + Properties + SparkleShareInviteOpen + SparkleShareInviteOpen + v3.5 + 512 + ..\..\..\data\icons\sparkleshare.ico + + + true + full + false + ..\..\..\bin\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\..\bin\ + TRACE + prompt + 4 + + + + + + + sparkleshare-invite-open.cs + + + + + + \ No newline at end of file diff --git a/SparkleShare/Windows/SparkleStatusIcon.cs b/SparkleShare/Windows/SparkleStatusIcon.cs index 15a3365f..5f1b01ce 100644 --- a/SparkleShare/Windows/SparkleStatusIcon.cs +++ b/SparkleShare/Windows/SparkleStatusIcon.cs @@ -16,22 +16,20 @@ using System; +using System.Drawing; using System.IO; +using System.Runtime.InteropServices; using SparkleLib; using System.Windows.Forms; -using System.Drawing; - -using System.Runtime.InteropServices; namespace SparkleShare { - // The statusicon that stays in the - // user's notification area public class SparkleStatusIcon : IDisposable { public SparkleStatusIconController Controller = new SparkleStatusIconController(); + private Timer Animation; private Bitmap [] AnimationFrames; private int FrameNumber; @@ -61,28 +59,28 @@ namespace SparkleShare { SetNormalState (); Program.Controller.FolderListChanged += delegate { - status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { + status_icon.ContextMenuStrip.SafeInvoke ((Action) delegate { SetNormalState (); CreateMenu (); }); }; Program.Controller.OnIdle += delegate { - status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { + status_icon.ContextMenuStrip.SafeInvoke ((Action) delegate { SetNormalState (); UpdateMenu (); }); }; Program.Controller.OnSyncing += delegate { - status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { + status_icon.ContextMenuStrip.SafeInvoke ((Action) delegate { SetAnimationState (); UpdateMenu (); }); }; Program.Controller.OnError += delegate { - status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { + status_icon.ContextMenuStrip.SafeInvoke ((Action) delegate { SetNormalState (true); UpdateMenu (); }); @@ -90,6 +88,10 @@ namespace SparkleShare { } + [DllImport("user32.dll", EntryPoint = "DestroyIcon")] + static extern bool DestroyIcon(IntPtr hIcon); + + // Slices up the graphic that contains the // animation frames. private Bitmap [] CreateAnimationFrames () @@ -104,16 +106,6 @@ namespace SparkleShare { return animation_frames; } - [DllImport("user32.dll", EntryPoint = "DestroyIcon")] - static extern bool DestroyIcon(IntPtr hIcon); - - private Icon GetIconFromBitmap (Bitmap bitmap) - { - IntPtr unmanagedIcon = bitmap.GetHicon(); - Icon icon = (Icon)Icon.FromHandle(unmanagedIcon).Clone(); - DestroyIcon(unmanagedIcon); - return icon; - } // Creates the Animation that handles the syncing animation private Timer CreateAnimation () @@ -130,8 +122,8 @@ namespace SparkleShare { else FrameNumber = 0; - status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { - this.status_icon.Icon = GetIconFromBitmap( AnimationFrames [FrameNumber]); + status_icon.ContextMenuStrip.SafeInvoke ((Action) delegate { + this.status_icon.Icon = GetIconFromBitmap (AnimationFrames [FrameNumber]); }); }; @@ -156,7 +148,7 @@ namespace SparkleShare { }; folder_item.Click += delegate { - Program.Controller.OpenSparkleShareFolder (); + Controller.SparkleShareClicked (); }; Menu.Items.Add (folder_item); @@ -182,7 +174,7 @@ namespace SparkleShare { } } else { - ToolStripMenuItem no_folders_item = new ToolStripMenuItem (_ ("No Remote Folders Yet")) { + ToolStripMenuItem no_folders_item = new ToolStripMenuItem (_("No projects yet")) { Enabled = false }; @@ -192,24 +184,25 @@ namespace SparkleShare { Menu.Items.Add (new ToolStripSeparator ()); // Opens the wizard to add a new remote folder - ToolStripMenuItem sync_item = new ToolStripMenuItem (_ ("Add Hosted Project…")); + ToolStripMenuItem sync_item = new ToolStripMenuItem (_("Add Hosted Project…")); if (Program.Controller.FirstRun) sync_item.Enabled = false; sync_item.Click += delegate { - Controller.AddHostedProjectClicked(); + Controller.AddHostedProjectClicked (); }; Menu.Items.Add (sync_item); Menu.Items.Add (new ToolStripSeparator ()); - ToolStripMenuItem recent_events_item = new ToolStripMenuItem (_ ("Open Recent Events")); + ToolStripMenuItem recent_events_item = new ToolStripMenuItem (_("View Recent Changes…")); if (Program.Controller.Folders.Count < 1) recent_events_item.Enabled = false; recent_events_item.Click += delegate { + // Controller.OpenRecentEventsClicked (); if (SparkleUI.EventLog == null) SparkleUI.EventLog = new SparkleEventLog (); @@ -222,9 +215,9 @@ namespace SparkleShare { ToolStripMenuItem notify_item; if (Program.Controller.NotificationsEnabled) - notify_item = new ToolStripMenuItem (_ ("Turn Notifications Off")); + notify_item = new ToolStripMenuItem (_("Turn Notifications Off")); else - notify_item = new ToolStripMenuItem (_ ("Turn Notifications On")); + notify_item = new ToolStripMenuItem (_("Turn Notifications On")); notify_item.Click += delegate { Program.Controller.ToggleNotifications (); @@ -234,8 +227,8 @@ namespace SparkleShare { Menu.Items.Add (notify_item); Menu.Items.Add (new ToolStripSeparator ()); - // A menu item that takes the user to http://www.sparkleshare.org/ - ToolStripMenuItem about_item = new ToolStripMenuItem (_ ("About SparkleShare")); + + ToolStripMenuItem about_item = new ToolStripMenuItem (_("About SparkleShare")); about_item.Click += delegate { if (SparkleUI.About == null) @@ -249,7 +242,7 @@ namespace SparkleShare { Menu.Items.Add (new ToolStripSeparator ()); // A menu item that quits the application - ToolStripMenuItem quit_item = new ToolStripMenuItem (_ ("Quit")); + ToolStripMenuItem quit_item = new ToolStripMenuItem (_("Quit")); quit_item.Click += delegate { Program.Controller.Quit (); @@ -260,23 +253,16 @@ namespace SparkleShare { status_icon.ContextMenuStrip = Menu; } + public void ShowBalloon (string title, string subtext, string image_path) { + // TODO: Use the image pointed to by image_path + status_icon.BalloonTipText = title; status_icon.BalloonTipText = subtext; - // TODO: Use the image pointed to by image_path status_icon.BalloonTipIcon = ToolTipIcon.None; - status_icon.ShowBalloonTip (2 * 1000); - } - - // A method reference that makes sure that opening the - // event log for each repository works correctly - private EventHandler OpenFolderDelegate (string name) - { - return delegate { - Program.Controller.OpenSparkleShareFolder (name); - }; + status_icon.ShowBalloonTip (5 * 1000); } @@ -313,7 +299,7 @@ namespace SparkleShare { this.status_icon.Icon = GetIconFromBitmap (Icons.sparkleshare_syncing_error_24); }); } else { - StateText = _("Up to date") + " (" + FolderSize + ")"; + StateText = _("Files up to date") + Controller.FolderSize; status_icon.ContextMenuStrip.SafeInvoke ((Action)delegate { this.status_icon.Icon = GetIconFromBitmap (AnimationFrames [0]); }); @@ -322,6 +308,14 @@ namespace SparkleShare { } + #region IDisposable Members + public void Dispose () + { + this.status_icon.Dispose (); + } + #endregion + + // The state when animating private void SetAnimationState () { @@ -331,56 +325,60 @@ namespace SparkleShare { Animation.Start (); } - public string FolderSize + + // A method reference that makes sure that opening the + // event log for each repository works correctly + private EventHandler OpenFolderDelegate (string name) { - get - { - double size = 0; - - foreach (SparkleRepoBase repo in Program.Controller.Repositories) - size += repo.Size + repo.HistorySize; - - return Program.Controller.FormatSize(size); - } + return delegate { + Controller.SubfolderClicked (name); + }; } - #region IDisposable Members - public void Dispose () + private Icon GetIconFromBitmap (Bitmap bitmap) { - status_icon.Dispose (); - } + IntPtr unmanaged_icon = bitmap.GetHicon (); + Icon icon = (Icon) Icon.FromHandle (unmanaged_con).Clone (); + DestroyIcon (unmanaged_icon); - #endregion + return icon; + } } public static class ControlExtention { - public static void SafeInvoke (this Control uiElement, Action updater, bool forceSynchronous) - { - if (uiElement == null) { - //throw new ArgumentNullException ("uiElement"); - return; - } - if (uiElement.InvokeRequired) { - if (forceSynchronous) { - uiElement.Invoke ((Action)delegate { SafeInvoke (uiElement, updater, forceSynchronous); }); + public static void SafeInvoke (this Control ui_element, + Action updater, bool force_synchronous) + { + if (ui_element == null) + return; + + if (ui_element.InvokeRequired) { + if (force_synchronous) { + ui_element.Invoke ((Action) delegate { + SafeInvoke (ui_element, updater, force_synchronous); + }); + } else { - uiElement.BeginInvoke ((Action)delegate { SafeInvoke (uiElement, updater, forceSynchronous); }); + ui_element.BeginInvoke ((Action) delegate { + SafeInvoke (ui_element, updater, force_synchronous); + }); } + } else { - if (uiElement.IsDisposed) { + if (ui_element.IsDisposed) throw new ObjectDisposedException ("Control is already disposed."); - } updater (); } } - public static void SafeInvoke (this Control uiElement, Action updater) - { - uiElement.SafeInvoke (updater, false); - } + + public static void SafeInvoke (this Control ui_element, Action updater) + { + ui_element.SafeInvoke (updater, false); + } } } diff --git a/SparkleShare/sparkleshare-invite-open.cs b/SparkleShare/Windows/sparkleshare-invite-opener.cs similarity index 100% rename from SparkleShare/sparkleshare-invite-open.cs rename to SparkleShare/Windows/sparkleshare-invite-opener.cs