Thread: [Java-gnome-developer] Thanks and some questions
Brought to you by:
afcowie
From: Mark W. <ma...@kl...> - 2003-06-29 17:50:22
|
Hi, Thanks for the java-gnome bindings! It was very nice to extend my program with a simple GUI frontend that makes it look, feel and integrate with the rest of my desktop. Thanks very much! See <http://www.klomp.org/snark/snark-gnome.html> for the result. Some questions and suggestions. Since this is my first Gnome program please feel free to point out any mistaken assumptions. I used the java-gnome packages that came with Debian GNU/Linux (unstable) 0.8.0cvs20030415-1. I tried to get a more recent version but anonymous CVS just doesn't seem to work on sourceforge (I have had problems with other projects on sourceforge as well). So please tell me if the problems I encountered are already known or fixed in a next release. The documentation on the home page seems very outdated. But using the the general gtk and gnome API reference and the examples it wasn't very hard to understand how to create the simple GUI that I needed. Having those simple examples really helped getting up to speed quickly. java-gnome doesn't seem to work with kaffe (not even the just released 1.1 version). I have already emailed the kaffe mailinglist but haven't had time to investigate more. It does work very nicely with gij (GNU Interpreter for Java) that comes with gcc 3.3 and that handles traditional class and jar files. I haven't tried compiling everything to native code using gcj (GNU Compiler for Java) which does work very nicely for the command line version of my program. I noticed that there is also a gnome-gcj project <http://gnome-gcj.sourceforge.net> but that doesn't seem to get updated any more. Have the projects merged? Do you want to provide CNI bindings and natively compiled libraries? That should speed things up a bit especially the startup phase and the shared libraries could be used much more efficiently when the user has multiple java-gnome based programs running. The org.gnu.gnome.About class doesn't seem to work correctly. It seems to use the strings that I give it randomly as authors, documentors and translator. I couldn't really detect when it used which string. And if given a null string for the translator it crashes the whole application. In general the library doesn't behave very nicely when calls are made in the wrong order or are given the wrong arguments. Often it wasn't that hard to see what went wrong or when I object should no longer be used but crashing the whole application instead of throwing IllegalStateExceptions makes debugging a bit harder then necessary. An example is using a widget from a window which close box has just been pressed. When using the UIInfo class to get some standard widget like UIInfo.quitItem() when you try to call quitMenuItem.getWidget() before the window that it is attched to is shown it crashes. Is this know behaviour? I couldn't find documentation about how to work with java-gnome from multiple threads. To be save I just created a Fireable and a Timer that sets off a couple times a second and then update the Widgets in the fire() method that checks progress flags set in other threads. What is the recommended way to handle multiple thread that want to update the GUI. When is it save to call a widget or other glib, gtk or gnome object from a thread that isn't the main gtk thread? For the window layout I tried following the Gnome HIG. Is there example code to do some of the things described there? Currently I use alot of VBoxes inside HBoxes with different borders and spacing values tied together with SizeGroups which seems to make it look like the HIG describes. But since every Gnome application implements these kinds of things I wondered if there isn't an example library that just does the right thing. Once again thanks for this binding. Even though I had some troubles, it was not that hard and actually a pleasure to create something usefull. Hope that I can help make it even better. Cheers, Mark |
From: Mikael H. <mi...@im...> - 2003-06-29 20:30:25
|
s=C3=B6n 2003-06-29 klockan 19.49 skrev Mark Wielaard: > Hi, Hi! Haven't tried out the bindings myself (had some problems building the .jar-files and didn't have time to look into it), will soon though. I've been a GNOME developers for several years though. > The org.gnu.gnome.About class doesn't seem to work correctly.=20 Why is org.gnu.gnome namespace used anyway? org.gnome.* looks more correct. > In general the library doesn't behave very nicely when calls are made > in the wrong order or are given the wrong arguments. Often it wasn't > that hard to see what went wrong or when I object should no longer be > used but crashing the whole application instead of throwing > IllegalStateExceptions makes debugging a bit harder then necessary. > An example is using a widget from a window which close box has just > been pressed. This might be the underlying GTK+ that makes this hard. Since C/GTK+ doesn't have ref counts as in Java I'm not sure if the fact that you keep a java ref on an object makes you have a gtk-ref on the C-object. My guess is that you have to be careful how you use the widgets and that you will have to explicitly call g_object_ref (not sure if that is wrapped or not) to keep a reference to a widget in a closed window after destroying the window but I'm not sure. > When using the UIInfo class to get some standard widget like > UIInfo.quitItem() when you try to call quitMenuItem.getWidget() before > the window that it is attched to is shown it crashes. Is this know > behaviour? Might be that the item/widget isn't created yet? > I couldn't find documentation about how to work with java-gnome from > multiple threads. To be save I just created a Fireable and a Timer > that sets off a couple times a second and then update the Widgets in > the fire() method that checks progress flags set in other threads. > What is the recommended way to handle multiple thread that want to > update the GUI. When is it save to call a widget or other glib, gtk or > gnome object from a thread that isn't the main gtk thread? When working with GTK+ you need to make sure that only one thread at a time work on a widget. Therefor you will have to create locks around calls that updates the widgets to prevent several simultanious accesses to a widget. > For the window layout I tried following the Gnome HIG. Is there > example code to do some of the things described there? Currently I use > alot of VBoxes inside HBoxes with different borders and spacing values > tied together with SizeGroups which seems to make it look like the HIG > describes. But since every Gnome application implements these kinds of > things I wondered if there isn't an example library that just does the > right thing. You probably want to work with Glade/Libglade (not sure if it is wrapped in java-gnome yet) for doing that. Most GNOME applications today use Glade to create the GUI in a GUI-editor which outputs an XML-file describing the UI. This saves lots of code and makes your application more maintainable since you can change the UI without touching the code. Hope it helps even though I don't know the current status of java-gnome. Regards, Mikael Hallendal --=20 Mikael Hallendal mi...@im... Imendio http://www.imendio.com Phone: +46 (0)709 718 918 |
From: Mark H. <mh...@ti...> - 2003-06-30 08:46:17
|
On Sun, 2003-06-29 at 21:30, Mikael Hallendal wrote: > This might be the underlying GTK+ that makes this hard. Since C/GTK+ > doesn't have ref counts as in Java I'm not sure if the fact that you > keep a java ref on an object makes you have a gtk-ref on the C-object. > > My guess is that you have to be careful how you use the widgets and that > you will have to explicitly call g_object_ref (not sure if that is > wrapped or not) to keep a reference to a widget in a closed window after > destroying the window but I'm not sure. I've been talking about this lately to the other java-gnome developers. We are probably going to implement a system so that there will always be a gtk-ref when the java object exists. Implementation of this is being delayed until after 0.8 release. > You probably want to work with Glade/Libglade (not sure if it is wrapped > in java-gnome yet) It is done with java-gnome, although I've not used it myself yet. Not in the Debian packages at the moment (perhaps I'll find some free time this week...) -- .''`. Mark Howard : :' : `. `' http://www.tildemh.com `- mh...@de... | mh...@ti... | mh...@ca... |
From: Pablo B. <pb...@uo...> - 2003-06-29 20:36:19
|
I'll try to help you in some stuff I experimented with, I'm not a java-gnome expert. On Sun, 2003-06-29 at 17:49, Mark Wielaard wrote: > I couldn't find documentation about how to work with java-gnome from > multiple threads. To be save I just created a Fireable and a Timer > that sets off a couple times a second and then update the Widgets in > the fire() method that checks progress flags set in other threads. > What is the recommended way to handle multiple thread that want to > update the GUI. When is it save to call a widget or other glib, gtk or > gnome object from a thread that isn't the main gtk thread? With my Gtk# project (http://gnomencoder.sourceforge.net), I used the C gdk_threads_enter and gdk_threads_leave functions. I don't have a clue on how to call them with Java, or if they are wrapped somewhere. Regards! -- <HACKrley_PaNiK> si perl esta bueno <Script-Fu> Compilar PERL? <Script-Fu> Juas! <agamenon> que usas para compilarlo??? <pablog> el el Perl2Exe |