Commit graph

3577 commits

Author SHA1 Message Date
Bertrand Lorentz
253da2e05c Remove obsolete fix-ups for needs_ref attribute
The needs_ref attribute hasn't been used by the generator for quite some
time now.
2013-02-23 13:41:50 +01:00
Bertrand Lorentz
99cb57e7aa generator: Add option to validate GAPI XML against an XSD schema
With a new --schema option, you can specify the path to an XSD file, and
all GAPI XML files will be validated against this schema, including the
files given through the --include option.
2013-02-23 13:41:50 +01:00
Cameron White
57c82a89c7 cairo: Fix rectangles returned by StrokeExtents and FillExtents methods
The third and fourth parameters of the Rectangle constructor are width
and height, but cairo_stroke_extents and cairo_fill_extents give right
and bottom coordinates.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2012-12-27 15:26:42 +01:00
Bertrand Lorentz
629a34aa4f generator: Improve handling of command-line parameters
Bundle Options.cs from the Mono source tree, and use it to parse the
command-line options for gapi-codegen. This gives us clearer code,
descriptions for each option, and a nice "--help" output.

This does not change the options syntax, except that -I|--include needs
to specified for each file to include. Two Makefiles in sample/ are
updated for that change.
2012-11-25 15:05:17 +01:00
Bertrand Lorentz
ab61fbccbd glib: Fix crash when freeing lists with elements typed as interfaces
If a GList or a GSList had its element type set to a GInterface, and if
the elements were marked as owned, it would end up freeing those
elements with g_free(), which would lead to a crash.

They need to be unreffed with g_object_unref, but the criteria for that
was whether the element type is assignable to GLib.Object. This is not
true for GInterface types.

We now first check if the element type is an opaque. If not, and if it's
assignable to GLib.IWrapper, we then use g_object_unref.

From what I can see, all GLib.IWrapper subclasses that not opaque can be
unreffed with g_object_unref.
2012-11-18 16:06:34 +01:00
Bertrand Lorentz
91474fe1f1 gtk: Mark the whole Style class as obsolete 2012-11-18 15:55:03 +01:00
Bertrand Lorentz
b312fcbc8c gio: Rename the DBus.Address* methods
Fix-ups to improve the DBus.Address* method names.

For example, DBus.GetStream(string address ...) is clear enough and
better than DBus.AddressGetStream(string address ...).
2012-11-18 12:22:17 +01:00
Bertrand Lorentz
14c0a84fdb gio: Rename the Dbus class to DBus
An uppercase B in DBus make the class name consistent with all the other
DBus* classes.
2012-11-18 12:20:20 +01:00
Bertrand Lorentz
fab58ea99d gio: Hide GioGlobal.RegistryBackendGetType method
It's Windows-specific, and probably doesn't need to be called directly
by anyone.
2012-11-18 11:55:28 +01:00
Bertrand Lorentz
722ec40812 gio: Move static methods from Simple to SimpleAsyncResult class
Static methods corresponding to g_simple_async_report_* functions were
automatically grouped into the badly-named Simple class.

Add fix-ups to hide this Simple class, move the methods to
SimpleAsyncResult and rename them accordingly.
2012-11-18 11:35:35 +01:00
Bertrand Lorentz
f0f998ccf3 generator: Fix compilation warning in some generated interface adapters
Don't generate a static field if it's not going to be used.

This fixes a compilation warning on the generated code for interfaces
that don't have virtual methods.
2012-11-18 11:10:18 +01:00
Bertrand Lorentz
0bc9ab9fd4 Merge pull request #55 from meebey/master
Replace top-level COPYING with LGPL2-only license
2012-11-18 01:42:19 -08:00
Mirco Bauer
9998c40f8e Replaced COPYING with LGPL2-only license
There is not a single file in gtk-sharp that has a LGPL2.1+ header but
LGPL2-only instead.
2012-11-17 23:24:56 +01:00
Bertrand Lorentz
de6b6029ec sample: Fix crashes in TreeModelDemo 2012-11-17 17:53:40 +01:00
Bertrand Lorentz
306f422c38 Fix a crash during initialization of interfaces (bxc#8447)
GInterfaceInfo.Data was automatically set to be a GCHandle on the
interface adapter. But the generated GInterfaceInitHandlers were
not using it, just free'ing it.

But for the GInterface property support, the Data field is now used to
pass the class pointer, so casting it to a GCHandle to free it would
cause an exception.

We now don't assume anything about GInterfaceInfo.Data.
2012-11-17 17:34:50 +01:00
Bertrand Lorentz
05fb2e2f3a Update top-level COPYING with current version of the LGPL v2.1
Apparently it needs to have an up-to-date address for the FSF.
2012-11-15 21:32:30 +01:00
Bertrand Lorentz
761cb09260 gui-thread-check: Replace COPYING with the correct license
As indicated in the source code, and confirmed by the original author,
the gui-thread-check is licensed under the GPL v2.
2012-11-15 21:14:45 +01:00
Bertrand Lorentz
f20970258e generator: Update the documentation in generator/DESIGN 2012-11-15 19:31:28 +01:00
Bertrand Lorentz
3b37e81b05 gtk: Fix-ups to set the scope of a few callbacks 2012-11-15 18:18:37 +01:00
Bertrand Lorentz
fdd1b201f7 generator: Fix misleading warning for callbacks in virtual methods
Wen generating a virtual method, the current member was not set in the
GenerationInfo. That caused the warning message about the callback scope
to refer to a wrong method name.
2012-11-15 15:06:07 +01:00
Bertrand Lorentz
3cce546661 gtk: Fix return types for IterList* methods in WidgetPath 2012-11-15 14:07:35 +01:00
Bertrand Lorentz
6809865526 gtk: Make the Group property for Radio* widgets a properly typed array
The Group property for all the Radio* classes (RadioAction, RadioButton,
RadioMenuItem and RadioToolButton) was exposed as a GLib.SList,
with its elements untyped.

We now hide the various Group properties and have custom code to handle
them correctly.
2012-11-15 12:05:45 +01:00
Bertrand Lorentz
d8aa4ab275 gtk: Fix-up return type for some methods returning lists 2012-11-15 11:58:18 +01:00
Bertrand Lorentz
f3a001a7bb gio: Enable the GSocketMsgFlags enum with hardcoded values
Same as the previous commit for GSocketFamily, the values are not going
to change much.
2012-11-12 20:36:55 +01:00
Bertrand Lorentz
0f13a66762 gio: Enable the GSocketFamily enum with hardcoded values
The values found by the parser for the GSocketFamily enum are in fact
constants defined in another header file, so the generated code would be
invalid.

We now hardcode the values through fix-ups. They probably don't
change, and they are also hardcoded in the gir file anyway, so it should
be OK.

Also fix-up a GInetAddress constructor that now gets generated.
2012-11-12 20:25:42 +01:00
Bertrand Lorentz
0f2af96e0a gio: Add fix-ups to set the scope of a few callbacks 2012-11-11 15:37:56 +01:00
Bertrand Lorentz
cc249042e3 gio: Mark the Seekable interface as consume-only
The implementor class is not generated correctly, because of some
strangeness with the method names. And I don't think anyone would need
to implement it.
2012-11-11 14:52:07 +01:00
Bertrand Lorentz
a17da364b1 gio: Fix-up capitalisation of several property types
For properties, the parser guesses the type name from an all-caps macro
name. So if the GType has a funny name, like dbus -> DBus, the property
type is wrong.
2012-11-11 14:44:03 +01:00
Bertrand Lorentz
bfb4ebe4c0 gio: Rename what remains of Io class to IOError and adjust method names
All method not related to IOError have been moved to other classes, so
we can rename the Io class to IOError.
2012-11-11 14:41:47 +01:00
Bertrand Lorentz
97972a7c9e gio: Move ErrorQuark method to GioGlobal 2012-11-11 14:34:11 +01:00
Bertrand Lorentz
3a5d1f2238 gio: Move the scheduler-related static functions into IOSchedulerJob 2012-11-11 14:32:15 +01:00
Bertrand Lorentz
1a253aeedd gio: Move the module-related static functions into the IOModule class
Also adjust their names and fix the return types.
2012-11-11 11:55:31 +01:00
Bertrand Lorentz
22ff426d88 gio: Rename Content class to ContentType and adjust method names
The parser automatically groups static functions with the same prefix
into classes, but the right name can't be determined automatically.

In this case, ContentType.GetDescription(...) is much better than
Content.TypeGetDescription(...).
2012-11-11 11:50:49 +01:00
Bertrand Lorentz
499540dd6d glib: Add GIOCondition symbol to glib-api.xml
This fixes some generator warnings for gio.
2012-11-11 11:46:40 +01:00
Bertrand Lorentz
dba3b18f97 gio: Fix-up return types for methods returning GList* 2012-11-11 11:43:31 +01:00
Bertrand Lorentz
2bbee634d0 sample: Add AsyncSample to showcase GLibSynchronizationContext
Add a sample to illustrate the point of having a
GLibSynchronizationContext, but with the async/await code ifdef'ed out
because we don't require Mono 3.0 for now. Instead, provide a crude
equivalent of what would be generated by the compiler, to show that it
works.
2012-11-08 22:39:30 +01:00
Rickard Edström
8e07e7d225 Add a SynchronizationContext implementation for GLib (bnc#621444)
Create a GLibSynchronizationContext that sends code to be run on the
GLib main loop, and set it as the current SynchronizationContext in
Gtk.Init().

When you use the await keyword to do a task asynchronously, by default
the awaiter will capture the current SynchronizationContext, and if
there was one, when the task completes it’ll Post the supplied
continuation back to that context, rather than running it on whatever
thread it wants.

This means that if you use the async/await keywords in your Gtk# app,
things will now work as expected with the GTK main thread. For example:

static async void DoWork () // called in the GTK main thread
{
    // Do some stuff with the UI...
    label.Text = "Starting Work";

    // Run something asynchronously, UI is not frozen
    int res = await DoLongOperation ();

    // Do some more UI stuff, it'll run on the GTK main thread
    label.Text = "Work done";
}

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2012-11-08 22:33:46 +01:00
Bertrand Lorentz
135e4cd258 build: Belated post-release version bump to 2.99.1 2012-11-04 18:25:40 +01:00
Bertrand Lorentz
c65107a0c2 sample: Fix compilation warning in DemoHyperText 2012-11-04 18:25:08 +01:00
Bertrand Lorentz
2edff869fd gui-thread-check: Fix some compilation warnings 2012-11-04 18:16:22 +01:00
Bertrand Lorentz
bd41e1150d Add the gui-thread-check profiler module by Lluis Sanchez
This is a mono profiler module that can be used to detect when GTK or
GDK methods are called from a thread which is not the main GUI thread.

Thanks to Andrés Aragoneses for doing the work to bring this into Gtk#.
2012-11-04 18:00:56 +01:00
Bertrand Lorentz
fa32f2ec36 generator: Refactor the member hashes in ClassBase
Switch the hash tables used to store fields, properties and methods to
strong-type dictionaries, and make them private. Make the necessary
adjustments in the subclasses.
2012-11-04 17:26:26 +01:00
Bertrand Lorentz
6850b343ca gtk: Switch to generic collections in some classes 2012-11-04 16:58:50 +01:00
Bertrand Lorentz
df751f87ce glib: Switch to generic collections in Marshaller and ValueArray 2012-11-04 16:58:49 +01:00
Bertrand Lorentz
6e3e73e2ac glib: Use dictionaries to store type information in GType class
Yay, type safety when managing types...
2012-11-04 16:58:49 +01:00
Bertrand Lorentz
6ecd2d01f9 gdk: Use a Dictionary to hold the filter functions in Window class 2012-11-04 16:58:49 +01:00
Bertrand Lorentz
eddc5fa796 generator: Use a Dictionary to hold the class structs cache
Again, nicer generated code, and no impact outside of it.
2012-11-04 16:58:49 +01:00
Bertrand Lorentz
3d6decbd0d generator: Use List<T> in generated constructors
This makes the generated code a bit nicer, but has no impact outside of
the generated constructors.
2012-11-04 16:58:49 +01:00
Bertrand Lorentz
15c5820cd8 generator: Rework data structures used by ManagedCallString
Use a single dictionary to hold the parameters and mark them as special,
instead of maintaining two lists in parallel.
2012-11-04 16:58:49 +01:00
Bertrand Lorentz
82a957bc9d generator: Switch a lot of collections to their generic counterpart
The additional type information makes the code a bit more safe
and readable.

At least one bug is fixed by this: in ObjectGen, an invalid child
property could still be generated, as it was not removed from the hash
table.

This should cause no real change to the generated code, except maybe in
the order of some members.
2012-11-04 16:58:49 +01:00