GtkSharp/gnome/About.custom
Mike Kestner d8ecc52b5e 2005-03-09 Mike Kestner <mkestner@novell.com>
* */*.custom : scrub for string usage in DllImports.
	* gnome/Makefile.am : remove IconTheme.custom, it's not generated.

svn path=/trunk/gtk-sharp/; revision=41615
2005-03-09 20:32:24 +00:00

70 lines
2.8 KiB
Text

// Gnome.About.custom - Gnome About class customizations
//
// Author: Mike Kestner <mkestner@novell.com>
//
// Copyright (C) 2005 Novell, Inc.
//
// This code is inserted after the automatically generated code.
//
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the Lesser GNU General
// Public License as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
[DllImport("gnomeui-2")]
static extern IntPtr gnome_about_new(IntPtr name, IntPtr version, IntPtr copyright, IntPtr comments, IntPtr[] authors, IntPtr[] documenters, IntPtr translator_credits, IntPtr logo_pixbuf);
IntPtr[] NullTerm (string[] src)
{
if (src.Length == 0)
return null;
IntPtr[] result = new IntPtr [src.Length + 1];
for (int i = 0; i < src.Length; i++)
result [i] = GLib.Marshaller.StringToPtrGStrdup (src [i]);
result [src.Length] = IntPtr.Zero;
return result;
}
void ReleaseArray (IntPtr[] ptrs)
{
if (ptrs == null)
return;
foreach (IntPtr p in ptrs)
GLib.Marshaller.Free (p);
}
public About (string name, string version, string copyright, string comments, string[] authors, string[] documenters, string translator_credits, Gdk.Pixbuf logo_pixbuf) : base (IntPtr.Zero)
{
if (GetType () != typeof (About)) {
CreateNativeObject (new string[0], new GLib.Value[0]);
Construct (name, version, copyright, comments, authors, documenters,translator_credits, logo_pixbuf);
return;
}
IntPtr nname = GLib.Marshaller.StringToPtrGStrdup (name);
IntPtr nversion = GLib.Marshaller.StringToPtrGStrdup (version);
IntPtr ncopyright = GLib.Marshaller.StringToPtrGStrdup (copyright);
IntPtr ncomments = GLib.Marshaller.StringToPtrGStrdup (comments);
IntPtr ntranslator_credits = GLib.Marshaller.StringToPtrGStrdup (translator_credits);
IntPtr[] nauthors = NullTerm (authors);
IntPtr[] ndocumenters = NullTerm (documenters);
Raw = gnome_about_new (nname, nversion, ncopyright, ncomments, nauthors, ndocumenters, ntranslator_credits, (logo_pixbuf != null) ? logo_pixbuf.Handle : IntPtr.Zero);
GLib.Marshaller.Free (nname);
GLib.Marshaller.Free (nversion);
GLib.Marshaller.Free (ncopyright);
GLib.Marshaller.Free (ncomments);
GLib.Marshaller.Free (ntranslator_credits);
ReleaseArray (nauthors);
ReleaseArray (ndocumenters);
}