Monday, November 08, 2010 at 12:03 AM.

system.verbs.builtins.Frontier.tools.windowTypes.commands.quit

on quit () {
	bundle { //set quitting flag
		if not defined (temp.Frontier) {
			new (tableType, @temp.Frontier)};
		temp.Frontier.closingDown = true};
	
	on closeWindow (adr) {
		if defined (adr^) { //don't check the About window or the Find & Replace dialog
			if table.getRootAddress (adr) == adr { //hide the window
				window.hide (adr);
				return (true)}};
		return (Frontier.tools.windowTypes.commands.close (adr))}; //this also calls callbacks
	if not window.visit (@closeWindow) {
		return (false)};
	
	local (rootPath = window.getFile (@root));
	on closeDatabase (f) {
		fileMenu.save (f);
		if f != rootPath {
			if not system.callbacks.closeWindow (@[f]) {
				return (false)};
			fileMenu.close (f)};
		return (true)};
	if not table.visitOpenDatabases (@closeDatabase, true) {
		return (false)};
	
	filemenu.save ();
	filemenu.quit ();
	return (true);
	};
	<<bundle //old code
		<<Quit Radio UserLand.
			<<Changes:
				<<Thu, Oct 26, 2000 at 7:05:05 PM by PBS
					<<Always save each database, no matter what callbacks return.
					<<Don't use Frontier.getFilePath, since it may return a gdb. Construct the path to the current system root.
					<<Visit open databases in reverse order -- since we're removing items from the list.
					<<Set a quitting flag in the temp table so other threads know the app is shutting down.
				<<12/29/00; 4:06:10 AM by JES
					<<Bug fix: delete outlines in sub-tables of user.pike.sites before deleting user.pike.sites, to prevent an 'outline' undefined error on saving Radio.root, when quitting with open, un-saved Manila messages/templates.
				<<01/05/01; 9:28:22 PM by JES
					<<Changed handling of the closeWindow callback so that top-level guest database windows would be handled correctly.
		<<bundle //set quitting flag
			<<if not defined (temp.Frontier)
				<<new (tableType, @temp.Frontier)
			<<temp.Frontier.closingDown = true
		<<on closeChildWindow (adr)
			<<if defined (adr^)
				<<if table.getRootAddress (adr) != adr
				<<if system.callbacks.closeWindow (adr)
					<<try
						<<if adr == table.getRootAddress (adr) // hide the window instead of closing it
							<<window.hide (adr)
						<<else
							<<return (window.close (adr))
					<<return (true) // continue through the rest of the windows
				<<else
					<<if adr == table.getRootAddress (adr) //01/05/01 JES: don't stop if the window is the top level of a guest database.
						<<return (true)
					<<return (false)
			<<return (true)
		<<if not window.visit (@closeChildWindow)
			<<return (false)
		<<if defined (user.pike.sites) //clean up our temporary storage area; 12/29/00 JES: do this before closing databases
			<<bundle //12/29/00 JES: delete outlines in newStories, savedStories and advancedItems sub-tables of all of the site tables -- prevents an error window at shutdown.
				<<local (adrSite)
				<<on deleteOutlinesFromSubtables (adrTable)
					<<if defined (adrTable^)
						<<local (adrSubTable)
						<<for adrSubTable in adrTable
							<<if defined (adrSubTable^.outline)
								<<delete (@adrSubTable^.outline)
				<<for adrSite in @user.pike.sites
					<<local (adrStory)
					<<deleteOutlinesFromSubtables (@adrSite^.advancedItems)
					<<deleteOutlinesFromSubtables (@adrSite^.newStories)
					<<deleteOutlinesFromSubtables (@adrSite^.savedStories)
			<<table.emptyTable (@user.pike.sites) //12/29/00 JES: this will eventually go away, in favor of deleting the story tables.
		<<local (rootPath = window.getFile (@root)) //PBS 10/26/00: get path to system root
		<<on closeDatabase (f)
			<<fileMenu.save (f)
			<<if f != rootPath
				<<if not system.callbacks.closeWindow (@[f]) //01/05/01 JES: commented out -- the callbacks have already been called.
					<<return (false)
				<<fileMenu.close (f)
			<<return (true)
		<<if not table.visitOpenDatabases (@closeDatabase, true) //PBS 10/26/00: visit in reverse order
			<<return (false)
		<<filemenu.save ()
		<<filemenu.quit ()
		<<return (true)
bundle { // debugging
	quit ()}



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.