use switch statement for platform dependant stuff

This commit is contained in:
Hylke Bons 2010-05-21 00:44:37 +01:00
parent 94fc95366a
commit b01513e9e4
2 changed files with 33 additions and 13 deletions

View file

@ -89,19 +89,33 @@ namespace SparkleShare {
MenuItem OpenFolderItem = new MenuItem (_("Open SparkleShare Folder")); MenuItem OpenFolderItem = new MenuItem (_("Open SparkleShare Folder"));
OpenFolderItem.Activated += delegate { OpenFolderItem.Activated += delegate {
Process Process = new Process (); Process Process = new Process ();
switch (SparklePlatform.Name) {
case "GNOME":
Process.StartInfo.FileName = "xdg-open"; Process.StartInfo.FileName = "xdg-open";
Process.StartInfo.Arguments = SparklePaths.SparklePath; break;
Process.Start(); case "OSX":
Process.StartInfo.FileName = "open";
break;
}
Process.StartInfo.Arguments = SparklePaths.SparklePath;
Process.Start();
}; };
Menu.Add (OpenFolderItem); Menu.Add (OpenFolderItem);
MenuItem AboutItem = new MenuItem (_("About SparkleShare")); MenuItem AboutItem = new MenuItem (_("About SparkleShare"));
AboutItem.Activated += delegate { AboutItem.Activated += delegate {
Process Process = new Process (); Process Process = new Process ();
switch (SparklePlatform.Name) {
case "GNOME":
Process.StartInfo.FileName = "xdg-open"; Process.StartInfo.FileName = "xdg-open";
Process.StartInfo.Arguments = "http://www.sparkleshare.org/"; break;
Process.Start(); case "OSX":
Process.StartInfo.FileName = "open";
break;
}
Process.StartInfo.Arguments = "http://www.sparkleshare.org/";
Process.Start ();
}; };
Menu.Add (AboutItem); Menu.Add (AboutItem);
@ -133,8 +147,9 @@ namespace SparkleShare {
// Quits the program // Quits the program
public void Quit (object o, EventArgs args) { public void Quit (object o, EventArgs args) {
System.IO.File.Delete (SparkleHelpers.CombineMore (SparklePaths.SparkleTmpPath + System.IO.File.Delete
"sparkleshare.pid")); (SparkleHelpers.CombineMore (SparklePaths.SparkleTmpPath +
"sparkleshare.pid"));
Application.Quit (); Application.Quit ();
} }

View file

@ -186,7 +186,7 @@ namespace SparkleShare {
LogView.AppendColumn ("", TextCellRight, "text", 3); LogView.AppendColumn ("", TextCellRight, "text", 3);
TreeViewColumn [] Columns = LogView.Columns; TreeViewColumn [] Columns = LogView.Columns;
Columns [0].MinWidth = 32; Columns [0].MinWidth = 28;
Columns [1].Expand = true; Columns [1].Expand = true;
Columns [2].Expand = true; Columns [2].Expand = true;
Columns [1].MinWidth = 300; Columns [1].MinWidth = 300;
@ -275,11 +275,16 @@ namespace SparkleShare {
// Compose an e-mail when an item is activated // Compose an e-mail when an item is activated
PeopleView.ItemActivated += PeopleView.ItemActivated +=
delegate (object o, ItemActivatedArgs Args) { delegate (object o, ItemActivatedArgs Args) {
if (SparklePlatform.Name.Equals ("GNOME")) { switch (SparklePlatform.Name) {
Process.StartInfo.FileName = "xdg-open"; case "GNOME":
Process.StartInfo.Arguments = "mailto:" + SelectedEmail; Process.StartInfo.FileName = "xdg-open";
Process.Start (); break;
case "OSX":
Process.StartInfo.FileName = "open";
break;
} }
Process.StartInfo.Arguments = "mailto:" + SelectedEmail;
Process.Start ();
}; };
// Select the person matching with the committer event list // Select the person matching with the committer event list