[glom: 2/4] Pass some sharedptr&s as const.



commit f579c2047acfc9b2bf32474f863f2e2cd83b9f63
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu May 7 18:52:01 2009 +0200

    Pass some sharedptr&s as const.
    
    * glom/utility_widgets/flowtable_dnd.h: on_dnd_add_layout_item()
    * glom/mode_data/flowtablewithfields.[h|cc]: on_dnd_add_layout_item(),
    on_entry_edited(), on_entry_open_details_requested(),
    on_dnd_add_layout_item(): Pass the sharedptr& as const.
---
 ChangeLog                             |   11 ++++++++++-
 glom/mode_data/flowtablewithfields.cc |   18 ++++++++----------
 glom/mode_data/flowtablewithfields.h  |   10 ++++------
 glom/utility_widgets/flowtable_dnd.h  |    2 +-
 4 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 238e8aa..a68d852 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,13 @@
-2009-05-07  Murray Cumming  <murrayc murrayc-x61>
+2009-05-07  Murray Cumming  <murrayc murrayc com>
+
+	Pass some sharedptr&s as const.
+
+	* glom/utility_widgets/flowtable_dnd.h: on_dnd_add_layout_item()
+	* glom/mode_data/flowtablewithfields.[h|cc]: on_dnd_add_layout_item(), 
+	on_entry_edited(), on_entry_open_details_requested(), 
+	on_dnd_add_layout_item(): Pass the sharedptr& as const.
+
+2009-05-07  Murray Cumming  <murrayc murrayc com>
 
 	Fixed minor compiler warnings and removed some virtuals.
 
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index 3551402..3640619 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -1018,12 +1018,12 @@ void FlowTableWithFields::on_script_button_clicked(const sharedptr< LayoutItem_B
   m_signal_script_button_clicked.emit(layout_item);
 }
 
-void FlowTableWithFields::on_entry_edited(const Gnome::Gda::Value& value, sharedptr<const LayoutItem_Field> field)
+void FlowTableWithFields::on_entry_edited(const Gnome::Gda::Value& value, const sharedptr<const LayoutItem_Field> field)
 {
   m_signal_field_edited.emit(field, value);
 }
 
-void FlowTableWithFields::on_entry_open_details_requested(const Gnome::Gda::Value& value, sharedptr<const LayoutItem_Field> field)
+void FlowTableWithFields::on_entry_open_details_requested(const Gnome::Gda::Value& value, const sharedptr<const LayoutItem_Field> field)
 {
   m_signal_field_open_details_requested.emit(field, value);
 }
@@ -1215,7 +1215,7 @@ void FlowTableWithFields::on_dnd_add_layout_item_field(LayoutWidgetBase* above)
   }
 
   sharedptr<LayoutItem> item = sharedptr<LayoutItem>::cast_dynamic(layout_item_field);
-  dnd_add_to_layout_group (item, above);
+  dnd_add_to_layout_group(item, above);
   
   //Tell the parent to tell the document to save the layout
   signal_layout_changed().emit();
@@ -1232,7 +1232,7 @@ void FlowTableWithFields::on_dnd_add_layout_notebook (LayoutWidgetBase* above)
   group->set_name(_("Group"));
   notebook->m_list_items.push_back(group);
   
-  dnd_add_to_layout_group (item, above);
+  dnd_add_to_layout_group(item, above);
   
   //Tell the parent to tell the document to save the layout
   signal_layout_changed().emit();
@@ -1304,7 +1304,7 @@ void FlowTableWithFields::on_dnd_add_layout_item_image(LayoutWidgetBase* above)
   signal_layout_changed().emit();
 }
 
-void FlowTableWithFields::on_dnd_add_layout_item(LayoutWidgetBase* above, sharedptr<LayoutItem>& item)
+void FlowTableWithFields::on_dnd_add_layout_item(LayoutWidgetBase* above, const sharedptr<LayoutItem>& item)
 {
   dnd_add_to_layout_group(item, above);
   
@@ -1326,8 +1326,8 @@ void FlowTableWithFields::on_dnd_add_placeholder(LayoutWidgetBase* above)
                                                             above);
   sharedptr<LayoutItem_Placeholder> placeholder_field(new LayoutItem_Placeholder);
   sharedptr<LayoutItem> item = sharedptr<LayoutItem>::cast_dynamic(placeholder_field);  
-  add_layout_item_at_position (placeholder_field, cur_widget);
-  dnd_add_to_layout_group (item, above, true /* ignore error*/);
+  add_layout_item_at_position(placeholder_field, cur_widget);
+  dnd_add_to_layout_group(item, above, true /* ignore error*/);
 }
 
 void FlowTableWithFields::on_dnd_remove_placeholder()
@@ -1366,9 +1366,7 @@ void FlowTableWithFields::dnd_notify_failed_drop()
   dialog.run();
 }
 
-bool FlowTableWithFields::dnd_add_to_layout_group (sharedptr<LayoutItem>& item, 
-                                                   LayoutWidgetBase* layoutwidget,
-                                                   bool ignore_error)
+bool FlowTableWithFields::dnd_add_to_layout_group(const sharedptr<LayoutItem>& item,  LayoutWidgetBase* layoutwidget, bool ignore_error)
 {
   //Get the layout group that the "above" widget's layout item is in:
   sharedptr<LayoutGroup> layout_group = get_layout_group();
diff --git a/glom/mode_data/flowtablewithfields.h b/glom/mode_data/flowtablewithfields.h
index bd26224..0725d6a 100644
--- a/glom/mode_data/flowtablewithfields.h
+++ b/glom/mode_data/flowtablewithfields.h
@@ -155,8 +155,8 @@ private:
 
   //int get_suitable_width(Field::glom_field_type field_type);
 
-  void on_entry_edited(const Gnome::Gda::Value& value, sharedptr<const LayoutItem_Field> field);
-  void on_entry_open_details_requested(const Gnome::Gda::Value& value, sharedptr<const LayoutItem_Field> field);
+  void on_entry_edited(const Gnome::Gda::Value& value, const sharedptr<const LayoutItem_Field> field);
+  void on_entry_open_details_requested(const Gnome::Gda::Value& value, const sharedptr<const LayoutItem_Field> field);
   void on_flowtable_entry_edited(const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value);
   void on_flowtable_entry_open_details_requested(const sharedptr<const LayoutItem_Field>& field, const Gnome::Gda::Value& value); 
   void on_flowtable_related_record_changed(const Glib::ustring& relationship_name);
@@ -226,14 +226,12 @@ private:
   virtual void on_dnd_add_layout_item_image(LayoutWidgetBase* above);
   virtual void on_dnd_add_layout_notebook(LayoutWidgetBase* above);
   virtual void on_dnd_add_layout_portal(LayoutWidgetBase* above);
-
-  //TODO: Why isn't this a const sharedptr&?
-  virtual void on_dnd_add_layout_item(LayoutWidgetBase* above, sharedptr<LayoutItem>& item);
+  virtual void on_dnd_add_layout_item(LayoutWidgetBase* above, const sharedptr<LayoutItem>& item);
   
   sharedptr<LayoutItem_Portal> get_portal_relationship();
 
   void dnd_notify_failed_drop();
-  bool dnd_add_to_layout_group(sharedptr<LayoutItem>& item, LayoutWidgetBase* layoutwidget, bool ignore_error = false);
+  bool dnd_add_to_layout_group(const sharedptr<LayoutItem>& item, LayoutWidgetBase* layoutwidget, bool ignore_error = false);
   
 #endif // !GLOM_ENABLE_CLIENT_ONLY
   
diff --git a/glom/utility_widgets/flowtable_dnd.h b/glom/utility_widgets/flowtable_dnd.h
index 96d018d..ebd100c 100644
--- a/glom/utility_widgets/flowtable_dnd.h
+++ b/glom/utility_widgets/flowtable_dnd.h
@@ -71,7 +71,7 @@ private:
   virtual void on_dnd_add_layout_item_image(LayoutWidgetBase* above) = 0;
   virtual void on_dnd_add_layout_notebook(LayoutWidgetBase* above) = 0;
   virtual void on_dnd_add_layout_portal(LayoutWidgetBase* above) = 0;
-  virtual void on_dnd_add_layout_item(LayoutWidgetBase* above, sharedptr<LayoutItem>& item) = 0;
+  virtual void on_dnd_add_layout_item(LayoutWidgetBase* above, const sharedptr<LayoutItem>& item) = 0;
 
 
   virtual void on_dnd_add_placeholder(LayoutWidgetBase* above) = 0;



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