Commit graph

3646 commits

Author SHA1 Message Date
Andrés G. Aragoneses
7d75adf68c glib: fix FindClassProperty()'s copy-paste error
The implementation of FindClassProperty() was the same as the
implementation of FindInterfaceProperty(), both receiving an iface
instead of a GObjectClass* [1].

The reason of this oversight can well be explained by the fact that
FindClassProperty() is private and not used, actually. However, we
may need it soonish as a good bind to g_object_class_find_property.

[1] https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-class-find-property
2013-10-10 20:25:23 +02:00
Bertrand Lorentz
5f8e0953cf gtk: Use native function for GtkTextIter.Equals(GtkTextIter)
As GtkTextIter has no public properties, the default generated Equals
implementation would be "return true;". We now suppress that and with a
fix-up now use the native gtk_text_iter_equal to implement the Equals
method.
2013-10-10 16:28:37 +02:00
Bertrand Lorentz
bc498ff650 generator: Add support for suppressing the Equals(T) method in structs
Similarly to what exists for GetHashCode, add a noequals attribute to
indicate we don't want the default Equals implementation.
2013-10-10 16:27:13 +02:00
Bertrand Lorentz
90e834327e Merge pull request #71 from knocte/bindinator
generator and glibsharp changes from bindinator's GSoC work
2013-10-10 06:03:35 -07:00
Stephan Sundermann
587f0f56e7 generator: NativeStructGen needs to be partial 2013-10-09 20:49:09 +02:00
Stephan Sundermann
50f07d17ad generator: removed redundant allocation 2013-10-09 20:48:24 +02:00
Stephan Sundermann
21c9c9ff8c generator: remove bitfields from Equals/GetHashCode 2013-10-09 20:47:26 +02:00
Stephan Sundermann
f6fef3a402 generator: fixed NativeStructGen's formatting 2013-10-09 20:44:28 +02:00
Stephan Sundermann
c5b04cb70e generator: fixed native struct parent 2013-10-09 20:43:44 +02:00
Stephan Sundermann
edc339baf5 generator: redundant method in NativeStructGen 2013-10-09 20:43:12 +02:00
Stephan Sundermann
0f79e9af06 generator: fixicate NativeStructGen
Made NativeStructGen more consistent with the way Gdk.Event
and Pango.Attribute are handled. Also increases performance
because reflection is not needed anymore to marshal these
kind of structs.
2013-10-09 20:42:03 +02:00
Stephan Sundermann
31e2c02e94 generator: public accessor in method overloads 2013-10-09 20:37:18 +02:00
Stephan Sundermann
53312d5fc0 generator: fixed optional array parameters 2013-10-09 20:35:02 +02:00
Stephan Sundermann
2152f4626e generator: use default value for optional generation 2013-10-09 20:30:14 +02:00
Stephan Sundermann
5f271e04fa generator: ignore private structs completely
Don't spam the log with these messages for private structs
(and don't count this in the statistics), as there are too
many. These kind of types are just empty structs marked as
hidden and private.
2013-10-09 20:28:38 +02:00
Stephan Sundermann
c3f7b8e32b generator: fixed optional array parameters 2013-10-09 20:05:03 +02:00
Stephan Sundermann
5eea00f705 generator: new --gapidir flag to search for xml files 2013-10-09 20:00:14 +02:00
Stephan Sundermann
f958b2247b generator: include api files from XML 2013-10-09 19:49:28 +02:00
Stephan Sundermann
b868b80dee glib,generator: map MainContext type and expose members
This is needed to reference a MainContext from
external bindings, which need to create a
MainContext using a Handle
2013-10-09 19:44:50 +02:00
Stephan Sundermann
6ab620d689 generator,glib: added GPollFD and GSource types
GSource type was already there (but was not mapped by
the generator yet) so then the autogenerated methods
have been added manually inside the class after the
custom methods.

Other Source-related class are also generated and added
(but not mapped in the SymbolTable) to glib.
2013-10-09 19:41:21 +02:00
Stephan Sundermann
139479036b generator: do not generate methods without (C)Name 2013-10-09 18:53:31 +02:00
Stephan Sundermann
e031a4ff18 generator: auto escape string constants 2013-10-09 18:51:38 +02:00
Stephan Sundermann
8b101d5525 glib: Mutex is actually opaque
This means that we're modifying the generated code that
we checked in, so then we increase the future TODO about
more information about what we need to fix later.

The changes to Cond are a consequence of the changes to
Mutex because the former uses the latter.
2013-10-09 18:44:04 +02:00
Stephan Sundermann
9abde602ec glib: add GDate, GDateTime
Add GDate and GDateTime classes to glib, and map
them in the generator's SymbolTable.

(The types TimeZone and TimeVal are also added because
the Date* types depend on them, but there is no need
to map them in the generator.)

Also move the TODOs of other auto-generated classes
to a single TODO in the Makefile
2013-10-09 18:30:10 +02:00
Stephan Sundermann
aaa41cd095 fixup: added copy-node metadata tag 2013-10-09 18:04:47 +02:00
Bertrand Lorentz
62f0285177 build: Post-release version bump to 2.99.2 2013-10-09 16:40:02 +02:00
Stephan Sundermann
55ab3ab284 generator: fixed glue code for callbacks 2013-10-09 15:44:33 +02:00
Stephan Sundermann
ddd2419151 generator: fix optional parameters again 2013-10-09 15:41:27 +02:00
Stephan Sundermann
949c538fe3 generator: IntPtr.Zero for optional IntPtr params
IntPtr.Zero should be passed for optional IntPtr params
instead of null
2013-10-09 15:38:46 +02:00
Stephan Sundermann
972e6257fc generator: removed wrong glue code for structs 2013-10-09 15:35:36 +02:00
Stephan Sundermann
388a2fe659 generator: added handling of optional parameters 2013-10-09 15:31:10 +02:00
Stephan Sundermann
33fd293b84 generator: null check for handle (NativeStructGen)
Check Handle against IntPtr.Zero before marshalling.
2013-10-09 14:02:46 +02:00
Stephan Sundermann
29a900e51e generator: added conversion for byref structs
The pointer from native is stored inside of a class which
wraps the structure. Fields can be accessed by marshalling
from and to the pointer. glib: Value.Update does now invoke
a private Update() method which is needed to update the new
structures.
2013-10-09 13:40:56 +02:00
Stephan Sundermann
d01be26f0c generator: added defaultconstructoraccess attrib 2013-10-09 13:13:15 +02:00
Stephan Sundermann
112e2b9598 generator,glib: Added Mutex, RecMutex, Cond types
Bind these types manually and added generator support
for them.
2013-10-09 13:09:34 +02:00
Stephan Sundermann
747a4ad871 generator: Added conversion for unions
Also removed all assumptions for parameters when
ParserVersion >= 3
2013-10-08 20:22:16 +02:00
Stephan Sundermann
fd2fb44f99 generator: readable&writable attribs to be backwards compat 2013-10-08 18:55:34 +02:00
Stephan Sundermann
dc4e7f30b9 generator: Added long long conversion 2013-10-08 18:48:05 +02:00
Stephan Sundermann
c5909d32fb generator: fixed string array return type for virtual_methods 2013-10-08 18:47:45 +02:00
Stephan Sundermann
f6219b97e0 generator: Added count param detection for return values 2013-10-08 18:47:21 +02:00
Stephan Sundermann
edde96c5be generator: fixed writeable and readable detection 2013-10-08 18:46:44 +02:00
Stephan Sundermann
c53147c1c4 generator: Added constants to gapi
Unfortunately, gir marks all integers as gint regardless
of its size. We have to check if the value will really
fit into a int, that is why there is an automatic fallback
to long.
2013-10-08 18:45:42 +02:00
Stephan Sundermann
b5806d2a1b generator: fixed string[] return types 2013-10-08 17:54:29 +02:00
Stephan Sundermann
8d4ec22ef2 generator: Added throws attribute to parameters
This enables gapi to decide whether a parameter is
really throwing or should be handled as a usual parameter.
2013-10-08 17:46:19 +02:00
Stephan Sundermann
94da3fb2ab generator: faster Equals implementation 2013-10-08 16:27:47 +02:00
Stephan Sundermann
115659f46b generator: fixed Equals/GetHashCode for no fields or padding
Fixed Equals/GetHashCode methods when struct has no fields,
or field is padding.
2013-10-08 15:52:47 +02:00
Stephan Sundermann
c14277f391 generator: GThread type should be SimpleGen 2013-10-08 15:43:23 +02:00
Stephan Sundermann
4b470cadbb generator: Added GThread type 2013-10-08 15:41:14 +02:00
Stephan Sundermann
3eefa37272 generator: Bumped parser_version to 3
Added support for new closure and destroy attributes from which we can
determine which callback a parameter belongs to.
2013-10-08 15:39:31 +02:00
Andrés G. Aragoneses
7ce1457c13 gtk: Fix a KeyNotFoundException regression in Destroyed event
The migration to generic collections [1] caused another regression: a
KeyNotFoundException was being thrown (instead of returning null like
HashTable did) when using the Destroyed event of the Gtk.Widget class.

[1] 6850b343ca

A particular example of this problem is Banshee's Import Media feature,
which was generating the following stacktrace:

[1 Debug 23:24:36.898] Starting - Importing Media
Marshaling activate signal
Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException
to handle the exception.
System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. --->
System.Collections.Generic.KeyNotFoundException: The given key was not
present in the dictionary.
  at System.Collections.Generic.Dictionary`2[System.IntPtr,System.Delegate].get_Item
(IntPtr key) [0x00000] in <filename unknown>:0
  at Gtk.Widget.add_Destroyed (System.EventHandler value) [0x00000] in
/home/knocte/gtk-sharp/gtk/Widget.cs:333
  at Hyena.Widgets.AnimatedWidget..ctor (Gtk.Widget widget, UInt32
duration, Easing easing, Blocking blocking, Boolean horizontal)
[0x0004d] in /home/knocte/banshee/src/Hyena/Hyena.Gui/Hyena.Widgets/AnimatedWidget.cs:78
2013-09-24 18:58:33 +02:00