<commit_before>#!/usr/bin/env seed
Seed.import_namespace("Gtk");
Gtk.init(null, null);

with(Gtk)
{
	window = new Window();
	window.signal.hide.connect(function () { main_quit() });
	toolbar = new Toolbar();
	vbox = new VBox();
	window.add(vbox);

	actions = new ActionGroup({name: "toolbar"});
	accels = new AccelGroup();

	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")});

	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")});


	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"})});
	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);

	packing = [{child: menu}, {child:toolbar}];
	vbox.pack(packing);

	window.show_all();
	window.width_request = 150;
	main();
}


<commit_msg>Update actions example.<commit_after>#!/usr/bin/env seed
Seed.import_namespace("Gtk");
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 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});
	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"); });

	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());

	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);

	vbox.pack([{child: menu}, {child:toolbar}]);

	window.resize(300, 300);
	window.show_all();
	
	main();
}



{'fraction_non_alphanumeric': 0.15881763527054107, 'fraction_numerical': 0.00375751503006012, 'mean_word_length': 5.545901639344263, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4366584', 'n_tokens_mistral': 1530, 'n_tokens_neox': 1374, 'n_words': 230}