[glom] Box_Data_Portal: Make m_parent_table private and add accessors.



commit d125b35c62d4edc0ec7b1cced0aaaedf4bd34d25
Author: Murray Cumming <murrayc murrayc com>
Date:   Sat Mar 19 16:36:48 2016 +0100

    Box_Data_Portal: Make m_parent_table private and add accessors.

 glom/mode_data/box_data_calendar_related.cc |    4 ++--
 glom/mode_data/box_data_list_related.cc     |    4 ++--
 glom/mode_data/box_data_portal.cc           |   10 ++++++++++
 glom/mode_data/box_data_portal.h            |   12 ++++++------
 4 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/glom/mode_data/box_data_calendar_related.cc b/glom/mode_data/box_data_calendar_related.cc
index eab2314..3f5d400 100644
--- a/glom/mode_data/box_data_calendar_related.cc
+++ b/glom/mode_data/box_data_calendar_related.cc
@@ -83,7 +83,7 @@ bool Box_Data_Calendar_Related::init_db_details(const Glib::ustring& parent_tabl
 {
   //std::cout << "debug: " << G_STRFUNC << ": " << parent_table << std::endl;
 
-  m_parent_table = parent_table;
+  set_parent_table(parent_table);
 
   const auto portal = get_portal();
   if(portal)
@@ -401,7 +401,7 @@ void Box_Data_Calendar_Related::prepare_layout_dialog(Dialog_Layout* dialog)
   }
   else
   {
-    related_dialog->init_with_tablename(m_layout_name, m_layout_platform, get_document(), m_parent_table);
+    related_dialog->init_with_tablename(m_layout_name, m_layout_platform, get_document(), 
get_parent_table());
   }
 }
 #endif // !GLOM_ENABLE_CLIENT_ONLY
diff --git a/glom/mode_data/box_data_list_related.cc b/glom/mode_data/box_data_list_related.cc
index ac4cf4c..d68f0a8 100644
--- a/glom/mode_data/box_data_list_related.cc
+++ b/glom/mode_data/box_data_list_related.cc
@@ -79,7 +79,7 @@ bool Box_Data_List_Related::init_db_details(const std::shared_ptr<const LayoutIt
 
 bool Box_Data_List_Related::init_db_details(const Glib::ustring& parent_table, bool show_title)
 {
-  m_parent_table = parent_table;
+  set_parent_table(parent_table);
 
   const auto portal = get_portal();
   if(portal)
@@ -381,7 +381,7 @@ void Box_Data_List_Related::prepare_layout_dialog(Dialog_Layout* dialog)
     return;
   }
 
-  related_dialog->init_with_portal(m_layout_name, m_layout_platform, get_document(), portal, m_parent_table);
+  related_dialog->init_with_portal(m_layout_name, m_layout_platform, get_document(), portal, 
get_parent_table());
 }
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
diff --git a/glom/mode_data/box_data_portal.cc b/glom/mode_data/box_data_portal.cc
index 3f2f843..470f86d 100644
--- a/glom/mode_data/box_data_portal.cc
+++ b/glom/mode_data/box_data_portal.cc
@@ -388,5 +388,15 @@ void Box_Data_Portal::set_find_mode(bool val)
   m_find_mode = val;
 }
 
+Glib::ustring Box_Data_Portal::get_parent_table() const
+{
+  return m_parent_table;
+}
+
+void Box_Data_Portal::set_parent_table(const Glib::ustring& parent_table)
+{
+  m_parent_table = parent_table;
+}
+
 
 } //namespace Glom
diff --git a/glom/mode_data/box_data_portal.h b/glom/mode_data/box_data_portal.h
index 890dbd3..adca728 100644
--- a/glom/mode_data/box_data_portal.h
+++ b/glom/mode_data/box_data_portal.h
@@ -92,6 +92,9 @@ public:
    */
   virtual void set_find_mode(bool val = true);
 
+  Glib::ustring get_parent_table() const;
+  void set_parent_table(const Glib::ustring& parent_table);
+
 protected:
   type_vecConstLayoutFields get_fields_to_show() const override;
     
@@ -122,16 +125,13 @@ protected:
   Gtk::Frame m_Frame;
   Gtk::Label m_Label;
 
-public:
-  const Glib::ustring &get_parent() const {
-    return m_parent_table;
-  }
-
-protected:
+private:
   Glib::ustring m_parent_table; //A duplicate of the from_table in the poral, but only when get_portal() is 
not null.
   
   // m_key_field and m_key_value are the field and its value in this table that 
   // must match another field in the parent table.
+
+public:
   std::shared_ptr<Field> m_key_field;
   Gnome::Gda::Value m_key_value;
 


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