seed r751 - trunk/examples/browser
- From: hortont svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r751 - trunk/examples/browser
- Date: Thu, 15 Jan 2009 00:33:15 +0000 (UTC)
Author: hortont
Date: Thu Jan 15 00:33:15 2009
New Revision: 751
URL: http://svn.gnome.org/viewvc/seed?rev=751&view=rev
Log:
Working on new browser.
Modified:
trunk/examples/browser/BrowserTab.js
trunk/examples/browser/BrowserView.js
trunk/examples/browser/Makefile.am
trunk/examples/browser/TabbedBrowser.js
Modified: trunk/examples/browser/BrowserTab.js
==============================================================================
--- trunk/examples/browser/BrowserTab.js (original)
+++ trunk/examples/browser/BrowserTab.js Thu Jan 15 00:33:15 2009
@@ -1,11 +1,21 @@
BrowserTab = new GType({
parent: Gtk.VBox.type,
name: "BrowserTab",
+ class_init: function(klass, prototype)
+ {
+ // TODO: Robb is promising a prettier interface to this.
+ klass.c_install_property(GObject.param_spec_object("web_view",
+ "WebView",
+ "WebView to display",
+ BrowserView.type,
+ GObject.ParamFlags.READABLE |
+ GObject.ParamFlags.WRITABLE));
+ },
init: function (klass)
{
// Private
var toolbar = new BrowserToolbar();
- var web_view = new BrowserView();
+ var local_web_view;
var scroll_view = new Gtk.ScrolledWindow();
var tab_label;
@@ -14,10 +24,10 @@
{
return toolbar;
};
-
+
this.get_web_view = function ()
{
- return web_view;
+ return local_web_view;
};
this.set_tab_label = function (new_tab_label)
@@ -31,10 +41,20 @@
};
// Implementation
- web_view.set_tab(this);
+ if(this.web_view == null)
+ {
+ Seed.print("creating new webview");
+ local_web_view = new BrowserView();
+ }
+ else
+ {
+ local_web_view = this.web_view;
+ }
+
+ local_web_view.set_tab(this);
scroll_view.smooth_scroll = true;
- scroll_view.add(web_view);
+ scroll_view.add(local_web_view);
scroll_view.set_policy(Gtk.PolicyType.AUTOMATIC,
Gtk.PolicyType.AUTOMATIC);
Modified: trunk/examples/browser/BrowserView.js
==============================================================================
--- trunk/examples/browser/BrowserView.js (original)
+++ trunk/examples/browser/BrowserView.js Thu Jan 15 00:33:15 2009
@@ -6,6 +6,18 @@
// Private
var tab;
+ var install_signals = function (web_view)
+ {
+ Seed.print("connecting");
+
+ web_view.set_scroll_adjustments(null, null);
+ web_view.signal.title_changed.connect(update_title);
+ web_view.signal.load_committed.connect(update_url);
+ web_view.signal.create_web_view.connect(create_new_tab);
+
+ Seed.print("connected");
+ }
+
var update_title = function (web_view, web_frame, title)
{
if(title.length > 25)
@@ -23,6 +35,20 @@
toolbar.set_can_go_forward(web_view.can_go_forward());
};
+ var create_new_tab = function (web_view, web_frame, new_web_view)
+ {
+ new_web_view = new WebKit.WebView();
+ new_web_view.signal.web_view_ready.connect(show_new_tab);
+ return new_web_view;
+ }
+
+ var show_new_tab = function (new_web_view)
+ {
+ Seed.print("new tab!");
+ //install_signals(new_web_view);
+ browser.new_tab("", new_web_view);
+ };
+
// Public
this.browse = function (url)
{
@@ -43,8 +69,6 @@
};
// Implementation
- this.set_scroll_adjustments(null, null);
- this.signal.title_changed.connect(update_title);
- this.signal.load_committed.connect(update_url);
+ install_signals(this);
}
});
Modified: trunk/examples/browser/Makefile.am
==============================================================================
--- trunk/examples/browser/Makefile.am (original)
+++ trunk/examples/browser/Makefile.am Thu Jan 15 00:33:15 2009
@@ -2,10 +2,20 @@
browserdir = $(datadir)/doc/seed/examples/browser
browser_DATA = \
COPYING \
- browser.js
+ BrowserSettings.js \
+ BrowserTab.js \
+ BrowserToolbar.js \
+ BrowserView.js \
+ TabbedBrowser.js \
+ main.js
endif
EXTRA_DIST = \
COPYING \
- browser.js
+ BrowserSettings.js \
+ BrowserTab.js \
+ BrowserToolbar.js \
+ BrowserView.js \
+ TabbedBrowser.js \
+ main.js
Modified: trunk/examples/browser/TabbedBrowser.js
==============================================================================
--- trunk/examples/browser/TabbedBrowser.js (original)
+++ trunk/examples/browser/TabbedBrowser.js Thu Jan 15 00:33:15 2009
@@ -15,10 +15,17 @@
}
};
- this.new_tab = function (url)
+ this.new_tab = function (url, new_web_view)
{
- var new_tab = new BrowserTab();
- new_tab.get_web_view().browse(url);
+ var new_tab;
+
+ if(new_web_view)
+ new_tab = new BrowserTab({"web_view":new_web_view});
+ else
+ new_tab = new BrowserTab();
+
+ if(!new_web_view)
+ new_tab.get_web_view().browse(url);
var tab_label = new Gtk.Label({label:"Untitled"});
var tab_button = new Gtk.Button({relief: Gtk.ReliefStyle.NONE});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]