[seed] docs: Document the one function in the gtkbuilder module, and also provide an example



commit 432a7af563f91abd55585aff85e727afdddb235a
Author: Robert Carr <racarr svn gnome org>
Date:   Wed May 20 22:36:17 2009 -0400

    docs: Document the one function in the gtkbuilder module, and also provide an example
---
 doc/modules/gtkbuilder/Makefile.am    |    6 ++++--
 doc/modules/gtkbuilder/example.js     |   24 ++++++++++++++++++++++++
 doc/modules/gtkbuilder/example.ui     |   24 ++++++++++++++++++++++++
 doc/modules/gtkbuilder/gtkbuilder.js  |    7 ++++++-
 doc/modules/gtkbuilder/gtkbuilder.xml |    8 +++-----
 5 files changed, 61 insertions(+), 8 deletions(-)

diff --git a/doc/modules/gtkbuilder/Makefile.am b/doc/modules/gtkbuilder/Makefile.am
index 0558b73..026f530 100644
--- a/doc/modules/gtkbuilder/Makefile.am
+++ b/doc/modules/gtkbuilder/Makefile.am
@@ -1,7 +1,9 @@
 EXTRA_DIST = \
-	gtkbuilder.js
+	gtkbuilder.js \
+	example.ui \
+	example.js
 
-gtkbuilder-funcs.xml: $(top_builddir)/src/seed gtkbuilder.js
+gtkbuilder-funcs.xml: $(top_builddir)/src/seed gtkbuilder.js example.ui example.js
 	$(top_builddir)/src/seed ../make-functions.js gtkbuilder.js > gtkbuilder-funcs.xml
 CLEANFILES=gtkbuilder-funcs.xml
 
diff --git a/doc/modules/gtkbuilder/example.js b/doc/modules/gtkbuilder/example.js
new file mode 100755
index 0000000..f167329
--- /dev/null
+++ b/doc/modules/gtkbuilder/example.js
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<programlisting>
+#!/usr/local/bin/seed
+Gtk = imports.gi.Gtk;
+GtkBuilder = imports.gtkbuilder;
+
+handlers = {
+    ok_button_clicked: function(button){
+	Seed.quit();
+    }
+};
+
+Gtk.init(Seed.argv);
+
+b = new Gtk.Builder();
+b.add_from_file("test.ui");
+b.connect_signals(handlers);
+
+d = b.get_object("dialog1");
+
+d.show_all();
+
+Gtk.main();
+</programlisting>
diff --git a/doc/modules/gtkbuilder/example.ui b/doc/modules/gtkbuilder/example.ui
new file mode 100644
index 0000000..02ca7ae
--- /dev/null
+++ b/doc/modules/gtkbuilder/example.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<programlisting>
+&lt;interface&gt;
+  &lt;object class="GtkDialog" id="dialog1"&gt;
+    &lt;child internal-child="vbox"&gt;
+      &lt;object class="GtkVBox" id="vbox1"&gt;
+        &lt;property name="border-width"&gt;10&lt;/property&gt;
+        &lt;child internal-child="action_area"&gt;
+          &lt;object class="GtkHButtonBox" id="hbuttonbox1"&gt;
+            &lt;property name="border-width"&gt;20&lt;/property&gt;
+            &lt;child&gt;
+              &lt;object class="GtkButton" id="ok_button"&gt;
+                &lt;property name="label"&gt;gtk-ok&lt;/property&gt;
+                &lt;property name="use-stock"&gt;TRUE&lt;/property&gt;
+                &lt;signal name="clicked" handler="ok_button_clicked"/&gt;
+              &lt;/object&gt;
+            &lt;/child&gt;
+          &lt;/object&gt;
+        &lt;/child&gt;
+      &lt;/object&gt;
+    &lt;/child&gt;
+  &lt;/object&gt;
+&lt;/interface&gt;
+</programlisting>
diff --git a/doc/modules/gtkbuilder/gtkbuilder.js b/doc/modules/gtkbuilder/gtkbuilder.js
index 3de4e9a..438d9ce 100644
--- a/doc/modules/gtkbuilder/gtkbuilder.js
+++ b/doc/modules/gtkbuilder/gtkbuilder.js
@@ -1,5 +1,10 @@
 funcs = [{id: "gtkbuilder-connect-signals",
 	  title: "builder.connect_signals (object, user_data)",
-	  description: "Connects signals"
+	  description: "Connects the signals present in the GtkBuilder to the functions present in <parameter>object</parameter>. That is to say, a signal with handler name, 'ok_button_clicked' will be connected to the 'ok_button_clicked' property of object.",
+	  params: [
+	      {name: "object", description: "The object containing the signal handlers"},
+	      {name: "user_data", description: "The user_data to use in connecting the signals"}
+	      ]
+
 	 }]
 
diff --git a/doc/modules/gtkbuilder/gtkbuilder.xml b/doc/modules/gtkbuilder/gtkbuilder.xml
index aae9250..827853e 100644
--- a/doc/modules/gtkbuilder/gtkbuilder.xml
+++ b/doc/modules/gtkbuilder/gtkbuilder.xml
@@ -27,11 +27,9 @@
   <section>
     <title>Examples</title>
     <para>Below are several examples of using the Seed GtkBuilder module. For additional resources, consult the examples/ folder of the Seed source</para>
-    <example id="GtkBuilder-repl-example">
-      <para>This demonstrates basic usage of GtkBuilder automatic signal connection.</para>
-      <programlisting>
-
-      </programlisting>
+    <example id="GtkBuilder-xml-example">
+      <xi:include href="example.ui"/>
+      <xi:include href="example.js"/>
     </example>
   </section>
 </chapter>



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