Index: main/trunk/greenstone2/runtime-src/src/recpt/librarymain.cpp
===================================================================
--- main/trunk/greenstone2/runtime-src/src/recpt/librarymain.cpp	(revision 22067)
+++ main/trunk/greenstone2/runtime-src/src/recpt/librarymain.cpp	(revision 22142)
@@ -36,34 +36,5 @@
 
 #include "action.h"
-#include "authenaction.h"
-#include "browseaction.h"
-#include "collectoraction.h"
-#include "depositoraction.h"
-#include "documentaction.h"
-#include "dynamicclassifieraction.h"
-#include "extlinkaction.h"
-#include "pageaction.h"
-#ifdef ENABLE_MGPP
-#include "phindaction.h"
-#endif
-#include "pingaction.h"
-#include "queryaction.h"
-
-#if defined(USE_SQLITE)
-#include "sqlqueryaction.h"
-#endif
-
-#include "tipaction.h"
-#include "statusaction.h"
-#include "usersaction.h"
-
 #include "browserclass.h"
-#include "vlistbrowserclass.h"
-#include "hlistbrowserclass.h"
-#include "datelistbrowserclass.h"
-#include "invbrowserclass.h"
-#include "pagedbrowserclass.h"
-#include "htmlbrowserclass.h"
-#include "phindbrowserclass.h"
 
 
@@ -122,126 +93,14 @@
 #endif
 
-  // the list of actions. Note: these actions will become invalid
-  // at the end of this function. We will clean them.
-
-#ifdef GSDL_USE_TIP_ACTION
-  recpt.add_action (new tipaction());
-#endif
-
-#ifdef GSDL_USE_STATUS_ACTION
-  statusaction *astatusaction = new statusaction();
-  astatusaction->set_receptionist (&recpt);
-  recpt.add_action (astatusaction);
-#endif
-
-  pageaction *apageaction = new pageaction();
-  apageaction->set_receptionist (&recpt);
-  recpt.add_action (apageaction);
-
-#ifdef GSDL_USE_PING_ACTION
-  recpt.add_action (new pingaction());
-#endif
-
-  queryaction *aqueryaction = new queryaction();
-  aqueryaction->set_receptionist (&recpt);
-  recpt.add_action (aqueryaction);
-
-#if defined(USE_SQLITE)
-  sqlqueryaction *asqlqueryaction = new sqlqueryaction();
-  asqlqueryaction->set_receptionist (&recpt);
-  recpt.add_action (asqlqueryaction);
-#endif
-
-  documentaction *adocumentaction = new documentaction();
-  adocumentaction->set_receptionist (&recpt);
-  recpt.add_action (adocumentaction);
-
   userdbclass *udb = new userdbclass(gsdlhome);
   keydbclass *kdb = new keydbclass(gsdlhome);
 
-#ifdef GSDL_USE_USERS_ACTION
-  usersaction *ausersaction = new usersaction();
-  ausersaction->set_userdb(udb);
-  recpt.add_action (ausersaction);
-#endif
+  add_all_actions(recpt,udb,kdb);
+  // Note: these actions will become invalid at the end of this function. 
+  // => We will retrieve them from the receptionist and delete them
 
-#ifdef GSDL_USE_EXTLINK_ACTION
-  extlinkaction *aextlinkaction = new extlinkaction();
-  aextlinkaction->set_receptionist(&recpt);
-  recpt.add_action (aextlinkaction);
-#endif
-		
-#ifdef GSDL_USE_AUTHEN_ACTION
-  authenaction *aauthenaction = new authenaction();
-  aauthenaction->set_userdb(udb);
-  aauthenaction->set_keydb(kdb);
-  aauthenaction->set_receptionist(&recpt);
-  recpt.add_action (aauthenaction);
-#endif
-
-#ifdef GSDL_USE_COLLECTOR_ACTION
-  collectoraction *acollectoraction = new collectoraction();
-  acollectoraction->set_receptionist (&recpt);
-  recpt.add_action(acollectoraction);
-#endif
-
-#ifdef GSDL_USE_DEPOSITOR_ACTION
-  depositoraction *adepositoraction = new depositoraction();
-  adepositoraction->set_receptionist (&recpt);
-  recpt.add_action(adepositoraction);
-#endif
-
-#ifdef GSDL_USE_BROWSE_ACTION
-  browseaction *abrowseaction = new browseaction();
-  abrowseaction->set_receptionist (&recpt);
-  recpt.add_action(abrowseaction);
-#endif
-
-#ifdef GSDL_USE_PHIND_ACTION
-  recpt.add_action(new phindaction());
-#endif
-
-#ifdef GSDL_USE_GTI_ACTION
-  gtiaction *agtiaction = new gtiaction();
-  agtiaction->set_receptionist(&recpt);
-  recpt.add_action(agtiaction);
-#endif
-
-  dynamicclassifieraction *adynamicclassifieraction = new dynamicclassifieraction();
-  adynamicclassifieraction->set_receptionist(&recpt);
-  recpt.add_action(adynamicclassifieraction);  
-
-  // list of browsers
-  vlistbrowserclass avlistbrowserclass;
-  avlistbrowserclass.set_receptionist(&recpt);
-  recpt.add_browser (&avlistbrowserclass);
-  recpt.setdefaultbrowser ("VList");
-
-  hlistbrowserclass ahlistbrowserclass;
-  ahlistbrowserclass.set_receptionist(&recpt);
-  recpt.add_browser (&ahlistbrowserclass);
-
-#ifdef GSDL_USE_DATELIST_BROWSER
-  datelistbrowserclass adatelistbrowserclass;
-  recpt.add_browser (&adatelistbrowserclass);
-#endif
-
-  invbrowserclass ainvbrowserclass;
-  recpt.add_browser (&ainvbrowserclass);
-
-#ifdef GSDL_USE_PAGED_BROWSER
-  pagedbrowserclass apagedbrowserclass;
-  recpt.add_browser (&apagedbrowserclass);
-#endif
-
-#ifdef GSDL_USE_HTML_BROWSER
-  htmlbrowserclass ahtmlbrowserclass;
-  recpt.add_browser (&ahtmlbrowserclass);
-#endif
-
-#ifdef GSDL_USE_PHIND_BROWSER
-  phindbrowserclass aphindbrowserclass;
-  recpt.add_browser (&aphindbrowserclass);
-#endif
+  add_all_browsers(recpt);
+  // Browsers are not currently deleted (at all?) in code.  Seems likely they
+  // should be treated in a similar fashion to actions
 
   cgiwrapper (recpt, "");
@@ -252,7 +111,8 @@
   // clean up the actions
   actionmapclass::iterator thisAction = recpt.get_actionmap_ptr()->begin();
-  actionmapclass::iterator endAction = recpt.get_actionmap_ptr()->begin();
+  actionmapclass::iterator endAction = recpt.get_actionmap_ptr()->end();
   while (thisAction != endAction) {
-    delete thisAction->second.a; thisAction->second.a = NULL;
+    delete thisAction->second.a; 
+    thisAction->second.a = NULL;
     ++thisAction;
   }
@@ -260,4 +120,18 @@
   recpt.get_actionmap_ptr()->erase(thisAction, endAction);
 
+
+  /*
+  // clean up the browsers
+  browsermapclass::iterator thisBrowser = recpt.get_browsermap_ptr()->begin();
+  browsermapclass::iterator endBrowser = recpt.get_browsermap_ptr()->end();
+  while (thisBrowser != endBrowser) {
+    delete thisBrowser->second.a; 
+    thisBrowser->second.a = NULL;
+    ++thisBrowser;
+  }
+  thisBrowser = recpt.get_browsermap_ptr()->begin();
+  recpt.get_browsermap_ptr()->erase(thisBrowser, endBrowser);
+  */
+
   return 0;
 }
