[seed] Start randomly updating a few examples



commit a929363e82a8d8071aa2d3d53d4e4684e523a636
Author: Robert Carr <racarr mireia (none)>
Date:   Sun Apr 12 11:21:54 2009 -0400

    Start randomly updating a few examples
---
 examples/calculator.js |   26 +++++++++++++-------------
 examples/gtkplug.js    |   11 ++++++-----
 examples/video.js      |    6 +++---
 examples/vte-test.js   |    6 +++---
 4 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/examples/calculator.js b/examples/calculator.js
index c7f5e2f..430353d 100755
--- a/examples/calculator.js
+++ b/examples/calculator.js
@@ -1,8 +1,8 @@
 #!/usr/bin/env seed
 
-Seed.import_namespace("Gdk");
-Seed.import_namespace("Gtk");
-Seed.import_namespace("GLib");
+Gdk = imports.gi.Gdk;
+Gtk = imports.gi.Gtk;
+GLib = imports.gi.GLib;
 
 Gtk.init(null, null);
 
@@ -11,7 +11,7 @@ var calc_val = "";
 function update_display()
 {
 	label.set_markup("<span size='30000'>" + calc_val + "</span>");
-	
+
 	if(calc_val === "")
 	{
 		label.set_markup("<span size='30000'>0</span>");
@@ -58,25 +58,25 @@ function pressed_number(button)
 
 function swap_sign(button)
 {
-	calc_val = ((calc_val[0] == "-") ? 
+	calc_val = ((calc_val[0] == "-") ?
 		    calc_val.substring(1) : "-" + calc_val);
 	update_display();
 }
 
 function random_num()
 {
-	calc_val = Math.floor(Math.random() * 1000) + "";	
+	calc_val = Math.floor(Math.random() * 1000) + "";
 	update_display();
 }
 
 function pack_buttons(buttons, vbox)
 {
 	var hbox = new Gtk.HBox();
-	
+
 	hbox.homogeneous = true;
 
 	vbox.pack_start(hbox, true, true, 2);
-	
+
 	for(i = 0; i <= 4; i++)
 	{
 		hbox.pack_start(buttons[i], true, true, 1);
@@ -93,22 +93,22 @@ function create_button(str, func)
 function create_buttons()
 {
 	var vbox = new Gtk.VBox();
-	
+
 	vbox.homogeneous = true;
-	
+
 	pack_buttons([	create_button("(", pressed_number),
 						create_button("â??", backspace),
 						create_button("â?»", random_num),
 						create_button("Clr", clear),
 						create_button("±", swap_sign)], vbox);
-						
+
 
 	pack_buttons([	create_button(")", pressed_number),
 						create_button("7", pressed_number),
 						create_button("8", pressed_number),
 						create_button("9", pressed_number),
 						create_button("/", pressed_operator)], vbox);
-	
+
 	pack_buttons([	create_button("sin(", pressed_number),
 						create_button("4", pressed_number),
 						create_button("5", pressed_number),
@@ -120,7 +120,7 @@ function create_buttons()
 						create_button("2", pressed_number),
 						create_button("3", pressed_number),
 						create_button("-", pressed_operator)], vbox);
-	
+
 	pack_buttons([	create_button("tan(", pressed_number),
 						create_button("0", pressed_number),
 						create_button(".", pressed_number),
diff --git a/examples/gtkplug.js b/examples/gtkplug.js
index 8ffd43e..e54301d 100755
--- a/examples/gtkplug.js
+++ b/examples/gtkplug.js
@@ -1,7 +1,8 @@
 #!/usr/bin/env seed
-Seed.import_namespace("Gtk");
-Seed.import_namespace("Multiprocessing");
-Seed.import_namespace("Gio");
+Gtk = imports.gi.Gtk;
+Gio = imports.gi.Gio;
+Multiprocessing = imports.multiprocessing;
+
 
 var pipes = new Multiprocessing.Pipe();
 
@@ -10,12 +11,12 @@ var child_pid = Seed.fork();
 if (child_pid === 0)
 {
 	Gtk.init(null, null);
-	
+
 	var id = parseInt(pipes[0].read(), 10);
 
 	var label = new Gtk.Label({label: "Hello GtkPlug World"});
 	var plug = new Gtk.Plug.c_new(id);
-	
+
 	plug.add(label);
 	plug.show_all();
 	Gtk.main();
diff --git a/examples/video.js b/examples/video.js
index 7a689b0..a3544f0 100755
--- a/examples/video.js
+++ b/examples/video.js
@@ -1,7 +1,7 @@
 #!/usr/bin/env seed
-Seed.import_namespace("Gtk");
-Seed.import_namespace("Gst");
-Seed.import_namespace("GstVideo");
+Gtk = imports.gi.Gtk;
+Gst = imports.gi.Gst;
+GstVideo = imports.gi.GstVideo;
 
 Gtk.init(null, null);
 Gst.init(null, null);
diff --git a/examples/vte-test.js b/examples/vte-test.js
index 7f4ca2f..a7341ea 100755
--- a/examples/vte-test.js
+++ b/examples/vte-test.js
@@ -1,7 +1,7 @@
 #!/usr/bin/env seed
 
-Seed.import_namespace("Gtk","2.0");
-Seed.import_namespace("Vte");
+Gtk = imports.gi.Gtk;
+Vte = imports.gi.Vte;
 
 with (Gtk)
 {
@@ -9,7 +9,7 @@ with (Gtk)
 
 	var window = new Window();
 	window.signal.hide.connect(function () { Gtk.main_quit(); } );
-	
+
 	var scroll = new ScrolledWindow();
 
 	var vte = new Vte.Terminal();



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