Permalink
Browse files

2008-05-16 Everaldo Canuto <ecanuto@novell.com>

	* sources/Makefile.am: Add carriage return to .h fix routine.

	* sources/webkit-sharp.metadata: Add WebView signals.

	* samples/FunnyBrowser.cs: Improved sample browse:
	- Add toolbar buttons back, forward, stop and refresh.
	- Add URI entry to type addresses.
	- Show links on status bar using mouse over events.


svn path=/trunk/webkit-sharp/; revision=103351
  • Loading branch information...
1 parent fbe1024 commit 5c356ce63880643e201ac6663508325d3581d52b Everaldo Canuto committed May 16, 2008
Showing with 345 additions and 35 deletions.
  1. +11 −0 ChangeLog
  2. +156 −26 samples/FunnyBrowser.cs
  3. +2 −2 sources/Makefile.am
  4. +176 −7 sources/webkit-sharp.metadata
View
@@ -1,3 +1,14 @@
+2008-05-16 Everaldo Canuto <ecanuto@novell.com>
+
+ * sources/Makefile.am: Add carriage return to .h fix routine.
+
+ * sources/webkit-sharp.metadata: Add WebView signals.
+
+ * samples/FunnyBrowser.cs: Improved sample browse:
+ - Add toolbar buttons back, forward, stop and refresh.
+ - Add URI entry to type addresses.
+ - Show links on status bar using mouse over events.
+
2008-05-12 Everaldo Canuto <ecanuto@novell.com>
* sources/webkit-sharp.dll.config.in: Dll map added to webkit.
View
@@ -52,61 +52,191 @@ public class MainWindow: Gtk.Window
const string APP_NAME = "FunnyBrowser";
private string url = "http://www.google.com/";
- private Toolbar toolbar = null;
+
+ private Gtk.VBox vbox = null;
+ private Gtk.Toolbar toolbar = null;
+ private Gtk.Toolbar findbar = null;
+ private Gtk.Entry uri_entry = null;
+ private Gtk.Entry find_entry = null;
private WebKit.WebView webview = null;
private Gtk.Statusbar statusbar = null;
+
+ private Gtk.Action action_back;
+ private Gtk.Action action_forward;
+ private Gtk.Action action_reload;
+ private Gtk.Action action_stop;
+ private Gtk.Action action_jump;
public MainWindow (string url): base (Gtk.WindowType.Toplevel)
{
if (url != "")
this.url = url;
- InitializeWidgets ();
+ CreateWidgets ();
webview.Open (this.url);
}
- private void InitializeWidgets ()
+ private void CreateWidgets ()
{
- this.Title = "";
+ this.Title = APP_NAME;
this.SetDefaultSize (700, 500);
this.DeleteEvent += new DeleteEventHandler (OnDeleteEvent);
- Gtk.VBox vbox = new VBox (false, 1);
+ CreateActions ();
+ CreateToolbar ();
+ CreateWebView ();
+ CreateFindbar ();
+ CreateStatusBar ();
+
+ Gtk.ScrolledWindow scroll = new Gtk.ScrolledWindow ();
+ scroll.Add (webview);
+ vbox = new Gtk.VBox (false, 1);
+ vbox.PackStart (toolbar, false, false, 0);
+ vbox.PackStart (scroll);
+ //vbox.PackStart (findbar, false, false, 0);
+ vbox.PackEnd (statusbar, false, true, 0);
+
+ this.Add (vbox);
+ this.ShowAll ();
+ }
+
+ private void CreateActions ()
+ {
+ action_back = new Gtk.Action("go-back", "Go Back", null, "gtk-go-back");
+ action_forward = new Gtk.Action("go-forward", "Go Forward", null, "gtk-go-forward");
+ action_reload = new Gtk.Action("reload", "Reload", null, "gtk-refresh");
+ action_stop = new Gtk.Action("stop", "Stop", null, "gtk-stop");
+ action_jump = new Gtk.Action("jump", "Jump", null, "gtk-jump-to");
+
+ action_back.Activated += new EventHandler(on_back_activate);
+ action_forward.Activated += new EventHandler(on_forward_activate);
+ action_reload.Activated += new EventHandler(on_reload_activate);
+ action_stop.Activated += new EventHandler(on_stop_activate);
+ action_jump.Activated += new EventHandler(on_uri_activate);
+ }
+
+ private void CreateToolbar ()
+ {
+ // UrlEntry
+ uri_entry = new Gtk.Entry ();
+ uri_entry.Activated += new EventHandler(on_uri_activate);
+
+ Gtk.ToolItem uri_item = new Gtk.ToolItem ();
+ uri_item.Expand = true;
+ uri_item.Add (uri_entry);
+
+ // Toolbar
toolbar = new Toolbar ();
- toolbar.ToolbarStyle = ToolbarStyle.Both;
+ toolbar.ToolbarStyle = ToolbarStyle.Icons;
toolbar.Orientation = Orientation.Horizontal;
toolbar.ShowArrow = true;
- vbox.PackStart (toolbar, false, false, 0);
+ // Toolbar Itens
+ toolbar.Add (action_back.CreateToolItem());
+ toolbar.Add (action_forward.CreateToolItem());
+ toolbar.Add (action_reload.CreateToolItem());
+ toolbar.Add (action_stop.CreateToolItem());
+ toolbar.Add (uri_item);
+ toolbar.Add (action_jump.CreateToolItem());
+ }
+
+ private void CreateWebView ()
+ {
webview = new WebView ();
+ webview.Editable = false;
+ webview.TitleChanged += new TitleChangedHandler (OnTitleChanged);
+ webview.HoveringOverLink += new HoveringOverLinkHandler (OnHoveringOverLink);
+ webview.LoadCommitted += new LoadCommittedHandler (OnLoadCommitted);
+ webview.LoadFinished += new LoadFinishedHandler (OnLoadFinished);
+ }
- Gtk.ScrolledWindow scroll = new Gtk.ScrolledWindow ();
- scroll.Add (webview);
- scroll.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
- vbox.PackStart (scroll);
-
+ private void CreateStatusBar ()
+ {
statusbar = new Gtk.Statusbar ();
- vbox.PackEnd (statusbar, false, true, 0);
+ }
- this.Add (vbox);
- this.ShowAll ();
+ private void CreateFindbar ()
+ {
+ // FindEntry
+ find_entry = new Gtk.Entry ();
+ //find_entry.Activated += new EventHandler(on_uri_activate);
+
+ Gtk.ToolItem find_item = new Gtk.ToolItem ();
+ //find_item.Expand = true;
+ find_item.Add (find_entry);
+
+ // Toolbar
+ findbar = new Toolbar ();
+ findbar.ToolbarStyle = ToolbarStyle.Icons;
+ findbar.Orientation = Orientation.Horizontal;
+ findbar.ShowArrow = true;
+
+ // Toolbar Itens
+ findbar.Add (action_stop.CreateToolItem());
+ findbar.Add (find_item);
+ findbar.Add (action_back.CreateToolItem());
+ findbar.Add (action_forward.CreateToolItem());
+ }
+
+ protected void OnDeleteEvent (object sender, DeleteEventArgs args)
+ {
+ Application.Quit ();
+ args.RetVal = true;
+ }
+
+ private void OnTitleChanged (object o, TitleChangedArgs args)
+ {
+ if (args.Title == String.Empty)
+ this.Title = APP_NAME;
+ else
+ this.Title = String.Format ("{0} - {1}", args.Title, APP_NAME);
}
- /*public string Caption
+ private void OnHoveringOverLink (object o, HoveringOverLinkArgs args)
{
- get { return base.Title; }
- set {
- string fmt_str = (value != "") ? "{1} - {0}" : "{0}";
-
- base.Title = String.Format (fmt_str, APP_NAME, value);
+ statusbar.Pop (1);
+ if (args.Link != null) {
+ statusbar.Push (1, args.Link);
}
- }*/
-
- protected void OnDeleteEvent (object sender, DeleteEventArgs a)
+ }
+
+ private void OnLoadCommitted (object o, LoadCommittedArgs args)
{
- Application.Quit ();
- a.RetVal = true;
+ action_back.Sensitive = webview.CanGoBack ();
+ action_forward.Sensitive = webview.CanGoForward ();
+
+ uri_entry.Text = args.Frame.Uri;
+ }
+
+ private void OnLoadFinished (object o, LoadFinishedArgs args)
+ {
+ //
+ }
+
+ private void on_back_activate (object o, EventArgs args)
+ {
+ webview.GoBack ();
+ }
+
+ private void on_forward_activate (object o, EventArgs args)
+ {
+ webview.GoForward ();
+ }
+
+ private void on_reload_activate (object o, EventArgs args)
+ {
+ webview.Reload ();
+ }
+
+ private void on_stop_activate (object o, EventArgs args)
+ {
+ webview.StopLoading ();
+ }
+
+ private void on_uri_activate (object o, EventArgs args)
+ {
+ webview.Open (uri_entry.Text);
}
}
}
View
@@ -32,10 +32,10 @@ all: generated-stamp $(ASSEMBLY)
get-sources:
cp -rf /usr/include/webkit-1.0 .
@for file in webkit-1.0/webkit/*.h; do \
- sed -i -e 's,WEBKIT_API ,/*WEBKIT_API*/ ,' $$file; \
+ sed -i -e 's,^WEBKIT_API ,/*WEBKIT_API*/\r,' $$file; \
done
@for file in webkit-1.0/JavaScriptCore/*.h; do \
- sed -i -e 's,JS_EXPORT ,/*JS_EXPORT*/ ,' $$file; \
+ sed -i -e 's,^JS_EXPORT ,/*JS_EXPORT*/\r,' $$file; \
done
api: get-sources
Oops, something went wrong.

0 comments on commit 5c356ce

Please sign in to comment.