[glom] Minor formatting changes



commit d1a3988b8ebd2ec3064021e13f1d27359c2e7d83
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Feb 3 16:22:36 2012 +0100

    Minor formatting changes

 glom/mode_data/box_data.cc         |   30 +++++++++++++-------------
 glom/mode_data/box_data_details.cc |   39 +++++++++++++++++++----------------
 2 files changed, 36 insertions(+), 33 deletions(-)
---
diff --git a/glom/mode_data/box_data.cc b/glom/mode_data/box_data.cc
index efbb3a6..df821c4 100644
--- a/glom/mode_data/box_data.cc
+++ b/glom/mode_data/box_data.cc
@@ -358,21 +358,21 @@ void Box_Data::execute_button_script(const sharedptr<const LayoutItem_Button>& l
   //We need the connection when we run the script, so that the script may use it.
   sharedptr<SharedConnection> sharedconnection = connect_to_server(0 /* parent window */);
 
-    //Allow this UI to respond to UI change requests from the Python code:
-    AppPythonUICallbacks callbacks;
-
-    Glib::ustring error_message;
-    glom_execute_python_function_implementation(layout_item->get_script(),
-      field_values, //TODO: Maybe use the field's type here.
-      get_document(),
-      get_table_name(), field_primary_key, primary_key_value,
-      sharedconnection->get_gda_connection(),
-      callbacks,
-      error_message);
-    if(!error_message.empty())
-    {
-      std::cerr << "Python Error: " << error_message << std::endl;
-    }
+  //Allow this UI to respond to UI change requests from the Python code:
+  AppPythonUICallbacks callbacks;
+
+  Glib::ustring error_message;
+  glom_execute_python_function_implementation(layout_item->get_script(),
+    field_values, //TODO: Maybe use the field's type here.
+    get_document(),
+    get_table_name(), field_primary_key, primary_key_value,
+    sharedconnection->get_gda_connection(),
+    callbacks,
+    error_message);
+  if(!error_message.empty())
+  {
+    std::cerr << "Python Error: " << error_message << std::endl;
+  }
 }
 
 } //namespace Glom
diff --git a/glom/mode_data/box_data_details.cc b/glom/mode_data/box_data_details.cc
index 40f7346..ef9315d 100644
--- a/glom/mode_data/box_data_details.cc
+++ b/glom/mode_data/box_data_details.cc
@@ -675,27 +675,30 @@ void Box_Data_Details::on_flowtable_field_open_details_requested(const sharedptr
 
 void Box_Data_Details::on_flowtable_script_button_clicked(const sharedptr<const LayoutItem_Button>& layout_item)
 {
-  if(layout_item)
+  if(!layout_item)
   {
-    const Gnome::Gda::Value primary_key_value = get_primary_key_value_selected();
-    const Glib::ustring table_name_before = m_table_name;
-    execute_button_script(layout_item, primary_key_value);
+    std::cerr << G_STRFUNC << ": layout_item is null" << std::endl;
+    return;
+  }
+  
+  const Gnome::Gda::Value primary_key_value = get_primary_key_value_selected();
+  const Glib::ustring table_name_before = m_table_name;
+  execute_button_script(layout_item, primary_key_value);
 
-    //Refresh the view, in case the script changed any data,
-    //but not if the script navigated away:
-    if(m_table_name != table_name_before)
-      return;
+  //Refresh the view, in case the script changed any data,
+  //but not if the script navigated away:
+  if(m_table_name != table_name_before)
+    return;
 
-    //(m_primary_key_value seems to be NULL here. We can use primary_key_value instead, but it's a bit strange. murrayc.)
-    if(get_primary_key_is_in_foundset(m_found_set, primary_key_value)) //Check, because maybe the script deleted the current record, or changed something so that it should no longer be shown in the found set.
-    {
-      refresh_data_from_database_with_primary_key(primary_key_value);
-    }
-    else
-    {
-      //Tell the parent to do something appropriate, such as show another record:
-      signal_record_deleted().emit(primary_key_value);
-    }
+  //(m_primary_key_value seems to be NULL here. We can use primary_key_value instead, but it's a bit strange. murrayc.)
+  if(get_primary_key_is_in_foundset(m_found_set, primary_key_value)) //Check, because maybe the script deleted the current record, or changed something so that it should no longer be shown in the found set.
+  {
+    refresh_data_from_database_with_primary_key(primary_key_value);
+  }
+  else
+  {
+    //Tell the parent to do something appropriate, such as show another record:
+    signal_record_deleted().emit(primary_key_value);
   }
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]