windows statusicon: clean up

This commit is contained in:
Hylke Bons 2012-11-25 13:33:12 +00:00
parent 38b4fd8e81
commit 2b1fa6a57c
2 changed files with 28 additions and 48 deletions

View file

@ -26,6 +26,6 @@ using System.Reflection;
namespace SparkleLib { namespace SparkleLib {
public class Defines { public class Defines {
public const string INSTALL_DIR = "/usr/local/share/sparkleshare"; public const string INSTALL_DIR = "/usr/share/sparkleshare";
} }
} }

View file

@ -114,8 +114,6 @@ namespace SparkleShare {
IsEnabled = false IsEnabled = false
}; };
this.notify_icon.HeaderText = "SparkleShare\n" + Controller.StateText;
Image folder_image = new Image () { Image folder_image = new Image () {
Source = SparkleUIHelpers.GetImageSource ("sparkleshare-folder"), Source = SparkleUIHelpers.GetImageSource ("sparkleshare-folder"),
Width = 16, Width = 16,
@ -127,61 +125,44 @@ namespace SparkleShare {
Icon = folder_image Icon = folder_image
}; };
SparkleMenuItem add_item = new SparkleMenuItem () { SparkleMenuItem add_item = new SparkleMenuItem () { Header = "Add hosted project…" };
Header = "Add hosted project…"
};
add_item.Click += delegate {
Controller.AddHostedProjectClicked ();
};
this.log_item = new SparkleMenuItem () { this.log_item = new SparkleMenuItem () {
Header = "Recent changes…", Header = "Recent changes…",
IsEnabled = Controller.RecentEventsItemEnabled IsEnabled = Controller.RecentEventsItemEnabled
}; };
this.log_item.Click += delegate { CheckBox notify_check_box = new CheckBox () {
Controller.RecentEventsClicked (); Margin = new Thickness (6, 0, 0, 0),
}; IsChecked = (Controller.Folders.Length > 0 && Program.Controller.NotificationsEnabled)
SparkleMenuItem notify_item = new SparkleMenuItem () {
Header = "Notifications"
}; };
CheckBox notify_check_box = new CheckBox () { SparkleMenuItem notify_item = new SparkleMenuItem () { Header = "Notifications" };
Margin = new Thickness (6, 0, 0, 0), notify_item.Icon = notify_check_box;
IsChecked = (Controller.Folders.Length > 0 && Program.Controller.NotificationsEnabled)
};
notify_item.Icon = notify_check_box; SparkleMenuItem about_item = new SparkleMenuItem () { Header = "About SparkleShare" };
this.exit_item = new SparkleMenuItem () { Header = "Exit" };
notify_check_box.Click += delegate {
this.context_menu.IsOpen = false;
Program.Controller.ToggleNotifications ();
notify_check_box.IsChecked = Program.Controller.NotificationsEnabled;
};
notify_item.Click += delegate { add_item.Click += Controller.AddHostedProjectClicked;
Program.Controller.ToggleNotifications (); this.log_item.Click += Controller.RecentEventsClicked;
notify_check_box.IsChecked = Program.Controller.NotificationsEnabled; about_item.Click += Controller.AboutClicked;
};
SparkleMenuItem about_item = new SparkleMenuItem () { notify_check_box.Click += delegate {
Header = "About SparkleShare" this.context_menu.IsOpen = false;
Program.Controller.ToggleNotifications ();
notify_check_box.IsChecked = Program.Controller.NotificationsEnabled;
}; };
about_item.Click += delegate { notify_item.Click += delegate {
Controller.AboutClicked (); Program.Controller.ToggleNotifications ();
}; notify_check_box.IsChecked = Program.Controller.NotificationsEnabled;
this.exit_item = new SparkleMenuItem () {
Header = "Exit"
}; };
this.exit_item.Click += delegate { this.exit_item.Click += delegate {
this.notify_icon.Dispose (); this.notify_icon.Dispose ();
Controller.QuitClicked (); Controller.QuitClicked ();
}; };
this.context_menu.Items.Add (this.state_item); this.context_menu.Items.Add (this.state_item);
@ -229,7 +210,6 @@ namespace SparkleShare {
} }
this.context_menu.Items.Add (subfolder_item); this.context_menu.Items.Add (subfolder_item);
i++; i++;
} }
} }