[gnome-devel-docs] platform-demos: organisational changes and updated Makefile.am



commit 665b0d116ae1655527b59d9d10e8bab1a2e6218a
Author: Tiffany Antopolski <tiffany antopolski gmail com>
Date:   Thu Apr 12 18:25:01 2012 -0400

    platform-demos: organisational changes and updated Makefile.am

 .../C/{guitar.js.page => guitar-tuner.js.page}     |    9 ++-
 platform-demos/C/guitar-tuner/guitar-tuner.js      |   74 ++++++++++++++++++++
 platform-demos/C/media/guitar-tuner.png            |  Bin 5677 -> 10344 bytes
 platform-demos/C/media/guitarJs.png                |  Bin 10344 -> 0 bytes
 platform-demos/Makefile.am                         |   24 ++++--
 5 files changed, 97 insertions(+), 10 deletions(-)
---
diff --git a/platform-demos/C/guitar.js.page b/platform-demos/C/guitar-tuner.js.page
similarity index 97%
rename from platform-demos/C/guitar.js.page
rename to platform-demos/C/guitar-tuner.js.page
index fa63499..dc1adfc 100644
--- a/platform-demos/C/guitar.js.page
+++ b/platform-demos/C/guitar-tuner.js.page
@@ -1,6 +1,6 @@
 <page xmlns="http://projectmallard.org/1.0/";
       type="guide" style="task"
-      id="guitar.js">
+      id="guitar-tuner.js">
   <info>
     <link type="guide" xref="index#js"/>
     <revision version="0.1" date="2012-03-09" status="stub"/>
@@ -31,7 +31,7 @@
     </list> 
   </synopsis>
   <p>After reading this tutorial, you should see this in your screen:</p>
-  <media type="image" mime="image/png" src="media/guitarJs.png"/>
+  <media type="image" mime="image/png" src="media/guitar-tuner.png"/>
   <section id="gstreamer">
     <title>GStreamer pipelines</title>
     <p>GStreamer is GNOME's multimedia framework &#x2014; you can use it for playing, recording, and processing video, audio, webcam streams and the like. Here, we'll be using it to produce single-frequency tones.</p>
@@ -227,6 +227,11 @@ Gtk.main();]]></code>
   <title>Running the application form Terminal</title>
   <p>To run this application open Terminal, go to the folder where your application is stored and then run</p> <screen> <output style="prompt">$ </output><input> GJS_PATH=`pwd` gjs guitarTuner.js</input> </screen>
     </section>
+
+<section id="impl">
+ <title>Reference Implementation</title>
+ <p>If you run into problems with the tutorial, compare your code with this <link href="guitar-tuner/guitar-tuner.js">reference code</link>.</p>
+</section>
   
  
 </page>
diff --git a/platform-demos/C/guitar-tuner/guitar-tuner.js b/platform-demos/C/guitar-tuner/guitar-tuner.js
new file mode 100644
index 0000000..8e6e0e6
--- /dev/null
+++ b/platform-demos/C/guitar-tuner/guitar-tuner.js
@@ -0,0 +1,74 @@
+#!/usr/bin/gjs
+var Gtk = imports.gi.Gtk;
+var Gst = imports.gi.Gst;
+
+const Mainloop = imports.mainloop;
+
+Gtk.init(null, 0);
+Gst.init(null, 0);
+
+var guitarwindow = new Gtk.Window({type: Gtk.WindowType.TOPLEVEL, border_width: 100});
+guitarwindow.title = "Guitar Tuner";
+guitarwindow.connect("destroy", function(){Gtk.main_quit()});
+
+var guitar_box = new Gtk.ButtonBox ({orientation: Gtk.Orientation.VERTICAL, spacing: 10});
+
+var E = new Gtk.Button({label: "E"});
+var A = new Gtk.Button({label: "A"});
+var D = new Gtk.Button({label: "D"});
+var G = new Gtk.Button({label: "G"});
+var B = new Gtk.Button({label: "B"});
+var e = new Gtk.Button({label: "e"});
+
+var frequencies = {E: 369.23, A: 440,	D: 587.33,	G: 783.99,	B: 987.77,	e: 1318.5}
+
+
+function playSound(frequency){
+  var pipeline = new Gst.Pipeline({name: "note"});
+
+  var source = new Gst.ElementFactory.make("audiotestsrc","source");
+  var sink = new Gst.ElementFactory.make("autoaudiosink","output");
+    
+  source.set_property('freq', frequency);
+  pipeline.add(source);
+  pipeline.add(sink);
+  source.link(sink);
+  pipeline.set_state(Gst.State.PLAYING);
+
+  Mainloop.timeout_add(500, function () { 
+    pipeline.set_state(Gst.State.PAUSED);
+	  return false;
+});	
+}
+
+E.connect("clicked", function() {
+  playSound(frequencies.E);
+});
+A.connect("clicked", function(){
+  playSound(frequencies.A);
+});
+D.connect("clicked", function(){
+  playSound(frequencies.D);
+});
+G.connect("clicked", function(){
+  playSound(frequencies.G);
+});
+B.connect("clicked", function(){
+  playSound(frequencies.B);
+});
+e.connect("clicked", function(){
+  playSound(frequencies.e);
+});
+
+guitar_box.add(E);
+guitar_box.add(A);
+guitar_box.add(D);
+guitar_box.add(G);
+guitar_box.add(B);
+guitar_box.add(e);
+
+guitarwindow.add(guitar_box);
+
+guitar_box.show_all();
+guitarwindow.show();
+Gtk.main();
diff --git a/platform-demos/C/media/guitar-tuner.png b/platform-demos/C/media/guitar-tuner.png
index 42dac73..aeabd8e 100644
Binary files a/platform-demos/C/media/guitar-tuner.png and b/platform-demos/C/media/guitar-tuner.png differ
diff --git a/platform-demos/Makefile.am b/platform-demos/Makefile.am
index 6f49dbb..787febb 100644
--- a/platform-demos/Makefile.am
+++ b/platform-demos/Makefile.am
@@ -8,6 +8,7 @@ demo_sources = \
 	audio-player/audio-player.vala \
 	guitar-tuner/guitar-tuner.c \
 	guitar-tuner/guitar-tuner.cc \
+	guitar-tuner/guitar-tuner.js \
 	guitar-tuner/guitar-tuner.py \
 	guitar-tuner/guitar-tuner.vala \
 	image-viewer/image-viewer.c \
@@ -24,39 +25,45 @@ demo_sources = \
 
 DOC_FIGURES = \
 	media/ubuntu.png			\
+	media/button.png			\
 	media/button_with_progress_bar.png	\
-	media/entry.png			\
+	media/entry.png				\
 	media/fedora.png			\
 	media/opensuse.png			\
-	media/guitarJs.png			\
 	media/guitar-tuner.png			\
 	media/guitar-tuner-glade.png		\
 	media/guitar-tuner-pipeline.png		\
 	media/helloWorldJs.png		\
 	media/image-viewer.png			\
+	media/magic-mirror.png			\
 	media/message-board.ogv			\
+	media/messagedialog.png			\
 	media/photo-wall.png			\
 	media/photo-wall-focused.png		\
 	media/record-collection.png		\
 	media/toolbar.png		\
 	media/magic-mirror.png			\
 	media/weatherAppJs.png			\
+	media/window.png
 	$(demo_sources)
 
 DOC_PAGES =				\
 	audio-player.vala.page		\
+	beginner.c.page			\
+	beginner.js.page		\
+	beginner.py.page		\
 	beginner.vala.page		\
 	bug-filing.page			\
 	button.js.page			\
-	button.vala.page
-	documentation.page		\
+	button.vala.page		\
 	desktop.js.page		\
-	beginner.js.page		\
+	dialog.vala.page		\
+	documentation.page		\
 	entry.js.page		\
 	getting-ready.page		\
 	guitar-tuner.c.page		\
 	guitar-tuner.cpp.page		\
-	guitar.js.page		\
+	guitar-tuner.js.page		\
 	guitar-tuner.py.page		\
 	guitar-tuner.vala.page		\
 	helloWorld.js.page  \
@@ -68,14 +75,15 @@ DOC_PAGES =				\
 	index.page			\
 	magic-mirror.vala.page		\
 	message-board.c.page		\
+	messagedialog.vala.page		\
 	toolbar.js.page		\
-	toolabar.vala.page		\
 	photo-wall.c.page		\
 	record-collection.js.page		\
 	translate.page		\
 	weatherApp.js.page		\
 	weatherAppMain.js.page		\
 	weatherAutotools.js.page		\
-	weatherGeonames.js.page
+	weatherGeonames.js.page		\
+	window.vala.page
 
 dist-hook: doc-dist-hook



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