[glom/maemo5] Maemo: Actually show new related record in the list.
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glom/maemo5] Maemo: Actually show new related record in the list.
- Date: Fri, 16 Oct 2009 10:21:29 +0000 (UTC)
commit 862e963741d504e324e80d4a5a4ded4d390db047
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Oct 16 12:21:28 2009 +0200
Maemo: Actually show new related record in the list.
* glom/mode_data/box_data_portal.[h|cc]: on_maemo_appmenubutton_add():
* glom/mode_data/notebook_data.[h|cc]: Constructor:
Update the window when the maemo details window is hidden, for instance to
show the new related record in the portal.
ChangeLog | 9 +++++++++
glom/mode_data/box_data_portal.cc | 24 +++++++++++++++++++++---
glom/mode_data/box_data_portal.h | 1 +
glom/mode_data/notebook_data.cc | 14 ++++++++++++++
glom/mode_data/notebook_data.h | 6 ++++++
5 files changed, 51 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 09cad72..78f95c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2009-10-16 Murray Cumming <murrayc murrayc com>
+ Maemo: Actually show new related record in the list.
+
+ * glom/mode_data/box_data_portal.[h|cc]: on_maemo_appmenubutton_add():
+ * glom/mode_data/notebook_data.[h|cc]: Constructor:
+ Update the window when the maemo details window is hidden, for instance to
+ show the new related record in the portal.
+
+2009-10-16 Murray Cumming <murrayc murrayc com>
+
* glom/libglom/document/document.cc: load_after(), save_before():
Avoid crashes when load/saving singular_titles.
diff --git a/glom/mode_data/box_data_portal.cc b/glom/mode_data/box_data_portal.cc
index b9e0406..41f08c1 100644
--- a/glom/mode_data/box_data_portal.cc
+++ b/glom/mode_data/box_data_portal.cc
@@ -97,6 +97,12 @@ void Box_Data_Portal::make_record_related(const Gnome::Gda::Value& related_recor
std::cerr << "Box_Data_Portal::make_record_related(): m_key_field was null." << std::endl;
}
+ if(Conversions::value_is_empty(m_key_value))
+ {
+ std::cerr << "Box_Data_Portal::make_record_related(): m_key_value was empty." << std::endl;
+ }
+
+
if(!m_portal)
{
std::cerr << "Box_Data_Portal::make_record_related(): m_portal was null." << std::endl;
@@ -144,11 +150,16 @@ void Box_Data_Portal::on_maemo_appmenubutton_add()
Gtk::Window* pWindow = get_app_window();
if(pWindow)
m_window_maemo_details->set_transient_for(*pWindow);
+
+ //Refresh the portal when the window is closed:
+ //TODO: Refresh the parent Details too.
+ m_window_maemo_details->signal_hide().connect(
+ sigc::mem_fun(*this, &Box_Data_Portal::on_window_maemo_details_closed));
const Glib::ustring title =
Glib::ustring::compose(_("New Related %1"),
get_title_singular());
- pWindow->set_title(title);
+ m_window_maemo_details->set_title(title);
FoundSet found_set;
found_set.m_table_name = m_portal->get_table_used(Glib::ustring());
@@ -165,10 +176,16 @@ void Box_Data_Portal::on_maemo_appmenubutton_add()
m_box_maemo_details->get_primary_key_value_selected();
make_record_related(related_record_primary_key_value);
- std::cout << "DEBUG: Showing details for new related record." << std::endl;
m_window_maemo_details->show();
}
+void Box_Data_Portal::on_window_maemo_details_closed()
+{
+ std::cout << "DEBUG: Box_Data_Portal::on_window_maemo_details_closed()" << std::endl;
+ //Show the new added record in the portal:
+ fill_from_database();
+}
+
void Box_Data_Portal::on_realize()
{
if(!m_portal)
@@ -256,7 +273,7 @@ Glib::ustring Box_Data_Portal::get_title_singular() const
return relationship_title;
}
-//TODO: Is this base class implemenation actually called by anything?
+//TODO: Is this base class implementation actually called by anything?
bool Box_Data_Portal::init_db_details(const Glib::ustring& parent_table, bool show_title)
{
m_parent_table = parent_table;
@@ -293,6 +310,7 @@ bool Box_Data_Portal::init_db_details(const Glib::ustring& parent_table, bool sh
bool Box_Data_Portal::refresh_data_from_database_with_foreign_key(const Gnome::Gda::Value& foreign_key_value)
{
m_key_value = foreign_key_value;
+ std::cout << "DEBUG: Box_Data_Portal::refresh_data_from_database_with_foreign_key(): m_key_value=" << m_key_value.to_string() << std::endl;
if(m_key_field && m_portal)
diff --git a/glom/mode_data/box_data_portal.h b/glom/mode_data/box_data_portal.h
index 5b1e8d5..ad4189d 100644
--- a/glom/mode_data/box_data_portal.h
+++ b/glom/mode_data/box_data_portal.h
@@ -127,6 +127,7 @@ private:
void on_realize();
void on_unrealize();
void on_maemo_appmenubutton_add();
+ void on_window_maemo_details_closed();
//Each related-records portal adds its own Add Something button
//to the application's AppMenu when the portal is visible.
diff --git a/glom/mode_data/notebook_data.cc b/glom/mode_data/notebook_data.cc
index 4547e5f..278bf38 100644
--- a/glom/mode_data/notebook_data.cc
+++ b/glom/mode_data/notebook_data.cc
@@ -53,6 +53,10 @@ Notebook_Data::Notebook_Data()
Gtk::Window* pWindow = get_app_window();
if(pWindow)
m_window_maemo_details->set_transient_for(*pWindow);
+
+ //Refresh the list when the details window is closed:
+ m_window_maemo_details->signal_hide().connect(
+ sigc::mem_fun(*this, &Notebook_Data::on_window_maemo_details_closed));
m_Box_Details.show_all();
#endif //GLOM_ENABLE_MAEMO
@@ -110,6 +114,16 @@ Notebook_Data::~Notebook_Data()
#endif //GLOM_ENABLE_MAEMO
}
+#ifdef GLOM_ENABLE_MAEMO
+void Notebook_Data::on_window_maemo_details_closed()
+{
+ //Show the changed record in the list:
+ const Gnome::Gda::Value primary_key_selected = m_Box_List.get_primary_key_value_selected();
+ m_Box_List.refresh_data_from_database();
+ m_Box_List.set_primary_key_value_selected(primary_key_selected);
+}
+#endif //GLOM_ENABLE_MAEMO
+
bool Notebook_Data::init_db_details(const FoundSet& found_set, const Gnome::Gda::Value& primary_key_value_for_details)
{
m_table_name = found_set.m_table_name;
diff --git a/glom/mode_data/notebook_data.h b/glom/mode_data/notebook_data.h
index 4e4f504..4b44c1b 100644
--- a/glom/mode_data/notebook_data.h
+++ b/glom/mode_data/notebook_data.h
@@ -92,6 +92,12 @@ protected:
virtual void on_switch_page_handler(GtkNotebookPage* pPage, guint uiPageNumber);
+private:
+ #ifdef GLOM_ENABLE_MAEMO
+ void on_window_maemo_details_closed();
+ #endif
+
+protected:
//Member widgets:
Box_Data_List m_Box_List;
Box_Data_Details m_Box_Details;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]