[seed] Clean up formatting for a lot of the examples



commit 8f6084c7f2eea8db6ec3982459ffa3140bc3b7f0
Author: Robert Carr <racarr svn gnome org>
Date:   Tue Apr 28 13:41:51 2009 -0400

    Clean up formatting for a lot of the examples
---
 examples/Gnio-server.js     |   24 +++---
 examples/accelgroup.js      |   30 ++++----
 examples/actions.js         |   90 +++++++++++-----------
 examples/async-quine.js     |   14 ++--
 examples/calculator.js      |  148 +++++++++++++++++-----------------
 examples/clutter-0.8.js     |  154 ++++++++++++++++++------------------
 examples/clutter-0.9.js     |  160 +++++++++++++++++++-------------------
 examples/clutter-cogl.js    |  148 +++++++++++++++++-----------------
 examples/gdkpixbufloader.js |   38 +++++-----
 examples/gtkplug.js         |   14 ++--
 examples/json-packing.js    |   32 ++++----
 examples/ls.js              |    6 +-
 examples/notify-test.js     |    3 +-
 examples/poppler.js         |  184 +++++++++++++++++++++---------------------
 examples/repl.js            |   18 ++--
 15 files changed, 532 insertions(+), 531 deletions(-)

diff --git a/examples/Gnio-server.js b/examples/Gnio-server.js
index 39cf526..9a2221d 100755
--- a/examples/Gnio-server.js
+++ b/examples/Gnio-server.js
@@ -5,13 +5,13 @@ Seed.import_namespace("Gio");
 // I don't think this is the right way of doing things.
 var r = new Gnio.Resolver();
 var sock = new Gnio.Socket({domain: Gnio.SocketDomain.INET,
-						    type: Gnio.SocketType.STREAM});
+			    type: Gnio.SocketType.STREAM});
 
 
 var addr = r.lookup_name("localhost");
-						
+
 sock.bind(new Gnio.InetSocketAddress({address: addr,
- 				                      port: 9999}));
+ 				      port: 9999}));
 
 Seed.print("Echo server listening on port 9999");
 sock.listen(true);
@@ -26,15 +26,15 @@ os.put_string("Seed echo server. Type quit to quit.\n");
 
 while(1)
 {
-	var line = ds.read_line(null);
-        var cowsay = Seed.spawn("cowsay " + line);
-	if (line.search("quit") > -1)
-	{
-		client.close();
-		Seed.quit();
-	}
-	os.put_string(cowsay.stdout);
-	os.put_string("\n");
+    var line = ds.read_line(null);
+    var cowsay = Seed.spawn("cowsay " + line);
+    if (line.search("quit") > -1)
+    {
+	client.close();
+	Seed.quit();
+    }
+    os.put_string(cowsay.stdout);
+    os.put_string("\n");
 }
 
 
diff --git a/examples/accelgroup.js b/examples/accelgroup.js
index f2b9f49..71366b9 100755
--- a/examples/accelgroup.js
+++ b/examples/accelgroup.js
@@ -5,25 +5,25 @@ Gdk = imports.gi.Gdk;
 
 with (Gtk)
 {
-	init(null, null);
+    init(null, null);
 
-	var quit = function ()
-	{
-		main_quit();
-	};
+    var quit = function ()
+    {
+	main_quit();
+    };
 
-	var w = new Window();
-	w.signal.hide.connect(quit);
+    var w = new Window();
+    w.signal.hide.connect(quit);
 
-	var group = new AccelGroup();
-	group.connect(Gdk.keyval_from_name("q"), 0, 0, quit);
-	w.add_accel_group(group);
+    var group = new AccelGroup();
+    group.connect(Gdk.keyval_from_name("q"), 0, 0, quit);
+    w.add_accel_group(group);
 
-	var label = new Label({label: "Press Q to quit"});
-	w.add(label);
+    var label = new Label({label: "Press Q to quit"});
+    w.add(label);
 
-	w.resize(300, 300);
-	w.show_all();
+    w.resize(300, 300);
+    w.show_all();
 
-	main();
+    main();
 }
diff --git a/examples/actions.js b/examples/actions.js
index 87f84e2..0e02488 100755
--- a/examples/actions.js
+++ b/examples/actions.js
@@ -5,61 +5,61 @@ Gtk.init(null, null);
 
 with(Gtk)
 {
-	var window = new Window();
-	window.signal.hide.connect(function () { main_quit(); });
-	var toolbar = new Toolbar();
-	var vbox = new VBox();
-	window.add(vbox);
+    var window = new Window();
+    window.signal.hide.connect(function () { main_quit(); });
+    var toolbar = new Toolbar();
+    var vbox = new VBox();
+    window.add(vbox);
 
-	var actions = new ActionGroup({name: "toolbar"});
-	var accels = new AccelGroup();
+    var actions = new ActionGroup({name: "toolbar"});
+    var accels = new AccelGroup();
 
-	window.add_accel_group(accels);
+    window.add_accel_group(accels);
 
-	new_action = new Action({name:"new", label: "New",
-							 tooltip:"New File",
-							 stock_id:STOCK_NEW});
-	new_action.set_accel_group(accels);
-	actions.add_action_with_accel(new_action);
-	//Could pass string, but this makes it use default accelerator for STOCK_NEW
-	new_action.connect_accelerator();
-	new_action.signal.activate.connect(function () { Seed.print("New file"); });
+    new_action = new Action({name:"new", label: "New",
+			     tooltip:"New File",
+			     stock_id:STOCK_NEW});
+    new_action.set_accel_group(accels);
+    actions.add_action_with_accel(new_action);
+    //Could pass string, but this makes it use default accelerator for STOCK_NEW
+    new_action.connect_accelerator();
+    new_action.signal.activate.connect(function () { Seed.print("New file"); });
 
-	open_action = new Action({name:"open", label: "Open",
-							  tooltip:"Open File",
-							  stock_id:STOCK_OPEN});
-	open_action.set_accel_group(accels);
-	actions.add_action_with_accel(open_action);
-	open_action.connect_accelerator();
-	open_action.signal.activate.connect(function () { Seed.print("Open file"); });
+    open_action = new Action({name:"open", label: "Open",
+			      tooltip:"Open File",
+			      stock_id:STOCK_OPEN});
+    open_action.set_accel_group(accels);
+    actions.add_action_with_accel(open_action);
+    open_action.connect_accelerator();
+    open_action.signal.activate.connect(function () { Seed.print("Open file"); });
 
-	save_action = new Action({name:"save", label: "Save",
-							  tooltip:"Save File",
-							  stock_id:STOCK_SAVE});
-	save_action.set_accel_group(accels);
-	actions.add_action_with_accel(save_action);
-	save_action.connect_accelerator();
-	save_action.signal.activate.connect(function () { Seed.print("Save file"); });
+    save_action = new Action({name:"save", label: "Save",
+			      tooltip:"Save File",
+			      stock_id:STOCK_SAVE});
+    save_action.set_accel_group(accels);
+    actions.add_action_with_accel(save_action);
+    save_action.connect_accelerator();
+    save_action.signal.activate.connect(function () { Seed.print("Save file"); });
 
-	toolbar.insert(new_action.create_tool_item());
-	toolbar.insert(open_action.create_tool_item());
-	toolbar.insert(save_action.create_tool_item());
+    toolbar.insert(new_action.create_tool_item());
+    toolbar.insert(open_action.create_tool_item());
+    toolbar.insert(save_action.create_tool_item());
 
-	var menu = new MenuBar();
-	var file = new MenuItem({"child": new Label({"label": "File"})});
-	file_menu = new Menu();
-	file.submenu = file_menu;
-	menu.append(file);
+    var menu = new MenuBar();
+    var file = new MenuItem({"child": new Label({"label": "File"})});
+    file_menu = new Menu();
+    file.submenu = file_menu;
+    menu.append(file);
 
-	file_menu.append(new_action.create_menu_item(), -1);
-	file_menu.append(open_action.create_menu_item(), -1);
-	file_menu.append(save_action.create_menu_item(), -1);
+    file_menu.append(new_action.create_menu_item(), -1);
+    file_menu.append(open_action.create_menu_item(), -1);
+    file_menu.append(save_action.create_menu_item(), -1);
 
-	vbox.pack([{child: menu}, {child:toolbar}]);
+    vbox.pack([{child: menu}, {child:toolbar}]);
 
-	window.resize(300, 300);
-	window.show_all();
+    window.resize(300, 300);
+    window.show_all();
 
-	main();
+    main();
 }
 
diff --git a/examples/async-quine.js b/examples/async-quine.js
index 0a7c097..469bc6f 100755
--- a/examples/async-quine.js
+++ b/examples/async-quine.js
@@ -6,14 +6,14 @@ Gio = imports.gi.Gio;
 var file = Gio.file_new_for_path("./async-quine.js");
 
 file.read_async(0, null, function(source, result)
-				{
-					var stream = source.read_finish(result);
-					var dstream = new Gio.DataInputStream.c_new(stream);
-					var data = dstream.read_until("", 0);
+		{
+		    var stream = source.read_finish(result);
+		    var dstream = new Gio.DataInputStream.c_new(stream);
+		    var data = dstream.read_until("", 0);
 
-					Seed.print(data);
-					Seed.quit();
-				});
+		    Seed.print(data);
+		    Seed.quit();
+		});
 
 var loop = GLib.main_loop_new();
 GLib.main_loop_run(loop);
diff --git a/examples/calculator.js b/examples/calculator.js
index 430353d..03217f3 100755
--- a/examples/calculator.js
+++ b/examples/calculator.js
@@ -10,124 +10,124 @@ var calc_val = "";
 
 function update_display()
 {
-	label.set_markup("<span size='30000'>" + calc_val + "</span>");
+    label.set_markup("<span size='30000'>" + calc_val + "</span>");
 
-	if(calc_val === "")
-	{
-		label.set_markup("<span size='30000'>0</span>");
-	}
+    if(calc_val === "")
+    {
+	label.set_markup("<span size='30000'>0</span>");
+    }
 }
 
 function clear(button)
 {
-	calc_val = "";
-	update_display();
+    calc_val = "";
+    update_display();
 }
 
 function backspace(button)
 {
-	calc_val = calc_val.substring(0, calc_val.length - 1);
-	update_display();
+    calc_val = calc_val.substring(0, calc_val.length - 1);
+    update_display();
 }
 
 function pressed_equals(button)
 {
-	calc_val = calc_val.replace("sin", "Math.sin");
-	calc_val = calc_val.replace("cos", "Math.cos");
-	calc_val = calc_val.replace("tan", "Math.tan");
-	calc_val = eval(calc_val) + "";
-	// Avoid rediculous amounts of precision from toString.
-	if (calc_val == Math.floor(calc_val))
-	    calc_val = Seed.sprintf("%d", calc_val);
-	else
-	    calc_val = Seed.sprintf("%.4f", calc_val);
-	label.set_markup("<span size='30000'>" + calc_val + "</span>");
+    calc_val = calc_val.replace("sin", "Math.sin");
+    calc_val = calc_val.replace("cos", "Math.cos");
+    calc_val = calc_val.replace("tan", "Math.tan");
+    calc_val = eval(calc_val) + "";
+    // Avoid rediculous amounts of precision from toString.
+    if (calc_val == Math.floor(calc_val))
+	calc_val = Seed.sprintf("%d", calc_val);
+    else
+	calc_val = Seed.sprintf("%.4f", calc_val);
+    label.set_markup("<span size='30000'>" + calc_val + "</span>");
 }
 
 function pressed_operator(button)
 {
-	calc_val += button.label;
-	update_display();
+    calc_val += button.label;
+    update_display();
 }
 
 function pressed_number(button)
 {
-	calc_val = (((calc_val === 0) ? "" : calc_val) + button.label);
-	update_display();
+    calc_val = (((calc_val === 0) ? "" : calc_val) + button.label);
+    update_display();
 }
 
 function swap_sign(button)
 {
-	calc_val = ((calc_val[0] == "-") ?
-		    calc_val.substring(1) : "-" + calc_val);
-	update_display();
+    calc_val = ((calc_val[0] == "-") ?
+		calc_val.substring(1) : "-" + calc_val);
+    update_display();
 }
 
 function random_num()
 {
-	calc_val = Math.floor(Math.random() * 1000) + "";
-	update_display();
+    calc_val = Math.floor(Math.random() * 1000) + "";
+    update_display();
 }
 
 function pack_buttons(buttons, vbox)
 {
-	var hbox = new Gtk.HBox();
+    var hbox = new Gtk.HBox();
 
-	hbox.homogeneous = true;
+    hbox.homogeneous = true;
 
-	vbox.pack_start(hbox, true, true, 2);
+    vbox.pack_start(hbox, true, true, 2);
 
-	for(i = 0; i <= 4; i++)
-	{
-		hbox.pack_start(buttons[i], true, true, 1);
-	}
+    for(i = 0; i <= 4; i++)
+    {
+	hbox.pack_start(buttons[i], true, true, 1);
+    }
 }
 
 function create_button(str, func)
 {
-	var btn = new Gtk.Button({label:str});
-	btn.signal.clicked.connect(func);
-	return btn;
+    var btn = new Gtk.Button({label:str});
+    btn.signal.clicked.connect(func);
+    return btn;
 }
 
 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),
-						create_button("6", pressed_number),
-						create_button("*", pressed_operator)], vbox);
-
-	pack_buttons([	create_button("cos(", pressed_number),
-						create_button("1", pressed_number),
-						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),
-						create_button("=", pressed_equals),
-						create_button("+", pressed_operator)], vbox);
-
-	return vbox;
+    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),
+			create_button("6", pressed_number),
+			create_button("*", pressed_operator)], vbox);
+
+    pack_buttons([	create_button("cos(", pressed_number),
+			create_button("1", pressed_number),
+			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),
+			create_button("=", pressed_equals),
+			create_button("+", pressed_operator)], vbox);
+
+    return vbox;
 }
 
 var window = new Gtk.Window({title: "Calculator", resizable: false});
diff --git a/examples/clutter-0.8.js b/examples/clutter-0.8.js
index e7fb3c3..41429b9 100755
--- a/examples/clutter-0.8.js
+++ b/examples/clutter-0.8.js
@@ -5,38 +5,38 @@ Clutter = imports.gi.Clutter;
 Clutter.init(null, null);
 
 colors = [	"blanched almond",
-			"OldLace",
-			"MistyRose",
-			"White",
-			"LavenderBlush",
-			"CornflowerBlue",
-			"chartreuse",
-			"chocolate",
-			"light coral",
-			"medium violet red",
-			"LemonChiffon2",
-			"RosyBrown3"];
+		"OldLace",
+		"MistyRose",
+		"White",
+		"LavenderBlush",
+		"CornflowerBlue",
+		"chartreuse",
+		"chocolate",
+		"light coral",
+		"medium violet red",
+		"LemonChiffon2",
+		"RosyBrown3"];
 
 function alpha_func(alpha)
 {
-	var timeline = alpha.get_timeline();
-	var frame = timeline.get_current_frame();
-	var n_frames = timeline.num_frames;
-	var fps = timeline.fps;
-	var duration = n_frames/fps;
-	var time = frame/fps;
-
-	if ((time/=duration) < (1/2.75))
-		return Clutter.ALPHA_MAX_ALPHA*(7.5625*time*time);
-	else if (time < (2/2.75))
-		return Clutter.ALPHA_MAX_ALPHA*(7.5625 *
-										(time-=(1.5/2.75))*time+0.75);
-	else if (time < (2.5/2.75))
-		return Clutter.ALPHA_MAX_ALPHA*(7.5625 *
-										(time-=(2.25/2.75))*time+0.9375);
-	else
-		return Clutter.ALPHA_MAX_ALPHA*(7.5625 *
-										(time-=(2.625/2.75))*time+0.984375);
+    var timeline = alpha.get_timeline();
+    var frame = timeline.get_current_frame();
+    var n_frames = timeline.num_frames;
+    var fps = timeline.fps;
+    var duration = n_frames/fps;
+    var time = frame/fps;
+
+    if ((time/=duration) < (1/2.75))
+	return Clutter.ALPHA_MAX_ALPHA*(7.5625*time*time);
+    else if (time < (2/2.75))
+	return Clutter.ALPHA_MAX_ALPHA*(7.5625 *
+					(time-=(1.5/2.75))*time+0.75);
+    else if (time < (2.5/2.75))
+	return Clutter.ALPHA_MAX_ALPHA*(7.5625 *
+					(time-=(2.25/2.75))*time+0.9375);
+    else
+	return Clutter.ALPHA_MAX_ALPHA*(7.5625 *
+					(time-=(2.625/2.75))*time+0.984375);
 }
 
 var stage = new Clutter.Stage();
@@ -57,67 +57,67 @@ stage.color = black;
 
 for (var i = 0; i < colors.length; i++)
 {
-	var c = new Clutter.Color();
-	Clutter.color_parse(colors[i],c);
+    var c = new Clutter.Color();
+    Clutter.color_parse(colors[i],c);
 
-	var r = new Clutter.Rectangle();
-	r.width = r.height = rheight;
-	r.color = c;
-	r.y = i * r.height+r.height/2;
+    var r = new Clutter.Rectangle();
+    r.width = r.height = rheight;
+    r.color = c;
+    r.y = i * r.height+r.height/2;
 
-	r.anchor_x = r.height/2;
-	r.anchor_y = r.height/2;
+    r.anchor_x = r.height/2;
+    r.anchor_y = r.height/2;
 
-	stage.add_actor(r);
-	rectangles[i] = r;
+    stage.add_actor(r);
+    rectangles[i] = r;
 }
 
 // Was initially intended as a test to see if performance was accetable to do
 // custom animations at 60fps. Turns out to be fine, serves as an example now.
 
 timeline.signal.new_frame.connect(
-	function(timeline, frame_num)
+    function(timeline, frame_num)
+    {
+	for (var i = 0; i < colors.length; i++)
 	{
-		for (var i = 0; i < colors.length; i++)
-		{
-			rectangles[i].x += width / 600;
-			rectangles[i].rotation_angle_z += 1;
-		}
-	});
+	    rectangles[i].x += width / 600;
+	    rectangles[i].rotation_angle_z += 1;
+	}
+    });
 
 timeline.signal.completed.connect(
-	function(timeline)
-	{
+    function(timeline)
+    {
+
+	var text = new Clutter.Label({text:"Congratulations!",
+				      font_name:"Bitstream Vera Sans 40"});
+	var fadeline = new Clutter.Timeline({fps:60, num_frames:200});
+	var effect = new Clutter.EffectTemplate.c_new(timeline, alpha_func);
+
+	text.show();
+	stage.add_actor(text);
+	text.color = white;
+
+	text.anchor_x = text.width / 2;
+	text.anchor_y = text.height / 2;
 
-		var text = new Clutter.Label({text:"Congratulations!",
-									   font_name:"Bitstream Vera Sans 40"});
-		var fadeline = new Clutter.Timeline({fps:60, num_frames:200});
-		var effect = new Clutter.EffectTemplate.c_new(timeline, alpha_func);
-
-		text.show();
-		stage.add_actor(text);
-		text.color = white;
-
-		text.anchor_x = text.width / 2;
-		text.anchor_y = text.height / 2;
-
-		text.x = stage.width / 2;
-
-		text.y = -text.height;
-		Clutter.effect_move(effect,
-							text,
-							text.x,
-							stage.height / 2);
-
-		for (i in rectangles)
-		{
-			Clutter.effect_fade(effect, rectangles[i], 0);
-			Clutter.effect_move(effect, rectangles[i],
-								Math.random() * stage.width,
-								Math.random() * stage.height / 2 +
-								stage.height / 2);
-		}
-	});
+	text.x = stage.width / 2;
+
+	text.y = -text.height;
+	Clutter.effect_move(effect,
+			    text,
+			    text.x,
+			    stage.height / 2);
+
+	for (i in rectangles)
+	{
+	    Clutter.effect_fade(effect, rectangles[i], 0);
+	    Clutter.effect_move(effect, rectangles[i],
+				Math.random() * stage.width,
+				Math.random() * stage.height / 2 +
+				stage.height / 2);
+	}
+    });
 
 timeline.start();
 Clutter.main();
diff --git a/examples/clutter-0.9.js b/examples/clutter-0.9.js
index 2d928c2..e61488d 100755
--- a/examples/clutter-0.9.js
+++ b/examples/clutter-0.9.js
@@ -8,104 +8,104 @@ GObject = imports.gi.GObject;
 Clutter.init(null, null);
 
 colors = [	"blanched almond", 
-				"OldLace", 
-				"MistyRose", 
-				"White", 
-				"LavenderBlush",
-				"CornflowerBlue",
-				"chartreuse",
-				"chocolate",
-				"light coral",
-				"medium violet red",
-				"LemonChiffon2",
-				"RosyBrown3"];
+		"OldLace", 
+		"MistyRose", 
+		"White", 
+		"LavenderBlush",
+		"CornflowerBlue",
+		"chartreuse",
+		"chocolate",
+		"light coral",
+		"medium violet red",
+		"LemonChiffon2",
+		"RosyBrown3"];
 
 function create_rectangles(rectangles, colors)
 {
-	for(var i in colors)
-	{
-		var c = new Clutter.Color();
-		var r = new Clutter.Rectangle();
-		
-		c.from_string(colors[i]);
-		
-		r.width = r.height = stage.height / colors.length;
-		r.color = c;
-		r.set_anchor_point_from_gravity(Clutter.Gravity.CENTER);
-		r.y = i * r.height + r.height/2;
-		r.show();
-		
-		stage.add_actor(r);
-		
-		rectangles[i] = r;
-	}
+    for(var i in colors)
+    {
+	var c = new Clutter.Color();
+	var r = new Clutter.Rectangle();
+	
+	c.from_string(colors[i]);
+	
+	r.width = r.height = stage.height / colors.length;
+	r.color = c;
+	r.set_anchor_point_from_gravity(Clutter.Gravity.CENTER);
+	r.y = i * r.height + r.height/2;
+	r.show();
+	
+	stage.add_actor(r);
+	
+	rectangles[i] = r;
+    }
 }
 
 function animate_rectangles(rectangles)
 {
-	for (var i in rectangles)
+    for (var i in rectangles)
+    {
+	rectangles[i].anim = rectangles[i].animate(Clutter.AnimationMode.LINEAR, 5000,
+						   {
+						       x: [GObject.TYPE_INT, stage.width / 2],
+						       rotation_angle_z: [GObject.TYPE_DOUBLE, 500]
+						   });
+	rectangles[i].anim.timeline.start();
+    }
+    rectangles[i].anim.timeline.signal.completed.connect(
+	function(tml)
 	{
-		rectangles[i].anim = rectangles[i].animate(Clutter.AnimationMode.LINEAR, 5000,
-			{
-				x: [GObject.TYPE_INT, stage.width / 2],
-				rotation_angle_z: [GObject.TYPE_DOUBLE, 500]
-			});
-		rectangles[i].anim.timeline.start();
-	}
-	rectangles[i].anim.timeline.signal.completed.connect(
-		function(tml)
-		{
-			var white = new Clutter.Color({red:255,
-										   blue:255,
-										   green:255,
-										   alpha:255});
-			
-			var text = new Clutter.Text({text:"Congratulations!",
-				font_name:"Bitstream Vera Sans 40", color:white});
-			
-			text.set_anchor_point_from_gravity(Clutter.Gravity.CENTER);
-			text.x = stage.width / 2;
-			text.y = -text.height;	// Off-stage
-			stage.add_actor(text);
-			text.show();
-			text.anim = text.animate(Clutter.AnimationMode.EASE_OUT_BOUNCE, 3000,
-				{
-					y: [GObject.TYPE_INT, stage.height / 2]
-				});
-			text.anim.timeline.start();
+	    var white = new Clutter.Color({red:255,
+					   blue:255,
+					   green:255,
+					   alpha:255});
+	    
+	    var text = new Clutter.Text({text:"Congratulations!",
+					 font_name:"Bitstream Vera Sans 40", color:white});
+	    
+	    text.set_anchor_point_from_gravity(Clutter.Gravity.CENTER);
+	    text.x = stage.width / 2;
+	    text.y = -text.height;	// Off-stage
+	    stage.add_actor(text);
+	    text.show();
+	    text.anim = text.animate(Clutter.AnimationMode.EASE_OUT_BOUNCE, 3000,
+				     {
+					 y: [GObject.TYPE_INT, stage.height / 2]
+				     });
+	    text.anim.timeline.start();
 
-			for (var i in rectangles)
-			{
-				rectangles[i].anim = 
-					rectangles[i].animate(Clutter.AnimationMode.EASE_OUT_BOUNCE, 3000,
-					{
-						x: [GObject.TYPE_INT, Math.random() * stage.width],
-						y: [GObject.TYPE_INT, Math.random() * stage.height / 2 + stage.height / 2],
-						rotation_angle_z: [GObject.TYPE_DOUBLE, rectangles[i].rotation_angle_z],
-						opacity: [GObject.TYPE_UCHAR, 0 ]
-					});
-					//rotation_angle change makes it stop spinning. don't know why it's still
-					//spinning here, it really should have stopped when the timeline did. 
+	    for (var i in rectangles)
+	    {
+		rectangles[i].anim = 
+		    rectangles[i].animate(Clutter.AnimationMode.EASE_OUT_BOUNCE, 3000,
+					  {
+					      x: [GObject.TYPE_INT, Math.random() * stage.width],
+					      y: [GObject.TYPE_INT, Math.random() * stage.height / 2 + stage.height / 2],
+					      rotation_angle_z: [GObject.TYPE_DOUBLE, rectangles[i].rotation_angle_z],
+					      opacity: [GObject.TYPE_UCHAR, 0 ]
+					  });
+		//rotation_angle change makes it stop spinning. don't know why it's still
+		//spinning here, it really should have stopped when the timeline did. 
 
-				rectangles[i].anim.timeline.start();
-			}
-		});
+		rectangles[i].anim.timeline.start();
+	    }
+	});
 }
 
 function main()
 {
-	stage = new Clutter.Stage();
-	var rectangles = new Array(colors.length);
-	stage.signal.hide.connect(function(){Clutter.main_quit();});
+    stage = new Clutter.Stage();
+    var rectangles = new Array(colors.length);
+    stage.signal.hide.connect(function(){Clutter.main_quit();});
 
-	create_rectangles(rectangles, colors);
+    create_rectangles(rectangles, colors);
 
-	stage.color = new Clutter.Color({alpha:255});
-	stage.show_all();
+    stage.color = new Clutter.Color({alpha:255});
+    stage.show_all();
 
-	animate_rectangles(rectangles);
+    animate_rectangles(rectangles);
 
-	Clutter.main();
+    Clutter.main();
 }
 
 main();
diff --git a/examples/clutter-cogl.js b/examples/clutter-cogl.js
index 887672f..a414742 100755
--- a/examples/clutter-cogl.js
+++ b/examples/clutter-cogl.js
@@ -16,29 +16,29 @@ const SCREEN_H = 480;
 
 function deg_to_rad(x)
 {
-	return (((x) * 1024.0) / 360.0);
+    return (((x) * 1024.0) / 360.0);
 }
 
 function alpha_func(alpha)
 {
-	var timeline = alpha.get_timeline();
-	var frame = timeline.get_current_frame();
-	var n_frames = timeline.num_frames;
-	var fps = timeline.fps;
-	var duration = n_frames/fps;
-	var time = frame/fps;
-	
-	if ((time/=duration) < (1/2.75))
-		return Clutter.ALPHA_MAX_ALPHA*(7.5625*time*time);
-	else if (time < (2/2.75))
-		return Clutter.ALPHA_MAX_ALPHA*(7.5625 * 
-										(time-=(1.5/2.75))*time+0.75);
-	else if (time < (2.5/2.75))
-		return Clutter.ALPHA_MAX_ALPHA*(7.5625 *
-										(time-=(2.25/2.75))*time+0.9375);
-	else
-		return Clutter.ALPHA_MAX_ALPHA*(7.5625 *
-										(time-=(2.625/2.75))*time+0.984375);
+    var timeline = alpha.get_timeline();
+    var frame = timeline.get_current_frame();
+    var n_frames = timeline.num_frames;
+    var fps = timeline.fps;
+    var duration = n_frames/fps;
+    var time = frame/fps;
+    
+    if ((time/=duration) < (1/2.75))
+	return Clutter.ALPHA_MAX_ALPHA*(7.5625*time*time);
+    else if (time < (2/2.75))
+	return Clutter.ALPHA_MAX_ALPHA*(7.5625 * 
+					(time-=(1.5/2.75))*time+0.75);
+    else if (time < (2.5/2.75))
+	return Clutter.ALPHA_MAX_ALPHA*(7.5625 *
+					(time-=(2.25/2.75))*time+0.9375);
+    else
+	return Clutter.ALPHA_MAX_ALPHA*(7.5625 *
+					(time-=(2.625/2.75))*time+0.984375);
 }
 
 Clutter.init(null, null);
@@ -47,61 +47,61 @@ var template = new Clutter.EffectTemplate.for_duration(RIPPLE_S, alpha_func);
 
 function destroy_actor(actor)
 {
-	actor.destroy();
+    actor.destroy();
 }
 
 function circle_paint (actor)
 {
-	var radius = Clutter.cogl_double_to_fixed(actor.width/2);
-	
-	actor.fill_color.alpha = actor.opacity;
-	
-	Clutter.cogl_color(actor.fill_color);
-	Clutter.cogl_path_move_to(radius, radius);
-	Clutter.cogl_path_arc(radius, radius, radius, radius,
-						  deg_to_rad(0),
-						  deg_to_rad(360));
-	Clutter.cogl_path_line_to(radius - RIPPLE_WX/2, radius);
-	Clutter.cogl_path_arc(radius, radius, 
-						  radius-RIPPLE_WX/2, radius-RIPPLE_WX/2,
-						  deg_to_rad(0),
-						  deg_to_rad(360));
-	Clutter.cogl_path_close();
-	Clutter.cogl_path_fill();	
+    var radius = Clutter.cogl_double_to_fixed(actor.width/2);
+    
+    actor.fill_color.alpha = actor.opacity;
+    
+    Clutter.cogl_color(actor.fill_color);
+    Clutter.cogl_path_move_to(radius, radius);
+    Clutter.cogl_path_arc(radius, radius, radius, radius,
+			  deg_to_rad(0),
+			  deg_to_rad(360));
+    Clutter.cogl_path_line_to(radius - RIPPLE_WX/2, radius);
+    Clutter.cogl_path_arc(radius, radius, 
+			  radius-RIPPLE_WX/2, radius-RIPPLE_WX/2,
+			  deg_to_rad(0),
+			  deg_to_rad(360));
+    Clutter.cogl_path_close();
+    Clutter.cogl_path_fill();	
 }
 
 function ripple(stage, x, y)
 {
-	var transp = new Clutter.Color();
+    var transp = new Clutter.Color();
+    
+    var n = parseInt(Math.random()*RIPPLE_N , 10) + 1;
+    
+    for (i = 0; i < n; i++)
+    {
+	var actor = new Clutter.Rectangle({color: transp});
+	
+	actor.fill_color = new Clutter.Color({red: 0xff,
+					      green: 0xff,
+					      blue: 0xff});
 	
-	var n = parseInt(Math.random()*RIPPLE_N , 10) + 1;
+	var size = ((RIPPLE_W * 2) * (i+1)) + (RIPPLE_G * i);
 	
-	for (i = 0; i < n; i++)
-	{
-		var actor = new Clutter.Rectangle({color: transp});
-		
-		actor.fill_color = new Clutter.Color({red: 0xff,
-											  green: 0xff,
-											  blue: 0xff});
-		
-		var size = ((RIPPLE_W * 2) * (i+1)) + (RIPPLE_G * i);
-		
-		actor.width = actor.height = size;
-		actor.set_anchor_point_from_gravity(Clutter.Gravity.CENTER);
-		actor.x = x;
-		actor.y = y;
-		actor.opacity = 0x80;
-		
-		stage.add_actor(actor);
-		
-		actor.signal["paint"].connect(circle_paint);
-		Clutter.effect_scale(template,actor,
-							 SCREEN_W / RIPPLE_W,
-							 SCREEN_W / RIPPLE_W);
-		Clutter.effect_fade(template, actor,
-							0x00,
-							destroy_actor);
-	}
+	actor.width = actor.height = size;
+	actor.set_anchor_point_from_gravity(Clutter.Gravity.CENTER);
+	actor.x = x;
+	actor.y = y;
+	actor.opacity = 0x80;
+	
+	stage.add_actor(actor);
+	
+	actor.signal["paint"].connect(circle_paint);
+	Clutter.effect_scale(template,actor,
+			     SCREEN_W / RIPPLE_W,
+			     SCREEN_W / RIPPLE_W);
+	Clutter.effect_fade(template, actor,
+			    0x00,
+			    destroy_actor);
+    }
 }
 
 var stage = new Clutter.Stage();
@@ -111,21 +111,21 @@ stage.height = SCREEN_H;
 stage.color = {};
 
 stage.signal["button_press_event"].connect(
-	function(stage, event)
-	{
-		ripple(stage, event.button.x, event.button.y);
-		
-		return true;
-	});
+    function(stage, event)
+    {
+	ripple(stage, event.button.x, event.button.y);
+	
+	return true;
+    });
 
 stage.show();
 
 function random_ripple()
 {
-	ripple(stage, Math.random()*SCREEN_W, Math.random()*SCREEN_H);
-	GLib.timeout_add(Math.random()*RIPPLE_MAXD + RIPPLE_MIND, random_ripple);
-	
-	return false;
+    ripple(stage, Math.random()*SCREEN_W, Math.random()*SCREEN_H);
+    GLib.timeout_add(Math.random()*RIPPLE_MAXD + RIPPLE_MIND, random_ripple);
+    
+    return false;
 }
 
 random_ripple();
diff --git a/examples/gdkpixbufloader.js b/examples/gdkpixbufloader.js
index 36f5e2d..d6bab6d 100755
--- a/examples/gdkpixbufloader.js
+++ b/examples/gdkpixbufloader.js
@@ -6,29 +6,29 @@ GdkPixbuf = imports.gi.GdkPixbuf;
 Gtk = imports.gi.Gtk;
 
 var blue_marble =
-	Gio.file_new_for_uri("http://veimages.gsfc.nasa.gov/7100/world.topo.bathy.200401.3x5400x2700.jpg";);
+    Gio.file_new_for_uri("http://veimages.gsfc.nasa.gov/7100/world.topo.bathy.200401.3x5400x2700.jpg";);
 
 blue_marble.read_async(0, null, function(source, result)
-					   {
-						   var loader = new GdkPixbuf.PixbufLoader();
-						   var stream = source.read_finish(result);
-						   var dstream = new Gio.DataInputStream.c_new(stream);
+		       {
+			   var loader = new GdkPixbuf.PixbufLoader();
+			   var stream = source.read_finish(result);
+			   var dstream = new Gio.DataInputStream.c_new(stream);
 
-						   try
-						   {
-							   while (1)
-							   {
-								   loader.write([dstream.read_byte()], 1);
-							   }
-						   }
-						   catch (e)
-						   {
-						   }
+			   try
+			   {
+			       while (1)
+			       {
+				   loader.write([dstream.read_byte()], 1);
+			       }
+			   }
+			   catch (e)
+			   {
+			   }
 
-						   var pixbuf = loader.get_pixbuf();
-						   pixbuf.savev("bluemarble","jpeg");
-						Seed.quit();
-					   });
+			   var pixbuf = loader.get_pixbuf();
+			   pixbuf.savev("bluemarble","jpeg");
+			   Seed.quit();
+		       });
 
 var loop = GLib.main_loop_new();
 GLib.main_loop_run(loop);
diff --git a/examples/gtkplug.js b/examples/gtkplug.js
index e54301d..e8bf667 100755
--- a/examples/gtkplug.js
+++ b/examples/gtkplug.js
@@ -10,16 +10,16 @@ var child_pid = Seed.fork();
 
 if (child_pid === 0)
 {
-	Gtk.init(null, null);
+    Gtk.init(null, null);
 
-	var id = parseInt(pipes[0].read(), 10);
+    var id = parseInt(pipes[0].read(), 10);
 
-	var label = new Gtk.Label({label: "Hello GtkPlug World"});
-	var plug = new Gtk.Plug.c_new(id);
+    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();
+    plug.add(label);
+    plug.show_all();
+    Gtk.main();
 }
 
 Gtk.init(null, null);
diff --git a/examples/json-packing.js b/examples/json-packing.js
index 2237ee9..678142c 100755
--- a/examples/json-packing.js
+++ b/examples/json-packing.js
@@ -9,22 +9,22 @@ var button = new Gtk.Button({label: "Bye"});
 var entry = new Gtk.Entry();
 
 var packing = [
-	{
-		child: label,
-		fill: false,
-		padding: 10,
-		position: Gtk.PackType.END
-	},
-	{
-		child: button,
-		fill: false,
-		padding: 100,
-		expand: true
-	},
-	{
-		child:entry
-	}
-	];
+    {
+	child: label,
+	fill: false,
+	padding: 10,
+	position: Gtk.PackType.END
+    },
+    {
+	child: button,
+	fill: false,
+	padding: 100,
+	expand: true
+    },
+    {
+	child:entry
+    }
+];
 
 window = new Gtk.Window();
 window.signal.hide.connect(function () { Gtk.main_quit(); });
diff --git a/examples/ls.js b/examples/ls.js
index 0fbf51c..ba7269e 100755
--- a/examples/ls.js
+++ b/examples/ls.js
@@ -7,13 +7,13 @@ Gio = imports.gi.Gio;
 // Gio.file_new_for_path, etc...
 
 if (Seed.argv.length < 3)
-	file = Gio.file_new_for_path(".");
+    file = Gio.file_new_for_path(".");
 else
-	file = Gio.file_new_for_path(Seed.argv[2]);
+    file = Gio.file_new_for_path(Seed.argv[2]);
 
 enumerator = file.enumerate_children("standard::name,standard::size");
 
 while ((child = enumerator.next_file()))
 {
-	Seed.printf("%s\t%d",child.get_name(), child.get_size());
+    Seed.printf("%s\t%d",child.get_name(), child.get_size());
 }
diff --git a/examples/notify-test.js b/examples/notify-test.js
index 6239be2..ea0805e 100755
--- a/examples/notify-test.js
+++ b/examples/notify-test.js
@@ -9,7 +9,7 @@ function file_changed(monitor, child, other, event)
 {
     var notification =
 	new Notify.Notification({summary: "File Notification",
-                             body : "It's not clear what notification system this file is providing an example of." });
+				 body : "It's not clear what notification system this file is providing an example of." });
     notification.set_timeout(5000);
     notification.show();
 }
@@ -24,3 +24,4 @@ monitor.signal.changed.connect(file_changed);
 
 Gtk.main();
 
+
diff --git a/examples/poppler.js b/examples/poppler.js
index 2cb3d57..36ce33a 100755
--- a/examples/poppler.js
+++ b/examples/poppler.js
@@ -15,121 +15,121 @@ var num_pages = null;
 
 function draw_document()
 {
-	if (current_page)
-	{
-		drawing_area.window.clear();
-		cairo = Gdk.cairo_create(drawing_area.window);
-		current_page.render(cairo);
-	}
-
-	return true;
+    if (current_page)
+    {
+	drawing_area.window.clear();
+	cairo = Gdk.cairo_create(drawing_area.window);
+	current_page.render(cairo);
+    }
+
+    return true;
 }
 
 function set_page(num)
 {
-	if(num < 0)
-	{
-		set_page(0);
-		return;
-	}
-
-	if(num >= num_pages)
-	{
-		set_page(num_pages - 1);
-		return;
-	}
-
-	current_page = current_document.get_page(num);
-	draw_document();
-
-	//Get rid of precision.
-	entry.text = Seed.sprintf("%d",num+1);
-	page_num = num;
-
-	if (page_num == num_pages-1)
-		next_button.sensitive = false;
-	else
-		next_button.sensitive = true;
-
-	if (page_num)
-		previous_button.sensitive = true;
-	else
-		previous_button.sensitive = false;
+    if(num < 0)
+    {
+	set_page(0);
+	return;
+    }
+
+    if(num >= num_pages)
+    {
+	set_page(num_pages - 1);
+	return;
+    }
+
+    current_page = current_document.get_page(num);
+    draw_document();
+
+    //Get rid of precision.
+    entry.text = Seed.sprintf("%d",num+1);
+    page_num = num;
+
+    if (page_num == num_pages-1)
+	next_button.sensitive = false;
+    else
+	next_button.sensitive = true;
+
+    if (page_num)
+	previous_button.sensitive = true;
+    else
+	previous_button.sensitive = false;
 }
 
 function open_file(sv)
 {
-	var file_chooser = new Gtk.FileChooserDialog();
-	var file_filter = new Gtk.FileFilter();
-	file_filter.add_mime_type("application/x-pdf");
-	file_chooser.set_filter(file_filter);
-	file_chooser.add_button("Cancel", Gtk.ResponseType.CANCEL);
-	file_chooser.add_button("Open", Gtk.ResponseType.ACCEPT);
-	file_chooser.set_action(Gtk.FileChooserAction.OPEN);
-
-	if(file_chooser.run() == Gtk.ResponseType.ACCEPT)
-	{
-		// Poppler.Document will not take a uri as a construction property,
-		// use this:
-		current_document = new
-			Poppler.Document.from_file(file_chooser.get_uri());
-		num_pages = current_document.get_n_pages();
-		set_page(0);
-
-		if(num_pages == 1)
-			next_button.sensitive = previous_button.sensitive = false;
-
-		page_label.label = " of " + num_pages;
-		draw_document();
+    var file_chooser = new Gtk.FileChooserDialog();
+    var file_filter = new Gtk.FileFilter();
+    file_filter.add_mime_type("application/x-pdf");
+    file_chooser.set_filter(file_filter);
+    file_chooser.add_button("Cancel", Gtk.ResponseType.CANCEL);
+    file_chooser.add_button("Open", Gtk.ResponseType.ACCEPT);
+    file_chooser.set_action(Gtk.FileChooserAction.OPEN);
+
+    if(file_chooser.run() == Gtk.ResponseType.ACCEPT)
+    {
+	// Poppler.Document will not take a uri as a construction property,
+	// use this:
+	current_document = new
+	Poppler.Document.from_file(file_chooser.get_uri());
+	num_pages = current_document.get_n_pages();
+	set_page(0);
+
+	if(num_pages == 1)
+	    next_button.sensitive = previous_button.sensitive = false;
+
+	page_label.label = " of " + num_pages;
+	draw_document();
 
-		if (num_pages > 1)
-			next_button.sensitive = true;
-	}
+	if (num_pages > 1)
+	    next_button.sensitive = true;
+    }
 
-	file_chooser.destroy();
+    file_chooser.destroy();
 }
 
 function make_toolbar()
 {
-	var window = new Gtk.Window();
-	var toolbar = new Gtk.Toolbar();
-	var main_vbox = new Gtk.VBox();
-
-	var open_button = new Gtk.ToolButton({stock_id:"gtk-open"});
-	previous_button = new Gtk.ToolButton({stock_id:"gtk-go-up"});
-	next_button = new Gtk.ToolButton({stock_id:"gtk-go-down"});
-	var entry_item = new Gtk.ToolItem();
-	entry = new Gtk.Entry({text:"0"});
-	entry_item.add(entry);
-	entry_item.width_request = 40;
-	entry.signal.activate.connect(function(){set_page(parseInt(entry.text, 10)-1);});
-	var label_item = new Gtk.ToolItem();
-	page_label = new Gtk.Label({label: " of 0"});
-	label_item.add(page_label);
-
-	open_button.signal.clicked.connect(open_file);
-	next_button.signal.clicked.connect(
+    var window = new Gtk.Window();
+    var toolbar = new Gtk.Toolbar();
+    var main_vbox = new Gtk.VBox();
+
+    var open_button = new Gtk.ToolButton({stock_id:"gtk-open"});
+    previous_button = new Gtk.ToolButton({stock_id:"gtk-go-up"});
+    next_button = new Gtk.ToolButton({stock_id:"gtk-go-down"});
+    var entry_item = new Gtk.ToolItem();
+    entry = new Gtk.Entry({text:"0"});
+    entry_item.add(entry);
+    entry_item.width_request = 40;
+    entry.signal.activate.connect(function(){set_page(parseInt(entry.text, 10)-1);});
+    var label_item = new Gtk.ToolItem();
+    page_label = new Gtk.Label({label: " of 0"});
+    label_item.add(page_label);
+
+    open_button.signal.clicked.connect(open_file);
+    next_button.signal.clicked.connect(
 	function(button)
 	{
-		set_page(page_num+1);
+	    set_page(page_num+1);
 	});
-	previous_button.signal.clicked.connect(
+    previous_button.signal.clicked.connect(
 	function(button)
 	{
-		set_page(page_num-1);
+	    set_page(page_num-1);
 	});
-	next_button.sensitive = previous_button.sensitive = false;
+    next_button.sensitive = previous_button.sensitive = false;
 
 
-	toolbar.insert(open_button,-1);
-	toolbar.insert(previous_button, -1);
-	toolbar.insert(next_button, -1);
-	toolbar.insert(new Gtk.SeparatorToolItem(), -1);
-	toolbar.insert(entry_item, -1);
-	toolbar.insert(label_item, -1);
-	toolbar.insert(new Gtk.SeparatorToolItem(), -1);
+    toolbar.insert(open_button,-1);
+    toolbar.insert(previous_button, -1);
+    toolbar.insert(next_button, -1);
+    toolbar.insert(new Gtk.SeparatorToolItem(), -1);
+    toolbar.insert(entry_item, -1);
+    toolbar.insert(label_item, -1);
+    toolbar.insert(new Gtk.SeparatorToolItem(), -1);
 
-	return toolbar;
+    return toolbar;
 }
 
 var toolbar = make_toolbar();
diff --git a/examples/repl.js b/examples/repl.js
index b30d3b2..2c5f970 100755
--- a/examples/repl.js
+++ b/examples/repl.js
@@ -4,13 +4,13 @@ readline = imports.readline;
 
 while(1)
 {
-	try
-	{
-		item = readline.readline("> ");
-		Seed.print(eval(item));
-	}
-	catch(e)
-	{
-	   	Seed.print(e.name + " " + e.message);
-	}
+    try
+    {
+	item = readline.readline("> ");
+	Seed.print(eval(item));
+    }
+    catch(e)
+    {
+	Seed.print(e.name + " " + e.message);
+    }
 }



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