[gnome-subtitles] Only set the process name if running on a unix platform
- From: Pedro Daniel da Rocha Melo e Castro <pcastro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-subtitles] Only set the process name if running on a unix platform
- Date: Sat, 20 Feb 2010 23:01:58 +0000 (UTC)
commit 50ec0cf8e60ed9a099052b791d3b61de642380c6
Author: Pedro Castro <mail>
Date: Sat Feb 20 23:01:33 2010 +0000
Only set the process name if running on a unix platform
src/GnomeSubtitles/Execution/Executable.cs | 6 +++-
src/GnomeSubtitles/Execution/ExecutionContext.cs | 34 +++++++++++++++++++++-
2 files changed, 38 insertions(+), 2 deletions(-)
---
diff --git a/src/GnomeSubtitles/Execution/Executable.cs b/src/GnomeSubtitles/Execution/Executable.cs
index cbe92a5..e415455 100644
--- a/src/GnomeSubtitles/Execution/Executable.cs
+++ b/src/GnomeSubtitles/Execution/Executable.cs
@@ -71,7 +71,11 @@ public class Executable {
ExecutionContext executionContext = new ExecutionContext(args);
- SetProcessName(executionContext.ExecutableName);
+ /* If on unix, set process name to gnome-subtitles instead of mono default */
+ if (executionContext.PlatformIsUnix) {
+ SetProcessName(executionContext.ExecutableName);
+ }
+
Base.Run(executionContext);
}
diff --git a/src/GnomeSubtitles/Execution/ExecutionContext.cs b/src/GnomeSubtitles/Execution/ExecutionContext.cs
index eeb2cd3..8cfe277 100644
--- a/src/GnomeSubtitles/Execution/ExecutionContext.cs
+++ b/src/GnomeSubtitles/Execution/ExecutionContext.cs
@@ -31,11 +31,35 @@ public class ExecutionContext {
/* Constant strings */
private const string applicationName = "Gnome Subtitles";
private const string applicationID = "gnome-subtitles";
+
+ /* Dynamic variables */
+ private string localeDir = String.Empty;
+ private bool platformIsWindows = false;
+ private bool platformIsUnix = false;
private string[] args = null;
public ExecutionContext (string[] args) {
this.args = args;
+
+ SetDynamicVariables();
+ }
+
+ private void SetDynamicVariables () {
+ this.localeDir = System.AppDomain.CurrentDomain.BaseDirectory + "../../share/locale";
+
+ /* Handle platform */
+ switch (Environment.OSVersion.Platform) {
+ case PlatformID.Win32NT:
+ case PlatformID.Win32S:
+ case PlatformID.Win32Windows:
+ case PlatformID.WinCE:
+ platformIsWindows = true;
+ break;
+ case PlatformID.Unix:
+ platformIsUnix = true;
+ break;
+ }
}
/* Public properties */
@@ -58,7 +82,7 @@ public class ExecutionContext {
//Unix only
public string LocaleDir {
- get { return System.AppDomain.CurrentDomain.BaseDirectory + "../../share/locale"; }
+ get { return localeDir; }
}
public string Version {
@@ -85,6 +109,14 @@ public class ExecutionContext {
public string TranslationDomain {
get { return applicationID; }
}
+
+ public bool PlatformIsWindows {
+ get { return platformIsWindows; }
+ }
+
+ public bool PlatformIsUnix {
+ get { return platformIsUnix; }
+ }
/* Public methods */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]