[seed] ClutterPad: Fix ability to close file chooser dialogs without a crash



commit adc90184677655fea4ffbd7affba34d870d1b62e
Author: Tim Horton <hortont svn gnome org>
Date:   Wed May 13 17:10:24 2009 -0400

    ClutterPad: Fix ability to close file chooser dialogs without a crash
---
 examples/clutter-pad/main.js |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/examples/clutter-pad/main.js b/examples/clutter-pad/main.js
index bd41596..ca0eb33 100755
--- a/examples/clutter-pad/main.js
+++ b/examples/clutter-pad/main.js
@@ -37,10 +37,13 @@ function load_file(filename)
 	execute_file();
 }
 
-function new_file()
+function new_file(button)
 {
 	reset_stage();
 	
+	if(button)
+		ui.get_object("example_selector").set_active(-1);
+	
 	window.title = "ClutterPad";
 	current_filename = "";
 	source_buf.text = "GObject = imports.gi.GObject;\nClutter = imports.gi.Clutter;\nstage = Clutter.Stage.get_default();\n";
@@ -50,8 +53,8 @@ function open_file()
 {
 	file_chooser = ui.get_object("open_file_dialog");
 	file_chooser.set_filter(js_file_filter);
-
-	if(file_chooser.run())
+	
+	if(file_chooser.run() > 0)
 	{
 		load_file(file_chooser.get_filename());
 	}
@@ -66,7 +69,7 @@ function save_file(filename)
 		file_chooser = ui.get_object("save_file_dialog");
 		file_chooser.set_filter(js_file_filter);
 
-		if(file_chooser.run())
+		if(file_chooser.run() > 0)
 		{
 			current_filename = file_chooser.get_filename();
 			window.title = "ClutterPad - " + current_filename;



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