[glom/glom-1-18] Find: Get criteria even when a field is on the layout twice.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/glom-1-18] Find: Get criteria even when a field is on the layout twice.
- Date: Fri, 7 Oct 2011 07:55:29 +0000 (UTC)
commit 548e8b8cabe43db7c40d45494d44e3a63527beec
Author: Murray Cumming <murrayc murrayc com>
Date: Sun Oct 2 23:49:12 2011 +0200
Find: Get criteria even when a field is on the layout twice.
* glom/mode_data/flowtablewithfields.cc: get_field_value():
Look at all the widgets for this field, instead of just the first one,
and keep looking until we find a non-empty value.
This is still rather arbitrary, but this method is only used for
find criteria, or should be.
ChangeLog | 10 ++++++++++
glom/mode_data/flowtablewithfields.cc | 12 ++++++++----
2 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7bc20b5..337f1e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-10-02 Murray Cumming <murrayc murrayc com>
+
+ Find: Get criteria even when a field is on the layout twice.
+
+ * glom/mode_data/flowtablewithfields.cc: get_field_value():
+ Look at all the widgets for this field, instead of just the first one,
+ and keep looking until we find a non-empty value.
+ This is still rather arbitrary, but this method is only used for
+ find criteria, or should be.
+
2011-09-29 Murray Cumming <murrayc murrayc com>
Dialog_Choose_ID: Work around a crash in GTK+.
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index f9a3130..33c5221 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -837,12 +837,16 @@ void FlowTableWithFields::set_other_field_value(const sharedptr<const LayoutItem
Gnome::Gda::Value FlowTableWithFields::get_field_value(const sharedptr<const LayoutItem_Field>& field) const
{
type_list_const_widgets list_widgets = get_field(field, true);
- if(!list_widgets.empty())
+ for(type_list_const_widgets::const_iterator iter = list_widgets.begin();
+ iter != list_widgets.end(); ++iter)
{
- const DataWidget* datawidget = dynamic_cast<const DataWidget*>(*(list_widgets.begin()));
+ const DataWidget* datawidget = dynamic_cast<const DataWidget*>(*iter);
+ if(!datawidget)
+ continue;
- if(datawidget)
- return datawidget->get_value();
+ const Gnome::Gda::Value value = datawidget->get_value();
+ if(!Conversions::value_is_empty(value))
+ return value;
}
//g_warning("FlowTableWithFields::get_field_value(): returning null");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]