nemo r71 - in trunk: . gtk
- From: arj svn gnome org
- To: svn-commits-list gnome org
- Subject: nemo r71 - in trunk: . gtk
- Date: Tue, 15 Jan 2008 17:20:00 +0000 (GMT)
Author: arj
Date: Tue Jan 15 17:20:00 2008
New Revision: 71
URL: http://svn.gnome.org/viewvc/nemo?rev=71&view=rev
Log:
Add code to make nemo work like any other non-mono program
Thanks Corey Burger for the tip
Added:
trunk/gtk/OSSpecific.cs
Modified:
trunk/gtk/MainWindow.cs
trunk/nemo.mdp
Modified: trunk/gtk/MainWindow.cs
==============================================================================
--- trunk/gtk/MainWindow.cs (original)
+++ trunk/gtk/MainWindow.cs Tue Jan 15 17:20:00 2008
@@ -25,6 +25,12 @@
public MainWindow(bool reindex, bool hidden): base ("")
{
+ try {
+ OSSpecific.SetProcessName ("nemo");
+ } catch (Exception e) {
+ Console.Error.WriteLine ("Failed to set process name: {0}", e.Message);
+ }
+
// gettext
Mono.Unix.Catalog.Init("nemo", "/usr/share/locale");
Added: trunk/gtk/OSSpecific.cs
==============================================================================
--- (empty file)
+++ trunk/gtk/OSSpecific.cs Tue Jan 15 17:20:00 2008
@@ -0,0 +1,29 @@
+using System.Runtime.InteropServices;
+using System.Text;
+using System;
+
+namespace Nemo
+{
+ class OSSpecific
+ {
+ [DllImport ("libc")] // Linux
+ private static extern int prctl (int option, byte [] arg2, IntPtr arg3, IntPtr arg4, IntPtr arg5);
+
+ [DllImport ("libc")] // BSD
+ private static extern void setproctitle (byte [] fmt, byte [] str_arg);
+
+ public static void SetProcessName (string name)
+ {
+ try {
+ if (prctl (15 /* PR_SET_NAME */, Encoding.ASCII.GetBytes (name + "\0"),
+ IntPtr.Zero, IntPtr.Zero, IntPtr.Zero) != 0) {
+ throw new ApplicationException ("Error setting process name: " +
+ Mono.Unix.Native.Stdlib.GetLastError ());
+ }
+ } catch (EntryPointNotFoundException) {
+ setproctitle (Encoding.ASCII.GetBytes ("%s\0"),
+ Encoding.ASCII.GetBytes (name + "\0"));
+ }
+ }
+ }
+}
Modified: trunk/nemo.mdp
==============================================================================
--- trunk/nemo.mdp (original)
+++ trunk/nemo.mdp Tue Jan 15 17:20:00 2008
@@ -103,6 +103,7 @@
<File name="gtk/Indexing.cs" subtype="Code" buildaction="Compile" />
<File name="gtk-gui/Nemo.Indexing.cs" subtype="Code" buildaction="Compile" />
<File name="images/blue_guy.png" subtype="Code" buildaction="EmbedAsResource" />
+ <File name="gtk/OSSpecific.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]