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

View file

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