2004-04-07 Mike Kestner <mkestner@ximian.com>

* generator/ClassBase.cs : remove default ctor generation and
	hasDefaultConstructor field.
	* generator/Ctor.cs : chain to base (IntPtr.Zero).
	* generator/StructBase.cs : remove hasDefaultConstructor usage.
	* glib/Object.cs : remove Object () ctor.  Add Ben's GetGType
	method, although nothing uses it yet.  Still working on integrating
	the remainder of Ben's patch.
	* gtk/Gtk.metadata : remove all the disabledefaultctor rules.
	* */*.custom : add base (IntPtr.Zero) or this (...) chaining for
	all ctors.

svn path=/trunk/gtk-sharp/; revision=25184
This commit is contained in:
Mike Kestner 2004-04-07 19:15:01 +00:00
parent ebea661ee4
commit e7bf3a279f
21 changed files with 73 additions and 97 deletions

View file

@ -1,4 +1,17 @@
2004-04-0 John Luke <jluke@cfl.rr.com> 2004-04-07 Mike Kestner <mkestner@ximian.com>
* generator/ClassBase.cs : remove default ctor generation and
hasDefaultConstructor field.
* generator/Ctor.cs : chain to base (IntPtr.Zero).
* generator/StructBase.cs : remove hasDefaultConstructor usage.
* glib/Object.cs : remove Object () ctor. Add Ben's GetGType
method, although nothing uses it yet. Still working on integrating
the remainder of Ben's patch.
* gtk/Gtk.metadata : remove all the disabledefaultctor rules.
* */*.custom : add base (IntPtr.Zero) or this (...) chaining for
all ctors.
2004-04-07 John Luke <jluke@cfl.rr.com>
* gtk/Gtk.metadata: mark Gtk.Widget.ModifyFont font_desc null_ok * gtk/Gtk.metadata: mark Gtk.Widget.ModifyFont font_desc null_ok

View file

@ -36,12 +36,12 @@
g_object_ref (Raw); g_object_ref (Raw);
} }
public Pixbuf (System.IO.Stream stream) public Pixbuf (System.IO.Stream stream) : base (IntPtr.Zero)
{ {
LoadFromStream (stream); LoadFromStream (stream);
} }
public Pixbuf (System.Reflection.Assembly assembly, string resource) public Pixbuf (System.Reflection.Assembly assembly, string resource) : base (IntPtr.Zero)
{ {
if (assembly == null) if (assembly == null)
assembly = System.Reflection.Assembly.GetCallingAssembly (); assembly = System.Reflection.Assembly.GetCallingAssembly ();
@ -93,14 +93,14 @@
} }
// overload to default the colorspace // overload to default the colorspace
public Pixbuf(byte [] data, bool has_alpha, int bits_per_sample, int width, int height, int rowstride, Gdk.PixbufDestroyNotify destroy_fn) public Pixbuf(byte [] data, bool has_alpha, int bits_per_sample, int width, int height, int rowstride, Gdk.PixbufDestroyNotify destroy_fn) : base (IntPtr.Zero)
{ {
GdkSharp.PixbufDestroyNotifyWrapper destroy_fn_wrapper = null; GdkSharp.PixbufDestroyNotifyWrapper destroy_fn_wrapper = null;
destroy_fn_wrapper = new GdkSharp.PixbufDestroyNotifyWrapper (destroy_fn, this); destroy_fn_wrapper = new GdkSharp.PixbufDestroyNotifyWrapper (destroy_fn, this);
Raw = gdk_pixbuf_new_from_data(data, (int) Gdk.Colorspace.Rgb, has_alpha, bits_per_sample, width, height, rowstride, destroy_fn_wrapper.NativeDelegate, IntPtr.Zero); Raw = gdk_pixbuf_new_from_data(data, (int) Gdk.Colorspace.Rgb, has_alpha, bits_per_sample, width, height, rowstride, destroy_fn_wrapper.NativeDelegate, IntPtr.Zero);
} }
public unsafe Pixbuf(byte[] data, bool copy_pixels) public unsafe Pixbuf(byte[] data, bool copy_pixels) : base (IntPtr.Zero)
{ {
IntPtr error = IntPtr.Zero; IntPtr error = IntPtr.Zero;
Raw = gdk_pixbuf_new_from_inline(data.Length, data, copy_pixels, out error); Raw = gdk_pixbuf_new_from_inline(data.Length, data, copy_pixels, out error);
@ -110,7 +110,7 @@
[DllImport("libgdk_pixbuf-2.0-0.dll")] [DllImport("libgdk_pixbuf-2.0-0.dll")]
static extern unsafe IntPtr gdk_pixbuf_new_from_inline(int len, IntPtr data, bool copy_pixels, out IntPtr error); static extern unsafe IntPtr gdk_pixbuf_new_from_inline(int len, IntPtr data, bool copy_pixels, out IntPtr error);
public unsafe Pixbuf(int data_length, void *data, bool copy_pixels) public unsafe Pixbuf(int data_length, void *data, bool copy_pixels) : base (IntPtr.Zero)
{ {
IntPtr error = IntPtr.Zero; IntPtr error = IntPtr.Zero;
Raw = gdk_pixbuf_new_from_inline(data_length, (IntPtr) data, copy_pixels, out error); Raw = gdk_pixbuf_new_from_inline(data_length, (IntPtr) data, copy_pixels, out error);

View file

@ -4,7 +4,9 @@
// Authors: Rachel Hestilow <hestilow@ximian.com> // Authors: Rachel Hestilow <hestilow@ximian.com>
// Mike Kestner <mkestner@speakeasy.net> // Mike Kestner <mkestner@speakeasy.net>
// //
// (c) 2002 Rachel Hestilow, 2001-2002 Mike Kestner // Copyright (c) 2002 Rachel Hestilow
// Copyright (c) 2001-2003 Mike Kestner
// Copyright (c) 2004 Novell, Inc.
namespace GtkSharp.Generation { namespace GtkSharp.Generation {
using System; using System;
@ -19,7 +21,6 @@ namespace GtkSharp.Generation {
protected ArrayList interfaces = null; protected ArrayList interfaces = null;
protected ArrayList ctors = new ArrayList(); protected ArrayList ctors = new ArrayList();
protected bool hasDefaultConstructor = true;
private bool ctors_initted = false; private bool ctors_initted = false;
private Hashtable clash_map; private Hashtable clash_map;
@ -43,7 +44,6 @@ namespace GtkSharp.Generation {
} }
protected ClassBase (XmlElement ns, XmlElement elem) : base (ns, elem) { protected ClassBase (XmlElement ns, XmlElement elem) : base (ns, elem) {
hasDefaultConstructor = !elem.HasAttribute ("disabledefaultconstructor");
foreach (XmlNode node in elem.ChildNodes) { foreach (XmlNode node in elem.ChildNodes) {
if (!(node is XmlElement)) continue; if (!(node is XmlElement)) continue;
@ -353,12 +353,6 @@ namespace GtkSharp.Generation {
foreach (Ctor ctor in ctors) foreach (Ctor ctor in ctors)
ctor.Generate (gen_info); ctor.Generate (gen_info);
if (!clash_map.ContainsKey("") && hasDefaultConstructor) {
gen_info.Writer.WriteLine("\t\tprotected " + Name + "() : base(){}");
gen_info.Writer.WriteLine();
}
} }
} }

View file

@ -133,7 +133,7 @@ namespace GtkSharp.Generation {
sw.Write ("new {0} (", name); sw.Write ("new {0} (", name);
sw.WriteLine (cname + "(" + body.GetCallString (false) + "));"); sw.WriteLine (cname + "(" + body.GetCallString (false) + "));");
} else { } else {
sw.WriteLine("\t\tpublic " + safety + name + "(" + sig.ToString() + ")"); sw.WriteLine("\t\tpublic " + safety + name + "(" + sig.ToString() + ") : base (IntPtr.Zero)");
sw.WriteLine("\t\t{"); sw.WriteLine("\t\t{");
body.Initialize(gen_info, false, false, ""); body.Initialize(gen_info, false, false, "");

View file

@ -18,8 +18,6 @@ namespace GtkSharp.Generation {
public StructBase (XmlElement ns, XmlElement elem) : base (ns, elem) public StructBase (XmlElement ns, XmlElement elem) : base (ns, elem)
{ {
hasDefaultConstructor = false;
foreach (XmlNode node in elem.ChildNodes) { foreach (XmlNode node in elem.ChildNodes) {
if (!(node is XmlElement)) continue; if (!(node is XmlElement)) continue;

View file

@ -83,8 +83,11 @@
/// <summary>Creates a Glade.XML object from a Stream</summary> /// <summary>Creates a Glade.XML object from a Stream</summary>
/// <remarks>Reads the contents of the stream and parses it. It must be in /// <remarks>Reads the contents of the stream and parses it. It must be in
/// correct Glade format</remarks> /// correct Glade format</remarks>
public XML (System.IO.Stream s, string root, string domain) public XML (System.IO.Stream s, string root, string domain) : base (IntPtr.Zero)
{ {
if (GetType() != typeof (XML))
throw new InvalidOperationException ("Can't chain to this constructor from subclasses.");
if (s == null) if (s == null)
throw new ArgumentNullException ("s"); throw new ArgumentNullException ("s");
@ -99,8 +102,11 @@
/// given assembly and parses it. If the assembly is null, /// given assembly and parses it. If the assembly is null,
/// the current assembly will be used. It must be in /// the current assembly will be used. It must be in
/// correct Glade format</remarks> /// correct Glade format</remarks>
public XML (System.Reflection.Assembly assembly, string resource_name, string root, string domain) public XML (System.Reflection.Assembly assembly, string resource_name, string root, string domain) : base (IntPtr.Zero)
{ {
if (GetType() != typeof (XML))
throw new InvalidOperationException ("Can't chain to this constructor from subclasses.");
if (assembly == null) if (assembly == null)
assembly = System.Reflection.Assembly.GetCallingAssembly (); assembly = System.Reflection.Assembly.GetCallingAssembly ();

View file

@ -138,10 +138,23 @@ namespace GLib {
GtkSharp.ObjectManager.RegisterType (name, t.Namespace + t.Name, t.Assembly.GetName().Name); GtkSharp.ObjectManager.RegisterType (name, t.Namespace + t.Name, t.Assembly.GetName().Name);
GType gtype = new GType (gtksharp_register_type (name, parent_gtype.Val)); GType gtype = new GType (gtksharp_register_type (name, parent_gtype.Val));
ConnectDefaultHandlers (gtype, t); ConnectDefaultHandlers (gtype, t);
g_types[t] = gtype;
return gtype; return gtype;
} }
protected Object () {}
static Hashtable g_types = new Hashtable ();
public static GType GetGType (System.Type t)
{
if (g_types.ContainsKey (t))
return (GType) g_types [t];
PropertyInfo pi = t.GetProperty ("GType", BindingFlags.DeclaredOnly | BindingFlags.Static | BindingFlags.Public);
if (pi != null)
return (GType) pi.GetValue (null, null);
return RegisterGType (t);
}
public Object (IntPtr raw) public Object (IntPtr raw)
{ {

View file

@ -13,14 +13,9 @@ namespace Gnome {
public class CanvasProxy : Gnome.CanvasItem public class CanvasProxy : Gnome.CanvasItem
{ {
public CanvasProxy (IntPtr raw) public CanvasProxy (IntPtr raw) : base (raw) {}
: base (raw)
{
}
protected CanvasProxy () : base () protected CanvasProxy () : base (IntPtr.Zero) {}
{
}
public event UpdateHandler Update { public event UpdateHandler Update {
add { add {

View file

@ -8,7 +8,7 @@
// This code is inserted after the automatically generated code. // This code is inserted after the automatically generated code.
// //
public PrintJob() public PrintJob() : base (IntPtr.Zero)
{ {
Raw = gnome_print_job_new (PrintConfig.Default().Handle); Raw = gnome_print_job_new (PrintConfig.Default().Handle);
} }

View file

@ -21,8 +21,7 @@ struct PropertyArg {
static extern System.IntPtr static extern System.IntPtr
gtksharp_gnome_program_init (string app_id, string app_version, ref ModuleInfo module, int argc, string[] argv, int nargs, PropertyArg[] args); gtksharp_gnome_program_init (string app_id, string app_version, ref ModuleInfo module, int argc, string[] argv, int nargs, PropertyArg[] args);
public Program (string app_id, string app_version, ModuleInfo module, public Program (string app_id, string app_version, ModuleInfo module, string[] argv, params object[] props) : base (IntPtr.Zero)
string[] argv, params object[] props)
{ {
int nargs = props.Length / 2; int nargs = props.Length / 2;
PropertyArg[] args = new PropertyArg[nargs]; PropertyArg[] args = new PropertyArg[nargs];

View file

@ -12,8 +12,10 @@
// Manually wrap until we figure out how to gen ellipses. // Manually wrap until we figure out how to gen ellipses.
[DllImport("libgtk-win32-2.0-0.dll")] [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 (string title, IntPtr i, int flags, IntPtr dummy);
public Dialog (string title, Gtk.Window parent, Gtk.DialogFlags flags) : base() public Dialog (string title, Gtk.Window parent, Gtk.DialogFlags flags) : base(IntPtr.Zero)
{ {
if (GetType() != typeof (Dialog))
throw new InvalidOperationException ("Can't chain to this constructor from subclasses.");
Raw = gtk_dialog_new_with_buttons (title, parent.Handle, (int) flags, IntPtr.Zero); Raw = gtk_dialog_new_with_buttons (title, parent.Handle, (int) flags, IntPtr.Zero);
} }

View file

@ -7,7 +7,4 @@
// //
// This code is inserted after the automatically generated code. // This code is inserted after the automatically generated code.
// //
public Frame() public Frame() : this (null) {}
{
Raw = gtk_frame_new (null);
}

View file

@ -101,9 +101,7 @@
<attr path="/api/namespace/object[@cname='GtkFileSelection']/method[@name='GetSelections']" name="hidden">1</attr> <attr path="/api/namespace/object[@cname='GtkFileSelection']/method[@name='GetSelections']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkFrame']/method[@name='GetLabelAlign']" name="hidden">1</attr> <attr path="/api/namespace/object[@cname='GtkFrame']/method[@name='GetLabelAlign']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkFrame']/method[@name='SetLabelAlign']" name="hidden">1</attr> <attr path="/api/namespace/object[@cname='GtkFrame']/method[@name='SetLabelAlign']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkFrame']" name="disabledefaultconstructor">1</attr>
<attr path="/api/namespace/object[@cname='GtkHandleBox']/property[@name='ShadowType']" name="hidden">1</attr> <attr path="/api/namespace/object[@cname='GtkHandleBox']/property[@name='ShadowType']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkHBox']" name="disabledefaultconstructor">1</attr>
<attr path="/api/namespace/object[@cname='GtkHScale']/constructor[@cname='gtk_hscale_new']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr> <attr path="/api/namespace/object[@cname='GtkHScale']/constructor[@cname='gtk_hscale_new']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkHScrollbar']/constructor[@cname='gtk_hscrollbar_new']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr> <attr path="/api/namespace/object[@cname='GtkHScrollbar']/constructor[@cname='gtk_hscrollbar_new']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkImageMenuItem']/constructor[@cname='gtk_image_menu_item_new_with_mnemonic']" name="preferred">1</attr> <attr path="/api/namespace/object[@cname='GtkImageMenuItem']/constructor[@cname='gtk_image_menu_item_new_with_mnemonic']" name="preferred">1</attr>
@ -116,7 +114,6 @@
<attr path="/api/namespace/object[@cname='GtkItem']/signal[@name='Deselect']" name="name">Deselected</attr> <attr path="/api/namespace/object[@cname='GtkItem']/signal[@name='Deselect']" name="name">Deselected</attr>
<attr path="/api/namespace/object[@cname='GtkItem']/signal[@name='Select']" name="name">Selected</attr> <attr path="/api/namespace/object[@cname='GtkItem']/signal[@name='Select']" name="name">Selected</attr>
<attr path="/api/namespace/object[@cname='GtkItem']/signal[@name='Toggle']" name="name">Toggled</attr> <attr path="/api/namespace/object[@cname='GtkItem']/signal[@name='Toggle']" name="name">Toggled</attr>
<attr path="/api/namespace/object[@cname='GtkLabel']" name="disabledefaultconstructor">1</attr>
<attr path="/api/namespace/object[@cname='GtkLabel']/constructor[@cname='gtk_label_new_with_mnemonic']" name="preferred">1</attr> <attr path="/api/namespace/object[@cname='GtkLabel']/constructor[@cname='gtk_label_new_with_mnemonic']" name="preferred">1</attr>
<attr path="/api/namespace/object[@cname='GtkLayout']/constructor[@cname='gtk_layout_new']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr> <attr path="/api/namespace/object[@cname='GtkLayout']/constructor[@cname='gtk_layout_new']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkLayout']/method[@name='SetHadjustment']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr> <attr path="/api/namespace/object[@cname='GtkLayout']/method[@name='SetHadjustment']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>
@ -165,7 +162,6 @@
<attr path="/api/namespace/object[@cname='GtkReadyEvent']" name="hidden">1</attr> <attr path="/api/namespace/object[@cname='GtkReadyEvent']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkScrolledWindow']/constructor[@cname='gtk_scrolled_window_new']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr> <attr path="/api/namespace/object[@cname='GtkScrolledWindow']/constructor[@cname='gtk_scrolled_window_new']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkScrolledWindow']/method[@name='GetPolicy']/*/*[@type='GtkPolicyType*']" name="pass_as">out</attr> <attr path="/api/namespace/object[@cname='GtkScrolledWindow']/method[@name='GetPolicy']/*/*[@type='GtkPolicyType*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkScrolledWindow']" name="disabledefaultconstructor">1</attr>
<attr path="/api/namespace/object[@cname='GtkSpinButton']/constructor[@cname='gtk_spin_button_new']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr> <attr path="/api/namespace/object[@cname='GtkSpinButton']/constructor[@cname='gtk_spin_button_new']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkSpinButton']/method[@name='Configure']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr> <attr path="/api/namespace/object[@cname='GtkSpinButton']/method[@name='Configure']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkTable']/method[@name='AttachDefaults']" name="name">Attach</attr> <attr path="/api/namespace/object[@cname='GtkTable']/method[@name='AttachDefaults']" name="name">Attach</attr>
@ -242,11 +238,9 @@
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='ScrollToCell']/*/*[@type='GtkTreeViewColumn*']" name="null_ok">1</attr> <attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='ScrollToCell']/*/*[@type='GtkTreeViewColumn*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='SetModel']/*/*[@type='GtkTreeModel*']" name="null_ok">1</attr> <attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='SetModel']/*/*[@type='GtkTreeModel*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/signal[@name='SetScrollAdjustments']" name="name">ScrollAdjustmentsSet</attr> <attr path="/api/namespace/object[@cname='GtkTreeView']/signal[@name='SetScrollAdjustments']" name="name">ScrollAdjustmentsSet</attr>
<attr path="/api/namespace/object[@cname='GtkVBox']" name="disabledefaultconstructor">1</attr>
<attr path="/api/namespace/object[@cname='GtkViewport']/constructor[@cname='gtk_viewport_new']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr> <attr path="/api/namespace/object[@cname='GtkViewport']/constructor[@cname='gtk_viewport_new']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkViewport']/method[@name='SetHadjustment']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr> <attr path="/api/namespace/object[@cname='GtkViewport']/method[@name='SetHadjustment']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkViewport']/method[@name='SetVadjustment']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr> <attr path="/api/namespace/object[@cname='GtkViewport']/method[@name='SetVadjustment']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkViewport']" name="disabledefaultconstructor">1</attr>
<attr path="/api/namespace/object[@cname='GtkViewport']/signal[@name='SetScrollAdjustments']" name="name">ScrollAdjustmentsSet</attr> <attr path="/api/namespace/object[@cname='GtkViewport']/signal[@name='SetScrollAdjustments']" name="name">ScrollAdjustmentsSet</attr>
<attr path="/api/namespace/object[@cname='GtkVScale']/constructor[@cname='gtk_vscale_new']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr> <attr path="/api/namespace/object[@cname='GtkVScale']/constructor[@cname='gtk_vscale_new']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkVScrollbar']/constructor[@cname='gtk_vscrollbar_new']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr> <attr path="/api/namespace/object[@cname='GtkVScrollbar']/constructor[@cname='gtk_vscrollbar_new']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>

View file

@ -6,7 +6,4 @@
// Author: John Luke <jluke@cfl.rr.com> // Author: John Luke <jluke@cfl.rr.com>
// //
public Label () public Label () : this (null) {}
{
Raw = gtk_label_new (null);
}

View file

@ -80,8 +80,10 @@
return AppendValues ((Array) values); return AppendValues ((Array) values);
} }
public ListStore (params Type[] types) public ListStore (params Type[] types) : base (IntPtr.Zero)
{ {
if (GetType() != typeof (ListStore))
throw new InvalidOperationException ("Can't chain to this constructor from subclasses.");
IntPtr[] ctypes = new IntPtr[types.Length]; IntPtr[] ctypes = new IntPtr[types.Length];
int i = 0; int i = 0;
foreach (Type type in types) { foreach (Type type in types) {

View file

@ -270,7 +270,7 @@ namespace Gtk {
[DllImport("gtksharpglue")] [DllImport("gtksharpglue")]
static extern IntPtr gtksharp_node_store_new (); static extern IntPtr gtksharp_node_store_new ();
public NodeStore (Type node_type) public NodeStore (Type node_type) : base (IntPtr.Zero)
{ {
Raw = gtksharp_node_store_new (); Raw = gtksharp_node_store_new ();
ScanType (node_type); ScanType (node_type);

View file

@ -18,6 +18,9 @@
} }
set { set {
base.Raw = value; base.Raw = value;
if (value == IntPtr.Zero)
return;
if (gtksharp_object_is_floating (value)) { if (gtksharp_object_is_floating (value)) {
g_object_ref (value); g_object_ref (value);
Sink (); Sink ();

View file

@ -7,14 +7,6 @@
// This code is inserted after the automatically generated code. // This code is inserted after the automatically generated code.
/// <summary>
/// Appends a row.
/// </summary>
///
/// <remarks>
/// Appends a row to the root level of the TreeStore.
/// </remarks>
[DllImport ("libgtk-win32-2.0-0.dll")] [DllImport ("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_store_append (IntPtr raw, out Gtk.TreeIter iter, IntPtr parent); static extern void gtk_tree_store_append (IntPtr raw, out Gtk.TreeIter iter, IntPtr parent);
@ -22,15 +14,6 @@
gtk_tree_store_append (Handle, out iter, IntPtr.Zero); gtk_tree_store_append (Handle, out iter, IntPtr.Zero);
} }
/// <summary>
/// Inserts a row.
/// </summary>
///
/// <remarks>
/// Inserts a row in the root level of the TreeStore at
/// the given position.
/// </remarks>
[DllImport ("libgtk-win32-2.0-0.dll")] [DllImport ("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_store_insert (IntPtr raw, out Gtk.TreeIter iter, IntPtr parent, int position); static extern void gtk_tree_store_insert (IntPtr raw, out Gtk.TreeIter iter, IntPtr parent, int position);
@ -38,14 +21,6 @@
gtk_tree_store_insert (Handle, out iter, IntPtr.Zero, position); gtk_tree_store_insert (Handle, out iter, IntPtr.Zero, position);
} }
/// <summary>
/// Prepends a row.
/// </summary>
///
/// <remarks>
/// Prepends a row to the root level of the TreeStore.
/// </remarks>
[DllImport ("libgtk-win32-2.0-0.dll")] [DllImport ("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_store_prepend (IntPtr raw, out Gtk.TreeIter iter, IntPtr parent); static extern void gtk_tree_store_prepend (IntPtr raw, out Gtk.TreeIter iter, IntPtr parent);
@ -53,15 +28,6 @@
gtk_tree_store_append (Handle, out iter, IntPtr.Zero); gtk_tree_store_append (Handle, out iter, IntPtr.Zero);
} }
/// <summary>
/// Inserts a row.
/// </summary>
///
/// <remarks>
/// Inserts a row in the root level of TreeStore before the
/// given sibling.
/// </remarks>
[DllImport ("libgtk-win32-2.0-0.dll")] [DllImport ("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_store_insert_before (IntPtr raw, out Gtk.TreeIter iter, IntPtr parent, ref Gtk.TreeIter sibling); static extern void gtk_tree_store_insert_before (IntPtr raw, out Gtk.TreeIter iter, IntPtr parent, ref Gtk.TreeIter sibling);
@ -69,15 +35,6 @@
gtk_tree_store_insert_before (Handle, out iter, IntPtr.Zero, ref sibling); gtk_tree_store_insert_before (Handle, out iter, IntPtr.Zero, ref sibling);
} }
/// <summary>
/// Inserts a row.
/// </summary>
///
/// <remarks>
/// Inserts a row in the root level of TreeStore before the
/// given sibling.
/// </remarks>
[DllImport ("libgtk-win32-2.0-0.dll")] [DllImport ("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_store_insert_after (IntPtr raw, out Gtk.TreeIter iter, IntPtr parent, ref Gtk.TreeIter sibling); static extern void gtk_tree_store_insert_after (IntPtr raw, out Gtk.TreeIter iter, IntPtr parent, ref Gtk.TreeIter sibling);
@ -168,8 +125,11 @@
return AppendValues ((Array) values); return AppendValues ((Array) values);
} }
public TreeStore (params Type[] types) public TreeStore (params Type[] types) : base (IntPtr.Zero)
{ {
if (GetType() != typeof (TreeStore))
throw new InvalidOperationException ("Can't chain to this constructor from subclasses.");
IntPtr[] ctypes = new IntPtr[types.Length]; IntPtr[] ctypes = new IntPtr[types.Length];
int i = 0; int i = 0;
foreach (Type type in types) { foreach (Type type in types) {

View file

@ -10,8 +10,10 @@
// This code is inserted after the automatically generated code. // This code is inserted after the automatically generated code.
public TreeView (NodeStore store) public TreeView (NodeStore store) : base (IntPtr.Zero)
{ {
if (GetType() != typeof (TreeView))
throw new InvalidOperationException ("Can't chain to this constructor from subclasses.");
Raw = gtk_tree_view_new_with_model (store.Handle); Raw = gtk_tree_view_new_with_model (store.Handle);
} }

View file

@ -21,14 +21,13 @@
} }
} }
public TreeViewColumn (string title, Gtk.CellRenderer cell, Array attrs) { public TreeViewColumn (string title, Gtk.CellRenderer cell, Array attrs) : this ()
Raw = gtk_tree_view_column_new (); {
_NewWithAttributes (title, cell, attrs); _NewWithAttributes (title, cell, attrs);
} }
public TreeViewColumn (string title, Gtk.CellRenderer cell, params object[] attrs) public TreeViewColumn (string title, Gtk.CellRenderer cell, params object[] attrs) : this ()
{ {
Raw = gtk_tree_view_column_new ();
_NewWithAttributes (title, cell, attrs); _NewWithAttributes (title, cell, attrs);
} }

View file

@ -17,6 +17,8 @@
} }
set { set {
base.Raw = value; base.Raw = value;
if (value == IntPtr.Zero)
return;
g_object_ref (value); g_object_ref (value);
} }
} }