[glom/glom-1-18] Make the Calendar portal work again.



commit 6bc1d9830d318a4fc9b57f586624a2b690307ff4
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Nov 16 09:23:45 2011 +0100

    Make the Calendar portal work again.
    
    	* glom/mode_data/box_data_calendar_related.[h|cc]: Override
    	create_layout() as a place to call our get_fields_to_show(), like
    	Box_Data_List_Related does. Then fill_from_database() can succeed.
    
    Conflicts:
    
    	glom/mode_data/box_data_calendar_related.h

 ChangeLog                                   |    8 ++++++++
 glom/mode_data/box_data_calendar_related.cc |   17 +++++++++++++++++
 glom/mode_data/box_data_calendar_related.h  |    3 ++-
 3 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 72f4414..6b05339 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-11-16  Murray Cumming  <murrayc murrayc com>
+
+	Make the Calendar portal work again.
+
+	* glom/mode_data/box_data_calendar_related.[h|cc]: Override
+	create_layout() as a place to call our get_fields_to_show(), like
+	Box_Data_List_Related does. Then fill_from_database() can succeed.
+
 2011-11-11  Murray Cumming  <murrayc murrayc com>
 
 	List view and Related Records: Disable buttons when appropriate.
diff --git a/glom/mode_data/box_data_calendar_related.cc b/glom/mode_data/box_data_calendar_related.cc
index ffb11ee..fa15cc6 100644
--- a/glom/mode_data/box_data_calendar_related.cc
+++ b/glom/mode_data/box_data_calendar_related.cc
@@ -119,6 +119,14 @@ bool Box_Data_Calendar_Related::init_db_details(const Glib::ustring& parent_tabl
   return Box_Data::init_db_details(found_set, "" /* layout_platform */); //Calls create_layout() and fill_from_database().
 }
 
+
+void Box_Data_Calendar_Related::create_layout()
+{
+  Box_Data::create_layout();
+
+  m_FieldsShown = get_fields_to_show();
+}
+
 bool Box_Data_Calendar_Related::fill_from_database()
 {
   if(!m_portal)
@@ -324,11 +332,17 @@ Box_Data_Calendar_Related::type_vecLayoutFields Box_Data_Calendar_Related::get_f
 
   sharedptr<LayoutItem_CalendarPortal> derived_portal = sharedptr<LayoutItem_CalendarPortal>::cast_dynamic(m_portal);
   if(!derived_portal)
+  {
+    std::cerr << G_STRFUNC << ": The portal is not a LayoutItem_CalendarPortal." << std::endl;
     return layout_fields;
+  }
 
   sharedptr<const Field> date_field = derived_portal->get_date_field();
   if(!date_field)
+  {
+    std::cerr << G_STRFUNC << ": get_date_field() returned no field." << std::endl;
     return layout_fields;
+  }
 
   //Add it to the list to ensure that we request the date (though it will not really be shown in the calendar):
   sharedptr<LayoutItem_Field> layout_item_date_field = sharedptr<LayoutItem_Field>::create();
@@ -406,7 +420,10 @@ Glib::ustring Box_Data_Calendar_Related::on_calendar_details(guint year, guint m
 
   sharedptr<const Field> date_field = derived_portal->get_date_field();
   if(!date_field)
+  {
+    std::cerr << G_STRFUNC << ":  get_date_field() returned no field." << std::endl;
     return Glib::ustring();
+  }
 
   //TODO: month seems to be 143710360 sometimes, which seems to be a GtkCalendar bug:
   //std::cout << "Box_Data_Calendar_Related::on_calendar_details(): year=" << year << ", month=" << month << " day=" << day << std::endl;
diff --git a/glom/mode_data/box_data_calendar_related.h b/glom/mode_data/box_data_calendar_related.h
index 98f0c15..6debefe 100644
--- a/glom/mode_data/box_data_calendar_related.h
+++ b/glom/mode_data/box_data_calendar_related.h
@@ -50,8 +50,9 @@ public:
 
 private:
   virtual bool fill_from_database(); //Override.
+
   virtual type_vecLayoutFields get_fields_to_show() const; //override
-    
+  virtual void create_layout(); //override
     
   //Implementations of pure virtual methods from Base_DB_Table_Data:
   virtual void set_primary_key_value(const Gtk::TreeModel::iterator& row, const Gnome::Gda::Value& value);



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