This avoids unnecessary work, and prevents the IntPtr from being
freed when assigned to itself.
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
Gtk.Builder crashes when AddFromString(string) is called with a string
that contains a BOM. Hence, if the buffer contains a BOM, just skip it.
This fixes the crash with the Gtk# 3 project template in MonoDevelop
(robpvn/MonoDevelopGtkSharp3Template).
This fixes an issue where unref would get called too often because the
ownership has changed when passing an instance to the native side.
See https://github.com/mono/gtk-sharp/pull/112 for more details.
GLib 2.32 has been released in March 2012, so we can now require it a
build and run time. This allows us to remove GLib 2.31 conditionals,
mark the Thread.Init as obsolete, and remove all references to
libgthread.
Please note that the API exposed in glib and gio is still from 2.28, but
we will have some API additions in the future. First example is the next
commit, which brings GBytes, an addition in GLib 2.32.
If the StructLayout is not set, StructureToPtr will throw an exception.
In these cases the type is probably wrapped using a handle and thus
needs no update.
In Cairo there the default constructor does not take a ref to the native
object making the object invalid when trying to access it.
This commit changes the behaviour to search for another constructor that
takes an owner variable which is set to false when invoked to indicate
that the managed side should take a ref.
When an instance of SourceProxy was finalized, we would try to remove
the corresponding source, even if it was already removed. This now
causes native GLib to print out warnings because it can't find the
source ID.
Now Source.Remove only calls g_source_remove if we really had a handler
registered for the ID we're removing.
Turn Source.source_handlers into a private generic Dictionary, and add
the necessary methods to allow Idle and Timeout to add and remove
entries from it.
This improves the encapsulation of the Source class, and factors
into it some code that was previously duplicated in Idle and Timeout.
Move stuff around to have them in a reasonable order: fields, then
constructors, then destructor, then static methods, then instance stuff.
Also remove a commented out method, which would not be correct anyway.
No real code change here, just cosmetic changes.
This allows you to avoid ugly calls like "NewArray (null, some_array)"
when you want the child type to be determined by the first element of
the children array.
Also throw specific exceptions when both type and children parameters
would be null.
Those methods are not in Mono.Cairo, and are not necessary for Gtk#, so
I'm assuming they are not really needed.
The idea is to have the same API as Mono.Cairo shipped with mono, so if
you need those methods, get them first in Mono.Cairo available at
https://github.com/mono/mono
Also move the HasCurrentPoint property to its logical place in the
source, next to CurrentPoint.
This also demonstrates the use of Gtk.Builder to load .ui files.
Also simplify handling of resources in GtkDemo build: we don't need to
make a distinction between images and other resources.