Commit graph

3558 commits

Author SHA1 Message Date
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
Bertrand Lorentz
608a760d45 gdk: Add reference to the GLib project in the .csproj 2012-11-04 16:58:49 +01:00
Bertrand Lorentz
47f3ca6ee5 gdk: Remove AddClientMessageFilter method from Gdk.Display and Global
The native function gdk_display_add_client_message_filter is gone from
GDK.

You can use Gdk.Window.AddFilter as a replacement.
2012-11-04 16:58:49 +01:00
Bertrand Lorentz
8db4e785aa Update samples to use generic collections 2012-11-04 16:58:39 +01:00
Andres G. Aragoneses
38e920996a gui-thread-check: Remove stock INSTALL file
It didn't contain any gui-thread-check's specifics.
2012-11-04 00:43:08 +00:00
Andres G. Aragoneses
3af6df2a2c gui-thread-check: Remove NEWS file (it was empty) 2012-11-04 00:42:22 +00:00
Andres G. Aragoneses
d58243149d gui-thread-check: Merge README with gtk-sharp's 2012-11-04 00:42:01 +00:00
Andres G. Aragoneses
0ed390b201 gui-thread-check: Remove AUTHORS
Lluis is already included in AUTHORS file of gtk-sharp.
2012-11-04 00:41:20 +00:00
Andres G. Aragoneses
38770b8917 gui-thread-check: Merge config/build infrastructure with gtk-sharp 2012-11-04 00:32:09 +00:00
Andres G. Aragoneses
ab447d924a gui-thread-check: Remove bogus Makefile.in
This is regenerate at every build (from Makefile.am) so
there's no need to store it in the repo. It must have been
included by mistake during the move.
2012-11-04 00:27:00 +00:00
Andres G. Aragoneses
797382180b Moved gui-thread-check subfolder inside gtk subfolder.
It's just really a profiler module facility for GTK, so it's not
related to the rest of the libraries/APIs that are not GTK and live
here.
2012-11-03 23:06:02 +00:00
Andres G. Aragoneses
f7e0721879 Merge branch 'gui-thread-check' into bring-slluis-gui-thread-check
(Merging gui-thread-check repo into gtk-sharp repo, as a subfolder)
2012-11-03 23:02:35 +00:00
Andres G. Aragoneses
00c1a731ac gui-thread-check: Moved gui-thread-check sources into a new subdir
In preparation for the move to gtk-sharp upstream preserving history.
2012-11-03 23:00:08 +00:00
Bertrand Lorentz
24b0e12c62 gio: Make FileEnumerator implement IEnumerable<FileInfo> 2012-11-03 17:57:31 +01:00
Bertrand Lorentz
c312fb739c gtk: Move interface declaration from fix-up to custom code
As we now use partial classes for custom code, we can put additional
interface implementation declaration in the custom code, instead of
adding it through a fix-up.

Side-note: I thought about moving to IEnumerable<T>, but ListStore is a
list of objects anyway, and Container is an array of Widgets, so there
wouldn't be much benefit from type safety.
2012-11-03 17:50:05 +01:00
Bertrand Lorentz
687e986c55 generator: Add using statements in generated code for generics 2012-11-03 17:03:31 +01:00
Bertrand Lorentz
f748be34c1 generator: Implement Parameters using the generics class List<T>
A first step in the wonderful world of strong-typed collections. We
don't need to limit ourselves to the old ways of the .NET 1.1 profile.
2012-11-03 16:56:51 +01:00
Bertrand Lorentz
d467cce6e6 generator: Move some classes from Parameters.cs into their own file
This is just code being moved around, there are no real code changes.
2012-11-03 15:46:06 +01:00
Bertrand Lorentz
b8b1cfa5d7 generator: Convert all .cs files to Unix line endings
There are no real code changes in this commit.
2012-11-03 15:20:06 +01:00
Bertrand Lorentz
4f29defd5c generator: Add validation check for return values that are arrays
When a C function returns an array, we need to be able to determine its
length. This is done either through a parameter to that function, or
because the array is null-terminated. If we don't know about either of
those, we print out a warning and fail the validation for the return
value. This means the corresponding method will not be generated.

This fixes a crash when trying to generate a method for which this
information is missing.

This wasn't a problem until now because the parser doesn't handle array
return values, so they were always handled through fix-ups. But now we
can get a GAPI XML converted from GIR which contains the "array"
attribute for a return value but no other information.
2012-11-03 14:17:02 +01:00