segunda-feira, 25 de abril de 2011

Mono WebBrowser with WebKit [Gtk# not WinForms]

Mono WebBrowser with WebKit [Gtk# not WinForms]: "– Enviado usando a Barra de Ferramentas Google"

Everaldo's Weblog: Mono Bindings in 5 minutes

Everaldo's Weblog: Mono Bindings in 5 minutes:

Mono Bindings in 5 minutes

Last month at FISL 9 I met again with my good friend Henri Bergius, and he told me about Midgard news and showed me some changes on version 2 of Midgard Core. Midgard Core is a glib based library that could be used to persist glib objects on databases. Since it uses the GLib object model it is very easy to create binding for Mono, and that's what we did it at FISL days.

That was not the first time that I created Mono bindings for GLib libraries, I had done it before for Maemo libraries, and this weekend again for WebKit, but at this time I decide to create a project skeleton so everybody that is interested in creating Mono binding for Glib based libraries could use this skeleton for easy bindings creation.

The steps below describe how I easily created WebKit bindings without typing any lines of C# code.

First, download the skeleton file, unpack it and rename it to "webkit-sharp":

# wget http://anonsvn.mono-project.com/viewcvs/trunk/monoskel-gapi.tar.gz
# tar -xzf monoskel-gapi.tar.gz
# mv monoskel-gapi webkit-sharp

Now, go into this new directory and run the script that will perform the magic:
# cd webkit-sharp
# chmod +x autogen.sh skel-create.sh
# ./skel-create.sh webkit-sharp
# ./autogen.sh

We now have our source tree ready with autotools and makefiles. In the next step we must tell gapi where the C header files of the library that we want to make bindings for are. Open sources/webkit-sharp-sources.xml with your preferred text editor and type the following content:






/usr/include/webkit-1.0/webkit





Here, the important information is "WebKit" that will be used as our namespace and "dir" that indicates the directory where our header (.h) files are.

And that is all, no changes needed anymore, you just need to run "make api" on the sources directory every time you change "webkit-sharp-sources.xml".
# cd sources
# make api

You can now follow the normal procedure to compile and install the linux package. On the package root directory, just type:
# ./configure
# make
# make install

If you are a developer, it should be easy to understand and create more samples in "samples" dir. There are also some "Package settings" that can be changed on top of "configure.in".

I did some other changes in my webkit-sharp like creation of webbrowser sample and checking for installed WebKit in configure.in. On my next post I will show webkit-sharp in action.

More information about GAPI could be found here.

ApplicationsGtk – WebKit

ApplicationsGtk – WebKit:

Applications using WebKit/GTK+

This is a list of applications known to be using WebKit/GTK+.

Browsers

All the browsers in this list use WebKit at the core of the application, unless otherwise stated.

Epiphany - GNOME

  • Open Source

Epiphany, Epiphany WebKit

Element Browser - Element Software LLC

  • Freeware
  • MS-Windows, Mac (Universal Binary)

Element Browser is a stylistic, modern and powerful web browser. It features unmatched security, an intuitive user interface and great features.

Midori

  • Open Source

Midori

Kazehakase

  • Open Source
  • Supports WebKit/Gecko

Kazehakase

WebKit EAL - Maemo

  • Open Source(?)
  • For mobile devices

WebKit EAL (repository has gone non-public)

Web Browser - OpenMoko

  • Open Source
  • For mobile devices

Web Browser

Web - Poky Linux

  • Open Source
  • For mobile devices

Poky

Skipstone

  • Open Source
  • Supports WebKit/Gecko

Skipstone

OLPC Sugar WebKit Browse activity

  • Open Source
  • For mobile devices

WebKit Browse

DeforaOS Surfer

  • Open Source
  • Supports WebKit, Gecko, GtkHtml
  • Features a variant for mobile devices

http://www.defora.org/os/project/340/Surfer

Widget Toolkits

SeedKit

http://live.gnome.org/SeedKit/

As a developer, SeedKit gives you a way to define you UI in pure standard web technologies (as supported by WebKit) bound to pure GObject/DBus symbols as exposed by Seed.

Pyjamas Desktop

PyjamasDesktop provides a simpler and more powerful alternative to python-wxWidgets, PyGtk2 and PyQt4. PyWebkitGtk is the current basis for PyjamasDesktop.

http://pyjd.org

SWT

SWT is the Eclipse project's widget toolkit, and can be used by anyone to build java apps with native platform integration. As of Eclipse 3.7 the SWT Browser control embeds WebKitGtk as its native renderer.

http://www.eclipse.org

E-Mail Clients

Claws Mail

  • Open Source
  • WebKit support available as a plug-in

Claws Mail, Fancy plugin

tinymail UI library

  • Open Source
  • Library toolkit for building mail clients

Tinymail, libtinymailui-webkit

Evolution - GNOME

  • Open Source
  • Experimental WebKit support (patch, not yet merged)

Evolution

Balsa

  • Open Source
  • WebKit support includes text search, printing, and user control of image downloads

Balsa

Postler

  • Open Source
  • WebKit is used for rendering and composing messages

Postler

Language bindings

Ok, those are not exactly applications, but can be used to build them.

Python bindings

http://live.gnome.org/PyWebKitGtk

Vala bindings

http://live.gnome.org/Vala

Perl bindings

http://search.cpan.org/dist/Gtk2-WebKit/

C++ / gtkmm bindings

git clone git clone http://www.gnome.org/~jjongsma/git/webkitmm.git/ 

Ruby bindings

http://github.com/russ/rbwebkitgtk/tree/master

Instant Messenger/Chat Clients

All Instant Messenger and Chat clients in this section use WebKit to render and style messages, unless otherwise stated. This allows messages to be styled using a stylesheet language such as CSS. This enables customised message layout to be developed easily using web technology, without touching a line of code in the application.

Pidgin

  • Open Source
  • Experimental WebKit support (not yet merged)

Pidgin

Galaxium

  • Open Source
  • Uses webkit-sharp

Galaxium

Gwibber

  • Open Source
  • Microblogging client for GNOME developed with Python and GTK
  • Experimental WebKit support

Gwibber

Empathy

  • Open Source
  • Uses the telepathy framework
  • Experimental WebKit support to render Adium themes (not yet merged)

Empathy

RSS Readers

All the RSS Readers in this section use WebKit to display the news summaries, and the full articles that the RSS feeds link to.

Feed Reader - OpenMoko

  • Open Source
  • For mobile devices

Feed Reader

Liferea

  • Open Source
  • Supports WebKit/Gecko/GtkHtml

Liferea

Straw - GNOME

  • Open Source

Straw

Evolution RSS Reader Plugin

  • Open Source
  • Supports WebKit/Gecko

http://gnome.eu.org/index.php/Evolution_RSS_Reader_Plugin

NewsKit

  • Open Source
  • Uses webkit-sharp

NewsKit

Blam

  • Open Source
  • Uses webkit-sharp

Blam

Help Viewers

All applications in this section use WebKit to display HTML based help files.

Devhelp - GNOME

  • Open Source

Devhelp

Yelp - GNOME

  • Open Source
  • Experimental WebKit support (SVN branch, not yet merged)

Yelp

monodoc - Mono

  • Open Source
  • Supports WebKit/Gecko/GtkHtml

monodoc

ilcontrast - Mono

  • Open Source

http://www.mono-project.com/

GIMP (Help viewer)

  • Open Source

GIMP

Media players

Rhythmbox

  • Open Source
  • Experimental WebKit support (patch, not yet merged)

MPX

  • Open Source

MPX

Banshee

  • Open Source
  • Experimental WebKit support (patch, not yet merged)

Banshee

Media center

Clutter

Rich OpenGL UI platform.

  • Open Source
  • Experimental WebKit support

Clutter, Clutter WebKit

Other

Conduit - GNOME

  • Open Source
  • Synchronization framework

Conduit

RedNotebook

  • Open Source
  • RedNotebook is a graphical diary and journal to keep track of notes and thoughts throughout the day.

RedNotebook

Mono WebBrowser with WebKit [Gtk# not WinForms] « configuration: debug

Mono WebBrowser with WebKit [Gtk# not WinForms] « configuration: debug: "– Enviado usando a Barra de Ferramentas Google"

For long time I have looking for displayin web pages on Mono by using Gtk#…And thanks to this post I came across with WebKit solution!

monologo

WebKit is as they define in their page:

WebKit is an open source web browser engine. WebKit is also the name of the Mac OS X system framework version of the engine that’s used by Safari, Dashboard, Mail, and many other OS X applications. WebKit’s HTML and JavaScript code began as a branch of the KHTML and KJS libraries from KDE. This website is also the home of S60‘s S60 WebKit development.

Well after looking to the simple solution that is made in shana.worldofcoding.com, I give a try to my solution and here it is:

01
using System;
02using Gtk;
03using WebKit;
04
05namespace browserapp {
06 class browser {
07
08 public static void Main () {
09 Application.Init ();
10 Window window = new Window ("BROWSER");
11 window.SetSizeRequest(240,300)
12
13<div id=":h0">
14
;
15 window.Destroyed += delegate (object sender, EventArgs e) {
16 Application.Quit ();
17 };
18 ScrolledWindow scrollWindow = new ScrolledWindow ();
19 WebView webView = new WebView ();
20 webView.SetSizeRequest(240,250);
21 webView.Open ("mono-project.com");
22 scrollWindow.Add (webView);
23
24 Label name=new Label();
25 name.Text="BrowserExample:";
26
27 Fixed fixed1=new Fixed();
28 fixed1.SetSizeRequest(240,300);
29
30 fixed1.Put(name,0,0);
31 fixed1.Put(scrollWindow,0,50);
32
33 window.Add (fixed1);
34 window.ShowAll ();
35 Application.Run ();
36 }
37 }
38}
39
40

In my Debian Lenny:

“apt-get install mono-2.0-devel gtk-sharp2 libwebkit1.0-cil”

“gmcs -pkg:gtk-sharp-2.0 -pkg:webkit-sharp-1.0 web.cs”

“mono web.exe”

The Ouput:

Reference:

[1.] http://shana.worldofcoding.com/en/browser.html

quinta-feira, 14 de abril de 2011

Click Start > Run.

Enter ipconfig /flushdns in the Open: textbox.

Click the OK button.

http://www.tacktech.com



Note: This does not modify your host file entries. If you run ipconfig /displaydns entries in the host file will still be listed.

quarta-feira, 13 de abril de 2011

Re: [Gtk-sharp-list] Widget absolute screen position

Re: [Gtk-sharp-list] Widget absolute screen position:
Dnia środa, 15 lipca 2009, napisałeś: > On Wed, Jul 15, 2009 at 12:30 PM, Piotr Budny wrote: > > Hello, > > is there any way to get widget's X and Y coordinates according to the > > current screen resolution? > > int x, y; > yourWidget.GdkWindow.GetOrigin(out x, out y);  Almost forget to thank you.  Thanks!  Regards, vip;

Can you get the parent GTK window from a widget? - Stack Overflow

Can you get the parent GTK window from a widget? - Stack Overflow: "

I have a custom widget and it needs to launch a MessageDialog and in order for me to put that message dialog on top of the window my widget is in then I need access to the parent gtk.window. Is there a way to get the parent GTK window? Thanks

link|edit|flag


2 Answers

The GTK docs suggest:

   GtkWidget *toplevel = gtk_widget_get_toplevel (widget);    if (gtk_widget_is_toplevel (toplevel))      {        /* Perform action on toplevel. */      } 

get_toplevel will return the topmost widget you're inside, whether or not it's a window, thus the is_toplevel check. Yeah something is mis-named since the code above does a "get_toplevel()" then an immediate "is_toplevel()" (most likely, get_toplevel() should be called something else).

link|edit|flag


Though gtk_widget_get_toplevel should work, you may also give a try to the code below. It should get the parent gtk window for the given widget and print it's title.

GdkWindow *gtk_window = gtk_widget_get_parent_window(widget); GtkWindow *parent = NULL; gdk_window_get_user_data(gtk_window, (gpointer *)&parent); g_print("%s\n", gtk_window_get_title(parent)); 

hope this helps, regards

link|edit|flag


This takes a needless detour through low-level GDK gunge - better to stay with the GTK layer. Here you require the widget to be realized, and will likely have issues in GTK 3.Havoc P Feb 24 at 2:49