seed r560 - trunk/doc/tutorial-standalone



Author: hortont
Date: Wed Dec 24 07:38:21 2008
New Revision: 560
URL: http://svn.gnome.org/viewvc/seed?rev=560&view=rev

Log:
Push tutorial stuff.


Modified:
   trunk/doc/tutorial-standalone/1.js
   trunk/doc/tutorial-standalone/2.js

Modified: trunk/doc/tutorial-standalone/1.js
==============================================================================
--- trunk/doc/tutorial-standalone/1.js	(original)
+++ trunk/doc/tutorial-standalone/1.js	Wed Dec 24 07:38:21 2008
@@ -13,26 +13,26 @@
         var back_button = new Gtk.ToolButton({stock_id:"gtk-go-back"});
         var forward_button = new Gtk.ToolButton({stock_id:"gtk-go-forward"});
         var refresh_button = new Gtk.ToolButton({stock_id:"gtk-refresh"});
-        
+
         var back = function ()
         {
             Seed.print("back");
-        }
-        
+        };
+
         var forward = function ()
         {
             Seed.print("forward");
-        }
-        
+        };
+
         var refresh = function ()
         {
             Seed.print("refresh");
-        }
-        
+        };
+
         var browse = function ()
         {
             Seed.print("browse");
-        }
+        };
 
         back_button.signal.clicked.connect(back);
         forward_button.signal.clicked.connect(forward);
@@ -48,7 +48,7 @@
 });
 
 window = new Gtk.Window({title: "Browser"});
-window.signal.hide.connect(function () { Gtk.main_quit() });
+window.signal.hide.connect(function () { Gtk.main_quit(); });
 window.add(new BrowserToolbar());
 window.show_all();
 

Modified: trunk/doc/tutorial-standalone/2.js
==============================================================================
--- trunk/doc/tutorial-standalone/2.js	(original)
+++ trunk/doc/tutorial-standalone/2.js	Wed Dec 24 07:38:21 2008
@@ -9,16 +9,16 @@
     name: "BrowserTab",
     instance_init: function(klass)
     {
-        var toolbar = new BrowserToolbar();
-        var web_view = new BrowserView();
+	var toolbar = new BrowserToolbar();
+	var web_view = new BrowserView();
 
-		this.get_web_view = function()
-		{
-			return web_view;
-		}
-        
-        this.pack_start(toolbar);
-        this.pack_start(web_view, true, true);
+	this.get_web_view = function()
+	{
+	    return web_view;
+	};
+
+	this.pack_start(toolbar);
+	this.pack_start(web_view, true, true);
     }
 });
 
@@ -27,7 +27,13 @@
     name: "BrowserView",
     instance_init: function(klass)
     {
-        
+	this.browse = function (url)
+	{
+	    if(url.search("://") < 0)
+		url = "http://"; + url;
+
+	    this.open(url);
+	};
     }
 });
 
@@ -36,52 +42,48 @@
     name: "BrowserToolbar",
     instance_init: function(klass)
     {
-        var url_bar = new Gtk.Entry();
+	var url_bar = new Gtk.Entry();
 
-        var back_button = new Gtk.ToolButton({stock_id:"gtk-go-back"});
-        var forward_button = new Gtk.ToolButton({stock_id:"gtk-go-forward"});
-        var refresh_button = new Gtk.ToolButton({stock_id:"gtk-refresh"});
-        
-        var back = function ()
-        {
-			tab.get_web_view().go_back();
-        }
-        
-        var forward = function ()
-        {
-            tab.get_web_view().go_forward();
-        }
-        
-        var refresh = function ()
-        {
-            tab.get_web_view().reload();
-        }
-        
-        var browse = function (url)
-        {
-			if(url.text.search("://") < 0)
-			{
-				url.text = "http://"; + url.text;
-			}
-
-			tab.get_web_view().open(url.text);
-        }
-
-        back_button.signal.clicked.connect(back);
-        forward_button.signal.clicked.connect(forward);
-        refresh_button.signal.clicked.connect(refresh);
-        url_bar.signal.activate.connect(browse);
-
-        this.pack_start(back_button);
-        this.pack_start(forward_button);
-        this.pack_start(refresh_button);
+	var back_button = new Gtk.ToolButton({stock_id:"gtk-go-back"});
+	var forward_button = new Gtk.ToolButton({stock_id:"gtk-go-forward"});
+	var refresh_button = new Gtk.ToolButton({stock_id:"gtk-refresh"});
+
+	var back = function ()
+	{
+	    tab.get_web_view().go_back();
+	};
+
+	var forward = function ()
+	{
+	    tab.get_web_view().go_forward();
+	};
+
+	var refresh = function ()
+	{
+	    tab.get_web_view().reload();
+	};
+
+	var browse = function (url)
+	{
+	    Seed.print(tab.get_web_view().browse_f);
+	    tab.get_web_view().browse(url.text);
+	};
+
+	back_button.signal.clicked.connect(back);
+	forward_button.signal.clicked.connect(forward);
+	refresh_button.signal.clicked.connect(refresh);
+	url_bar.signal.activate.connect(browse);
+
+	this.pack_start(back_button);
+	this.pack_start(forward_button);
+	this.pack_start(refresh_button);
 
-        this.pack_start(url_bar, true, true);
+	this.pack_start(url_bar, true, true);
     }
 });
 
 window = new Gtk.Window({title: "Browser"});
-window.signal.hide.connect(function () { Gtk.main_quit() });
+window.signal.hide.connect(function () { Gtk.main_quit(); });
 
 var tab = new BrowserTab();
 window.add(tab);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]