[glom] Find: Really stop when cancelling after none found.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Find: Really stop when cancelling after none found.
- Date: Fri, 18 Oct 2013 11:14:36 +0000 (UTC)
commit b2d1b56cdb3e5fc17db1166962aa1b252b8ef7d7
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Oct 18 13:14:29 2013 +0200
Find: Really stop when cancelling after none found.
glom/frame_glom.cc | 17 +++++++++++------
glom/frame_glom.h | 5 ++++-
glom/mode_data/notebook_data.cc | 1 +
3 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index db80209..2602492 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -1350,9 +1350,15 @@ void Frame_Glom::on_notebook_find_criteria(const Gnome::Gda::SqlExpr& where_clau
FoundSet found_set;
found_set.m_table_name = m_table_name;
found_set.m_where_clause = where_clause_to_use;
- records_found = m_Notebook_Data.init_db_details(found_set);
+ const bool inited = m_Notebook_Data.init_db_details(found_set);
m_Notebook_Data.select_page_for_find_results();
+
+ //Show how many records were found:
+ records_found = update_records_count();
+
+ if(!inited)
+ records_found = 0;
}
std::cout << G_STRFUNC << ": records_found=" << records_found << std::endl;
@@ -1365,6 +1371,7 @@ void Frame_Glom::on_notebook_find_criteria(const Gnome::Gda::SqlExpr& where_clau
{
//Go back to data mode, showing all records:
on_button_find_all();
+ app->set_mode_data();
}
}
else
@@ -1372,9 +1379,6 @@ void Frame_Glom::on_notebook_find_criteria(const Gnome::Gda::SqlExpr& where_clau
//Actually show the found data,
//and show that we are in data mode:
app->set_mode_data();
-
- //Show how many records were found:
- update_records_count();
}
}
@@ -2519,10 +2523,10 @@ void Frame_Glom::on_notebook_data_record_selection_changed()
pApp->enable_menu_print_layouts_details(something_selected);
}
-void Frame_Glom::update_records_count()
+gulong Frame_Glom::update_records_count()
{
//Get the number of records available and the number found,
- //and all the user to find all if necessary.
+ //and allow the user to find all if necessary.
gulong count_all = 0;
gulong count_found = 0;
@@ -2556,6 +2560,7 @@ void Frame_Glom::update_records_count()
m_Label_RecordsCount.set_text(str_count_all);
m_Label_FoundCount.set_text(str_count_found);
+ return count_found;
}
void Frame_Glom::on_button_find_all()
diff --git a/glom/frame_glom.h b/glom/frame_glom.h
index b36b0fd..0d90ac5 100644
--- a/glom/frame_glom.h
+++ b/glom/frame_glom.h
@@ -216,7 +216,10 @@ private:
Gtk::Window* get_app_window();
const Gtk::Window* get_app_window() const;
- void update_records_count();
+ /** Show the number of records in the table, and the number found, in the UI.
+ * @result The number of records found, for convenience for the caller.
+ */
+ gulong update_records_count();
void alert_no_table();
diff --git a/glom/mode_data/notebook_data.cc b/glom/mode_data/notebook_data.cc
index 9f3acc5..b85bf6b 100644
--- a/glom/mode_data/notebook_data.cc
+++ b/glom/mode_data/notebook_data.cc
@@ -130,6 +130,7 @@ bool Notebook_Data::init_db_details(const FoundSet& found_set, const Gnome::Gda:
sharedptr<SharedConnection> sharedconnection = connect_to_server(get_app_window());
result = m_Box_List.init_db_details(found_set, get_active_layout_platform(get_document())); //TODO:
Select the last selected record.
+ std::cout << G_STRFUNC << ": result=" << result << std::endl;
//Show the previously-shown record, if there is one, if this is not a new found-set (via a new
where_clause)
//so that returning to this table will return the user to the same record:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]