|There's more than one way to do things|
Turn a Website into a native applicationby cavac (Chaplain)
|on Dec 20, 2011 at 10:47 UTC||Need Help??|
In this walkthrough, i'll show you how to write a simple GTK3 Webkit based browser that turns a webpage into a "native application". Apple Users probably would call it an App.
First of all, If you are - like me - using any Ubuntu x64 derivate with ActivePerl 5.14, you're in for quite a ride. Mostly, because ExtUtils::MakeMaker wont find most libraries. This is easy to fix if you know how (and a bit risky too, since you are disabling checks). These checks in MakeMaker try to make sure you have the required libraries but wont find them even if you do have them.
So, find the file Kid.pm in */lib/ExtUtils/Liblist and find the following lines (somewhere around line 170 in my MakeMaker version):
We'll disabling using the "results" of this checks, just comment out four lines:
UPDATE: A nicer workaround of course is to check for environment variables. Let's say, if MM_DISABLE_LIBCHECKS is set to a nonzero value, override the broken checks:
So, running Makefile.PL like this should do the trick:
Of course, this also should also work when calling any CPAN script (untested but plausible).
END-OF-UPDATE This should do it. Since (most) Makefile.PL's use checks with "pkg-config" in addition to internal MakeMaker checks anyway, you should still see all missing dependencies from your operating system.
Installing the dependencies
You got a lot of dependencies for the module we are going to use, which is Gtk3::WebKit. Honestly, i didn't write those down - and i didn't do a clean install anyway, so i leave out the details. Mostly, you'll hunt for obscure "*-dev" packages in apt-get/synaptic. (If someone is kind enough to reply with a list of all the required packages, i'll gladly update this post).
The one, most obscure of the library packages is certainly libgirepository1.0-dev. That should pull in many of the required packages.
Writing the Browser
Without further delay, let's state some of the requirements for our project:
For the last two requirements, the only thing we have to do is not implementing those features. So, let's forget about them alltogether.
For the first two, we can just set the correct properties of the webkit element in our Gtk3 window. No big deal. For the third requirement, we set the Window title and we're done, too.
So, let's get right down to the code:
As you can see, no big deal, after you actually fought the battles against MakeMaker and your Distributions clearly confusing package managment.
All we do here is open a Gtk3 window, add a WebKit widget with some custom settings and pack it into the main window with some attached scrollbars. Then we call the Gtk3 mainloop and we got a nice, one-window one-tab browser that simulates a native application.
BREW /very/strong/coffee HTTP/1.1 Host: goodmorning.example.com 418 I'm a teapot