[glom/feature_choices_related_layout] In progress



commit 28c4d27a35425b97a655f5f413bb3ff71d06670d
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Sep 7 17:02:56 2010 +0200

    In progress

 glom/libglom/document/document.cc                  |   12 +++++++++++-
 .../layout_item_dialogs/dialog_fieldslist.cc       |   13 ++++++++++++-
 2 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/glom/libglom/document/document.cc b/glom/libglom/document/document.cc
index 3d71af6..6860a65 100644
--- a/glom/libglom/document/document.cc
+++ b/glom/libglom/document/document.cc
@@ -2020,9 +2020,19 @@ void Document::load_after_layout_item_formatting(const xmlpp::Element* element,
         xmlpp::Element* nodeExtraLayout = get_node_child_named(element, GLOM_ATTRIBUTE_FORMAT_CHOICES_RELATED_EXTRA_LAYOUT);
         if(nodeExtraLayout)
         {
+          std::cout << "debuga1" << std::endl;
           xmlpp::Element* nodeGroups = get_node_child_named(nodeExtraLayout, GLOM_NODE_DATA_LAYOUT_GROUPS);
           if(nodeGroups)
-            load_after_layout_group(nodeGroups, relationship->get_to_table(), extra_layouts);
+          {
+
+            sharedptr<LayoutGroup> layout_group = sharedptr<LayoutGroup>::create();
+            load_after_layout_group(nodeGroups, relationship->get_to_table(), layout_group);
+            if(layout_group && !(layout_group->m_list_items.empty()))
+            {
+              //We actually want the sub-group:
+              extra_layouts = sharedptr<LayoutGroup>::cast_dynamic( layout_group->m_list_items[0] );
+            }
+          }
         }
       }
 
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc b/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
index cdc0de1..ee4d42f 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
@@ -120,6 +120,8 @@ void Dialog_FieldsList::set_fields(const Glib::ustring& table_name, const Layout
     for(LayoutGroup::type_list_items::const_iterator iter = fields.begin(); iter != fields.end(); ++iter)
     {
       sharedptr<const LayoutItem_Field> item = sharedptr<const LayoutItem_Field>::cast_dynamic(*iter);
+      if(!item)
+        continue;
 
       Gtk::TreeModel::iterator iterTree = m_model_fields->append();
       Gtk::TreeModel::Row row = *iterTree;
@@ -277,7 +279,16 @@ void Dialog_FieldsList::on_cell_data_name(Gtk::CellRenderer* renderer, const Gtk
       Gtk::TreeModel::Row row = *iter;
 
       sharedptr<const LayoutItem_Field> item = row[m_ColumnsFields.m_col_layout_item]; //TODO_performance: Reduce copying.
-      renderer_text->property_markup() = item->get_layout_display_name();
+      if(item)
+      {
+        renderer_text->property_markup() = item->get_layout_display_name();
+      }
+      else
+      {
+        //Though this really shouldn't even be in the model:
+        renderer_text->property_markup() = Glib::ustring();
+      }
+
       renderer_text->property_editable() = false; //Names can never be edited.
     }
   }



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