From 6a00328dd1a5728a40204e090c60fbdaf924fbf6 Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Mon, 5 Mar 2007 22:33:19 +0000 Subject: [PATCH] 2007-03-05 Mike Kestner * gtk/Application.custom : set prgname in Init methods so that WM_CLASS is more appropriate. Programs using Gnome.Program already get a nice prgname, but Gtk.Application.Init apps were getting a path instead of a filename without extension. svn path=/trunk/gtk-sharp/; revision=73766 --- ChangeLog | 7 +++++++ gtk/Application.cs | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2aa439e00..e6221fe99 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-03-05 Mike Kestner + + * gtk/Application.custom : set prgname in Init methods so + that WM_CLASS is more appropriate. Programs using Gnome.Program + already get a nice prgname, but Gtk.Application.Init apps were + getting a path instead of a filename without extension. + 2007-03-01 Brad Taylor * gtk/Dialog.custom: obsolete old, improperly bound diff --git a/gtk/Application.cs b/gtk/Application.cs index 3f1bd2cf1..398ec26ca 100755 --- a/gtk/Application.cs +++ b/gtk/Application.cs @@ -39,8 +39,20 @@ namespace Gtk { [DllImport("libgtk-win32-2.0-0.dll")] static extern bool gtk_init_check (ref int argc, ref IntPtr argv); + [DllImport("libglib-2.0-0.dll")] + static extern bool g_set_prgname (IntPtr name); + + static void SetPrgname () + { + string name = System.IO.Path.GetFileNameWithoutExtension (Environment.GetCommandLineArgs () [0]); + IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name); + g_set_prgname (native_name); + GLib.Marshaller.Free (native_name); + } + public static void Init () { + SetPrgname (); IntPtr argv = new IntPtr(0); int argc = 0; @@ -49,6 +61,7 @@ namespace Gtk { static bool do_init (string progname, ref string[] args, bool check) { + SetPrgname (); bool res = false; string[] progargs = new string[args.Length + 1];