[glom] List: Actually show custom choices, instead of crashing.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] List: Actually show custom choices, instead of crashing.
- Date: Fri, 14 Oct 2011 18:58:50 +0000 (UTC)
commit 5daa674d23f7fb3d799f7bc147b5fee861011ad6
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Oct 14 20:58:27 2011 +0200
List: Actually show custom choices, instead of crashing.
* glom/mode_data/datawidget/cellcreation.cc: create_cell(): Call
set_choices_fixed() if appropriate.
* glom/mode_data/datawidget/cellrenderer_dblist.cc: on_editing_started():
Replace a g_assert with a warning to std::cerr, in case this happens
again, particularly now that we know when it can happen - if there is
no text-column set.
Bug #661764 (Andrà Klapper)
ChangeLog | 12 ++++++++++++
glom/mode_data/datawidget/cellcreation.cc | 12 ++++++++++--
glom/mode_data/datawidget/cellrenderer_dblist.cc | 8 +++++++-
3 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7c3a3eb..cea7238 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2011-10-14 Murray Cumming <murrayc murrayc com>
+ List: Actually show custom choices, instead of crashing.
+
+ * glom/mode_data/datawidget/cellcreation.cc: create_cell(): Call
+ set_choices_fixed() if appropriate.
+ * glom/mode_data/datawidget/cellrenderer_dblist.cc: on_editing_started():
+ Replace a g_assert with a warning to std::cerr, in case this happens
+ again, particularly now that we know when it can happen - if there is
+ no text-column set.
+ Bug #661764 (Andrà Klapper)
+
+2011-10-14 Murray Cumming <murrayc murrayc com>
+
Print Layout: Avoid grouping items at the tops of pages.
* glom/print_layout/print_layout_utils.[h|cc]: move_fully_to_page():
diff --git a/glom/mode_data/datawidget/cellcreation.cc b/glom/mode_data/datawidget/cellcreation.cc
index 510c96d..2b02749 100644
--- a/glom/mode_data/datawidget/cellcreation.cc
+++ b/glom/mode_data/datawidget/cellcreation.cc
@@ -90,14 +90,22 @@ Gtk::CellRenderer* create_cell(const sharedptr<const LayoutItem>& layout_item, c
}
default:
{
- if(item_field->get_formatting_used().get_has_choices())
+ const FieldFormatting& formatting = item_field->get_formatting_used();
+ if(formatting.get_has_choices())
{
CellRendererDbList* rendererList = Gtk::manage( new CellRendererDbList() );
sharedptr<LayoutItem> unconst = sharedptr<LayoutItem>::cast_const(layout_item); //TODO: Avoid this.
rendererList->set_layout_item(unconst, table_name);
bool as_radio_buttons = false; //Can't really be done in a list, so we ignore it.
rendererList->set_restrict_values_to_list(
- item_field->get_formatting_used().get_choices_restricted(as_radio_buttons));
+ formatting.get_choices_restricted(as_radio_buttons));
+
+ //Set the choices.
+ //For related choices, that gets set when the value of a dependent field is set.
+ if(formatting.get_has_custom_choices())
+ {
+ rendererList->set_choices_fixed( formatting.get_choices_custom() );
+ }
cell = rendererList;
}
diff --git a/glom/mode_data/datawidget/cellrenderer_dblist.cc b/glom/mode_data/datawidget/cellrenderer_dblist.cc
index a080bb0..551d6ea 100644
--- a/glom/mode_data/datawidget/cellrenderer_dblist.cc
+++ b/glom/mode_data/datawidget/cellrenderer_dblist.cc
@@ -200,7 +200,13 @@ void CellRendererDbList::repack_cells_related(Gtk::CellLayout* combobox)
void CellRendererDbList::on_editing_started(Gtk::CellEditable* cell_editable, const Glib::ustring& path)
{
- g_assert(cell_editable);
+ //This can happen if no text-column has been set yet,
+ //though that shouldn't really happen.
+ if(!cell_editable)
+ {
+ std::cerr << G_STRFUNC << ": cell_editable was null" << std::endl;
+ return;
+ }
Gtk::CellLayout* combobox = dynamic_cast<Gtk::CellLayout*>(cell_editable);
if(!combobox)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]