seed r584 - trunk/examples



Author: hortont
Date: Wed Dec 31 01:05:56 2008
New Revision: 584
URL: http://svn.gnome.org/viewvc/seed?rev=584&view=rev

Log:
Update actions example.


Modified:
   trunk/examples/actions.js

Modified: trunk/examples/actions.js
==============================================================================
--- trunk/examples/actions.js	(original)
+++ trunk/examples/actions.js	Wed Dec 31 01:05:56 2008
@@ -4,50 +4,48 @@
 
 with(Gtk)
 {
-	window = new Window();
+	var window = new Window();
 	window.signal.hide.connect(function () { main_quit() });
-	toolbar = new Toolbar();
-	vbox = new VBox();
+	var toolbar = new Toolbar();
+	var vbox = new VBox();
 	window.add(vbox);
 
-	actions = new ActionGroup({name: "toolbar"});
-	accels = new AccelGroup();
+	var actions = new ActionGroup({name: "toolbar"});
+	var accels = new AccelGroup();
 
 	window.add_accel_group(accels);
 
 	new_action = new Action({name:"new", label: "New",
-								 tooltip:"New File",
-								 stock_id:STOCK_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
+	//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.signal.activate.connect(function () { Seed.print("New file"); });
 
 	open_action = new Action({name:"open", label: "Open",
-								  tooltip:"Open File",
-								  stock_id:STOCK_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.signal.activate.connect(function () { Seed.print("Open file"); });
 
 	save_action = new Action({name:"save", label: "Save",
-								  tooltip:"Save File", 
-								  stock_id:STOCK_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.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());
 
-	menu = new MenuBar();
-	file = new MenuItem({"child":
-							 new Label({"label": "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);
@@ -56,11 +54,11 @@
 	file_menu.append(open_action.create_menu_item(), -1);
 	file_menu.append(save_action.create_menu_item(), -1);
 
-	packing = [{child: menu}, {child:toolbar}];
-	vbox.pack(packing);
+	vbox.pack([{child: menu}, {child:toolbar}]);
 
+	window.resize(300, 300);
 	window.show_all();
-	window.width_request = 150;
+	
 	main();
 }
 



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