[glom] Button scripts: Don't change the table back after the script has shown another.



commit 1e369ce07d9011aa16d3a0b4f176e43180743430
Author: Murray Cumming <murrayc murrayc com>
Date:   Sun Feb 28 17:50:48 2010 +0100

    Button scripts: Don't change the table back after the script has shown another.
    
    * glom/mode_data/box_data_details.cc: on_flowtable_script_button_clicked():
    Avoid refreshing the data if the script changed what table is shown, because
    that would change it back.

 glom/mode_data/box_data_details.cc |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/glom/mode_data/box_data_details.cc b/glom/mode_data/box_data_details.cc
index 8af11bb..2a60f2d 100644
--- a/glom/mode_data/box_data_details.cc
+++ b/glom/mode_data/box_data_details.cc
@@ -706,9 +706,14 @@ void Box_Data_Details::on_flowtable_script_button_clicked(const sharedptr<const
   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);
 
-    //Refresh the view, in case the script changed any data:
+    //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.
     {



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