From b01513e9e42a1d4307ce937bdc636b3e743f8978 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Fri, 21 May 2010 00:44:37 +0100 Subject: [PATCH] use switch statement for platform dependant stuff --- SparkleShare/SparkleStatusIcon.cs | 31 +++++++++++++++++++++++-------- SparkleShare/SparkleWindow.cs | 15 ++++++++++----- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index a08641ec..ccea2420 100644 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -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 (); } diff --git a/SparkleShare/SparkleWindow.cs b/SparkleShare/SparkleWindow.cs index 5c27b7f4..d7a647e9 100644 --- a/SparkleShare/SparkleWindow.cs +++ b/SparkleShare/SparkleWindow.cs @@ -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