update statusicon menu
This commit is contained in:
parent
d5e5e8d8eb
commit
a476c5eea2
|
@ -17,58 +17,83 @@
|
||||||
using Gtk;
|
using Gtk;
|
||||||
using SparkleShare;
|
using SparkleShare;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
|
||||||
public class SparkleStatusIcon : StatusIcon {
|
public class SparkleStatusIcon : StatusIcon {
|
||||||
|
|
||||||
public SparkleStatusIcon () : base () {
|
public SparkleStatusIcon () : base () {
|
||||||
Activate += delegate {
|
|
||||||
|
|
||||||
|
Activate += delegate {
|
||||||
|
|
||||||
Menu popupMenu = new Menu();
|
Menu Menu = new Menu();
|
||||||
|
|
||||||
foreach (SparkleRepo SparkleRepo in SparkleShare.Repositories) {
|
MenuItem OpenFolderItem = new MenuItem ("Open Sharing Folder");
|
||||||
ImageMenuItem Item = new ImageMenuItem (SparkleRepo.Name);
|
OpenFolderItem.Activated += delegate {
|
||||||
Item.Image = new Image (SparkleHelpers.GetIcon ("folder", 16));
|
Process Process = new Process ();
|
||||||
|
Process.StartInfo.FileName = "xdg-open";
|
||||||
|
Process.StartInfo.Arguments = SparklePaths.SparklePath;
|
||||||
|
Process.Start();
|
||||||
|
};
|
||||||
|
Menu.Add (OpenFolderItem);
|
||||||
|
|
||||||
|
Menu.Add (new SeparatorMenuItem ());
|
||||||
|
MenuItem StatusItem = new MenuItem ("Everything up to date");
|
||||||
|
StatusItem.Sensitive = false;
|
||||||
|
Menu.Add (StatusItem);
|
||||||
|
|
||||||
|
Menu.Add (new SeparatorMenuItem ());
|
||||||
|
|
||||||
|
foreach (SparkleRepo SparkleRepo in SparkleShare.Repositories) {
|
||||||
|
|
||||||
|
ImageMenuItem FolderItem = new ImageMenuItem (SparkleRepo.Name);
|
||||||
|
FolderItem.Image = new Image (SparkleHelpers.GetIcon ("folder", 16));
|
||||||
|
|
||||||
Item.Activated += delegate { SparkleWindow SparkleWindow = new SparkleWindow (SparkleRepo);
|
FolderItem.Activated += delegate {
|
||||||
SparkleWindow.ShowAll ();Console.WriteLine (SparkleRepo.Name); };
|
SparkleWindow SparkleWindow = new SparkleWindow (SparkleRepo);
|
||||||
popupMenu.Add(Item);
|
SparkleWindow.ShowAll ();
|
||||||
|
};
|
||||||
|
|
||||||
}
|
Menu.Add(FolderItem);
|
||||||
ImageMenuItem menuItemQuit = new ImageMenuItem ("Quit SparkleShare");
|
|
||||||
popupMenu.Add(menuItemQuit);
|
}
|
||||||
|
|
||||||
|
Menu.Add (new SeparatorMenuItem ());
|
||||||
|
MenuItem AboutItem = new MenuItem ("About SparkleShare");
|
||||||
|
AboutItem.Activated += delegate {
|
||||||
|
Process Process = new Process ();
|
||||||
// Quit the application when quit has been clicked.
|
Process.StartInfo.FileName = "xdg-open";
|
||||||
menuItemQuit.Activated += delegate { Environment.Exit(0); };
|
Process.StartInfo.Arguments = "http://www.sparkleshare.org/";
|
||||||
popupMenu.ShowAll();
|
Process.Start();
|
||||||
popupMenu.Popup();
|
};
|
||||||
|
Menu.Add(AboutItem);
|
||||||
|
|
||||||
|
Menu.Add (new SeparatorMenuItem ());
|
||||||
|
MenuItem QuitItem = new MenuItem ("Quit");
|
||||||
|
QuitItem.Activated += delegate { Environment.Exit (0); };
|
||||||
|
Menu.Add(QuitItem);
|
||||||
|
|
||||||
|
Menu.ShowAll();
|
||||||
|
Menu.Popup();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
};
|
|
||||||
SetIdleState ();
|
SetIdleState ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetIdleState () {
|
public void SetIdleState () {
|
||||||
IconName = "folder-synced";
|
IconName = "folder-synced";
|
||||||
Tooltip = "SparkleShare, all up to date";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetSyncingState () {
|
public void SetSyncingState () {
|
||||||
// IconName = "folder-syncing";
|
// IconName = "folder-syncing";
|
||||||
// Tooltip = "SparkleShare, updating files...";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetErrorState () {
|
public void SetErrorState () {
|
||||||
// IconName = "folder-sync-error";
|
// IconName = "folder-sync-error";
|
||||||
// Tooltip = "SparkleShare, something went wrong";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Quits the program
|
// Quits the program
|
||||||
public void Quit (object o, EventArgs args) {
|
public void Quit (object o, EventArgs args) {
|
||||||
|
|
Loading…
Reference in a new issue