[glom/maemo5] Change some indentation to make a function clearer.
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glom/maemo5] Change some indentation to make a function clearer.
- Date: Thu, 15 Oct 2009 11:50:41 +0000 (UTC)
commit 2eba23537aec710447a6ecdbbb800a4bea93dd20
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Oct 15 13:46:58 2009 +0200
Change some indentation to make a function clearer.
glom/utility_widgets/db_adddel/db_adddel.cc | 96 ++++++++++++++-------------
1 files changed, 49 insertions(+), 47 deletions(-)
---
diff --git a/glom/utility_widgets/db_adddel/db_adddel.cc b/glom/utility_widgets/db_adddel/db_adddel.cc
index cc14985..738f654 100644
--- a/glom/utility_widgets/db_adddel/db_adddel.cc
+++ b/glom/utility_widgets/db_adddel/db_adddel.cc
@@ -2548,6 +2548,7 @@ void DbAddDel::user_added(const Gtk::TreeModel::iterator& row)
std::cout << "DEBUG: DbAddDel::user_added()" << std::endl;
//Prevent impossible multiple related records:
+ //The developer-mode UI now prevents the developer from using such a relationship anyway.
if(m_allow_only_one_related_record && (get_count() > 0))
{
//Tell user that they can't do that:
@@ -2584,59 +2585,60 @@ void DbAddDel::user_added(const Gtk::TreeModel::iterator& row)
}
//If no primary key value is available yet, then don't add the record yet:
- if(!Conversions::value_is_empty(primary_key_value))
+ if(Conversions::value_is_empty(primary_key_value))
+ return;
+
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ sharedptr<SharedConnection> sharedconnection = connect_to_server(get_application()); //Keep it alive while we need the data_model.
+ #else
+ std::auto_ptr<ExceptionConnection> error;
+ sharedptr<SharedConnection> sharedconnection = connect_to_server(get_application(), error); //Keep it alive while we need the data_model.
+ // Ignore error - sharedconnection is checked for NULL instead:
+ #endif
+ if(!sharedconnection)
{
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
- sharedptr<SharedConnection> sharedconnection = connect_to_server(get_application()); //Keep it alive while we need the data_model.
-#else
- std::auto_ptr<ExceptionConnection> error;
- sharedptr<SharedConnection> sharedconnection = connect_to_server(get_application(), error); //Keep it alive while we need the data_model.
- // Ignore error - sharedconnection is checked for NULL instead:
-#endif
- if(sharedconnection)
- {
- sharedptr<LayoutItem_Field> layout_field = sharedptr<LayoutItem_Field>::create();
- layout_field->set_full_field_details(primary_key_field);
- if(!check_entered_value_for_uniqueness(m_found_set.m_table_name, layout_field, primary_key_value, get_application()))
- {
- //Revert to a blank value.
- primary_key_value = Conversions::get_empty_value(layout_field->get_full_field_details()->get_glom_type());
- set_entered_field_data(row, layout_field, primary_key_value);
- return;
- }
+ //Add Record failed.
+ //Replace with correct values:
+ fill_from_database();
+ return;
+ }
+
- if(m_find_mode)
- return;
-
- const bool added = record_new(true /* use entered field data*/, primary_key_value);
- if(added)
- {
- //Save the primary key value for later use:
- set_value_key(row, primary_key_value);
+ sharedptr<LayoutItem_Field> layout_field = sharedptr<LayoutItem_Field>::create();
+ layout_field->set_full_field_details(primary_key_field);
+ if(!check_entered_value_for_uniqueness(m_found_set.m_table_name, layout_field, primary_key_value, get_application()))
+ {
+ //Revert to a blank value.
+ primary_key_value = Conversions::get_empty_value(layout_field->get_full_field_details()->get_glom_type());
+ set_entered_field_data(row, layout_field, primary_key_value);
+ return;
+ }
- //Show the primary key in the row, if the primary key is visible:
+ if(m_find_mode)
+ return;
- //If it's an auto-increment, then get the value and show it:
- if(primary_key_field->get_auto_increment())
- {
- sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
- layout_item->set_full_field_details(primary_key_field);
- set_value(row, layout_item, primary_key_value);
- }
+ const bool added = record_new(true /* use entered field data*/, primary_key_value);
+ if(!added)
+ {
+ handle_error();
+ return;
+ }
+
+ //Save the primary key value for later use:
+ set_value_key(row, primary_key_value);
- //Allow a parent widget to link the new record by setting the foreign key:
- signal_record_added().emit(row, primary_key_value);
- }
- else
- handle_error();
- }
- else
- {
- //Add Record failed.
- //Replace with correct values:
- fill_from_database();
- }
+ //Show the primary key in the row, if the primary key is visible:
+
+ //If it's an auto-increment, then get the value and show it:
+ if(primary_key_field->get_auto_increment())
+ {
+ sharedptr<LayoutItem_Field> layout_item = sharedptr<LayoutItem_Field>::create();
+ layout_item->set_full_field_details(primary_key_field);
+ set_value(row, layout_item, primary_key_value);
}
+
+ //Allow a parent widget to link the new record by setting the foreign key:
+ signal_record_added().emit(row, primary_key_value);
}
void DbAddDel::user_requested_delete(const Gtk::TreeModel::iterator& rowStart, const Gtk::TreeModel::iterator& /* rowEnd TODO */)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]