[glom] Details: Avoid warning when using System Preferences fields.



commit 69e6e5216b9aa1fb82a3eaf7b87c20cff435c1e6
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Sep 21 11:36:12 2011 +0200

    Details: Avoid warning when using System Preferences fields.
    
    * glom/libglom/document/document.cc: get_field_used_in_relationship_to_one():
    Do not complain when the system preferences table is not found.

 ChangeLog                         |    7 +++++++
 NEWS                              |    1 -
 glom/libglom/document/document.cc |    7 ++++++-
 3 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5692bb7..ae1924c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2011-09-21  Murray Cumming  <murrayc murrayc com>
 
+	Details: Avoid warning when using System Preferences fields.
+
+	* glom/libglom/document/document.cc: get_field_used_in_relationship_to_one():
+	Do not complain when the system preferences table is not found.
+
+2011-09-21  Murray Cumming  <murrayc murrayc com>
+
 	Avoid "m_backend is NULL" warning at startup.
 
 	* glom/libglom/connectionpool.[h|cc]: Added get_instance_is_ready().
diff --git a/NEWS b/NEWS
index 6435bb2..e408cba 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,5 @@
 1.19.11 (unstable):
 
-
 * Details:
   - Avoid an empty layout when changing to developer mode.
   (Requires libgdamm 4.99.4)
diff --git a/glom/libglom/document/document.cc b/glom/libglom/document/document.cc
index 8984984..b90fc66 100644
--- a/glom/libglom/document/document.cc
+++ b/glom/libglom/document/document.cc
@@ -4118,13 +4118,18 @@ sharedptr<const Relationship> Document::get_field_used_in_relationship_to_one(co
   type_tables::const_iterator iterFind = m_tables.find(table_used);
   if(iterFind == m_tables.end())
   {
+    //This table is special. We would not create a relationship to it using a field:
+    if(table_used == GLOM_STANDARD_TABLE_PREFS_TABLE_NAME)
+      return result;
+     
     std::cerr << G_STRFUNC << ": table not found:" << table_used << std::endl;
     return result;
   }
 
   //Look at each relationship:
+  const DocumentTableInfo& table_info = iterFind->second;
   const Glib::ustring field_name = layout_field->get_name();
-  for(type_vec_relationships::const_iterator iterRel = iterFind->second.m_relationships.begin(); iterRel != iterFind->second.m_relationships.end(); ++iterRel)
+  for(type_vec_relationships::const_iterator iterRel = table_info.m_relationships.begin(); iterRel != table_info.m_relationships.end(); ++iterRel)
   {
     sharedptr<const Relationship> relationship = *iterRel;
     if(relationship)



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