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
This commit is contained in:
Mike Kestner 2005-03-09 20:32:24 +00:00
parent ae7d9dfbf9
commit d8ecc52b5e
40 changed files with 456 additions and 261 deletions

View File

@ -1,3 +1,8 @@
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.
2005-03-09 Mike Kestner <mkestner@novell.com>
* glib/Marshaller.cs : add IntPtr.Zero guarding.

View File

@ -13,7 +13,7 @@
// Copyright (c) 2003 Ximian, Inc. (Duncan Mak)
// Copyright (c) 2003 Ximian, Inc. (Gonzalo Paniagua Javier)
// Copyright (c) 2003 Martin Willemoes Hansen
// Copyright (c) 2004 Novell, Inc.
// Copyright (c) 2004-2005 Novell, Inc.
//
// This code is inserted after the automatically generated code.
//
@ -243,11 +243,15 @@
}
[DllImport("libgdk_pixbuf-2.0-0.dll")]
static extern unsafe bool gdk_pixbuf_save(IntPtr raw, string filename, string type, out IntPtr error, IntPtr dummy);
static extern unsafe bool gdk_pixbuf_save(IntPtr raw, IntPtr filename, IntPtr type, out IntPtr error, IntPtr dummy);
public unsafe bool Save(string filename, string type) {
IntPtr error = IntPtr.Zero;
bool ret = gdk_pixbuf_save(Handle, filename, type, out error, IntPtr.Zero);
IntPtr nfilename = GLib.Marshaller.StringToPtrGStrdup (filename);
IntPtr ntype = GLib.Marshaller.StringToPtrGStrdup (type);
bool ret = gdk_pixbuf_save(Handle, nfilename, ntype, out error, IntPtr.Zero);
GLib.Marshaller.Free (nfilename);
GLib.Marshaller.Free (ntype);
if (error != IntPtr.Zero) throw new GLib.GException (error);
return ret;
}
@ -256,17 +260,27 @@
static extern void g_free (IntPtr raw);
[DllImport("libgdk_pixbuf-2.0-0.dll")]
static extern unsafe bool gdk_pixbuf_save_to_bufferv (IntPtr raw, out IntPtr buffer, out uint buffer_size, string type, string[] option_keys, string[] option_values, out IntPtr error);
static extern unsafe bool gdk_pixbuf_save_to_bufferv (IntPtr raw, out IntPtr buffer, out uint buffer_size, IntPtr type, IntPtr[] option_keys, IntPtr[] option_values, out IntPtr error);
string[] NullTerm (string[] src)
IntPtr[] NullTerm (string[] src)
{
string[] result = new string [src.Length + 1];
if (src.Length == 0)
return null;
IntPtr[] result = new IntPtr [src.Length + 1];
for (int i = 0; i < src.Length; i++)
result [i] = src [i];
result [src.Length] = null;
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 unsafe byte[] SaveToBuffer (string type)
{
return SaveToBuffer (type, new string [0], new string [0]);
@ -277,9 +291,16 @@
IntPtr error = IntPtr.Zero;
IntPtr buffer;
uint buffer_size;
if (!gdk_pixbuf_save_to_bufferv (Handle, out buffer, out buffer_size, type, NullTerm (option_keys), NullTerm (option_values), out error))
throw new GLib.GException (error);
IntPtr ntype = GLib.Marshaller.StringToPtrGStrdup (type);
IntPtr[] nkeys = NullTerm (option_keys);
IntPtr[] nvals = NullTerm (option_values);
bool saved = gdk_pixbuf_save_to_bufferv (Handle, out buffer, out buffer_size, ntype, nkeys, nvals, out error);
GLib.Marshaller.Free (ntype);
ReleaseArray (nkeys);
ReleaseArray (nvals);
if (!saved)
throw new GLib.GException (error);
byte[] result = new byte [buffer_size];
Marshal.Copy (buffer, result, 0, (int) buffer_size);
g_free (buffer);
@ -287,7 +308,7 @@
}
[DllImport("libgdk_pixbuf-2.0-0.dll")]
static extern unsafe bool gdk_pixbuf_save_to_callbackv (IntPtr raw, GdkSharp.PixbufSaveFuncNative save_func, IntPtr user_data, string type, string[] option_keys, string[] option_values, out IntPtr error);
static extern unsafe bool gdk_pixbuf_save_to_callbackv (IntPtr raw, GdkSharp.PixbufSaveFuncNative save_func, IntPtr user_data, IntPtr type, IntPtr[] option_keys, IntPtr[] option_values, out IntPtr error);
public unsafe void SaveToCallback (PixbufSaveFunc save_func, string type)
{
@ -299,7 +320,15 @@
GdkSharp.PixbufSaveFuncWrapper save_func_wrapper = null;
save_func_wrapper = new GdkSharp.PixbufSaveFuncWrapper (save_func, this);
IntPtr error = IntPtr.Zero;
if(!gdk_pixbuf_save_to_callbackv (Handle, save_func_wrapper.NativeDelegate, IntPtr.Zero, type, NullTerm (option_keys), NullTerm (option_values), out error))
IntPtr ntype = GLib.Marshaller.StringToPtrGStrdup (type);
IntPtr[] nkeys = NullTerm (option_keys);
IntPtr[] nvals = NullTerm (option_values);
bool saved = gdk_pixbuf_save_to_callbackv (Handle, save_func_wrapper.NativeDelegate, IntPtr.Zero, ntype, nkeys, nvals, out error);
GLib.Marshaller.Free (ntype);
ReleaseArray (nkeys);
ReleaseArray (nvals);
if (!saved)
throw new GLib.GException (error);
}

View File

@ -21,50 +21,46 @@
public Pixmap (Gdk.Drawable drawable, int width, int height) : this (drawable, width, height, -1) {}
[DllImport("libgdk-win32-2.0-0.dll")]
static extern IntPtr gdk_pixmap_colormap_create_from_xpm(IntPtr drawable, IntPtr colormap, IntPtr mask, IntPtr transparent_color, string filename);
static extern IntPtr gdk_pixmap_colormap_create_from_xpm (IntPtr drawable, IntPtr colormap, IntPtr mask, IntPtr transparent_color, IntPtr filename);
public static Gdk.Pixmap ColormapCreateFromXpm(Gdk.Drawable drawable, Gdk.Colormap colormap, string filename)
{
IntPtr raw_ret = gdk_pixmap_colormap_create_from_xpm(drawable.Handle, colormap.Handle, IntPtr.Zero, IntPtr.Zero, filename);
if (raw_ret == IntPtr.Zero)
return null;
return (Gdk.Pixmap) GLib.Object.GetObject(raw_ret);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (filename);
IntPtr raw_ret = gdk_pixmap_colormap_create_from_xpm (drawable.Handle, colormap.Handle, IntPtr.Zero, IntPtr.Zero, native);
GLib.Marshaller.Free (native);
return GLib.Object.GetObject (raw_ret) as Gdk.Pixmap;
}
[DllImport("libgdk-win32-2.0-0.dll")]
static extern IntPtr gdk_pixmap_colormap_create_from_xpm_d(IntPtr drawable, IntPtr colormap, IntPtr mask, IntPtr transparent_color, string data);
static extern IntPtr gdk_pixmap_colormap_create_from_xpm_d (IntPtr drawable, IntPtr colormap, IntPtr mask, IntPtr transparent_color, IntPtr data);
public static Gdk.Pixmap ColormapCreateFromXpmD(Gdk.Drawable drawable, Gdk.Colormap colormap, string data)
{
IntPtr raw_ret = gdk_pixmap_colormap_create_from_xpm_d(drawable.Handle, colormap.Handle, IntPtr.Zero, IntPtr.Zero, data);
if (raw_ret == IntPtr.Zero)
return null;
return (Gdk.Pixmap) GLib.Object.GetObject(raw_ret);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (data);
IntPtr raw_ret = gdk_pixmap_colormap_create_from_xpm_d (drawable.Handle, colormap.Handle, IntPtr.Zero, IntPtr.Zero, native);
GLib.Marshaller.Free (native);
return GLib.Object.GetObject (raw_ret) as Gdk.Pixmap;
}
[DllImport("libgdk-win32-2.0-0.dll")]
static extern IntPtr gdk_pixmap_create_from_xpm(IntPtr drawable, IntPtr mask, IntPtr transparent_color, string filename);
static extern IntPtr gdk_pixmap_create_from_xpm (IntPtr drawable, IntPtr mask, IntPtr transparent_color, IntPtr filename);
public static Gdk.Pixmap CreateFromXpm(Gdk.Drawable drawable, string filename)
{
IntPtr raw_ret = gdk_pixmap_create_from_xpm(drawable.Handle, IntPtr.Zero, IntPtr.Zero, filename);
if (raw_ret == IntPtr.Zero)
return null;
return (Gdk.Pixmap) GLib.Object.GetObject(raw_ret);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (filename);
IntPtr raw_ret = gdk_pixmap_create_from_xpm (drawable.Handle, IntPtr.Zero, IntPtr.Zero, native);
GLib.Marshaller.Free (native);
return GLib.Object.GetObject (raw_ret) as Gdk.Pixmap;
}
[DllImport("libgdk-win32-2.0-0.dll")]
static extern IntPtr gdk_pixmap_create_from_xpm_d(IntPtr drawable, IntPtr mask, IntPtr transparent_color, string data);
static extern IntPtr gdk_pixmap_create_from_xpm_d (IntPtr drawable, IntPtr mask, IntPtr transparent_color, IntPtr data);
public static Gdk.Pixmap CreateFromXpmD(Gdk.Drawable drawable, string data)
{
IntPtr raw_ret = gdk_pixmap_create_from_xpm_d(drawable.Handle, IntPtr.Zero, IntPtr.Zero, data);
if (raw_ret == IntPtr.Zero)
return null;
return (Gdk.Pixmap) GLib.Object.GetObject(raw_ret);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (data);
IntPtr raw_ret = gdk_pixmap_create_from_xpm_d (drawable.Handle, IntPtr.Zero, IntPtr.Zero, native);
GLib.Marshaller.Free (native);
return GLib.Object.GetObject (raw_ret) as Gdk.Pixmap;
}

View File

@ -87,7 +87,7 @@
/* a constructor that reads the XML from a Stream */
[DllImport("libglade-2.0-0.dll")]
static extern IntPtr glade_xml_new_from_buffer(byte[] buffer, int size, string root, string domain);
static extern IntPtr glade_xml_new_from_buffer(byte[] buffer, int size, IntPtr root, IntPtr domain);
public XML (System.IO.Stream s, string root, string domain) : base (IntPtr.Zero)
{
@ -100,7 +100,11 @@
int size = (int) s.Length;
byte[] buffer = new byte[size];
s.Read (buffer, 0, size);
Raw = glade_xml_new_from_buffer(buffer, size, root, domain);
IntPtr nroot = GLib.Marshaller.StringToPtrGStrdup (root);
IntPtr ndomain = GLib.Marshaller.StringToPtrGStrdup (domain);
Raw = glade_xml_new_from_buffer(buffer, size, nroot, ndomain);
GLib.Marshaller.Free (nroot);
GLib.Marshaller.Free (ndomain);
}
public XML (string resource_name, string root) : this (System.Reflection.Assembly.GetEntryAssembly (), resource_name, root, null)
@ -124,7 +128,11 @@
byte[] buffer = new byte[size];
s.Read (buffer, 0, size);
s.Close ();
Raw = glade_xml_new_from_buffer(buffer, size, root, domain);
IntPtr nroot = GLib.Marshaller.StringToPtrGStrdup (root);
IntPtr ndomain = GLib.Marshaller.StringToPtrGStrdup (domain);
Raw = glade_xml_new_from_buffer(buffer, size, nroot, ndomain);
GLib.Marshaller.Free (nroot);
GLib.Marshaller.Free (ndomain);
}
/* signal autoconnection using reflection */
@ -167,8 +175,8 @@
this.handler_type = type;
}
delegate void RawXMLConnectFunc (string handler_name, IntPtr objekt,
string signal_name, string signal_data,
delegate void RawXMLConnectFunc (IntPtr handler_name, IntPtr objekt,
IntPtr signal_name, IntPtr signal_data,
IntPtr connect_object, int after, IntPtr user_data);
[DllImport("libglade-2.0-0.dll")]
@ -180,12 +188,16 @@
glade_xml_signal_autoconnect_full (gxml.Handle, cf, IntPtr.Zero);
}
void ConnectFunc (string handler_name, IntPtr objekt_ptr,
string signal_name, string signal_data,
void ConnectFunc (IntPtr native_handler_name, IntPtr objekt_ptr,
IntPtr native_signal_name, IntPtr native_signal_data,
IntPtr connect_object_ptr, int after, IntPtr user_data) {
GLib.Object objekt = GLib.Object.GetObject (objekt_ptr, false);
string handler_name = GLib.Marshaller.Utf8PtrToString (native_handler_name);
string signal_name = GLib.Marshaller.Utf8PtrToString (native_signal_name);
//string signal_data = GLib.Marshaller.Utf8PtrToString (native_signal_data);
/* if an connect_object_ptr is provided, use that as handler */
object connect_object =
connect_object_ptr == IntPtr.Zero
@ -332,11 +344,13 @@
}
[DllImport("libglade-2.0-0.dll")]
static extern IntPtr glade_xml_get_widget_prefix(IntPtr raw, string name);
static extern IntPtr glade_xml_get_widget_prefix(IntPtr raw, IntPtr name);
public Gtk.Widget[] GetWidgetPrefix(string name)
{
IntPtr raw_ret = glade_xml_get_widget_prefix(Handle, name);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (name);
IntPtr raw_ret = glade_xml_get_widget_prefix(Handle, native);
GLib.Marshaller.Free (native);
if (raw_ret == IntPtr.Zero)
return new Gtk.Widget [0];
GLib.List list = new GLib.List (raw_ret);

View File

@ -23,7 +23,26 @@
[DllImport("gnomeui-2")]
static extern IntPtr gnome_about_new(string name, string version, string copyright, string comments, string[] authors, string[] documenters, string translator_credits, IntPtr logo_pixbuf);
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)
{
@ -32,6 +51,20 @@
Construct (name, version, copyright, comments, authors, documenters,translator_credits, logo_pixbuf);
return;
}
Raw = gnome_about_new (name, version, copyright, comments, authors, documenters, translator_credits, (logo_pixbuf != null) ? logo_pixbuf.Handle : 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);
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);
}

View File

@ -16,7 +16,7 @@
[DllImport("gnomeui-2")]
static extern IntPtr gnome_app_new(string appname, string title);
static extern IntPtr gnome_app_new(IntPtr appname, IntPtr title);
public App (string appname, string title) : base (IntPtr.Zero)
{
@ -25,5 +25,9 @@
Construct (appname, title);
return;
}
Raw = gnome_app_new(appname, title);
IntPtr nappname = GLib.Marshaller.StringToPtrGStrdup (appname);
IntPtr ntitle = GLib.Marshaller.StringToPtrGStrdup (title);
Raw = gnome_app_new(nappname, ntitle);
GLib.Marshaller.Free (nappname);
GLib.Marshaller.Free (ntitle);
}

View File

@ -15,7 +15,16 @@
// Boston, MA 02111-1307, USA.
[DllImport("gnomeui-2")]
static extern IntPtr gnome_druid_new_with_window(string title, IntPtr parent, bool close_on_cancel, out IntPtr window);
static extern IntPtr gnome_druid_new_with_window(IntPtr title, IntPtr parent, bool close_on_cancel, out IntPtr window);
Gtk.Widget new_with_window (string title, Gtk.Widget parent, bool close_on_cancel)
{
IntPtr handle;
IntPtr ntitle = GLib.Marshaller.StringToPtrGStrdup (title);
Raw = gnome_druid_new_with_window (ntitle, parent == null ? IntPtr.Zero : parent.Handle, close_on_cancel, out handle);
GLib.Marshaller.Free (ntitle);
return GLib.Object.GetObject (handle) as Gtk.Widget;
}
public Druid (string title, bool close_on_cancel, out Gtk.Widget window) : base (IntPtr.Zero)
{
@ -24,9 +33,7 @@
window = ConstructWithWindow (title, null, close_on_cancel);
return;
}
IntPtr window_handle;
Raw = gnome_druid_new_with_window (title, IntPtr.Zero, close_on_cancel, out window_handle);
window = (Gtk.Widget) GLib.Object.GetObject (window_handle);
window = new_with_window (title, null, close_on_cancel);
}
public Druid (string title, bool close_on_cancel) : base (IntPtr.Zero)
@ -36,8 +43,7 @@
ConstructWithWindow (title, null, close_on_cancel);
return;
}
IntPtr window_handle;
Raw = gnome_druid_new_with_window (title, IntPtr.Zero, close_on_cancel, out window_handle);
new_with_window (title, null, close_on_cancel);
}
public Druid (string title, Gtk.Window parent, bool close_on_cancel) : base (IntPtr.Zero)
@ -47,8 +53,7 @@
ConstructWithWindow (title, parent, close_on_cancel);
return;
}
IntPtr window_handle;
Raw = gnome_druid_new_with_window (title, (parent != null) ? parent.Handle : IntPtr.Zero, close_on_cancel, out window_handle);
new_with_window (title, parent, close_on_cancel);
}
public Druid (string title, Gtk.Window parent, bool close_on_cancel, out Gtk.Widget window) : base (IntPtr.Zero)
@ -58,8 +63,6 @@
window = ConstructWithWindow (title, parent, close_on_cancel);
return;
}
IntPtr window_handle;
Raw = gnome_druid_new_with_window(title, (parent != null) ? parent.Handle : IntPtr.Zero, close_on_cancel, out window_handle);
window = (Gtk.Widget)GLib.Object.GetObject (window_handle);
window = new_with_window(title, parent, close_on_cancel);
}

View File

@ -15,7 +15,7 @@
// Boston, MA 02111-1307, USA.
[DllImport("gnomeui-2")]
static extern IntPtr gnome_druid_page_edge_new_with_vals(int position, bool antialiased, string title, string text, IntPtr logo, IntPtr watermark, IntPtr top_watermark);
static extern IntPtr gnome_druid_page_edge_new_with_vals(int position, bool antialiased, IntPtr title, IntPtr text, IntPtr logo, IntPtr watermark, IntPtr top_watermark);
public DruidPageEdge (Gnome.EdgePosition position) : this (position, false, String.Empty, String.Empty, null, null, null)
{
@ -28,5 +28,9 @@
Construct (position, antialiased, title, text, logo, watermark, top_watermark);
return;
}
Raw = gnome_druid_page_edge_new_with_vals((int) position, antialiased, title, text, (logo != null) ? logo.Handle : IntPtr.Zero, (watermark != null) ? watermark.Handle : IntPtr.Zero, (top_watermark != null) ? top_watermark.Handle : IntPtr.Zero);
IntPtr ntitle = GLib.Marshaller.StringToPtrGStrdup (title);
IntPtr ntext = GLib.Marshaller.StringToPtrGStrdup (text);
Raw = gnome_druid_page_edge_new_with_vals((int) position, antialiased, ntitle, ntext, (logo != null) ? logo.Handle : IntPtr.Zero, (watermark != null) ? watermark.Handle : IntPtr.Zero, (top_watermark != null) ? top_watermark.Handle : IntPtr.Zero);
GLib.Marshaller.Free (ntitle);
GLib.Marshaller.Free (ntext);
}

View File

@ -37,11 +37,13 @@
}
[DllImport("gnomeprint-2-2")]
static extern IntPtr gnome_font_style_list (string family);
static extern IntPtr gnome_font_style_list (IntPtr family);
public static string[] StyleList (string family)
{
IntPtr list_ptr = gnome_font_style_list (family);
IntPtr nfamily = GLib.Marshaller.StringToPtrGStrdup (family);
IntPtr list_ptr = gnome_font_style_list (nfamily);
GLib.Marshaller.Free (nfamily);
if (list_ptr == IntPtr.Zero)
return new string [0];

View File

@ -1,67 +0,0 @@
// IconTheme.custom - customizations to Gnome.IconTheme
//
// Authors: Mike Kestner <mkestner@ximian.com>
// Jerone Zwartepoorte <jeroen@xs4all.nl>
//
// Copyright (c) 2004 Novell, Inc.
//
// 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_icon_theme_list_icons (IntPtr raw, string context);
public string[] ListIcons (string context)
{
IntPtr list_ptr = gnome_icon_theme_list_icons (Handle, context);
if (list_ptr == IntPtr.Zero)
return new string [0];
GLib.List list = new GLib.List (list_ptr, typeof (string));
string[] result = new string [list.Count];
int i = 0;
foreach (string val in list)
result [i++] = val;
return result;
}
[DllImport("gnomeui-2")]
static extern void gnome_icon_theme_get_search_path(IntPtr raw, out IntPtr path, out int n_elements);
[DllImport("libglib-2.0-0.dll")]
static extern void g_strfreev (IntPtr mem);
public string[] SearchPath {
get {
string[] retval;
unsafe {
int length;
IntPtr raw_ret;
gnome_icon_theme_get_search_path (Handle, out raw_ret, out length);
int size = Marshal.SizeOf (typeof (IntPtr));
retval = new string[length];
for (int i = 0, j = 0; i < length; i++, j += size) {
IntPtr string_ptr = Marshal.ReadIntPtr (new IntPtr (raw_ret.ToInt32 () + j));
retval[i] = GLib.Marshaller.Utf8PtrToString (string_ptr);
}
g_strfreev (raw_ret);
}
return retval;
}
}

View File

@ -47,7 +47,6 @@ customs = \
FontFamily.custom \
IconList.custom \
IconTextItem.custom \
IconTheme.custom \
PanelApplet.custom \
Print.custom \
PrintContext.custom \

View File

@ -1,12 +1,14 @@
[DllImport ("panel-applet-2")]
static extern void panel_applet_setup_menu (IntPtr handle, string xml, BonoboUIVerb[] items, IntPtr user_data);
static extern void panel_applet_setup_menu (IntPtr handle, IntPtr xml, BonoboUIVerb[] items, IntPtr user_data);
public void SetupMenu (string xml, BonoboUIVerb[] items)
{
BonoboUIVerb[] nulled_items = new BonoboUIVerb[items.Length + 1];
Array.Copy (items, nulled_items, items.Length);
nulled_items[items.Length] = new BonoboUIVerb (null, null);
panel_applet_setup_menu (Handle, xml, nulled_items, IntPtr.Zero);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (xml);
panel_applet_setup_menu (Handle, native, nulled_items, IntPtr.Zero);
GLib.Marshaller.Free (native);
}
public abstract void Creation ();

View File

@ -1,8 +1,11 @@
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_beginpage (IntPtr raw, string name);
static extern int gnome_print_beginpage (IntPtr raw, IntPtr name);
public PrintReturnCode BeginPage (string name) {
return (PrintReturnCode)gnome_print_beginpage (Handle, name);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (name);
int result = gnome_print_beginpage (Handle, native);
GLib.Marshaller.Free (native);
return (PrintReturnCode) result;
}
[DllImport("gnomeprint-2-2")]
@ -213,41 +216,56 @@
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_show (IntPtr raw, string text);
static extern int gnome_print_show (IntPtr raw, IntPtr text);
public PrintReturnCode Show (string text) {
return (PrintReturnCode)gnome_print_show (Handle, text);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (text);
int result = gnome_print_show (Handle, native);
GLib.Marshaller.Free (native);
return (PrintReturnCode) result;
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_show_sized (IntPtr raw, string text, int bytes);
static extern int gnome_print_show_sized (IntPtr raw, IntPtr text, int bytes);
public PrintReturnCode ShowSized (string text, int bytes) {
return (PrintReturnCode)gnome_print_show_sized (Handle, text, bytes);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (text);
int result = gnome_print_show_sized (Handle, native, bytes);
GLib.Marshaller.Free (native);
return (PrintReturnCode) result;
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_glyphlist (IntPtr raw, IntPtr glyphlist);
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_grayimage (IntPtr raw, string data, int width, int height, int rowstride);
static extern int gnome_print_grayimage (IntPtr raw, IntPtr data, int width, int height, int rowstride);
public PrintReturnCode GrayImage (string data, int width, int height, int rowstride) {
return (PrintReturnCode)gnome_print_grayimage (Handle, data, width, height, rowstride);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (data);
int result = gnome_print_grayimage (Handle, native, width, height, rowstride);
GLib.Marshaller.Free (native);
return (PrintReturnCode) result;
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_rgbimage (IntPtr raw, string data, int width, int height, int rowstride);
static extern int gnome_print_rgbimage (IntPtr raw, IntPtr data, int width, int height, int rowstride);
public PrintReturnCode RgbImage (string data, int width, int height, int rowstride) {
return (PrintReturnCode)gnome_print_rgbimage (Handle, data, width, height, rowstride);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (data);
int result = gnome_print_rgbimage (Handle, native, width, height, rowstride);
GLib.Marshaller.Free (native);
return (PrintReturnCode) result;
}
[DllImport("gnomeprint-2-2")]
static extern int gnome_print_rgbaimage (IntPtr raw, string data, int width, int height, int rowstride);
static extern int gnome_print_rgbaimage (IntPtr raw, IntPtr data, int width, int height, int rowstride);
public PrintReturnCode RgbaImage (string data, int width, int height, int rowstride) {
return (PrintReturnCode)gnome_print_rgbaimage (Handle, data, width, height, rowstride);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (data);
int result = gnome_print_rgbaimage (Handle, native, width, height, rowstride);
GLib.Marshaller.Free (native);
return (PrintReturnCode) result;
}
[DllImport("gnomeprint-2-2")]

View File

@ -15,7 +15,7 @@
// Boston, MA 02111-1307, USA.
[DllImport("gnomeui-2")]
static extern IntPtr gnome_scores_new(uint n_scores, string names, out float scores, IntPtr times, bool clear);
static extern IntPtr gnome_scores_new(uint n_scores, IntPtr names, out float scores, IntPtr times, bool clear);
public Scores (uint n_scores, string names, out float scores, System.DateTime times, bool clear) : base (IntPtr.Zero)
{
@ -24,5 +24,7 @@
scores = Construct (n_scores, names, times, clear);
return;
}
Raw = gnome_scores_new(n_scores, names, out scores, GLib.Marshaller.DateTimeTotime_t (times), clear);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (names);
Raw = gnome_scores_new(n_scores, native, out scores, GLib.Marshaller.DateTimeTotime_t (times), clear);
GLib.Marshaller.Free (native);
}

View File

@ -95,26 +95,34 @@
}
[DllImport("gnomevfs-2")]
static extern string gnome_vfs_get_local_path_from_uri (string uri);
static extern IntPtr gnome_vfs_get_local_path_from_uri (IntPtr uri);
public static string GetLocalPathFromUri (string uri)
{
return gnome_vfs_get_local_path_from_uri (uri);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (uri);
IntPtr result = gnome_vfs_get_local_path_from_uri (native);
GLib.Marshaller.Free (native);
return GLib.Marshaller.PtrToStringGFree (result);
}
[DllImport("gnomevfs-2")]
static extern string gnome_vfs_get_uri_from_local_path (string path);
static extern IntPtr gnome_vfs_get_uri_from_local_path (IntPtr path);
public static string GetUriFromLocalPath (string path)
{
return gnome_vfs_get_uri_from_local_path (path);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (path);
IntPtr result = gnome_vfs_get_uri_from_local_path (native);
GLib.Marshaller.Free (native);
return GLib.Marshaller.PtrToStringGFree (result);
}
[DllImport("gnomevfs-2")]
static extern IntPtr gnome_vfs_uri_list_parse(string uri_list);
static extern IntPtr gnome_vfs_uri_list_parse(IntPtr uri_list);
public static Uri[] ParseList (string uri_list) {
IntPtr raw_ret = gnome_vfs_uri_list_parse(uri_list);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (uri_list);
IntPtr raw_ret = gnome_vfs_uri_list_parse(native);
GLib.Marshaller.Free (native);
GLib.List list = new GLib.List(raw_ret);
Uri[] uris = new Uri [list.Count];
for (int i = 0; i < list.Count; i++)

View File

@ -2,7 +2,7 @@
//
// Authors: Mike Kestner <mkestner@ximian.com>
//
// Copyright (c) 2004 Novell, Inc.
// Copyright (c) 2004-2005 Novell, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the Lesser GNU General
@ -19,19 +19,23 @@
// Boston, MA 02111-1307, USA.
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_accel_map_save(string file_name);
static extern void gtk_accel_map_save(IntPtr file_name);
[Obsolete("Moved to AccelMap class. Use AccelMap.Save instead")]
public static void MapSave(string file_name) {
gtk_accel_map_save(file_name);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (file_name);
gtk_accel_map_save (native);
GLib.Marshaller.Free (native);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_accel_map_add_filter(string filter_pattern);
static extern void gtk_accel_map_add_filter(IntPtr filter_pattern);
[Obsolete("Moved to AccelMap class. Use AccelMap.AddFilter instead")]
public static void MapAddFilter(string filter_pattern) {
gtk_accel_map_add_filter(filter_pattern);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (filter_pattern);
gtk_accel_map_add_filter (native);
GLib.Marshaller.Free (native);
}
[DllImport("libgtk-win32-2.0-0.dll")]
@ -53,11 +57,13 @@
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_accel_map_add_entry(string accel_path, uint accel_key, int accel_mods);
static extern void gtk_accel_map_add_entry(IntPtr accel_path, uint accel_key, int accel_mods);
[Obsolete("Moved to AccelMap class. Use AccelMap.AddEntry instead")]
public static void MapAddEntry(string accel_path, uint accel_key, Gdk.ModifierType accel_mods) {
gtk_accel_map_add_entry(accel_path, accel_key, (int) accel_mods);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (accel_path);
gtk_accel_map_add_entry(native, accel_key, (int) accel_mods);
GLib.Marshaller.Free (native);
}
[DllImport("libgtk-win32-2.0-0.dll")]
@ -69,31 +75,35 @@
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern bool gtk_accel_map_lookup_entry(string accel_path, ref Gtk.AccelKey key);
static extern bool gtk_accel_map_lookup_entry(IntPtr accel_path, ref Gtk.AccelKey key);
[Obsolete("Moved to AccelMap class. Use AccelMap.LookupEntry instead")]
public static bool MapLookupEntry(string accel_path, Gtk.AccelKey key) {
bool raw_ret = gtk_accel_map_lookup_entry(accel_path, ref key);
bool ret = raw_ret;
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (accel_path);
bool ret = gtk_accel_map_lookup_entry(native, ref key);
GLib.Marshaller.Free (native);
return ret;
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern bool gtk_accel_map_change_entry(string accel_path, uint accel_key, int accel_mods, bool replace);
static extern bool gtk_accel_map_change_entry(IntPtr accel_path, uint accel_key, int accel_mods, bool replace);
[Obsolete("Moved to AccelMap class. Use AccelMap.ChangeEntry instead")]
public static bool MapChangeEntry(string accel_path, uint accel_key, Gdk.ModifierType accel_mods, bool replace) {
bool raw_ret = gtk_accel_map_change_entry(accel_path, accel_key, (int) accel_mods, replace);
bool ret = raw_ret;
public static bool MapChangeEntry (string accel_path, uint accel_key, Gdk.ModifierType accel_mods, bool replace) {
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (accel_path);
bool ret = gtk_accel_map_change_entry (native, accel_key, (int) accel_mods, replace);
GLib.Marshaller.Free (native);
return ret;
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_accel_map_load(string file_name);
static extern void gtk_accel_map_load (IntPtr file_name);
[Obsolete("Moved to AccelMap class. Use AccelMap.Load instead")]
public static void MapLoad(string file_name) {
gtk_accel_map_load(file_name);
public static void MapLoad (string file_name) {
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (file_name);
gtk_accel_map_load (native);
GLib.Marshaller.Free (native);
}
[DllImport("libgtk-win32-2.0-0.dll")]

View File

@ -22,7 +22,7 @@
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_button_new_from_stock(string stock_id);
static extern IntPtr gtk_button_new_from_stock(IntPtr stock_id);
public Button (string stock_id) : base (IntPtr.Zero)
{
@ -36,7 +36,9 @@ public Button (string stock_id) : base (IntPtr.Zero)
CreateNativeObject (names, vals);
return;
}
Raw = gtk_button_new_from_stock(stock_id);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (stock_id);
Raw = gtk_button_new_from_stock (native);
GLib.Marshaller.Free (native);
}
[DllImport("gtksharpglue-2")]

View File

@ -98,16 +98,16 @@
[DllImport("gtksharpglue-2")]
static extern void gtksharp_cellrenderer_override_start_editing (GLib.GType gtype, StartEditingDelegate cb);
delegate IntPtr StartEditingDelegate (IntPtr raw, IntPtr evnt, IntPtr widget, string path, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, Gtk.CellRendererState flags);
delegate IntPtr StartEditingDelegate (IntPtr raw, IntPtr evnt, IntPtr widget, IntPtr path, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, Gtk.CellRendererState flags);
static StartEditingDelegate StartEditingCallback;
static IntPtr StartEditing_cb (IntPtr raw, IntPtr evnt, IntPtr widget, string path, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, Gtk.CellRendererState flags)
static IntPtr StartEditing_cb (IntPtr raw, IntPtr evnt, IntPtr widget, IntPtr path, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, Gtk.CellRendererState flags)
{
CellRenderer obj = GLib.Object.GetObject (raw, false) as CellRenderer;
Gdk.Event _event = new Gdk.Event (evnt);
Widget widg = GLib.Object.GetObject (widget, false) as Gtk.Widget;
CellEditable retval = obj.StartEditing (_event, widg, path, background_area, cell_area, flags);
CellEditable retval = obj.StartEditing (_event, widg, GLib.Marshaller.Utf8PtrToString (path), background_area, cell_area, flags);
if (retval == null)
return IntPtr.Zero;
return retval.Handle;
@ -121,11 +121,13 @@
}
[DllImport("gtksharpglue-2")]
static extern IntPtr gtksharp_cellrenderer_base_start_editing(IntPtr raw, IntPtr evnt, IntPtr widget, string path, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, int flags);
static extern IntPtr gtksharp_cellrenderer_base_start_editing(IntPtr raw, IntPtr evnt, IntPtr widget, IntPtr path, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, int flags);
[GLib.DefaultSignalHandler (Type=typeof(Gtk.CellRenderer), ConnectionMethod="OverrideStartEditing")]
public virtual Gtk.CellEditable StartEditing(Gdk.Event evnt, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags) {
IntPtr raw_ret = gtksharp_cellrenderer_base_start_editing(Handle, evnt.Handle, widget.Handle, path, ref background_area, ref cell_area, (int) flags);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (path);
IntPtr raw_ret = gtksharp_cellrenderer_base_start_editing(Handle, evnt.Handle, widget.Handle, native, ref background_area, ref cell_area, (int) flags);
GLib.Marshaller.Free (native);
Gtk.CellEditable ret = (Gtk.CellEditable) GLib.Object.GetObject(raw_ret);
return ret;
}

View File

@ -22,7 +22,7 @@
[DllImport ("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_check_menu_item_new_with_mnemonic (string label);
static extern IntPtr gtk_check_menu_item_new_with_mnemonic (IntPtr label);
public CheckMenuItem (string label) : base (IntPtr.Zero)
{
@ -36,7 +36,9 @@
return;
}
Raw = gtk_check_menu_item_new_with_mnemonic (label);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (label);
Raw = gtk_check_menu_item_new_with_mnemonic (native);
GLib.Marshaller.Free (native);
}
public new void Toggle() {

View File

@ -22,7 +22,7 @@
static extern bool gtk_clipboard_set_with_data(IntPtr raw, IntPtr targets, int n_targets, GtkSharp.GtkClipboardGetFuncNative get_func, GtkSharp.GtkClipboardClearFuncNative clear_func, uint id);
[DllImport("gtksharpglue-2")]
static extern IntPtr gtksharp_clipboard_target_list_add (IntPtr list, string name, uint flags, uint info);
static extern IntPtr gtksharp_clipboard_target_list_add (IntPtr list, IntPtr name, uint flags, uint info);
[DllImport("gtksharpglue-2")]
static extern IntPtr gtksharp_clipboard_target_list_to_array (IntPtr list);
@ -54,7 +54,9 @@
IntPtr list = IntPtr.Zero;
foreach (Gtk.TargetEntry t in targets) {
list = gtksharp_clipboard_target_list_add (list, t.target, t.flags, t.info);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (t.target);
list = gtksharp_clipboard_target_list_add (list, native, t.flags, t.info);
GLib.Marshaller.Free (native);
}
IntPtr array = gtksharp_clipboard_target_list_to_array (list);

View File

@ -29,12 +29,14 @@
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern bool gtk_color_selection_palette_from_string(string str, out IntPtr colors, out int n_colors);
static extern bool gtk_color_selection_palette_from_string(IntPtr str, out IntPtr colors, out int n_colors);
public static Gdk.Color[] PaletteFromString(string str) {
IntPtr parsedColors;
int n_colors;
bool raw_ret = gtk_color_selection_palette_from_string(str, out parsedColors, out n_colors);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (str);
bool raw_ret = gtk_color_selection_palette_from_string(native, out parsedColors, out n_colors);
GLib.Marshaller.Free (native);
// If things failed, return silently
if (!raw_ret)

View File

@ -20,12 +20,14 @@
[DllImport("gtksharpglue-2")]
static extern void gtksharp_container_child_get_property (IntPtr container, IntPtr child, string property, ref GLib.Value value);
static extern void gtksharp_container_child_get_property (IntPtr container, IntPtr child, IntPtr property, ref GLib.Value value);
public GLib.Value ChildGetProperty (Gtk.Widget child, string property_name) {
GLib.Value value = new GLib.Value ();
gtksharp_container_child_get_property (Handle, child.Handle, property_name, ref value);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (property_name);
gtksharp_container_child_get_property (Handle, child.Handle, native, ref value);
GLib.Marshaller.Free (native);
return value;
}

View File

@ -25,7 +25,7 @@
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_dialog_new_with_buttons (string title, IntPtr i, int flags, IntPtr dummy);
static extern IntPtr gtk_dialog_new_with_buttons (IntPtr title, IntPtr i, int flags, IntPtr dummy);
public Dialog (string title, Gtk.Window parent, Gtk.DialogFlags flags, params object[] button_data) : base(IntPtr.Zero)
{
if (GetType() != typeof (Dialog)) {
@ -41,8 +41,11 @@ public Dialog (string title, Gtk.Window parent, Gtk.DialogFlags flags, params ob
DestroyWithParent = true;
if ((flags & DialogFlags.NoSeparator) > 0)
HasSeparator = false;
} else
Raw = gtk_dialog_new_with_buttons (title, parent.Handle, (int) flags, IntPtr.Zero);
} else {
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (title);
Raw = gtk_dialog_new_with_buttons (native, parent.Handle, (int) flags, IntPtr.Zero);
GLib.Marshaller.Free (native);
}
for (int i = 0; i < button_data.Length - 1; i += 2)
AddButton ((string) button_data [i], (int) button_data [i + 1]);

View File

@ -21,7 +21,7 @@
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_file_chooser_dialog_new(string title, IntPtr parent, int action, IntPtr nil);
static extern IntPtr gtk_file_chooser_dialog_new(IntPtr title, IntPtr parent, int action, IntPtr nil);
public FileChooserDialog (string title, Window parent, FileChooserAction action, params object[] button_data) : base (IntPtr.Zero)
{
@ -31,15 +31,18 @@
if (parent != null)
TransientFor = parent;
Action = action;
} else
Raw = gtk_file_chooser_dialog_new (title, parent == null ? IntPtr.Zero : parent.Handle, (int)action, IntPtr.Zero);
} else {
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (title);
Raw = gtk_file_chooser_dialog_new (native, parent == null ? IntPtr.Zero : parent.Handle, (int)action, IntPtr.Zero);
GLib.Marshaller.Free (native);
}
for (int i = 0; i < button_data.Length - 1; i += 2)
AddButton ((string) button_data [i], (int) button_data [i + 1]);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_file_chooser_dialog_new_with_backend(string title, IntPtr parent, int action, string backend, IntPtr nil);
static extern IntPtr gtk_file_chooser_dialog_new_with_backend(IntPtr title, IntPtr parent, int action, IntPtr backend, IntPtr nil);
public FileChooserDialog (string backend, string title, Window parent, FileChooserAction action, params object[] button_data) : base (IntPtr.Zero)
{
@ -49,8 +52,13 @@
if (parent != null)
TransientFor = parent;
Action = action;
} else
Raw = gtk_file_chooser_dialog_new_with_backend (title, parent == null ? IntPtr.Zero : parent.Handle, (int)action, backend, IntPtr.Zero);
} else {
IntPtr ntitle = GLib.Marshaller.StringToPtrGStrdup (title);
IntPtr nbackend = GLib.Marshaller.StringToPtrGStrdup (backend);
Raw = gtk_file_chooser_dialog_new_with_backend (ntitle, parent == null ? IntPtr.Zero : parent.Handle, (int)action, nbackend, IntPtr.Zero);
GLib.Marshaller.Free (ntitle);
GLib.Marshaller.Free (nbackend);
}
for (int i = 0; i < button_data.Length - 1; i += 2)
AddButton ((string) button_data [i], (int) button_data [i + 1]);

View File

@ -3,14 +3,32 @@
// Authors: Mike Kestner <mkestner@ximian.com>
// Jeroen Zwartepoorte <jeroen@xs4all.nl>
//
// Copyright (c) 2004 Novell, Inc.
// Copyright (c) 2004-2005 Novell, Inc.
//
// 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("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_icon_theme_list_icons (IntPtr raw, string context);
static extern IntPtr gtk_icon_theme_list_icons (IntPtr raw, IntPtr context);
public string[] ListIcons (string context)
{
IntPtr list_ptr = gtk_icon_theme_list_icons (Handle, context);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (context);
IntPtr list_ptr = gtk_icon_theme_list_icons (Handle, native);
GLib.Marshaller.Free (native);
if (list_ptr == IntPtr.Zero)
return new string [0];

View File

@ -35,7 +35,7 @@
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_image_new_from_stock(string stock_id, int size);
static extern IntPtr gtk_image_new_from_stock(IntPtr stock_id, int size);
public Image (string stock_id, Gtk.IconSize size) : base (IntPtr.Zero)
{
@ -49,6 +49,8 @@
CreateNativeObject ((string[])names.ToArray (typeof (string)), (GLib.Value[])vals.ToArray (typeof (GLib.Value)));
return;
}
Raw = gtk_image_new_from_stock(stock_id, (int) size);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (stock_id);
Raw = gtk_image_new_from_stock(native, (int) size);
GLib.Marshaller.Free (native);
}

View File

@ -22,7 +22,7 @@
[DllImport ("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_image_menu_item_new_with_mnemonic (string label);
static extern IntPtr gtk_image_menu_item_new_with_mnemonic (IntPtr label);
public ImageMenuItem (string label) : base (IntPtr.Zero)
{
@ -36,6 +36,8 @@
return;
}
Raw = gtk_image_menu_item_new_with_mnemonic (label);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (label);
Raw = gtk_image_menu_item_new_with_mnemonic (native);
GLib.Marshaller.Free (native);
}

View File

@ -22,7 +22,7 @@
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_item_factory_new(IntPtr container_type, string path, IntPtr accel_group);
static extern IntPtr gtk_item_factory_new(IntPtr container_type, IntPtr path, IntPtr accel_group);
public ItemFactory (GLib.GType container_type, string path, Gtk.AccelGroup accel_group) : base (IntPtr.Zero)
{
@ -31,6 +31,8 @@
Construct (container_type, path, accel_group);
return;
}
Raw = gtk_item_factory_new(container_type.Val, path, (accel_group != null) ? accel_group.Handle : IntPtr.Zero);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (path);
Raw = gtk_item_factory_new(container_type.Val, native, (accel_group != null) ? accel_group.Handle : IntPtr.Zero);
GLib.Marshaller.Free (native);
}

View File

@ -22,7 +22,7 @@
[DllImport ("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_menu_item_new_with_mnemonic (string label);
static extern IntPtr gtk_menu_item_new_with_mnemonic (IntPtr label);
public MenuItem (string label) : base (IntPtr.Zero)
{
@ -36,5 +36,7 @@
return;
}
Raw = gtk_menu_item_new_with_mnemonic (label);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (label);
Raw = gtk_menu_item_new_with_mnemonic (native);
GLib.Marshaller.Free (native);
}

View File

@ -14,21 +14,26 @@
// Boston, MA 02111-1307, USA.
[DllImport ("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_message_dialog_new (IntPtr parent_window, DialogFlags flags, MessageType type, ButtonsType bt, string msg, params object [] args);
static extern IntPtr gtk_message_dialog_new (IntPtr parent_window, DialogFlags flags, MessageType type, ButtonsType bt, IntPtr msg, IntPtr args);
[DllImport ("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_message_dialog_new_with_markup (IntPtr parent_window, DialogFlags flags, MessageType type, ButtonsType bt, string msg, params object [] args);
static extern IntPtr gtk_message_dialog_new_with_markup (IntPtr parent_window, DialogFlags flags, MessageType type, ButtonsType bt, IntPtr msg, IntPtr args);
public MessageDialog (Gtk.Window parent_window, DialogFlags flags, MessageType type, ButtonsType bt, bool use_markup, string format, params object[] args)
{
IntPtr p = (parent_window != null) ? parent_window.Handle : IntPtr.Zero;
if (format == null)
Raw = gtk_message_dialog_new (p, flags, type, bt, null, null);
else if (use_markup)
Raw = gtk_message_dialog_new_with_markup (p, flags, type, bt, GLib.Marshaller.StringFormat (format, args), null);
if (format == null) {
Raw = gtk_message_dialog_new (p, flags, type, bt, IntPtr.Zero, IntPtr.Zero);
return;
}
IntPtr nmsg = GLib.Marshaller.StringToPtrGStrdup (GLib.Marshaller.StringFormat (format, args));
if (use_markup)
Raw = gtk_message_dialog_new_with_markup (p, flags, type, bt, nmsg, IntPtr.Zero);
else
Raw = gtk_message_dialog_new (p, flags, type, bt, GLib.Marshaller.StringFormat (format, args), null);
Raw = gtk_message_dialog_new (p, flags, type, bt, nmsg, IntPtr.Zero);
GLib.Marshaller.Free (nmsg);
}
public MessageDialog (Gtk.Window parent_window, DialogFlags flags, MessageType type, ButtonsType bt, string format, params object[] args) : this (parent_window, flags, type, bt, true, format, args) {}

View File

@ -20,10 +20,12 @@
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_radio_button_new_with_mnemonic (IntPtr group, string label);
static extern IntPtr gtk_radio_button_new_with_mnemonic (IntPtr group, IntPtr label);
// creates a new group for this RadioButton
public RadioButton (string label)
{
Raw = gtk_radio_button_new_with_mnemonic (IntPtr.Zero, label);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (label);
Raw = gtk_radio_button_new_with_mnemonic (IntPtr.Zero, native);
GLib.Marshaller.Free (native);
}

View File

@ -40,7 +40,7 @@
private static extern IntPtr gtk_selection_data_get_text (IntPtr selection_data);
[DllImport("libgtk-win32-2.0-0.dll")]
private static extern void gtk_selection_data_set_text (IntPtr selection_data, string str, int len);
private static extern void gtk_selection_data_set_text (IntPtr selection_data, IntPtr str, int len);
public string Text {
get {
@ -50,7 +50,9 @@
return GLib.Marshaller.PtrToStringGFree (text);
}
set {
gtk_selection_data_set_text (Handle, value, value.Length);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (value);
gtk_selection_data_set_text (Handle, native, -1);
GLib.Marshaller.Free (native);
}
}

View File

@ -44,12 +44,15 @@
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern bool gtk_stock_lookup (string stock_id, out ConstStockItem item);
static extern bool gtk_stock_lookup (IntPtr stock_id, out ConstStockItem item);
public static Gtk.StockItem Lookup (string stock_id) {
ConstStockItem const_item;
if (!gtk_stock_lookup (stock_id, out const_item))
IntPtr native_id = GLib.Marshaller.StringToPtrGStrdup (stock_id);
bool result = gtk_stock_lookup (native_id, out const_item);
GLib.Marshaller.Free (native_id);
if (!result)
return Gtk.StockItem.Zero;
Gtk.StockItem item = new Gtk.StockItem ();

View File

@ -20,14 +20,16 @@
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_text_buffer_set_text (IntPtr raw, string text, int len);
static extern void gtk_text_buffer_set_text (IntPtr raw, IntPtr text, int len);
public string Text {
get {
return GetText (StartIter, EndIter, false);
}
set {
gtk_text_buffer_set_text (Handle, value, -1);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (value);
gtk_text_buffer_set_text (Handle, native, -1);
GLib.Marshaller.Free (native);
}
}
@ -47,11 +49,13 @@ public void PasteClipboard (Gtk.Clipboard clipboard)
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_text_buffer_insert (IntPtr raw, ref Gtk.TextIter iter, string text, int len);
static extern void gtk_text_buffer_insert (IntPtr raw, ref Gtk.TextIter iter, IntPtr text, int len);
public void Insert (ref Gtk.TextIter iter, string text)
{
gtk_text_buffer_insert (Handle, ref iter, text, -1);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (text);
gtk_text_buffer_insert (Handle, ref iter, native, -1);
GLib.Marshaller.Free (native);
}
public void InsertWithTags (ref TextIter iter, string text, params TextTag[] tags)
@ -90,26 +94,34 @@ public void SetText (string text)
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern bool gtk_text_buffer_insert_interactive(IntPtr raw, ref Gtk.TextIter iter, string text, int len, bool default_editable);
static extern bool gtk_text_buffer_insert_interactive(IntPtr raw, ref Gtk.TextIter iter, IntPtr text, int len, bool default_editable);
public bool InsertInteractive(ref Gtk.TextIter iter, string text, bool default_editable)
{
return gtk_text_buffer_insert_interactive(Handle, ref iter, text, -1, default_editable);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (text);
bool result = gtk_text_buffer_insert_interactive(Handle, ref iter, native, -1, default_editable);
GLib.Marshaller.Free (native);
return result;
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern bool gtk_text_buffer_insert_interactive_at_cursor(IntPtr raw, string text, int len, bool default_editable);
static extern bool gtk_text_buffer_insert_interactive_at_cursor(IntPtr raw, IntPtr text, int len, bool default_editable);
public bool InsertInteractiveAtCursor(string text, bool default_editable)
{
return gtk_text_buffer_insert_interactive_at_cursor(Handle, text, -1, default_editable);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (text);
bool result = gtk_text_buffer_insert_interactive_at_cursor(Handle, native, -1, default_editable);
GLib.Marshaller.Free (native);
return result;
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_text_buffer_insert_at_cursor(IntPtr raw, string text, int len);
static extern void gtk_text_buffer_insert_at_cursor(IntPtr raw, IntPtr text, int len);
public void InsertAtCursor(string text)
{
gtk_text_buffer_insert_at_cursor(Handle, text, -1);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (text);
gtk_text_buffer_insert_at_cursor(Handle, native, -1);
GLib.Marshaller.Free (native);
}

View File

@ -41,14 +41,20 @@
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_toolbar_append_element (IntPtr raw, int type, IntPtr widget, string text, string tooltip_text, string tooltip_private_text, IntPtr icon, GtkSharp.SignalFuncNative cb, IntPtr user_data);
static extern IntPtr gtk_toolbar_append_element (IntPtr raw, int type, IntPtr widget, IntPtr text, IntPtr tooltip_text, IntPtr tooltip_private_text, IntPtr icon, GtkSharp.SignalFuncNative cb, IntPtr user_data);
[Obsolete ("Replaced by ToolItem API")]
public Gtk.Widget AppendElement (Gtk.ToolbarChildType type, Gtk.Widget widget, string text, string tooltip_text, string tooltip_private_text, Gtk.Widget icon, Gtk.SignalFunc cb)
{
GtkSharp.SignalFuncWrapper cb_wrapper = null;
cb_wrapper = new GtkSharp.SignalFuncWrapper (cb, this);
IntPtr raw_ret = gtk_toolbar_append_element (Handle, (int) type, widget == null ? IntPtr.Zero : widget.Handle, text, tooltip_text, tooltip_private_text, icon.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
IntPtr ntext = GLib.Marshaller.StringToPtrGStrdup (text);
IntPtr ntiptext = GLib.Marshaller.StringToPtrGStrdup (tooltip_text);
IntPtr ntipprivtext = GLib.Marshaller.StringToPtrGStrdup (tooltip_private_text);
IntPtr raw_ret = gtk_toolbar_append_element (Handle, (int) type, widget == null ? IntPtr.Zero : widget.Handle, ntext, ntiptext, ntipprivtext, icon == null ? IntPtr.Zero : icon.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
GLib.Marshaller.Free (ntext);
GLib.Marshaller.Free (ntiptext);
GLib.Marshaller.Free (ntipprivtext);
Gtk.Widget ret;
if (raw_ret == IntPtr.Zero)
ret = null;
@ -60,14 +66,20 @@
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_toolbar_insert_element (IntPtr raw, int type, IntPtr widget, string text, string tooltip_text, string tooltip_private_text, IntPtr icon, GtkSharp.SignalFuncNative cb, IntPtr user_data, int position);
static extern IntPtr gtk_toolbar_insert_element (IntPtr raw, int type, IntPtr widget, IntPtr text, IntPtr tooltip_text, IntPtr tooltip_private_text, IntPtr icon, GtkSharp.SignalFuncNative cb, IntPtr user_data, int position);
[Obsolete ("Replaced by ToolItem API")]
public Gtk.Widget InsertElement (Gtk.ToolbarChildType type, Gtk.Widget widget, string text, string tooltip_text, string tooltip_private_text, Gtk.Widget icon, Gtk.SignalFunc cb, IntPtr user_data, int position)
{
GtkSharp.SignalFuncWrapper cb_wrapper = null;
cb_wrapper = new GtkSharp.SignalFuncWrapper (cb, this);
IntPtr raw_ret = gtk_toolbar_insert_element (Handle, (int) type, widget == null ? IntPtr.Zero : widget.Handle, text, tooltip_text, tooltip_private_text, icon.Handle, cb_wrapper.NativeDelegate, user_data, position);
IntPtr ntext = GLib.Marshaller.StringToPtrGStrdup (text);
IntPtr ntiptext = GLib.Marshaller.StringToPtrGStrdup (tooltip_text);
IntPtr ntipprivtext = GLib.Marshaller.StringToPtrGStrdup (tooltip_private_text);
IntPtr raw_ret = gtk_toolbar_insert_element (Handle, (int) type, widget == null ? IntPtr.Zero : widget.Handle, ntext, ntiptext, ntipprivtext, icon == null ? IntPtr.Zero : icon.Handle, cb_wrapper.NativeDelegate, user_data, position);
GLib.Marshaller.Free (ntext);
GLib.Marshaller.Free (ntiptext);
GLib.Marshaller.Free (ntipprivtext);
Gtk.Widget ret;
if (raw_ret == IntPtr.Zero)
ret = null;
@ -80,14 +92,20 @@
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_toolbar_prepend_element (IntPtr raw, int type, IntPtr widget, string text, string tooltip_text, string tooltip_private_text, IntPtr icon, GtkSharp.SignalFuncNative cb, IntPtr user_data);
static extern IntPtr gtk_toolbar_prepend_element (IntPtr raw, int type, IntPtr widget, IntPtr text, IntPtr tooltip_text, IntPtr tooltip_private_text, IntPtr icon, GtkSharp.SignalFuncNative cb, IntPtr user_data);
[Obsolete ("Replaced by ToolItem API")]
public Gtk.Widget PrependElement (Gtk.ToolbarChildType type, Gtk.Widget widget, string text, string tooltip_text, string tooltip_private_text, Gtk.Widget icon, Gtk.SignalFunc cb)
{
GtkSharp.SignalFuncWrapper cb_wrapper = null;
cb_wrapper = new GtkSharp.SignalFuncWrapper (cb, this);
IntPtr raw_ret = gtk_toolbar_prepend_element (Handle, (int) type, widget == null ? IntPtr.Zero : widget.Handle, text, tooltip_text, tooltip_private_text, icon.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
IntPtr ntext = GLib.Marshaller.StringToPtrGStrdup (text);
IntPtr ntiptext = GLib.Marshaller.StringToPtrGStrdup (tooltip_text);
IntPtr ntipprivtext = GLib.Marshaller.StringToPtrGStrdup (tooltip_private_text);
IntPtr raw_ret = gtk_toolbar_prepend_element (Handle, (int) type, widget == null ? IntPtr.Zero : widget.Handle, ntext, ntiptext, ntipprivtext, icon == null ? IntPtr.Zero : icon.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
GLib.Marshaller.Free (ntext);
GLib.Marshaller.Free (ntiptext);
GLib.Marshaller.Free (ntipprivtext);
Gtk.Widget ret;
if (raw_ret == IntPtr.Zero)
ret = null;
@ -99,14 +117,20 @@
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_toolbar_append_item (IntPtr raw, string text, string tooltip_text, string tooltip_private_text, IntPtr icon, GtkSharp.SignalFuncNative cb, IntPtr user_data);
static extern IntPtr gtk_toolbar_append_item (IntPtr raw, IntPtr text, IntPtr tooltip_text, IntPtr tooltip_private_text, IntPtr icon, GtkSharp.SignalFuncNative cb, IntPtr user_data);
[Obsolete ("Replaced by ToolItem API")]
public Gtk.Widget AppendItem (string text, string tooltip_text, string tooltip_private_text, Gtk.Widget icon, Gtk.SignalFunc cb)
{
GtkSharp.SignalFuncWrapper cb_wrapper = null;
cb_wrapper = new GtkSharp.SignalFuncWrapper (cb, this);
IntPtr raw_ret = gtk_toolbar_append_item (Handle, text, tooltip_text, tooltip_private_text, icon.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
IntPtr ntext = GLib.Marshaller.StringToPtrGStrdup (text);
IntPtr ntiptext = GLib.Marshaller.StringToPtrGStrdup (tooltip_text);
IntPtr ntipprivtext = GLib.Marshaller.StringToPtrGStrdup (tooltip_private_text);
IntPtr raw_ret = gtk_toolbar_append_item (Handle, ntext, ntiptext, ntipprivtext, icon == null ? IntPtr.Zero : icon.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
GLib.Marshaller.Free (ntext);
GLib.Marshaller.Free (ntiptext);
GLib.Marshaller.Free (ntipprivtext);
Gtk.Widget ret;
if (raw_ret == IntPtr.Zero)
ret = null;
@ -118,14 +142,20 @@
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_toolbar_insert_item (IntPtr raw, string text, string tooltip_text, string tooltip_private_text, IntPtr icon, GtkSharp.SignalFuncNative cb, IntPtr user_data, int position);
static extern IntPtr gtk_toolbar_insert_item (IntPtr raw, IntPtr text, IntPtr tooltip_text, IntPtr tooltip_private_text, IntPtr icon, GtkSharp.SignalFuncNative cb, IntPtr user_data, int position);
[Obsolete ("Replaced by ToolItem API")]
public Gtk.Widget InsertItem (string text, string tooltip_text, string tooltip_private_text, Gtk.Widget icon, Gtk.SignalFunc cb, IntPtr user_data, int position)
{
GtkSharp.SignalFuncWrapper cb_wrapper = null;
cb_wrapper = new GtkSharp.SignalFuncWrapper (cb, this);
IntPtr raw_ret = gtk_toolbar_insert_item (Handle, text, tooltip_text, tooltip_private_text, icon.Handle, cb_wrapper.NativeDelegate, user_data, position);
IntPtr ntext = GLib.Marshaller.StringToPtrGStrdup (text);
IntPtr ntiptext = GLib.Marshaller.StringToPtrGStrdup (tooltip_text);
IntPtr ntipprivtext = GLib.Marshaller.StringToPtrGStrdup (tooltip_private_text);
IntPtr raw_ret = gtk_toolbar_insert_item (Handle, ntext, ntiptext, ntipprivtext, icon == null ? IntPtr.Zero : icon.Handle, cb_wrapper.NativeDelegate, user_data, position);
GLib.Marshaller.Free (ntext);
GLib.Marshaller.Free (ntiptext);
GLib.Marshaller.Free (ntipprivtext);
Gtk.Widget ret;
if (raw_ret == IntPtr.Zero)
ret = null;
@ -137,14 +167,20 @@
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_toolbar_prepend_item (IntPtr raw, string text, string tooltip_text, string tooltip_private_text, IntPtr icon, GtkSharp.SignalFuncNative cb, IntPtr user_data);
static extern IntPtr gtk_toolbar_prepend_item (IntPtr raw, IntPtr text, IntPtr tooltip_text, IntPtr tooltip_private_text, IntPtr icon, GtkSharp.SignalFuncNative cb, IntPtr user_data);
[Obsolete ("Replaced by ToolItem API")]
public Gtk.Widget PrependItem (string text, string tooltip_text, string tooltip_private_text, Gtk.Widget icon, Gtk.SignalFunc cb)
{
GtkSharp.SignalFuncWrapper cb_wrapper = null;
cb_wrapper = new GtkSharp.SignalFuncWrapper (cb, this);
IntPtr raw_ret = gtk_toolbar_prepend_item (Handle, text, tooltip_text, tooltip_private_text, icon.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
IntPtr ntext = GLib.Marshaller.StringToPtrGStrdup (text);
IntPtr ntiptext = GLib.Marshaller.StringToPtrGStrdup (tooltip_text);
IntPtr ntipprivtext = GLib.Marshaller.StringToPtrGStrdup (tooltip_private_text);
IntPtr raw_ret = gtk_toolbar_prepend_item (Handle, ntext, ntiptext, ntipprivtext, icon == null ? IntPtr.Zero : icon.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
GLib.Marshaller.Free (ntext);
GLib.Marshaller.Free (ntiptext);
GLib.Marshaller.Free (ntipprivtext);
Gtk.Widget ret;
if (raw_ret == IntPtr.Zero)
ret = null;
@ -156,7 +192,7 @@
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_toolbar_insert_stock (IntPtr raw, string stock_id, string tooltip_text, string tooltip_private_text, GtkSharp.SignalFuncNative cb, IntPtr user_data, int position);
static extern IntPtr gtk_toolbar_insert_stock (IntPtr raw, IntPtr stock_id, IntPtr tooltip_text, IntPtr tooltip_private_text, GtkSharp.SignalFuncNative cb, IntPtr user_data, int position);
[Obsolete ("Replaced by ToolItem API")]
public Gtk.Widget InsertStock (string stock_id, string tooltip_text, string tooltip_private_text, Gtk.SignalFunc cb, int position)
@ -169,7 +205,13 @@
{
GtkSharp.SignalFuncWrapper cb_wrapper = null;
cb_wrapper = new GtkSharp.SignalFuncWrapper (cb, this);
IntPtr raw_ret = gtk_toolbar_insert_stock (Handle, stock_id, tooltip_text, tooltip_private_text, cb_wrapper.NativeDelegate, user_data, position);
IntPtr nstock = GLib.Marshaller.StringToPtrGStrdup (stock_id);
IntPtr ntiptext = GLib.Marshaller.StringToPtrGStrdup (tooltip_text);
IntPtr ntipprivtext = GLib.Marshaller.StringToPtrGStrdup (tooltip_private_text);
IntPtr raw_ret = gtk_toolbar_insert_stock (Handle, nstock, ntiptext, ntipprivtext, cb_wrapper.NativeDelegate, user_data, position);
GLib.Marshaller.Free (nstock);
GLib.Marshaller.Free (ntiptext);
GLib.Marshaller.Free (ntipprivtext);
Gtk.Widget ret;
if (raw_ret == IntPtr.Zero)
ret = null;

View File

@ -197,11 +197,14 @@ public bool IsDrawable {
}
[DllImport("gtksharpglue-2")]
static extern int gtksharp_gtk_widget_style_get_int (IntPtr raw, string name);
static extern int gtksharp_gtk_widget_style_get_int (IntPtr raw, IntPtr name);
public int FocusLineWidth {
get {
return gtksharp_gtk_widget_style_get_int (Handle, "focus-line-width");
IntPtr name = GLib.Marshaller.StringToPtrGStrdup ("focus-line-width");
int result = gtksharp_gtk_widget_style_get_int (Handle, name);
GLib.Marshaller.Free (name);
return result;
}
}
@ -267,10 +270,10 @@ static BindingHandler BindingDelegate {
}
[DllImport ("gtksharpglue-2")]
static extern void gtksharp_widget_add_binding_signal (IntPtr gvalue, string name, BindingHandler handler);
static extern void gtksharp_widget_add_binding_signal (IntPtr gvalue, IntPtr name, BindingHandler handler);
[DllImport ("gtksharpglue-2")]
static extern void gtksharp_widget_register_binding (IntPtr gvalue, string name, uint key, int mod, IntPtr data);
static extern void gtksharp_widget_register_binding (IntPtr gvalue, IntPtr name, uint key, int mod, IntPtr data);
[GLib.ClassInitializer]
static void ClassInit (GLib.GType gtype, Type t)
@ -280,7 +283,7 @@ static void ClassInit (GLib.GType gtype, Type t)
if (attrs.Length == 0)
return;
string signame = t.Name.Replace (".", "_") + "_bindings";
IntPtr signame = GLib.Marshaller.StringToPtrGStrdup (t.Name.Replace (".", "_") + "_bindings");
gtksharp_widget_add_binding_signal (gtype.Val, signame, BindingDelegate);
@ -292,16 +295,19 @@ static void ClassInit (GLib.GType gtype, Type t)
BindingInvoker inv = new BindingInvoker (mi, attr.Parms);
gtksharp_widget_register_binding (gtype.Val, signame, (uint) attr.Key, (int) attr.Mod, (IntPtr) GCHandle.Alloc (inv));
}
GLib.Marshaller.Free (signame);
}
[DllImport("gtksharpglue-2")]
static extern void gtksharp_widget_style_get_property (IntPtr widget, string property, ref GLib.Value value);
static extern void gtksharp_widget_style_get_property (IntPtr widget, IntPtr property, ref GLib.Value value);
public object StyleGetProperty (string property_name) {
GLib.Value value = new GLib.Value ();
object ret;
gtksharp_widget_style_get_property (Handle, property_name, ref value);
IntPtr name = GLib.Marshaller.StringToPtrGStrdup (property_name);
gtksharp_widget_style_get_property (Handle, name, ref value);
GLib.Marshaller.Free (name);
ret = value.Val;
value.Dispose ();
return ret;

View File

@ -34,7 +34,7 @@
}
[DllImport("gtkhtml-3.0")]
static extern IntPtr gtk_html_new_from_string(string Astr, int len);
static extern IntPtr gtk_html_new_from_string(IntPtr Astr, int len);
public HTML (string Astr) : base (IntPtr.Zero)
{
@ -45,7 +45,9 @@
return;
}
Raw = gtk_html_new_from_string(Astr, Astr.Length);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (Astr);
Raw = gtk_html_new_from_string (native, -1);
GLib.Marshaller.Free (native);
}
public void Write (HTMLStream handle, string buffer, int size)

View File

@ -21,24 +21,30 @@
// Boston, MA 02111-1307, USA.
[DllImport("libpango-1.0-0.dll")]
static extern bool pango_scan_int(string pos, out int out_param);
static extern bool pango_scan_int(IntPtr pos, out int out_param);
[Obsolete]
public static bool ScanInt(string pos, out int out_param) {
bool raw_ret = pango_scan_int(pos, out out_param);
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (pos);
bool raw_ret = pango_scan_int(native, out out_param);
GLib.Marshaller.Free (native);
bool ret = raw_ret;
return ret;
}
[DllImport("libpango-1.0-0.dll")]
static extern bool pango_parse_markup (string markup, int length, uint accel_marker, out IntPtr attr_list_handle, out string text, out uint accel_char, IntPtr err);
static extern bool pango_parse_markup (IntPtr markup, int length, uint accel_marker, out IntPtr attr_list_handle, out IntPtr text, out uint accel_char, IntPtr err);
public static bool ParseMarkup (string markup, char accel_marker, out Pango.AttrList attrs, out string text, out char accel_char)
{
uint ucs4_accel_char;
IntPtr text_as_native;
IntPtr attrs_handle;
bool result = pango_parse_markup (markup, -1, GLib.Marshaller.CharToGUnichar (accel_marker), out attrs_handle, out text, out ucs4_accel_char, IntPtr.Zero);
IntPtr native_markup = GLib.Marshaller.StringToPtrGStrdup (markup);
bool result = pango_parse_markup (native_markup, -1, GLib.Marshaller.CharToGUnichar (accel_marker), out attrs_handle, out text_as_native, out ucs4_accel_char, IntPtr.Zero);
GLib.Marshaller.Free (native_markup);
accel_char = GLib.Marshaller.GUnicharToChar (ucs4_accel_char);
text = GLib.Marshaller.Utf8PtrToString (text_as_native);
attrs = new Pango.AttrList (attrs_handle);
return result;
}

View File

@ -2,7 +2,7 @@
//
// Author: Mike Kestner <mkestner@ximian.com>
//
// Copyright (c) 2004 Novell, Inc.
// Copyright (c) 2004-2005 Novell, Inc.
//
// This code is inserted after the automatically generated code.
//
@ -22,11 +22,13 @@
[DllImport("libpango-1.0-0.dll")]
static extern IntPtr pango_glyph_item_apply_attrs(ref Pango.GlyphItem raw, string text, IntPtr list);
static extern IntPtr pango_glyph_item_apply_attrs(ref Pango.GlyphItem raw, IntPtr text, IntPtr list);
public GlyphItem[] ApplyAttrs (string text, Pango.AttrList list)
{
IntPtr list_handle = pango_glyph_item_apply_attrs (ref this, text, list.Handle);
IntPtr native_text = GLib.Marshaller.StringToPtrGStrdup (text);
IntPtr list_handle = pango_glyph_item_apply_attrs (ref this, native_text, list.Handle);
GLib.Marshaller.Free (native_text);
if (list_handle == IntPtr.Zero)
return new GlyphItem [0];
GLib.SList item_list = new GLib.SList (list_handle, typeof (GlyphItem));

View File

@ -38,12 +38,14 @@ public LayoutLine[] Lines {
}
[DllImport("libpango-1.0-0.dll")]
static extern void pango_layout_set_markup_with_accel (IntPtr raw, string markup, int length, uint accel_marker, out uint accel_char);
static extern void pango_layout_set_markup_with_accel (IntPtr raw, IntPtr markup, int length, uint accel_marker, out uint accel_char);
public void SetMarkupWithAccel (string markup, char accel_marker, out char accel_char)
{
uint ucs4_accel_char;
pango_layout_set_markup_with_accel (Handle, markup, -1, GLib.Marshaller.CharToGUnichar (accel_marker), out ucs4_accel_char);
IntPtr native_markup = GLib.Marshaller.StringToPtrGStrdup (markup);
pango_layout_set_markup_with_accel (Handle, native_markup, -1, GLib.Marshaller.CharToGUnichar (accel_marker), out ucs4_accel_char);
GLib.Marshaller.Free (native_markup);
accel_char = GLib.Marshaller.GUnicharToChar (ucs4_accel_char);
}