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 {
get {
return (string) GetValue (TextProperty);
}
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));
private string header_text;
private Forms.NotifyIcon notify_icon;
private HookProc hook_proc_ref;
private int mouse_hook_handle;

View file

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