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.
The main difference with the C demo is that we can't use GResource, as
it's only in gio 2.32 and later, so '@import url("resource://...' won't
work. Instead, we use a separate CssProvider to apply reset.css.
Since automake 1.14, autotools now generate a symbolic link named
`compile` in the root of the repository when running, so let's include
it in .gitignore to achieve a clean `git status` after compiling (or
avoid breaking the build via `git clean -fd`).
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
Port the current installer infrastructure from the gtk-sharp-2-12
branch, adapting it as needed. Credits go to Duncan Mak for
maintaining the 2.12 installer in the past few years.
When building on Windows, if the WiX toolset is available, the msi is
generated automatically at the end of the build.
Create 2 makefile variable to facilitate build on Windows:
GENERATED_SOURCES_FILES to match files created by the code generator,
and GENERATED_SOURCES_OPTION for the corresponding option to be passed
to the compiler.
Also adapt the makefile for the valtest sample to use these variables.
A user reported in the mailing list [1] to be advised to use
`/usr/lib64/pkgconfig/../..` as a prefix. This path is too
convoluted, could give problems, and also shouldn't be the
one to be compared against the prefix flag used, so use
readlink -m to follow '..' subfolders to transform it, in
this example, to simply `/usr`
[1] http://lists.ximian.com/pipermail/gtk-sharp-list/2014-May/011436.html
In Windows builds of GTK+ 3.x, the dll filename for GDK is
libgdk-3-0.dll.
We use this opportunity to use a common const in the DllImport for all
custom code.
Some types need special methods to convert an object to a GLib.Value.
The type system will look for a SetGValue method with a "ref GLib.Value"
parameter and invoke it.
A special case in the generation is needed because this is a non-static
method with the Handle being passed as the second parameter and the
GLib.Value as the first. Without this fix, the generator would generate
the Handle for the first parameter and then the GLib.Value.
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
This allows consumers to specifically require gdk-sharp-3.0 without
having to pull in the full gtk-sharp-3.0.
Closes issue #101.
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
If the parent already has a GType property, add a "new" keywords to hide
it.
This eliminates a lot of warnings when using classes derived from
Opaque. Closes issue #100.
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
A static getter method would always generate a Handle parameter even
though some types do not have a Handle, for example structs.
Closes issue #99.
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
Fixed length arrays are available in gobject introspection and are
already converted by the bindinator tool. The array_len attribute was
only used in structs.
This adds support for them as method parameters, generating the correct
code for them. Fixes issue #98.
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
Without that change, using ListStore.SetValue with a long would use the
float overload, which might not be expected and cause some issues.
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>