* glib/Opaque.cs : remove the Opaques hash. As f-spot demonstrated,
we cannot rely on a pointer continuing to point at the same type in
memory, since there is no destroy notification for most opaques.
* glib/Value.cs : use more explicit GetOpaque overload.
* gtk/Style.custom : use more explicit GetOpaque overload.
svn path=/trunk/gtk-sharp/; revision=50884
* glib/Object.cs : hold strong refs for managed subclasses and
weakrefs for wrappers.
* gtk/Object.custom : don't hold managed refs here, they are now held
in GLib.Object.
svn path=/trunk/gtk-sharp/; revision=48389
a bit; only Ref the pointer if Owned is false (and then set it to
true), and vice versa for Unref.
* glib/Opaque.cs (Opaque): set owned before setting Raw, so
that Raw will be reffed properly.
(GetOpaque): Fix this up to dtrt in all cases with refcounted
opaques.
* gtk/TreeView.custom (GetPathAtPos): Use "GetOpaque(...)" rather
than "new TreePath()"
* sample/opaquetest/*: regression test for opaque free/ref/unref
handling
* sample/Makefile.am (SUBDIRS): add opaquetest
* configure.in.in (AC_OUTPUT): add opaquetest files
svn path=/trunk/gtk-sharp/; revision=48168
* glib/Opaque.cs (Owned): new property saying whether or not gtk#
owns the memory.
(Opaque): Set Owned to true in the void ctor and false in the
IntPtr one.
(GetOpaque): add a new overload that can also create opaques, a la
GLib.Object.GetObject.
(Ref, Unref, Free): empty virtual methods to be overridden by
subclasses.
(set_Raw): Unref() and possibly Free() the old value, Ref() the
new one.
(~Opaque, Dispose): set Raw to IntPtr.Zero (triggering Free/Unref
if needed)
* parser/gapi2xml.pl (addReturnElem): if the method is named Copy
and returns a pointer, set the "owned" attribute on the
return-type.
* */*-api.raw: Regen
* generator/HandleBase.cs (FromNative): Add new
FromNative/FromNativeReturn overloads that takes a "bool owned"
param. Implement the 1-arg FromNative and FromNativeReturn in
terms of that.
* generator/ObjectBase.cs (FromNative): Implement HandleBase's new
overload. Use the two-arg version of GLib.Object.GetObject when
"owned" is true.
* generator/OpaqueGen.cs (Generate): Pull out Ref, Unref, and
Free/Destroy/Dispose methods and handle them specially by
overriding Opaque.Ref, .Unref, and .Free appropriately. (If any
of the methods are marked deprecated, output a deprecated
do-nothing method as well, to save us from having to write all
those deprecated methods by hand.)
(FromNative): use GetOpaque, passing "owned".
* generator/ReturnValue.cs (FromNative): if the value is a
HandleBase, pass Owned to its FromNative().
* generator/Parameters.cs (Owned): new property (for use on out
params)
(FromNative): Call FromNative() on the generatable, handling Owned
in the case of HandleBase.
* generator/ManagedCallString.cs:
* generator/MethodBody.cs:
* generator/Signal.cs: use param.FromNative() rather than
param.Generatable.FromNative(), to get ownership right.
* */*.metadata: Mark opaque ref/unref/free methods deprecated
(except where we were hiding them before). Add "owned" attributes
to return values and out params as needed.
* pango/AttrIterator.custom (GetFont): work around a
memory-management oddity of the underlying method.
* pango/AttrFontDesc.cs (AttrFontDesc): copy the passed-in
FontDescriptor, since the attribute will assume ownership of it.
* gtk/TreeView.custom (GetPathAtPos): set the "owned" flag on the
returned TreePaths.
* gtk/TargetList.custom: Remove refcounting stuff, which is
now handled automatically
* gtk/NodeStore.cs (GetPath): clear the Owned flag on the created
TreePath so that the underlying structure doesn't get freed when
the function returns
* gtkhtml/HTMLStream.custom (Destroy): hide this and then
reimplement it by hand to keep OpaqueGen from using it in
Dispose(), since calling it after an HTMLStream.Close() will
result in a crash.
svn path=/trunk/gtk-sharp/; revision=47928
constructors and casts. Add a new Enum cast.
(Val): Handle Pointer values. Change the handling of Enum/Flags
values to return the value directly rather than returning an
EnumWrapper. Remove the Char (ie, "byte") handling since there
aren't any char properties in all of gtk-sharp and the generator
mistakenly converts them to strings anyway.
* glib/EnumWrapper.cs:
* glib/UnwrappedObject.cs: Mark these Obsolete.
* glib/glue/type.c (gtksharp_get_parent_type,
gtksharp_get_type_name_for_id):
* glib/glue/value.c (gtksharp_value_get_value_type): Remove some
unneeded glue methods.
* generator/Ctor.cs (Generate):
* generator/Property.cs (Generate): Simplify the enum and object
property glue to not use EnumWrapper or UnwrappedObject.
* sample/valtest/*: a regression test for GLib.Value
* configure.in.in: add sample/valtest
svn path=/trunk/gtk-sharp/; revision=47564
whether or not to allow "complex" ref/out args.
(Validate): update for that
* generator/Signal.cs: set AllowComplexRefs false on the params.
(Validate): fix the messages
(GenCallback, GenEventHandler): properly handle ref/out args, by
manually pointerifying them (except for boxed args, which are
already pointers).
* glib/Marshaller.cs (StructureToPtrAlloc): Rename from
PtrToStructureAlloc, since it wraps Marshal.StructureToPtr.
svn path=/trunk/gtk-sharp/; revision=46773
* generator/ReturnValue.cs : support owned and elements_owned for lists.
* glib/List.cs : add ctor overloads for memory mgmt.
* glib/ListBase.cs : add ctor overloads for memory mgmt. Dispose
elements if specified.
* glib/SList.cs : add ctor overloads for memory mgmt.
* gnome/Gnome.metadata : unhide and generate a List prop.
* gnomevfs/Gnomevfs.metadata : unhide and generate a List prop.
* gtk/FileChooser.custom : new. add hidden props.
* gtk/FileChooserButton.custom : new. impl hidden props.
* gtk/FileChooserDialog.custom : remove some List props and use the
GLib.Marshaller for the remaining ones..
* gtk/FileChooserWidget.custom : remove some List props and use the
GLib.Marshaller for the remaining ones..
* gtk/Gtk.metadata : unhide and let the generator do some List props.
svn path=/trunk/gtk-sharp/; revision=46457
* generator/SimpleBase.cs : off-by-one in namespace join.
* glib/ListBase.cs : support IntPtr element_type.
* gnomevfs/FileInfo.cs : make it ManualGen friendly.
* gnomevfs/*.cs : rework for FileInfo api changes.
* gnomevfs/Gnomevfs.metadata : make FileInfo a manual symbol.
* gnomevfs/Uri.custom : rework for FileInfo api changes.
* gnome/Makefile.am : add gnomevfs dependency to pick up some more api
symbols.
* gnome/gnome-sharp-2.0.pc.in : advertise the vfs dep.
[Fixes#71060]
svn path=/trunk/gtk-sharp/; revision=45702
* generator/ReturnValue.cs : don't write a sem in FromNative.
* glib/ListBase.cs : handle GLib.Object explicit element types.
* glib/Marshaler.cs : only copy lists if Count > 0.
* gtk/Gtk.metadata : unhide Window.ListToplevels with a proper element
type for automatic list to array marshaling.
* gtk/Window.custom : kill manual ListToplevels impl.
svn path=/trunk/gtk-sharp/; revision=45654
* glib/ListBase.cs : add a nested class to support filename encoded
string element marshaling.
* gtk/Gtk.metadata : mark the filenames and folders as filename
encoded.
* gtk/FileChooserDialog.custom : use new ListBase.FilenameString type
for list element type of filenames and folders.
* gtk/FileChooserWidget.custom : use new ListBase.FilenameString type
for list element type of filenames and folders.
[Fixes#72701]
svn path=/trunk/gtk-sharp/; revision=45334
string[] (using a G_TYPE_STRV boxed value).
* generator/SymbolTable.cs (SymbolTable): Map GStrv to string[].
(The mapping relies on the above GLib.Value magic, so it only
works correctly for properties, but that's ok, because GStrv isn't
a real type anyway and only shows up in the api files for
G_TYPE_STRV properties.) Makes the Gtk.AboutDialog Artists,
Authors, and Documenters properties show up.
* gtk/Gtk.metadata: hide
AboutDialog.Get/SetArtists/Authors/Documenters, which can't be
used to implement the Artists/Authors/Documenters properties,
because the generated code doesn't know to NULL-terminate the
arrays.
svn path=/trunk/gtk-sharp/; revision=45301
* glib/Object.cs : add a try/catch block to g_object_unref calls to
help identify "extra unref" bugs when exceptions occur.
svn path=/trunk/gtk-sharp/; revision=44325
* autogen.sh : error out with bootstrap help message.
* bootstrap : replaces autogen.sh for the 2.5.x release line.
* bootstrap-2.4 : replaces autogen.sh for the 1.9.x release line.
* configure.in.in : renamed from configure.in and added substitution
for version, dependencies, CFLAGS and CSFLAGS.
* README : bootstrap docs
* */*-api.raw : moved to api-2.6.raw for bootstrapping.
* */*-api-2.4.raw : added 2.4 api files for bootstrapping.
* */glue/Makefile.am : add GTK_SHARP_VERSION_CFLAGS.
* pango/Attribute.cs : add a #if GTK_SHARP_2_6 block.
* pango/glue/attribute.c : add a couple #ifdef GTK_SHARP_2_6 blocks.
* sample/GtkDemo/* : make the 2.6 demos conditional.
svn path=/trunk/gtk-sharp/; revision=44047
* */*-api.xml: Regen, adding gtype="..." to many enum types
* generator/EnumGen.cs (Generate): if the enum has the
"gtype" property, add a GTypeAttribute pointing to an internal
FooGType class whose GType property can be used to get the enum's
GType.
* generator/ObjectGen.cs:
s/ObjectManager.RegisterType/GType.Register/
* glib/GTypeAttribute.cs: attribute for indicating a property that
will return the GType of a type (particularly for enums, which
can't have GType properties added to them).
* glib/GType.cs: renamed from Type.cs to match the type name
(public static readonly GType ...): add a few missing types.
(Register): moved from ObjectManager.RegisterType
(LookupGType): moved from TypeConverter.LookupType and extended to
handle GTypeAttribute. Also, fix mappings for sbyte/byte/char, and
return specific GTypes for Object subclasses rather than always
returning GType.Object. [Fixes#74699]
(LookupType): moved from ObjectWrapper.LookupType
(ToString): return the type name
* glib/Object.cs (RegisterGType):
s/ObjectManager.Register/GType.Register/
(LookupGType): Make this protected internal so GType can access
it.
* glib/ObjectManager.cs (RegisterType): deprecate in favor of
GType.Register.
(LookupType): moved to GType
* glib/TypeConverter.cs (LookupType): now a deprecated wrapper
around GType.LookupGType.
* glib/Value.cs: Use GType casts rather than TypeConverter
* gtk/NodeStore.cs (ScanType):
* gtk/ListStore.custom (ListStore):
* gtk/TreeStore.custom (TreeStore): Use (GType) cast rather than
TypeConverter. Remove the error check and exception, since the
cast never returns GType.Invalid. (The check probably predates
GLib.ManagedValue.)
* gnome/PanelAppletFactory.cs (Register): Use a GType cast rather
than GLib.Object.LookupGType (which is no longer accessible after
an mcs bugfix)
* sample/GtkDemo/DemoIconView.cs (CreateStore): use the Type[]
constructor rather than the GType[] constructor, since it
translates typeof(Gdk.Pixbuf) correctly now.
svn path=/trunk/gtk-sharp/; revision=44038
end with "callback, gpointer, GDestroyNotify", then mark the
callback as having "notified" Scope.
(Parameters.IsHidden): Hide user_data and GDestroyNotify after a
callback.
(Parameter.Scope): make this settable
(Parameter.IsDestroyNotify): new test
* generator/MethodBody.cs (Initialize): Handle "notified" callback
scope (using a GCHandle and GLib.DestroyHelper.NotifyHandler)
* generator/CallbackGen.cs (GenWrapper): Add a static
"GetManagedDelegate" method to the wrapper type, to translate a
native delegate back to its corresponding managed delegate.
(FromNative): use GetManagedDelegate.
* generator/ReturnValue.cs (Validate): We handle callback return
values now
* generator/SymbolTable.cs: marshal GDestroyNotify as
GLib.DestroyNotify
* glib/DestroyNotify.cs: Moved from gtk
* gtk/Gtk.metadata: globally change GtkDestroyNotify to
GDestroyNotify, but then change back the ones that are exposed in
the API. Un-hide lots of methods we can correctly autogenerate
now.
* gtk/DestroyHelper.cs: moved to glib
* gtk/*.custom: remove methods that are autogenerated now, add
Obsolete wrappers where needed, replace Gtk.DestroyHelper usage
with GLib.DestroyHelper.
* gdk/Gdk.metadata:
* gnome/Gnome.metadata: Turn Gdk.Drawable.SetData and
Gnome.IconList.SetIconDataFull's GDestroyNotify args into
gpointers so the generated API stays the same as it used to be.
* rsvg/Handle.custom: implement deprecated SetSizeCallback
* sample/GtkDemo/DemoIconView.cs (CreateSort): update for API
changes
svn path=/trunk/gtk-sharp/; revision=44020
param const
* glib/Marshaller.cs (Utf8PtrToString): Add an IntPtr[]->string[]
overload, since that's what we actually need in the case where
it's used (above). Leave the IntPtr[]->string[] overload of
PtrToStringGFree in case anyone is using it manually.
* gtk/Gtk.metadata: hide GtkModuleInitFunc and
GtkModuleDisplayInitFunc; they are the signatures of user-defined
methods that gtk only ever resolves via g_module_symbol(), so
they're not useful from C#. (And the marshalling was all wrong
anyway...)
svn path=/trunk/gtk-sharp/; revision=43461
for all of the assemblies
* Makefile.include:
* gconf/GConf/Makefile.am:
* gconf/GConf.PropertyEditors/Makefile.am:
* glib/Makefile.am:
* gtkdotnet/Makefile.am (CLEANFILES): add $(ASSEMBLY).mdb
$(ASSEMBLY): build with $(CSFLAGS). Always delete $(ASSEMBLY).mdb
before building $(ASSEMBLY), so that if you first build with
debugging enabled, then update, then rebuild without debugging
enabled, you don't end up with an out-of-date .mdb file.
svn path=/trunk/gtk-sharp/; revision=42791
* generator/CallbackGen.cs : don't create native delegates for nulls.
* generator/ObjectGen.cs : revamp the ObjectManager code.
* glib/Object.cs : use new ObjectManager.RegisterType overload.
* glib/ObjectManager.cs : rewrite to kill the lameass LoadWithPartial
hack and keep a GType to Type mapping for quicker lookup/activation.
svn path=/trunk/gtk-sharp/; revision=42241
* gapi-cdecl-insert : a little perl script to insert modopts
* Makefile.am : dist the new script.
for cdecl callback delegates on win32.
* glade/makefile.win32 : use gapi-cdecl-insert
* glade/XML.custom : add [GLib.CDeclCallback] to RawXMLConnectFunc.
* glib/makefile.win32 : use gapi-cdecl-insert
* glib/CDeclCallbackAttribute.cs : new attr to tag delegates with
that will be invoked from native code. We have to mangle the il
with a modopt otherwise they are stdcall'd.
* glib/ManagedValue.cs : add [GLib.CDeclCallback] to Copy/Free.
switch to using GCHandles instead of the current IntPtr hack.
svn path=/trunk/gtk-sharp/; revision=42168
* glib/Object.cs: use IsDefined to check for ClassInitializer
attribute, fixes a warning and is supposedly better for performance
svn path=/trunk/gtk-sharp/; revision=41839
* glib/Makefile.am : add new file.
* glib/Object.cs : add protected PersistentData hash to hold data
across GC cycles.
* glib/WeakObject.cs : new object to hold managed refs weakly against
the native object.
* gtk/ListStore.custom : hold refs for DefaultSortFuncs.
* gtk/TreeModelSort.custom : hold refs for DefaultSortFuncs.
* gtk/TreeStore.custom : hold refs for DefaultSortFuncs.
svn path=/trunk/gtk-sharp/; revision=41740
* generator/CallbackGen.cs : don't derive Wrappers from DelegateWrapper
any more. It leaks delegates like crazy. We effectively now use call
scope as the default for delegate parameters.
* generator/MethodBody.cs : use new simpler Wrapper ctor.
* glib/DelegateWrapper.cs : mark the ctor obsolete so people know to
update any manually coded wrappers out there.
* */*.custom : use new simpler Callback Wrapper ctors.
svn path=/trunk/gtk-sharp/; revision=41738
* glib/Marshaller.cs : don't use g_utf8_strlen to determine the byte
count to be copied, it returns chars, not bytes.
* glib/glue/unichar.c : implement a quick and dirty strlen glue func.
svn path=/trunk/gtk-sharp/; revision=41661