seed r554 - in trunk/doc: . tutorial-standalone



Author: hortont
Date: Tue Dec 23 09:55:10 2008
New Revision: 554
URL: http://svn.gnome.org/viewvc/seed?rev=554&view=rev

Log:
New GType inheritance indentation/syntax style.


Modified:
   trunk/doc/runtime.html
   trunk/doc/tutorial-standalone/1.js

Modified: trunk/doc/runtime.html
==============================================================================
--- trunk/doc/runtime.html	(original)
+++ trunk/doc/runtime.html	Tue Dec 23 09:55:10 2008
@@ -200,21 +200,22 @@
 To implement a new GType, an object describing the type is required.
 </p>
 <pre>
-  NewType = {
-     parent: ParentTypeConstructor,
-     name: "NewTypeName",
-     class_init: function(klass, prototype)
-     {
-     },
-     instance_init: function(klass)
-     {
-     }}
+NewType = {
+    parent: ParentTypeConstructor,
+    name: "NewTypeName",
+    class_init: function(klass, prototype)
+    {
+    },
+    instance_init: function(klass)
+    {
+    }
+}
 </pre>
 <p>
 Indicates that the new type derives from ParentType, i.e. Gtk.Window, with name "NewTypeName". The class_init function is called when the class comes in to existence, and allows you to add to the prototype of objects constructed by the type. The instance_init function is called on the creation of each instance, with the "this" variable set to the new instance. An example type:
 </p>
 <pre>
-HelloLabelType = {
+HelloLabel = new GType({
     parent: Gtk.Label,
     name: "HelloLabel",
     class_init: function(klass, prototype)
@@ -228,11 +229,11 @@
     instance_init: function(klass)
     {
         this.label = "Hello"; // Hello Labels Always Say Hello.
-    }};
+    }
+});
 </pre>
-<p> Now to create a constructor, and instance of the object: </p>
+<p> Now to create an instance of the object:</p>
 <pre>
-HelloLabel = new GType(HelloLabelType);
 label = new HelloLabel();
 box.pack_start(label);
 label.show();
@@ -266,7 +267,7 @@
 For example: 
 </p>
 <pre>
-HelloWindowType = {       
+HelloWindow = new GType({       
     parent: Gtk.Window.type,
     name: "HelloWindow",
     class_init: function(klass, prototype)
@@ -278,9 +279,8 @@
 
         hello_signal_id = klass.install_signal(HelloSignalDefinition);
     },
-}
+});
 
-HelloWindow = new GType(HelloWindowType);
 w = new HelloWindow();
 
 w.signal.hello.connect(function(object, number, string)

Modified: trunk/doc/tutorial-standalone/1.js
==============================================================================
--- trunk/doc/tutorial-standalone/1.js	(original)
+++ trunk/doc/tutorial-standalone/1.js	Tue Dec 23 09:55:10 2008
@@ -3,7 +3,7 @@
 Seed.import_namespace("Gtk");
 Gtk.init(null, null);
 
-BrowserToolbarType = {
+BrowserToolbar = new GType({
     parent: Gtk.HBox.type,
     name: "BrowserToolbar",
     instance_init: function(klass)
@@ -45,8 +45,7 @@
 
         this.pack_start(urlBar, true, true);
     }
-};
-BrowserToolbar = new GType(BrowserToolbarType);
+});
 
 window = new Gtk.Window({title: "Browser"});
 window.signal.hide.connect(function () { Gtk.main_quit() });



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