[glom/glom-1-20] List view: Do not show columns twice.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/glom-1-20] List view: Do not show columns twice.
- Date: Mon, 16 Jan 2012 13:01:38 +0000 (UTC)
commit b9a2ad6c0b5c59c1955ec11201c97663036b8972
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Dec 12 10:01:30 2011 +0100
List view: Do not show columns twice.
* glom/libglom/data_structure/layout/layoutgroup.[h|cc]:
Revert the recent change to get_items_recursive() so that it only returns
no-groups items, as its documentation says.
Add get_items_recursive_with_groups().
* tests/test_document_load.cc: Use the new method.
This problem was caused by commit e51bf19e8a595dbc4e34c390ae2194293deb0236
ChangeLog | 12 ++++++++
glom/libglom/data_structure/layout/layoutgroup.cc | 30 ++++++++++++++++----
glom/libglom/data_structure/layout/layoutgroup.h | 5 +++
tests/test_document_load.cc | 2 +-
4 files changed, 42 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 30af01f..95e637a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-12-12 Murray Cumming <murrayc murrayc com>
+
+ List view: Do not show columns twice.
+
+ * glom/libglom/data_structure/layout/layoutgroup.[h|cc]:
+ Revert the recent change to get_items_recursive() so that it only returns
+ no-groups items, as its documentation says.
+ Add get_items_recursive_with_groups().
+ * tests/test_document_load.cc: Use the new method.
+
+ This problem was caused by commit e51bf19e8a595dbc4e34c390ae2194293deb0236
+
2012-01-09 Murray Cumming <murrayc murrayc com>
examples: Remove translations for useless locale.
diff --git a/glom/libglom/data_structure/layout/layoutgroup.cc b/glom/libglom/data_structure/layout/layoutgroup.cc
index 7860b0d..56f8157 100644
--- a/glom/libglom/data_structure/layout/layoutgroup.cc
+++ b/glom/libglom/data_structure/layout/layoutgroup.cc
@@ -217,15 +217,14 @@ LayoutGroup::type_list_const_items LayoutGroup::get_items_recursive() const
{
const sharedptr<const LayoutItem> item = *iter;
- //Add the item itself:
- result.push_back(item);
-
sharedptr<const LayoutGroup> group = sharedptr<const LayoutGroup>::cast_dynamic(item);
if(group)
{
const type_list_const_items sub_result = group->get_items_recursive();
result.insert(result.end(), sub_result.begin(), sub_result.end());
}
+ else
+ result.push_back(item);
}
return result;
@@ -239,9 +238,6 @@ LayoutGroup::type_list_items LayoutGroup::get_items_recursive()
{
const sharedptr<LayoutItem> item = *iter;
- //Add the item itself:
- result.push_back(item);
-
sharedptr<LayoutGroup> group = sharedptr<LayoutGroup>::cast_dynamic(item);
if(group)
{
@@ -255,6 +251,28 @@ LayoutGroup::type_list_items LayoutGroup::get_items_recursive()
return result;
}
+LayoutGroup::type_list_const_items LayoutGroup::get_items_recursive_with_groups() const
+{
+ type_list_const_items result;
+
+ for(type_list_items::const_iterator iter = m_list_items.begin(); iter != m_list_items.end(); ++iter)
+ {
+ const sharedptr<const LayoutItem> item = *iter;
+
+ //Add the item itself:
+ result.push_back(item);
+
+ sharedptr<const LayoutGroup> group = sharedptr<const LayoutGroup>::cast_dynamic(item);
+ if(group)
+ {
+ const type_list_const_items sub_result = group->get_items_recursive();
+ result.insert(result.end(), sub_result.begin(), sub_result.end());
+ }
+ }
+
+ return result;
+}
+
void LayoutGroup::remove_relationship(const sharedptr<const Relationship>& relationship)
{
LayoutGroup::type_list_items::iterator iterItem = m_list_items.begin();
diff --git a/glom/libglom/data_structure/layout/layoutgroup.h b/glom/libglom/data_structure/layout/layoutgroup.h
index 1bcd5fe..1e46097 100644
--- a/glom/libglom/data_structure/layout/layoutgroup.h
+++ b/glom/libglom/data_structure/layout/layoutgroup.h
@@ -137,6 +137,11 @@ public:
*/
type_list_items get_items_recursive();
+ /** Get the items recursively, depth-first, also returning the groups.
+ * This is only used by the tests so far.
+ */
+ type_list_const_items get_items_recursive_with_groups() const;
+
virtual Glib::ustring get_part_type_name() const;
virtual Glib::ustring get_report_part_id() const;
diff --git a/tests/test_document_load.cc b/tests/test_document_load.cc
index 8c0a009..caf0369 100644
--- a/tests/test_document_load.cc
+++ b/tests/test_document_load.cc
@@ -80,7 +80,7 @@ static Glom::sharedptr<const Glom::LayoutItem_Portal> get_portal_from_details_la
const Glom::sharedptr<const Glom::LayoutGroup> group = *iter;
const Glom::LayoutGroup::type_list_const_items items =
- group->get_items_recursive();
+ group->get_items_recursive_with_groups();
for(Glom::LayoutGroup::type_list_const_items::const_iterator iter = items.begin();
iter != items.end(); ++iter)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]