statusicon: don't let the menu overlap the icon

This commit is contained in:
Hylke Bons 2010-06-01 19:00:57 +02:00
parent 17b8f53293
commit e32903efe0
2 changed files with 13 additions and 6 deletions

View file

@ -60,7 +60,7 @@ namespace SparkleShare {
Menu.Add (StatusMenuItem); Menu.Add (StatusMenuItem);
Menu.Add (new SeparatorMenuItem ()); Menu.Add (new SeparatorMenuItem ());
Action FolderAction = new Action ("", "SparkleShare Folder"); Action FolderAction = new Action ("", "SparkleShare");
FolderAction.IconName = "folder-sparkleshare"; FolderAction.IconName = "folder-sparkleshare";
FolderAction.IsImportant = true; FolderAction.IsImportant = true;
FolderAction.Activated += delegate { FolderAction.Activated += delegate {
@ -119,7 +119,7 @@ namespace SparkleShare {
} }
}; };
MenuItem AboutItem = new MenuItem (_("About SparkleShare")); MenuItem AboutItem = new MenuItem (_("Visit Website"));
AboutItem.Activated += delegate { AboutItem.Activated += delegate {
Process Process = new Process (); Process Process = new Process ();
switch (SparklePlatform.Name) { switch (SparklePlatform.Name) {
@ -141,8 +141,7 @@ namespace SparkleShare {
Menu.Add (QuitItem); Menu.Add (QuitItem);
Menu.ShowAll (); Menu.ShowAll ();
// TODO: Make sure the menu never overlaps the status icon // TODO: Make sure the menu never overlaps the status icon
Menu.Popup (); Menu.Popup (null, null, SetPosition, 0, 0);
} }
public void SetIdleState () { public void SetIdleState () {
@ -200,6 +199,13 @@ namespace SparkleShare {
StateText = _("Error syncing"); StateText = _("Error syncing");
} }
// TODO: menu should not dissappear on mouse up
public void SetPosition (Menu menu,
out int x, out int y,
out bool push_in) {
PositionMenu (menu, out x, out y, out push_in, Handle);
}
// Quits the program // Quits the program
public void Quit (object o, EventArgs args) { public void Quit (object o, EventArgs args) {
System.IO.File.Delete System.IO.File.Delete

View file

@ -54,13 +54,13 @@ namespace SparkleShare {
break; break;
} }
// Add the SparkleShare folder to the bookmarks // Add the SparkleShare folder to the bookmarks
switch (SparklePlatform.Name) { switch (SparklePlatform.Name) {
case "GNOME": case "GNOME":
string BookmarksFileName = string BookmarksFileName =
Path.Combine (SparklePaths.HomePath, ".gtk-bookmarks"); Path.Combine (SparklePaths.HomePath, ".gtk-bookmarks");
if (File.Exists (BookmarksFileName)) { if (File.Exists (BookmarksFileName)) {
TextWriter TextWriter = File.AppendText (BookmarksFileName); TextWriter TextWriter = File.AppendText (BookmarksFileName);
TextWriter.WriteLine ("file://" + SparklePath + " SparkleShare"); TextWriter.WriteLine ("file://" + SparklePath + " SparkleShare");
@ -68,6 +68,7 @@ namespace SparkleShare {
} }
break; break;
} }
} }