windows statusicon: add SparkleShare header to tooltip

This commit is contained in:
Hylke Bons 2012-03-10 16:23:20 +00:00
parent f98cf08c19
commit ef383afd15
2 changed files with 25 additions and 10 deletions

View file

@ -67,13 +67,28 @@ namespace SparkleShare {
} }
} }
public string HeaderText {
get {
return header_text;
}
set {
header_text = value;
}
}
public string Text { public string Text {
get { get {
return (string) GetValue (TextProperty); return (string) GetValue (TextProperty);
} }
set { set {
SetValue (TextProperty, value); string text = value;
if (!string.IsNullOrEmpty (header_text))
text = header_text + "\n" + text;
SetValue (TextProperty, text);
} }
} }
@ -108,6 +123,7 @@ namespace SparkleShare {
"Text", typeof(string), typeof (SparkleNotifyIcon), new PropertyMetadata (OnTextChanged)); "Text", typeof(string), typeof (SparkleNotifyIcon), new PropertyMetadata (OnTextChanged));
private string header_text;
private Forms.NotifyIcon notify_icon; private Forms.NotifyIcon notify_icon;
private HookProc hook_proc_ref; private HookProc hook_proc_ref;
private int mouse_hook_handle; private int mouse_hook_handle;

View file

@ -40,9 +40,7 @@ namespace SparkleShare {
private SparkleMenuItem status_item; private SparkleMenuItem status_item;
private SparkleMenuItem exit_item; private SparkleMenuItem exit_item;
private SparkleNotifyIcon notify_icon = new SparkleNotifyIcon () { private SparkleNotifyIcon notify_icon = new SparkleNotifyIcon ();
Text = "SparkleShare"
};
// Short alias for the translations // Short alias for the translations
@ -59,11 +57,12 @@ namespace SparkleShare {
ErrorIcon = SparkleUIHelpers.GetBitmap ("sparkleshare-syncing-error-windows"); ErrorIcon = SparkleUIHelpers.GetBitmap ("sparkleshare-syncing-error-windows");
this.notify_icon.Icon = AnimationFrames [0]; this.notify_icon.Icon = AnimationFrames [0];
this.notify_icon.HeaderText = "SparkleShare";
if (Controller.Folders.Length == 0) if (Controller.Folders.Length == 0)
StateText = _("Welcome to SparkleShare!"); StateText = _("Welcome to SparkleShare!");
else else
StateText = _("Files up to date") + Controller.FolderSize; this.notify_icon.Text = StateText = _("Files up to date") + Controller.FolderSize;
CreateMenu (); CreateMenu ();
@ -84,9 +83,9 @@ namespace SparkleShare {
Animation.Stop (); Animation.Stop ();
if (Controller.Folders.Length == 0) if (Controller.Folders.Length == 0)
StateText = "Welcome to SparkleShare!"; this.notify_icon.Text = StateText = "Welcome to SparkleShare!";
else else
StateText = "Files up to date" + Controller.FolderSize; this.notify_icon.Text = StateText = "Files up to date" + Controller.FolderSize;
this.status_item.Header = StateText; this.status_item.Header = StateText;
@ -99,7 +98,7 @@ namespace SparkleShare {
case IconState.Syncing: { case IconState.Syncing: {
StateText = "Syncing… " + this.notify_icon.Text = StateText = "Syncing… " +
Controller.ProgressPercentage + "% " + Controller.ProgressPercentage + "% " +
Controller.ProgressSpeed; Controller.ProgressSpeed;
@ -115,7 +114,7 @@ namespace SparkleShare {
Animation.Stop (); Animation.Stop ();
StateText = _("Not everything is synced"); this.notify_icon.Text = StateText = _("Not everything is synced");
this.status_item.Header = StateText; this.status_item.Header = StateText;
CreateMenu (); CreateMenu ();