[glom] Find: Show only the found records.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Find: Show only the found records.
- Date: Fri, 18 Oct 2013 19:40:36 +0000 (UTC)
commit 52efc4155d99ecfcc16649b2ed40d6d2116685b0
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Oct 18 21:39:24 2013 +0200
Find: Show only the found records.
* glom/frame_glom.cc: set_mode(): Call set_mode_widget() too,
so the UI is always showing the correct widgets.
set_mode_widget(): Avoid unnecessary changes.
glom/frame_glom.cc | 36 +++++++++++++++++++++++++-----------
glom/mode_data/notebook_data.cc | 1 -
2 files changed, 25 insertions(+), 12 deletions(-)
---
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index 2602492..b5ebf21 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -264,17 +264,22 @@ void Frame_Glom::set_mode_widget(Gtk::Widget& widget)
//and I don't see a way to get a list of children.
AppWindow* pApp = dynamic_cast<AppWindow*>(get_app_window());
- if(pApp)
+ if(!pApp)
+ return;
+
+ Notebook_Glom* notebook_current = dynamic_cast<Notebook_Glom*>(m_pBox_Mode->get_child());
+ if(notebook_current == &widget)
{
- Notebook_Glom* notebook_current = dynamic_cast<Notebook_Glom*>(m_pBox_Mode->get_child());
- if(notebook_current)
- {
- m_pBox_Mode->remove();
- }
+ return; //No change necessary.
+ }
- m_pBox_Mode->add(widget);
- widget.show();
+ if(notebook_current)
+ {
+ m_pBox_Mode->remove();
}
+
+ m_pBox_Mode->add(widget);
+ widget.show();
}
bool Frame_Glom::set_mode(enumModes mode)
@@ -309,6 +314,13 @@ bool Frame_Glom::set_mode(enumModes mode)
m_pBox_QuickFind->hide();
}
+
+ //Show the main part of the UI:
+ if(m_Mode == MODE_Find)
+ set_mode_widget(m_Notebook_Find);
+ else
+ set_mode_widget(m_Notebook_Data);
+
return changed;
}
@@ -376,7 +388,7 @@ void Frame_Glom::show_table_allow_empty(const Glib::ustring& table_name, const G
{
sharedptr<Field> field_primary_key = get_field_primary_key_for_table(m_table_name);
if(field_primary_key)
- {
+ {
sharedptr<LayoutItem_Field> layout_item_sort = sharedptr<LayoutItem_Field>::create();
layout_item_sort->set_full_field_details(field_primary_key);
@@ -1060,7 +1072,8 @@ void Frame_Glom::set_mode_data()
if(!set_mode(MODE_Data))
return;
- show_table(m_table_name);
+ //This would lose the current found set, if any:
+ //show_table(m_table_name);
}
@@ -1355,7 +1368,7 @@ void Frame_Glom::on_notebook_find_criteria(const Gnome::Gda::SqlExpr& where_clau
m_Notebook_Data.select_page_for_find_results();
//Show how many records were found:
- records_found = update_records_count();
+ records_found = (update_records_count() > 0);
if(!inited)
records_found = 0;
@@ -2531,6 +2544,7 @@ gulong Frame_Glom::update_records_count()
gulong count_all = 0;
gulong count_found = 0;
m_Notebook_Data.get_record_counts(count_all, count_found);
+ std::cout << G_STRFUNC << ": count_all=" << count_all << ", count_found=" << count_found << std::endl;
std::string str_count_all, str_count_found;
diff --git a/glom/mode_data/notebook_data.cc b/glom/mode_data/notebook_data.cc
index b85bf6b..9f3acc5 100644
--- a/glom/mode_data/notebook_data.cc
+++ b/glom/mode_data/notebook_data.cc
@@ -130,7 +130,6 @@ 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]