diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs
index e6be1fc5..44bddb05 100644
--- a/SparkleShare/SparkleController.cs
+++ b/SparkleShare/SparkleController.cs
@@ -973,7 +973,7 @@ namespace SparkleShare {
foreach (SparkleRepoBase repo in Repositories)
repo.Dispose ();
- Environment.Exit (0);
+ Gtk.Application.Quit ();
}
diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs
index 5707bb7e..70939505 100644
--- a/SparkleShare/SparkleStatusIcon.cs
+++ b/SparkleShare/SparkleStatusIcon.cs
@@ -21,6 +21,7 @@ using System.Timers;
using Gtk;
using Mono.Unix;
+using SparkleLib;
namespace SparkleShare {
@@ -272,7 +273,11 @@ namespace SparkleShare {
// Makes the menu visible
private void ShowMenu (object o, EventArgs args)
{
- Menu.Popup (null, null, SetPosition, 0, Global.CurrentEventTime);
+ if ((SparkleBackend.Platform == PlatformID.Unix ||
+ SparkleBackend.Platform == PlatformID.MacOSX))
+ Menu.Popup (null, null, SetPosition, 0, Global.CurrentEventTime);
+ else
+ Menu.Popup (null, null, null, 0, Global.CurrentEventTime);
}
diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs
index 5561c94f..edaf6fef 100644
--- a/SparkleShare/SparkleUI.cs
+++ b/SparkleShare/SparkleUI.cs
@@ -169,6 +169,7 @@ namespace SparkleShare {
public void Run ()
{
Application.Run ();
+ StatusIcon.Dispose ();
}
}
}
diff --git a/SparkleShare/Windows/Notification.cs b/SparkleShare/Windows/Notification.cs
index 1b165739..0c2733ec 100644
--- a/SparkleShare/Windows/Notification.cs
+++ b/SparkleShare/Windows/Notification.cs
@@ -16,40 +16,77 @@
using System;
-using Gdk;
+using System.Windows.Forms;
+using System.Drawing;
+using System.IO;
+
namespace Notifications
{
- 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);
-
- public class Notification
+ public partial class Notification : Form
{
- public Pixbuf Icon;
+ private Timer animationTimer;
+ private int startPosX;
+ private int startPosY;
+
+ public new Gdk.Pixbuf Icon;
public Notification ()
{
- }
+ InitializeComponent ();
- public Notification (string title, string subtext)
- {
- }
+ 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)
{
@@ -63,8 +100,29 @@ namespace Notifications
{
}
- public void Show ()
- {
- }
}
+
+ 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
new file mode 100644
index 00000000..a3d36c82
--- /dev/null
+++ b/SparkleShare/Windows/Notification.designer.cs
@@ -0,0 +1,96 @@
+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
new file mode 100644
index 00000000..19dc0dd8
--- /dev/null
+++ b/SparkleShare/Windows/Notification.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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/SparkleBubble.cs b/SparkleShare/Windows/SparkleBubble.cs
index 4e96228e..992c6948 100644
--- a/SparkleShare/Windows/SparkleBubble.cs
+++ b/SparkleShare/Windows/SparkleBubble.cs
@@ -24,7 +24,11 @@ namespace SparkleShare {
public SparkleBubble (string title, string subtext) : base (title, subtext)
{
- }
+ System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer ();
+ timer.Tick += delegate { this.Close (); };
+ timer.Interval = 4500;
+ timer.Start ();
+ }
// Checks whether the system allows adding buttons to a notification,
// prevents error messages in Ubuntu.
diff --git a/SparkleShare/Windows/SparkleShare.csproj b/SparkleShare/Windows/SparkleShare.csproj
index 9a706ea1..d6c11185 100644
--- a/SparkleShare/Windows/SparkleShare.csproj
+++ b/SparkleShare/Windows/SparkleShare.csproj
@@ -58,6 +58,8 @@
+
+
False
@@ -72,8 +74,15 @@
GlobalAssemblyInfo.tt
-
-
+
+ Form
+
+
+ Notification.cs
+
+
+ Form
+
@@ -140,4 +149,9 @@
$(ProjectDir)transform_tt.cmd
+
+
+ Notification.cs
+
+
\ No newline at end of file