Thread: [java-gnome-hackers] a possible merge strategy
Brought to you by:
afcowie
From: Colin W. <wa...@ve...> - 2008-10-15 04:39:15
|
Hi, The introspection project (http://live.gnome.org/GObjectIntrospection/) is getting pretty far along now, and I wanted to talk in particular about my prototype Java bindings (http://live.gnome.org/JGIR). These bindings, while they share in common the terms "GNOME" and "Java", have radically different approaches and therefore tradeoffs. JGIR in particular goes for *completeness*. There are multiple aspects to this - one is having a largely autogenerated *public* API. Another aspect is using JNA (https://jna.dev.java.net/) which gives access directly to C structures. Here's an example: TextView tv = new TextView(); TextBuffer buf = tv.getBuffer(); TextIter iter = new TextIter(); buf.getStartIter(iter); iter.forwardChars(5); buf.insert(iter, "hello world", -1); Note that TextIter is actually a C structure - the getStartIter takes it by reference and modifies it, just like how it works in C. Now, arguably this could be an <out> parameter, and getStartIter() could return it, but the current structure binding generalizes to multiple arguments well enough. I might later do an optimization around this case, we'll see. Another aspect of this is having automatic, useful coverage of a wide variety of libraries not covered by java-gnome, such as the Clutter library (http://clutter-project.org/) which uses structures like ClutterColor. You can see more examples here: http://live.gnome.org/JGIR/SampleCode What are the downsides versus java-gnome? The main ones are that there's no javadoc on the autogenerated part of the API, and that there are no Cairo bindings (because Cairo isn't a GObject library). The big picture here is that ideally, we can merge efforts and have the best of both worlds - an autogenerated complete API useful to platform hackers like me, and hand written custom bindings for tricky things like GtkTreeView on top, and share binding code for things like Cairo which aren't covered by introspection. But let's take things step by step. At the very first, one thing we can do is say that for GTK+ one can use java-gnome as is today if it has coverage you need. For other libraries like Clutter, GStreamer, libnotify etc., one can use JGIR. It *should* be possible to combine GTK+-using java-gnome with JGIR in the same process. But the first fundamental piece that would need to be merged is the GObject mapping layers. In JGIR, GObject.java is actually written entirely in Java, using JNA. You can see this code here: http://svn.gnome.org/svn/java-gobject-introspection/trunk/src/org/gnome/gir/gobject/GObject.java To merge this we'll have to figure out also how the Cairo library plugs in. Should be relatively straightforward. After that, I see two types of classes in java-gnome: * Very straightforward wrappers for the underlying API (AboutDialog.java, HBox.java) * Custom classes (DataColumn.java) For the first category, I think what we should do is write a script which compares the JGIR API to the java-gnome API, and for classes which are likely merge candidates (i.e. they have *exactly* the same API) extract the java-gnome javadoc and put it into a forthcoming JGIR "overrides" mechanism. My plan is to take a transformation of the C gtk-doc for the default javadoc, but java-gnome's javadoc could override that. Somewhat harder is to merge in custom Java override methods, we can talk about that when we get there. And for the custom classes, it should be relatively straightforward to just rebase their internals on the JGIR if we can do the first part right. |
From: Stefan P. <st...@pr...> - 2008-10-15 09:02:22
|
Hi Colin, your approach of generating the API is definetly interesting. As you might be aware we are also having autogenerated code in java-gnome (from the .def-files), so although the way it is done is different a common idea exists. What is different is our philosophy. We decided for a reason not to use the generated API as a public API, since often the usage of the generated APIs is not what a normal Java programmer usually would do. So we have this handcrafted public API to smoothen the edges of underlying APIs and reduce the learning curve for developers coming from the Java world. A good example for that you gave yourself: > TextIter iter = new TextIter(); > buf.getStartIter(iter); A more Java-like approach would be TextIter iter = buf.getStartIter(); > Now, > arguably this could be an <out> parameter, and getStartIter() could > return it, but the current structure binding generalizes to multiple > arguments well enough. I might later do an optimization around this > case, we'll see. This is a question of philosophy. We prefer to make those optimizations before making an API public. > The big picture here is that ideally, we can merge efforts and have > the best of both worlds - an autogenerated complete API useful to > platform hackers like me, and hand written custom bindings for tricky > things like GtkTreeView on top, and share binding code for things like > Cairo which aren't covered by introspection. Personally I would like to keep the hand written API, because I see it as a big plus. > But the first fundamental piece that would need to be merged is the > GObject mapping layers. In JGIR, GObject.java is actually written > entirely in Java, using JNA. You can see this code here: > http://svn.gnome.org/svn/java-gobject-introspection/trunk/src/org/gnome/gir/gobject/GObject.java > To merge this we'll have to figure out also how the Cairo library > plugs in. Should be relatively straightforward. Another possibility would be to use JGIR to feed our code generator and replace our .def files. By that we would get a much better non-public binding to write the public binding for. This might go together with improvements on our GObject code, but that must be discussed with people more familiar with the ugly binding details than me. > And for the custom classes, it should be relatively straightforward to > just rebase their internals on the JGIR if we can do the first part > right. JGIR is definetly an interesting aproach and it would be nice to have you onboard helping us with our code generation. You seem to have put a lot of effort on this, so it would be a shame if we could not both benefit from this. But I would not go so far to rely on automated generated public APIs using JGIR. Regards, Stefan |
From: Colin W. <wa...@ve...> - 2008-10-15 13:32:03
|
On Wed, Oct 15, 2008 at 4:57 AM, Stefan Prelle <st...@pr...> wrote: > > What is different is our philosophy. We decided for a reason not to use > the generated API as a public API, since often the usage of the > generated APIs is not what a normal Java programmer usually would do. I understand java-gnome's target audience is "Java programmer". My target audience is platform hackers and community developers who are already familiar with the C API, who want a sane language and might be willing to *learn* Java. Personally I think java-gnome is in a tough situation on this front because if what you need is "free crossplatform GUI toolkit", SWT and Qt-Jambi have always been around, and Swing is now Free. On the other hand, SWT and Swing don't offer GStreamer, WebKit, Clutter. > So we have this handcrafted public API to smoothen the edges of > underlying APIs and reduce the learning curve for developers coming from > the Java world. I understand the goal - note the tradeoff is this *increases* the learning curve for people coming from the GNOME community who already know the C APIs, because you're left guessing how things work. > Personally I would like to keep the hand written API, because I see it > as a big plus. Sure, until you want to use WebKit, Clutter, or GStreamer. > Another possibility would be to use JGIR to feed our code generator and > replace our .def files. By that we would get a much better non-public > binding to write the public binding for. With a relatively small amount of work I could make the JGIR code generator optionally output transformed class names, so instead of org.gnome.gir.dynamic.Gtk.AboutDialog, it would output org.gnome.gir.GtkAboutDialog. > This might go together with improvements on our GObject code, but that > must be discussed with people more familiar with the ugly binding > details than me. Yes, I would like to discuss that. > JGIR is definetly an interesting aproach and it would be nice to have > you onboard helping us with our code generation. You seem to have put a > lot of effort on this, so it would be a shame if we could not both > benefit from this. But I would not go so far to rely on automated > generated public APIs using JGIR. You may not - but there are a lot of people who would. Note both pygtk and Mono rely on public (after review) autogeneration - and there are *way* more pygtk and Mono apps shipped by vendors than java-gnome. |
From: Stefan P. <st...@pr...> - 2008-10-15 14:07:26
|
> > Personally I would like to keep the hand written API, because I see it > > as a big plus. > > Sure, until you want to use WebKit, Clutter, or GStreamer. Don't mix things here. Just because there currently is no coverage for those in java-gnome does not mean that there won't be any. Usually this only means that no one was interested in these parts enough to have a look at it. This might change as requests arise. You have a point when saying that providing an API by means of auto-generation is faster than hand-writing them. But just generating the code is not really helping. You need (as you already stated) review the code. Depending on what your goals are, there can be a lot to be done. E.g. we took considerable efforts to come up with an API for TreeView or TextView which we consider better than that a code generator would suggest. So even after a code generation there often is a lot of changes to be made. This is of course unless the goal is to look more familiar to C developers than to Java developers. But personally I don't see the point to tailor Java bindings for C developers - attracting Java developers with bindings that behave like they are used to seems to be a better idea to me. But as you already pointed out: It is a matter of goals. > > This might go together with improvements on our GObject code, but that > > must be discussed with people more familiar with the ugly binding > > details than me. > > Yes, I would like to discuss that. Any other people on this list who like to comment here? > > But I would not go so far to rely on automated > > generated public APIs using JGIR. > > You may not - but there are a lot of people who would. Note both > pygtk and Mono rely on public (after review) autogeneration - and > there are *way* more pygtk and Mono apps shipped by vendors than > java-gnome. Mixing again: Coverage (not the fact if it was auto-generated) may be a fact that explains that, but we don't know that for sure. It may well be to other facts like Java programmers preferring Swing or SWT when writing GUIs or cross plattform Mono applications being developed because the app developer simply favored .NET instead of Java. Stefan |
From: Colin W. <wa...@ve...> - 2008-10-16 16:12:39
|
On Wed, Oct 15, 2008 at 10:04 AM, Stefan Prelle <st...@pr...> wrote: > You have a point when saying that providing an API by means of > auto-generation is faster than hand-writing them. It's not just that it's faster - there are other arguments as well. For example, if one isn't an expert in the library domain, one could easily break the library. To pick a recent example, trying to change some of the GTK+ double arguments to integers. Even if one was an expert in all areas of GTK+ (and GTK+ is *enormous*) - how much would such a binding author in general know about web browsers (WebKit), or universal plug and play (GUPNP) or OpenGL/canvas (Clutter) or multimedia (GStreamer)? Personally I don't - but I'm trying to learn Clutter right now, and using Eclipse+Java is a nice way to do that. There's no way I would feel qualified to try to rewrite all the documentation and re-type all of the APIs. Even if I considered that a useful way to spend my time, which I definitely don't. > But just generating > the code is not really helping. You need (as you already stated) review > the code. Depending on what your goals are, there can be a lot to be > done. Depends on a few variables - for old code like GTK+ with some very complex APIs, yes, some overrides are going to help a lot. On the other hand for smaller and newer libraries like say libnotify or GUPNP, the existing API is going to be fine. The GObject introspection work is going to make this even better going forward, because we will have a --fail-unbindable option to g-ir-scanner, so if a C library author adds an unbindable or "weird" function while they're working, their build fails *right then* while they're developing, rather than binding authors having to figure it out 6 months to a year (or longer) later. > This is of course unless the goal is to look more familiar to C > developers than to Java developers. But personally I don't see the > point to tailor Java bindings for C developers Just as an example, I think using something like JamVM+JGIR would have been a good way to implement the new GDM. Now of course the new GDM is long since rewritten, but java-gnome's coverage of not even close to all the necessary parts of GTK+, not to mention the non-coverage of GConf would have completely ruled it out. Personally, my sense is that a lot of the "Java people" are using Windows or OS X if they even ever tried our platform, and as I said before, who I think we need to concentrate on is providing a nice environment for community developers who do know GTK+, but might not know Java, looking for a nice IDE (Eclipse) with a working debugger and a wide collection of usable libraries. Or at least, that describes me and a number of people I know. |
From: Andrew C. <an...@op...> - 2008-10-16 02:37:59
|
On Wed, 2008-10-15 at 16:04 +0200, Stefan Prelle wrote: > E.g. we took considerable efforts to come up with an API for TreeView or > TextView which we consider better than that a code generator would > suggest. Everyone please keep it straight in their minds that java-gnome 4.0 *is* substantially generated. It is only the outside layer that presents the public API that is hand crafted. The rest, that it wraps, is all generated - and having been a java-gnome 2.x hacker and later its maintainer, all I can say is Thank God because writing all that stuff by hand was a nightmare. So substantially our design goals for 4.0 have been achieved. This architecture has been validated again and again as we have had to make minor tweaks. There are of course still a number of TODOs and FIXMEs and NOTDONEYETs here and there, but really those only need to be addressed as people run into needing things that run afoul of such minor problems. [And I'd just like to put a huge shout out to Vreixo Formoso, who did the bulk of the grunt work during 2007 on the parts of the code generator that I was reluctant to get into. GLists, arrays and out-parameters come to mind. Thanks Vreio!] Meanwhile, it means we can concentrate on making sure our public API is sensible in Java terms and stable, protected from the the whims and variations happening in the underlying libraries. Anyway, everything Stefan is saying is totally on point. I just wanted to quibble on the "generation" issue. java-gnome is a generated binding. We just have a thin wrapper layer to provide for an abstraction that shields developers from things that simply do not (and never will) concern them. ... not to mention the entire engineering design of not doing injection into generated code; doing so is a HUGE anti-pattern. Ask anyone who has been around enterprise Java over the last 3-8 years. We went to great lengths to avoid it. [Not to mention it being the foundation of how we can properly document our public API. That doesn't seem to have come up. 5a-Architecture discusses this in detail] Colin is exposing every last function in GNOME as raw public API. Goodness. Given that so many of those functions are deprecated, unnecessary, unused, superseded, or is just C sugar, this seems misguided. Given further that the signatures of quite a number of the functions that *are* desirable are inappropriate in Java makes it really questionable indeed. Anyway, the java-gnome code generator already does generate code for everything it is fed data about - it just doesn't present it as public API. It could have, and for about 5 minutes at first it was tempting to do so. It didn't take very long 30 months ago when we were prototyping things to realize that exposing everything willy-nilly was a terrible idea. The shape of the public API of a library is for humans to decide. Most of the time exposing a method in java-gnome is as simple as writing a single line method - and, by design, code completion against the package visible generated code makes this no effort whatsoever. What does take thought is for people to ponder whether the public signature being presented is indeed appropriate (as usually it is) and to then invest a few moments into writing some documentation. It's really not that much to ask... but when trying to explain how something works quite often you realize that maybe this isn't something that should be exposed after all. Anyway, this is all an aside; I just wanted to encourage people to keep their terminology straight. You know me - the guy who works hard to point out the difference between users, developers, and hackers. :) AfC Sydney -- Andrew Frederick Cowie Operational Dynamics is an operations and engineering consultancy focusing on IT strategy, organizational architecture, systems review, and effective procedures for change management. We actively carry out research and development in these areas on behalf of our clients, and enable successful use of open source in their mission critical enterprises, worldwide. http://www.operationaldynamics.com/ Sydney New York Toronto London |
From: Colin W. <wa...@ve...> - 2008-10-16 14:34:49
|
On Wed, Oct 15, 2008 at 10:03 PM, Andrew Cowie <an...@op...> wrote: > Colin is exposing every last function in GNOME as raw public API. No, I'm not. > Goodness. Given that so many of those functions are deprecated, There's a gtk-doc Deprecated: flag, which shows up in the typelib, and JGIR generates an @Deprecated annotation. > unnecessary, unused, superseded, Perhaps - but there aren't that many APIs like that. > or is just C sugar, We don't expose things like varargs; and the introspection system supports hiding C sugar functions. Anyways - so you are saying you want to continue on java-gnome's path of being a hand-crafted API for some parts of GTK+ and below, continuing to expect that at some point many new people will appear and write/maintain bindings with custom documentation for every GObject library out there? You see no role for having a correct generated API to fill in gaps in the wide variety of libraries java-gnome hasn't even looked at? |
From: Stefan P. <st...@pr...> - 2008-10-16 14:55:02
|
Hi Colin, On Thu, 2008-10-16 at 10:34 -0400, Colin Walters wrote: > Anyways - so you are saying you want to continue on java-gnome's path > of being a hand-crafted API for some parts of GTK+ and below, > continuing to expect that at some point many new people will appear > and write/maintain bindings with custom documentation for every > GObject library out there? You see no role for having a correct > generated API to fill in gaps in the wide variety of libraries > java-gnome hasn't even looked at? Provoking question :) I would put it differently. We already use autogenerated APIs but take a different approach then you do. This may be combined but it will be a tough piece of work. I'd like to see cooperation on that part. Regarding coverage: If we chose to go your way for the yet not covered APIs and provide an unreviewed public API, we can not change the API later on if we find it unsuitable since this would break compatibility. So we would need to review every covered API down to every method. This is in fact the same level of work we now have when we review and cover APIs provided from our code generator. Or let me put your provoking question the other way around: You prefer to risk having a crappy API which cannot be changed later just to have the API immediately? Cheers, Stefan-who-hopes-this-won't-end-in-a-flame-war |
From: Gerald B. <ger...@gm...> - 2008-10-16 15:42:48
|
As an outsider looking in it seems like this bioils down to the following: 1. This project currently uses Auto-Generation of a private API from the .defs files for Gtk etc. 2. This is then wrapped with a public, hand-constructed, hand-documented, and intimately reviewed API 3. GObject/Gtk now provides an introspection/reflection API to make it much easier for language binding to auto-generate their binding API 4. Colin's project uses the new introspection API to do just that, providing nearly complete coverage (caveat: not all Gtk libs are based off GObject, e.g. Cairo, and so are not able to be thusly introspected) 5. Colin (and his ilk) would like to see complete coverage more than ideal public API 6. Stefan (and his ilk) would prefer a "Java Friendly" and well reviewed public API more so than immediate complete coverage Could a possible compromise be: 1. Auto-Generate a public, full-coverage API using the introspection method 2. Call this API, though public, not recommended for direct usage and clearly document that it will change whenever the underlying Gtk API's change 3. Create the "Java Friendly", well reviewed, well JavaDoc documented public API to wrap the above generated API This provides a couple of advantages: 1. Nice, Java-friendly, stable public API (though possibly incomplete initially) for those who wish (like me) to use something Java-friendly 2. Full-coverage, near immediate Semi-Public (for lack of a better term) that closely tracks the underlying Gtk API's This, to me, seems like the best of both worlds. Thoughts? Kind Regards, Gerry B. On Thu, Oct 16, 2008 at 10:54 AM, Stefan Prelle <st...@pr...> wrote: > Hi Colin, > > On Thu, 2008-10-16 at 10:34 -0400, Colin Walters wrote: > > Anyways - so you are saying you want to continue on java-gnome's path > > of being a hand-crafted API for some parts of GTK+ and below, > > continuing to expect that at some point many new people will appear > > and write/maintain bindings with custom documentation for every > > GObject library out there? You see no role for having a correct > > generated API to fill in gaps in the wide variety of libraries > > java-gnome hasn't even looked at? > > Provoking question :) > > I would put it differently. We already use autogenerated APIs but take a > different approach then you do. This may be combined but it will be a > tough piece of work. I'd like to see cooperation on that part. > > Regarding coverage: If we chose to go your way for the yet not covered > APIs and provide an unreviewed public API, we can not change the API > later on if we find it unsuitable since this would break compatibility. > So we would need to review every covered API down to every method. This > is in fact the same level of work we now have when we review and cover > APIs provided from our code generator. > > Or let me put your provoking question the other way around: You prefer > to risk having a crappy API which cannot be changed later just to have > the API immediately? > > Cheers, > Stefan-who-hopes-this-won't-end-in-a-flame-war > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > java-gnome-hackers mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-hackers > -- Gerald E. Butler http://bffoss.com ger...@gm... |
From: Stefan P. <st...@pr...> - 2008-10-16 15:56:46
|
On Thu, 2008-10-16 at 11:42 -0400, Gerald Butler wrote: > Could a possible compromise be: > > 1. Auto-Generate a public, full-coverage API using the > introspection method > 2. Call this API, though public, not recommended for direct usage > and clearly document that it will change whenever the underlying Gtk > API's change > 3. Create the "Java Friendly", well reviewed, well JavaDoc > documented public API to wrap the above generated API Wouldn't that be basically the same as two competing projects combined in a container project? Unless we find a way to build on the same code generator and hopefully GObject foundations, both APIs would have nothing in common. Stefan |
From: Gerald B. <ger...@gm...> - 2008-10-16 16:17:09
|
Yes, that is what I'm suggesting. Build on the same auto-generation (i.e. deprecate the current auto-generation and replace with new Gtk/Gobject introspection) So, it would be something like this: |---------------------------------------------------| | | | Application Code | | | |---------------------------------------------------| | | | | Public/Java-Friendly API | | | | | |--------------------------------------- | | | | Auto-Generated, Introspection API | | | |---------------------------------------------------| | | | Gtk API's | | | |---------------------------------------------------| The idea being that Java application should use the Public/Java-Friendly API except where there is not appropriate coverage. On Thu, Oct 16, 2008 at 11:56 AM, Stefan Prelle <st...@pr...> wrote: > > On Thu, 2008-10-16 at 11:42 -0400, Gerald Butler wrote: > > Could a possible compromise be: > > > > 1. Auto-Generate a public, full-coverage API using the > > introspection method > > 2. Call this API, though public, not recommended for direct usage > > and clearly document that it will change whenever the underlying Gtk > > API's change > > 3. Create the "Java Friendly", well reviewed, well JavaDoc > > documented public API to wrap the above generated API > > Wouldn't that be basically the same as two competing projects combined > in a container project? Unless we find a way to build on the same code > generator and hopefully GObject foundations, both APIs would have > nothing in common. > > Stefan > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > java-gnome-hackers mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-hackers > -- Gerald E. Butler http://bffoss.com ger...@gm... |
From: Colin W. <wa...@ve...> - 2008-10-16 16:14:42
|
On Thu, Oct 16, 2008 at 11:56 AM, Stefan Prelle <st...@pr...> wrote: > > Wouldn't that be basically the same as two competing projects combined > in a container project? Yeah, in a sense, though I think it is where we want to go. > Unless we find a way to build on the same code > generator and hopefully GObject foundations, both APIs would have > nothing in common. The code generator and GObject foundations are related but can be separated. I think if we shared a GObject layer it would be a huge win. The only major difference is a dependency on JNA. Would that be acceptable to java-gnome? |
From: Stefan P. <st...@pr...> - 2008-10-16 22:13:27
|
Hi Colin, Am Donnerstag, den 16.10.2008, 12:14 -0400 schrieb Colin Walters: > > Unless we find a way to build on the same code > > generator and hopefully GObject foundations, both APIs would have > > nothing in common. > > The code generator and GObject foundations are related but can be > separated. I think if we shared a GObject layer it would be a huge > win. The only major difference is a dependency on JNA. Would that be > acceptable to java-gnome? Honestly I don't know because I am not aware of the consequences to the whole project. But from what I understand it is not using a bit of JNA alongside with JNI in the GObject layer - it is either JNA or JNI. So I guess we are not talking about merging but replacing the GObject layer. I still don't understand our GObject layer and I avoid digging to deep in there, so I am not sure what the consequences would be. But I imagine that it really takes careful planning and a lot of testing, so this might be a long time goal. A short time goal could be to use GIR to replace the .def files we are currently using and write a code generator that for startes builds code suitable for our GObject layer. I can imagine that since you already adopted the gstreamer-java object layer you are not very happy about thinking about a different one. So I see two ways how we could proceed here: 1. You could contribute by putting our GLib/GObject layer on a GIR foundation and provide a code generator that produces code like our current code generator would. This would be a help we all would appreciate. 2. You stick to the idea of your object layer in which case you would need to find out what adjustments would need to be done to our current GObject layer, generated code or public API. I am a bit reluctant here since this would render lots of effort from recent years obsolete without a real need, but perhaps the result would convince me. But until that I guess you would work mostly alone here (with help on your questions of course). But these a only my 2 cents and since my focus is on public API and coverage it would be good if the people knowing the GObject code and code generator would comment here. Stefan |
From: Colin W. <wa...@ve...> - 2008-10-17 01:17:22
|
On Thu, Oct 16, 2008 at 6:13 PM, Stefan Prelle <st...@pr...> wrote: > I can imagine that since you already adopted the gstreamer-java object > layer you are not very happy about thinking about a different one. The gstreamer-java one was/is pretty nice, but I am not wedded to it, and am taking another look at the java-gnome layer now. Some of the underlying JNI code in jni/ would be relatively straightforward to use, though this gives me a bit of pause: g_idle_add(bindings_java_memory_deref, object); Granted most programs are going to use the mainloop, but it is valid to not do so. The dependency on GTK+ in various parts (e.g. call to gtk_main_quit() in bindings_java_signal) should really be converted to just GLib/GObject. The higher level (bindings/), would be better off using a class (JGIR uses JNA's Pointer class) instead of just 'long' for pointers. There are some things not handled at all - like "notify::" for properties (JGIR generates signals for these). The handling of boxed types is just wrong. "The trick is to figure out * whether we are owner of the <code>GBoxed</code> or not...</i>". Boxed types should always be copied when you get them. See: http://library.gnome.org/devel/gobject/unstable/gobject-Boxed-Types.html I'll take a look in more detail later. |
From: Andrew C. <an...@op...> - 2008-10-17 01:47:53
|
On Thu, 2008-10-16 at 21:17 -0400, Colin Walters wrote: > Boxed types should always be copied when you get them. We did that all the time anyway; we just had infrastructure anticipating for the times where that wouldn't be the case. Turned out to be unnecessary. Remove that was one of the things that Vreixo's recent memory management branch did, so it's all cleaned up as of 4.0.9 (though it sounds like there's an errant comment here or there. Hm. Have to hunt that down). [Naked structs and GBoxeds were treated as the same thing by the pygtk bindings, and that led to some confusion over the years as it became clear that they weren't, quite] People in #gnome-hackers and #gtk+ are usually kind enough to help with this sort of thing, but it's always nice to get further confirmation we were right about that. Good stuff. AfC Sydney |