glom r1853 - in trunk: . glom/libglom/document glom/navigation



Author: murrayc
Date: Tue Jan 20 10:49:00 2009
New Revision: 1853
URL: http://svn.gnome.org/viewvc/glom?rev=1853&view=rev

Log:
2009-01-20  Murray Cumming  <murrayc murrayc com>

* glom/libglom/document/document_glom.cc: save_changes():
Revert the Johannes change here too, because it is causing infinite 
loops when adding fields, and probably at other times, repeatedly 
saving the file. The code is not equivalent.

Modified:
   trunk/ChangeLog
   trunk/glom/libglom/document/document_glom.cc
   trunk/glom/navigation/box_tables.cc

Modified: trunk/glom/libglom/document/document_glom.cc
==============================================================================
--- trunk/glom/libglom/document/document_glom.cc	(original)
+++ trunk/glom/libglom/document/document_glom.cc	Tue Jan 20 10:49:00 2009
@@ -1289,8 +1289,8 @@
     
 void Document_Glom::set_tables(const type_listTableInfo& tables)
 {
-  //TODO: Avoid adding information about tables that we don't know about - that should be done explicitly.
-  //Look at each "table".
+  //We avoid adding information about tables that we don't know about - that should be done explicitly.
+  //Look at each "table":
 
   bool something_changed = false;
   for(type_tables::iterator iter = m_tables.begin(); iter != m_tables.end(); iter++)
@@ -1299,13 +1299,14 @@
 
     const Glib::ustring table_name = doctableinfo.m_info->get_name();
 
+    //If the table is also in the supplied list:
     type_listTableInfo::const_iterator iterfind = std::find_if(tables.begin(), tables.end(), predicate_FieldHasName<TableInfo>(table_name));
     if(iterfind != tables.end())
     {
       sharedptr<TableInfo> info = doctableinfo.m_info;
 
       sharedptr<TableInfo> infoFound = *iterfind;
-      *info = *infoFound;
+      *info = *infoFound; //TODO: Check that it has really changed, to avoid calling set_modified() unnecessarily?
 
       something_changed = true;
     }
@@ -1742,21 +1743,19 @@
   //(when in developer mode - no changes should even be possible when not in developer mode)
   if(get_userlevel() == AppState::USERLEVEL_DEVELOPER)
   {
-    /*//This rebuilds the whole XML DOM and saves the whole document,
+    //This rebuilds the whole XML DOM and saves the whole document,
     //so we need to be careful not to call set_modified() too often.
 
-      bool test = save_before();
+    bool test = save_before();
+    if(test)
+    {
+      //std::cout << "Document_Glom::save_changes(): calling write_to_disk()." << std::endl;
+      test = write_to_disk();
       if(test)
       {
-        //std::cout << "Document_Glom::save_changes(): calling write_to_disk()." << std::endl;
-        test = write_to_disk();
-        if(test)
-        {
-          set_modified(false);
-        }
-      }*/
-		// The above is equivalent as calling Bakery::Document::save()
-		save();
+        set_modified(false);
+      }
+    }
   }
   else
   {

Modified: trunk/glom/navigation/box_tables.cc
==============================================================================
--- trunk/glom/navigation/box_tables.cc	(original)
+++ trunk/glom/navigation/box_tables.cc	Tue Jan 20 10:49:00 2009
@@ -381,7 +381,7 @@
     }
 
     if(document)
-      document->set_tables( listTables); //TODO: Don't save all new tables - just the ones already in the document.
+      document->set_tables(listTables); //TODO: Don't save all new tables - just the ones already in the document.
   }
 }
 



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