[glom] LayoutGroup: Deprecate the old has_field() method and do not use it.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] LayoutGroup: Deprecate the old has_field() method and do not use it.
- Date: Tue, 29 Nov 2011 10:58:05 +0000 (UTC)
commit 1626750d239293fad6dcb5932ed416acf4f7c713
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Nov 29 11:54:28 2011 +0100
LayoutGroup: Deprecate the old has_field() method and do not use it.
* glom/libglom/data_structure/layout/layoutgroup.h:
* glom/libglom/document/document.cc:
* tests/test_document_load.cc: Adapt.
ChangeLog | 8 ++++++++
glom/libglom/data_structure/layout/layoutgroup.h | 8 +++++---
glom/libglom/document/document.cc | 2 +-
tests/test_document_load.cc | 10 +---------
4 files changed, 15 insertions(+), 13 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bb49a73..0eac1ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2011-11-29 Murray Cumming <murrayc murrayc com>
+ LayoutGroup: Deprecate the old has_field() method and do not use it.
+
+ * glom/libglom/data_structure/layout/layoutgroup.h:
+ * glom/libglom/document/document.cc:
+ * tests/test_document_load.cc: Adapt.
+
+2011-11-29 Murray Cumming <murrayc murrayc com>
+
test_document_load: Check that a field is on a layout.
* glom/libglom/data_structure/layout/layoutgroup.[h|cc]:
diff --git a/glom/libglom/data_structure/layout/layoutgroup.h b/glom/libglom/data_structure/layout/layoutgroup.h
index eb972ce..8ed5086 100644
--- a/glom/libglom/data_structure/layout/layoutgroup.h
+++ b/glom/libglom/data_structure/layout/layoutgroup.h
@@ -39,17 +39,19 @@ public:
virtual ~LayoutGroup();
virtual LayoutItem* clone() const;
-
- //TODO: Unify the has_field() and remove_field() method overloads,
- //probably like so: has_field(parent_table_name, table_name, field_name);
+ //TODO: Remove this now-unused method overload.
/** Discover whether the layout group contains the specified related field,
* @param field_name The name of the field to search for.
* @result True if the field is in the layout group (or its child groups).
+ *
+ * @deprecated Use has_field(parent_table_name, table_name, field_name) instead.
*/
bool has_field(const Glib::ustring& field_name) const;
/** Discover whether the layout group contains the specified field (from the current table).
+ * @param parent_table_name The table to which this layout belongs.
+ * @param table_name The table to which the field, specified by @a field_name, belongs.
* @param field_name The name of the field to search for.
* @result True if the field is in the layout group (or its child groups).
*/
diff --git a/glom/libglom/document/document.cc b/glom/libglom/document/document.cc
index 9813d2a..a7ca56c 100644
--- a/glom/libglom/document/document.cc
+++ b/glom/libglom/document/document.cc
@@ -1555,7 +1555,7 @@ Document::type_list_layout_groups Document::get_data_layout_groups_default(const
for(type_list_layout_groups::const_iterator iterFind = result.begin(); iterFind != result.end(); ++iterFind)
{
sharedptr<const LayoutGroup> group = *iterFind;
- if(group && group->has_field(field_name))
+ if(group && group->has_field(parent_table_name, parent_table_name, field_name))
{
found = true;
break;
diff --git a/tests/test_document_load.cc b/tests/test_document_load.cc
index e0f8b7f..87121ff 100644
--- a/tests/test_document_load.cc
+++ b/tests/test_document_load.cc
@@ -128,25 +128,17 @@ int main()
const Glom::Document::type_list_layout_groups groups =
document.get_data_layout_groups("details", layout_table_name);
bool found_on_layout = false;
- bool found_related_on_layout = false;
for(Glom::Document::type_list_layout_groups::const_iterator iter = groups.begin(); iter != groups.end(); ++iter)
{
const Glom::sharedptr<Glom::LayoutGroup> group = *iter;
- if(group->has_field("album_id"))
- {
- found_on_layout = true;
- break;
- }
-
if(group->has_field(layout_table_name, "artists", "name"))
{
- found_related_on_layout = true;
+ found_on_layout = true;
break;
}
}
g_assert(found_on_layout);
- g_assert(found_related_on_layout);
Glom::libglom_deinit();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]