GtkSharp/gnome/About.custom
Mike Kestner 6edc0b8b89 2005-01-31 Mike Kestner <mkestner@novell.com>
* gnome/About.custom : fix some nullterm issues in subclass 
	construction as reported on irc by latexer.

svn path=/trunk/gtk-sharp/; revision=56363
2006-01-31 20:56:51 +00:00

72 lines
2.9 KiB
Plaintext

// 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 == null || 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)
{
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);
if (GetType () != typeof (About)) {
CreateNativeObject (new string[0], new GLib.Value[0]);
gnome_about_construct (Handle, nname, nversion, ncopyright, ncomments, nauthors, ndocumenters, ntranslator_credits, logo_pixbuf == null ? IntPtr.Zero : logo_pixbuf.Handle);
} else
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);
}