Discussion:
Webkit
Niranjan Rao
2012-10-10 16:22:30 UTC
Permalink
Greetings!

I need lot of functionality that other java browsers such SWT were not
exporting. As far I know, java-gnome is also not exposing web kit bindings.
So I spent couple of days trying to adapt java-gnome to use webkit library
with some sucess. That is I am able to say new WebView() and windows does
show browser which functions as expected.

I wrote a simple code generator that parses gir files and generates defs
files and java classes. As per my understanding current design there are
plumbing classes in generated folder and concrete hand written classes in
the src directory. Since def files are almost complete in terms of methods,
this works nicely. Because of time constraint, currently I am generating
compilable stubs for concrete clases in src directory and then adding
methods that I need to appropriate classes.

Questions:
1. Do we want webkit to be part of main library. I understand that not
everyone needs webkit and right now current mechanism needs webkit
libraries to build.
2. Is it possible to split java gnome libraries per module - e.g. glib.jar,
gtk.jar, webkit.jar with version numbers.
3. What is recommended way to add java support for other GTK modules?

I would like to submit my changes upstream after polishing and making sure
its really submittable or make it available from other channel. Though
number of FIXME in the generated code has gone down, I can't really say its
zero. Especially if blocks compilation. There are couple of functions in
generated c code where it returns FIXME which does not exist and I have to
touch generated code to get it compile.

Regards,

Niranjan
Guillaume Mazoyer
2012-10-10 17:11:33 UTC
Permalink
Post by Niranjan Rao
I wrote a simple code generator that parses gir files and generates defs
files and java classes. As per my understanding current design there are
plumbing classes in generated folder and concrete hand written classes in
the src directory. Since def files are almost complete in terms of methods,
this works nicely. Because of time constraint, currently I am generating
compilable stubs for concrete clases in src directory and then adding
methods that I need to appropriate classes.
That's pretty cool. We are thinking about using introspection in our
code generator for a while now. So a parser for GIR files something
interesting for us.
Post by Niranjan Rao
1. Do we want webkit to be part of main library. I understand that not
everyone needs webkit and right now current mechanism needs webkit libraries
to build.
Maybe maybe not. We should think about this.
Post by Niranjan Rao
2. Is it possible to split java gnome libraries per module - e.g. glib.jar,
gtk.jar, webkit.jar with version numbers.
This is a discussion that has already been started [1].
Post by Niranjan Rao
3. What is recommended way to add java support for other GTK modules?
GTK is working quite well and adding GTK widgets is pretty easy for
now. Write .defs, use code generator, write API and documention, write
tests, you're done. Adding a GNOME module is pretty much the same but
it adds dependencies. If GNOME already depends on the said module I
don't see any problem of including the coverage for it in java-gnome.
Post by Niranjan Rao
I would like to submit my changes upstream after polishing and making sure
its really submittable or make it available from other channel. Though
number of FIXME in the generated code has gone down, I can't really say its
zero. Especially if blocks compilation. There are couple of functions in
generated c code where it returns FIXME which does not exist and I have to
touch generated code to get it compile.
It would be cool to have a branch of your work somewhere so we can
take a look at it.


[1] http://article.gmane.org/gmane.comp.gnome.bindings.java.devel/1611
--
Guillaume Mazoyer - http://respawner.fr/
Niranjan Rao
2012-10-11 18:40:42 UTC
Permalink
I am working on the generator that will create the code that can be
compiled. Right now there are some manual steps we have to execute to
get the code compiled.

Will send a link to git repo as soon as its more usable.

Regards,

Niranjan
Post by Guillaume Mazoyer
Post by Niranjan Rao
I wrote a simple code generator that parses gir files and generates defs
files and java classes. As per my understanding current design there are
plumbing classes in generated folder and concrete hand written classes in
the src directory. Since def files are almost complete in terms of methods,
this works nicely. Because of time constraint, currently I am generating
compilable stubs for concrete clases in src directory and then adding
methods that I need to appropriate classes.
That's pretty cool. We are thinking about using introspection in our
code generator for a while now. So a parser for GIR files something
interesting for us.
Post by Niranjan Rao
1. Do we want webkit to be part of main library. I understand that not
everyone needs webkit and right now current mechanism needs webkit libraries
to build.
Maybe maybe not. We should think about this.
Post by Niranjan Rao
2. Is it possible to split java gnome libraries per module - e.g. glib.jar,
gtk.jar, webkit.jar with version numbers.
This is a discussion that has already been started [1].
Post by Niranjan Rao
3. What is recommended way to add java support for other GTK modules?
GTK is working quite well and adding GTK widgets is pretty easy for
now. Write .defs, use code generator, write API and documention, write
tests, you're done. Adding a GNOME module is pretty much the same but
it adds dependencies. If GNOME already depends on the said module I
don't see any problem of including the coverage for it in java-gnome.
Post by Niranjan Rao
I would like to submit my changes upstream after polishing and making sure
its really submittable or make it available from other channel. Though
number of FIXME in the generated code has gone down, I can't really say its
zero. Especially if blocks compilation. There are couple of functions in
generated c code where it returns FIXME which does not exist and I have to
touch generated code to get it compile.
It would be cool to have a branch of your work somewhere so we can
take a look at it.
[1] http://article.gmane.org/gmane.comp.gnome.bindings.java.devel/1611
Andrew Cowie
2012-10-14 22:38:10 UTC
Permalink
Post by Niranjan Rao
1. Do we want webkit to be part of main library.
Sure! That would be terrific!
Post by Niranjan Rao
I understand that not everyone needs webkit and right now current
mechanism needs webkit libraries to build.
Yes, that is unfortunate. I ran into this 7 year ago; then the question
was gtkmozembed bindings in java-gnome 2.x
Post by Niranjan Rao
2. Is it possible to split java gnome libraries per module - e.g.
glib.jar, gtk.jar, webkit.jar with version numbers.
Guillaume kindly linked to a discussion on the topic. It *is* a piece of
engineering we should do.

It actually turns out that we *don't* need multiple .jar files (what a
pain) but we *do* need to split the .so into multiple pieces, loaded on
demand if the developer loads a class that causes the respective
Plumbing to be loaded and have its static initializer block run
Post by Niranjan Rao
I would like to submit my changes upstream after polishing and making
sure its really submittable or make it available from other channel.
Changes welcome.

We do enforce a fairly high standard of code hygiene in java-gnome, but
if you follow the existing style you won't have any problems in the
slightest.

Slightly more subjective is ensuring changes makes sense in the context
of the overall architecture of the library.

Finally, if you're working on code generation then I'd definitely
welcome Serkan and Vreixo having a look at your code, as they've done
the most recent work in this regard.

If you were able to join #java-gnome on gimpnet we can have a more
focused chat about it. I look forward to meeting you.

AfC
Sydney
Niranjan Rao
2012-10-15 16:56:38 UTC
Permalink
I can join the chat. Can you suggest any particular time? I am in
California
Post by Andrew Cowie
Post by Niranjan Rao
1. Do we want webkit to be part of main library.
Sure! That would be terrific!
Post by Niranjan Rao
I understand that not everyone needs webkit and right now current
mechanism needs webkit libraries to build.
Yes, that is unfortunate. I ran into this 7 year ago; then the question
was gtkmozembed bindings in java-gnome 2.x
Post by Niranjan Rao
2. Is it possible to split java gnome libraries per module - e.g.
glib.jar, gtk.jar, webkit.jar with version numbers.
Guillaume kindly linked to a discussion on the topic. It *is* a piece of
engineering we should do.
It actually turns out that we *don't* need multiple .jar files (what a
pain) but we *do* need to split the .so into multiple pieces, loaded on
demand if the developer loads a class that causes the respective
Plumbing to be loaded and have its static initializer block run
Post by Niranjan Rao
I would like to submit my changes upstream after polishing and making
sure its really submittable or make it available from other channel.
Changes welcome.
We do enforce a fairly high standard of code hygiene in java-gnome, but
if you follow the existing style you won't have any problems in the
slightest.
Slightly more subjective is ensuring changes makes sense in the context
of the overall architecture of the library.
Finally, if you're working on code generation then I'd definitely
welcome Serkan and Vreixo having a look at your code, as they've done
the most recent work in this regard.
If you were able to join #java-gnome on gimpnet we can have a more
focused chat about it. I look forward to meeting you.
AfC
Sydney
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
java-gnome-developer mailing list
https://lists.sourceforge.net/lists/listinfo/java-gnome-developer
Niranjan Rao
2012-10-15 19:24:19 UTC
Permalink
Greetings again.

I have posted my generated code at https://github.com/nhrdl/GirToGnomeJava

This is simple maven project. After you compile the project, just run
the jar file. It accepts two parameters - name of GIR file and output
directory.

I have not modified any of the java gnome sources. Rather I am using the
existing infrastructure by feeding new files. My generator, currently
generates the "defs" file and corresponding bindings in src/bindings
directory. You can execute the make command after running generator to
compile the sources. If everything goes well, you should get just one
compiler error in the generated c code.

Currently we generate only constructor in the src/binding directory.
Constructors are generated properly and code should compile. Generated
defs files are proper and do have all the method information. So
executing make command should generate proper bindings and all the
methods are available.

My current approach is to add functions I need to use in src/bindings
directory. However this can be completely automated and I should be able
to generate (mostly) proper bindings given some more time.

After fixing the minor compiler error in the generated C code (please
refer to readme.md), you should be able to use webkit in your java/gtk
applications - though not very useful in its default state as "loadUri"
method for WebVeiw is not generated and there is no way to tell it. You
can fix it by adding following method in the WebView class

public void loadUri(String string) {

ready = false;
WebKitWebView.loadUri(this, string);

}

Regards,

Niranjan
Post by Andrew Cowie
Post by Niranjan Rao
1. Do we want webkit to be part of main library.
Sure! That would be terrific!
Post by Niranjan Rao
I understand that not everyone needs webkit and right now current
mechanism needs webkit libraries to build.
Yes, that is unfortunate. I ran into this 7 year ago; then the question
was gtkmozembed bindings in java-gnome 2.x
Post by Niranjan Rao
2. Is it possible to split java gnome libraries per module - e.g.
glib.jar, gtk.jar, webkit.jar with version numbers.
Guillaume kindly linked to a discussion on the topic. It *is* a piece of
engineering we should do.
It actually turns out that we *don't* need multiple .jar files (what a
pain) but we *do* need to split the .so into multiple pieces, loaded on
demand if the developer loads a class that causes the respective
Plumbing to be loaded and have its static initializer block run
Post by Niranjan Rao
I would like to submit my changes upstream after polishing and making
sure its really submittable or make it available from other channel.
Changes welcome.
We do enforce a fairly high standard of code hygiene in java-gnome, but
if you follow the existing style you won't have any problems in the
slightest.
Slightly more subjective is ensuring changes makes sense in the context
of the overall architecture of the library.
Finally, if you're working on code generation then I'd definitely
welcome Serkan and Vreixo having a look at your code, as they've done
the most recent work in this regard.
If you were able to join #java-gnome on gimpnet we can have a more
focused chat about it. I look forward to meeting you.
AfC
Sydney
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
java-gnome-developer mailing list
https://lists.sourceforge.net/lists/listinfo/java-gnome-developer
Loading...