[glom/gtktoolpallete] FlowTable: Use foreach() instead of implementing forall().



commit 71ffc1894f285211f987593a541eb9c3d1b561de
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Dec 30 15:13:54 2009 +0100

    FlowTable: Use foreach() instead of implementing forall().
    
    * glom/utility_widgets/flowtable.[h|cc]:
    * glom/utility_widgets/flowtable_dnd.cc: Use foreach() instead of
    implementing forall().

 ChangeLog                             |    8 ++++++++
 glom/utility_widgets/flowtable.cc     |   29 +----------------------------
 glom/utility_widgets/flowtable.h      |    5 -----
 glom/utility_widgets/flowtable_dnd.cc |    4 ++--
 4 files changed, 11 insertions(+), 35 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4452792..82c54ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-12-30  Murray Cumming  <murrayc murrayc com>
+
+	FlowTable: Use foreach() instead of implementing forall().
+
+	* glom/utility_widgets/flowtable.[h|cc]:
+	* glom/utility_widgets/flowtable_dnd.cc: Use foreach() instead of 
+	implementing forall().
+
 2009-12-30  Murray Cumming  <murrayc murrayc-desktop>
 
 	* glom/mode_data/flowtablewithfields.[h|cc]: Remember the child widgets 
diff --git a/glom/utility_widgets/flowtable.cc b/glom/utility_widgets/flowtable.cc
index 8003552..d38d0f4 100644
--- a/glom/utility_widgets/flowtable.cc
+++ b/glom/utility_widgets/flowtable.cc
@@ -150,28 +150,6 @@ gboolean FlowTable::glom_expose_event_impl(GtkWidget* widget, GdkEventExpose* ev
 
 namespace Glom
 {
-
-static void container_forall_callback(GtkWidget* widget_gobj, void* data)
-{
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-  {
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-    FlowTable::ForallSlot& slot = *static_cast<FlowTable::ForallSlot*>(data);
-    Gtk::Widget *const widget = Glib::wrap(widget_gobj);
-
-    g_return_if_fail(widget != 0);
-
-    slot(*widget);
-  #ifdef GLIBMM_EXCEPTIONS_ENABLED
-  }
-  catch(...)
-  {
-    Glib::exception_handlers_invoke();
-  }
-  #endif //GLIBMM_EXCEPTIONS_ENABLED
-}
-
   
 FlowTable::FlowTableItem::FlowTableItem(Gtk::Widget* first, FlowTable* /* flowtable */)
 : m_first(first),
@@ -910,6 +888,7 @@ void FlowTable::on_remove(Gtk::Widget* child)
 }
 
 
+//This allows foreach() to work.
 void FlowTable::forall_vfunc(gboolean /* include_internals */, GtkCallback callback, gpointer callback_data)
 {
   for(type_vecChildren::const_iterator iter = m_children.begin(); iter != m_children.end(); ++iter)
@@ -926,12 +905,6 @@ void FlowTable::forall_vfunc(gboolean /* include_internals */, GtkCallback callb
   }
 }
 
-void FlowTable::forall(const ForallSlot& slot)
-{
-  ForallSlot slot_copy(slot);
-  gtk_container_forall(gobj(), &container_forall_callback, &slot_copy);
-}
-
 void FlowTable::set_column_padding(guint padding)
 {
   m_column_padding = padding; 
diff --git a/glom/utility_widgets/flowtable.h b/glom/utility_widgets/flowtable.h
index 17be659..f60c3f0 100644
--- a/glom/utility_widgets/flowtable.h
+++ b/glom/utility_widgets/flowtable.h
@@ -63,11 +63,6 @@ public:
   virtual void set_design_mode(bool value = true);
 
   void remove_all();
-
-  // Implement forall which is not implemented in gtkmm:
-  typedef sigc::slot<void, Widget&> ForallSlot;
-  void forall(const ForallSlot& slot);
-
 private:
 
   #ifndef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
diff --git a/glom/utility_widgets/flowtable_dnd.cc b/glom/utility_widgets/flowtable_dnd.cc
index 62c0e1b..9137743 100644
--- a/glom/utility_widgets/flowtable_dnd.cc
+++ b/glom/utility_widgets/flowtable_dnd.cc
@@ -497,9 +497,9 @@ void FlowTableDnd::set_design_mode(bool value)
 
   // We only want to enable drag and drop when in design mode
   if(value)
-    forall(sigc::mem_fun(*this, &FlowTableDnd::start_dnd));
+    foreach(sigc::mem_fun(*this, &FlowTableDnd::start_dnd));
   else
-    forall(sigc::mem_fun(*this, &FlowTableDnd::stop_dnd));
+    foreach(sigc::mem_fun(*this, &FlowTableDnd::stop_dnd));
 }
 
 /* This is a hack. The problem is that when you move the mouse down to the last



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