[glom] Box_Tables::on_adddel_changed(): Don't try to rename before an add.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Box_Tables::on_adddel_changed(): Don't try to rename before an add.
- Date: Thu, 29 Sep 2016 09:54:56 +0000 (UTC)
commit de23ae3b53451bd6ae1e3f2d7afda9d19531cbc4
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Sep 29 11:54:48 2016 +0200
Box_Tables::on_adddel_changed(): Don't try to rename before an add.
glom/navigation/box_tables.cc | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/glom/navigation/box_tables.cc b/glom/navigation/box_tables.cc
index 298d6c1..a60aaf1 100644
--- a/glom/navigation/box_tables.cc
+++ b/glom/navigation/box_tables.cc
@@ -400,6 +400,17 @@ void Box_Tables::on_adddel_changed(const Gtk::TreeModel::iterator& row, guint co
else if(column == m_col_table_name)
{
Glib::ustring table_name = m_AddDel.get_value_key(row);
+
+ // Check that the table really already exists.
+ // It could be left over from a failed attempt to add a table.
+ // In that case, try to add it again.
+ auto document = get_document();
+ if(!document->get_table_is_known(table_name))
+ {
+ on_adddel_Add(row);
+ return;
+ }
+
Glib::ustring table_name_new = m_AddDel.get_value(row, m_col_table_name);
if(!table_name.empty() && !table_name_new.empty())
{
@@ -422,7 +433,6 @@ void Box_Tables::on_adddel_changed(const Gtk::TreeModel::iterator& row, guint co
set_modified();
//Tell the document that this table's name has changed:
- auto document = get_document();
if(document)
document->change_table_name(table_name, table_name_new);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]