Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkmm-root/base/ChangeLog,v
retrieving revision 1.440
diff -u -3 -r1.440 ChangeLog
--- ChangeLog	2002/08/09 20:52:50	1.440
+++ ChangeLog	2002/08/10 11:14:13
@@ -1,4 +1,13 @@
-2002-09-08  Martin Schulze  <MHL.Schulze@t-online.de>
+2002-08-10  Martin Schulze  <MHL.Schulze@t-online.de>
+
+	* gtk/src/treeview.hg: Try to avoid the conditional compilation:
+	Make _connect_auto_store_editable_signal_handler() a global
+	function in namespace TreeView_Private. This non-member function
+	can safely refer to specializations of the member function template
+	TreeView::_auto_store_on_cellrenderer_*_edited(), working around
+	compiler bugs.
+
+2002-08-09  Martin Schulze  <MHL.Schulze@t-online.de>
 
 	* configure.in,scripts/cxx.m4,gtk/gtkmmconfig.h.in: Add configure
 	time check as proposed by Joe Yandle with some modifications. It
Index: gtk/src/treeview.hg
===================================================================
RCS file: /cvs/gnome/gtkmm-root/gtk-src/treeview.hg,v
retrieving revision 1.51
diff -u -3 -r1.51 treeview.hg
--- gtk/src/treeview.hg	2002/08/09 20:52:52	1.51
+++ gtk/src/treeview.hg	2002/08/10 11:16:31
@@ -1,4 +1,4 @@
-/* $Id: treeview.hg,v 1.51 2002/08/09 20:52:52 murrayc Exp $ */
+/* $Id: treeview.hg,v 1.50 2002/08/07 21:02:41 cactus Exp $ */
 
 
 /* treeview.h
@@ -40,6 +40,25 @@
 _WRAP_ENUM(TreeViewDropPosition, GtkTreeViewDropPosition)
 
 
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+class TreeView;
+
+namespace TreeView_Private
+{
+/* This helper function is not a member of TreeView just for the reason that there are compiler that have problems
+ * compiling it otherwise. E.g. in gcc 2.95.3 a compiler bug prevents member functions from refering to specialized
+ * member function templates and that's what we do here: In function _connect_auto_store_editable_signal_handler we
+ * build a slot from TreeView::_auto_store_on_cellrenderer_*_edited. (The latter must be member functions of TreeView
+ * since we connect them to signals and we want the connections to vanish when the TreeView dies, of course.)
+ */
+  template <class ColumnType> inline
+  void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<ColumnType>& model_column);
+}
+
+#endif //DOXYGEN_SHOULD_SKIP_THIS
+
+
 //class TreeViewColumn;
 class TreeModel;
 
@@ -243,8 +262,8 @@
 protected:
 
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
-  template <class ColumnType> inline
-  void _connect_auto_store_editable_signal_handler(CellRenderer* pCellRenderer, const TreeModelColumn<ColumnType>& model_column);
+//  template <class ColumnType> inline
+//  void _connect_auto_store_editable_signal_handler(CellRenderer* pCellRenderer, const TreeModelColumn<ColumnType>& model_column); //See above
 
   //I had to use a TreeModelColumn pointer here instead of a reference, to avoid some strange libsigc++ template errors about constructors not matching.
   template <class ColumnType> inline //Must be explicitly specialized.
@@ -254,10 +273,14 @@
   void _auto_store_on_cellrenderer_text_edited_numerical(const Glib::ustring& path_string, const Glib::ustring& new_text, int model_column);
 
   void _auto_store_on_cellrenderer_toggle_edited(const Glib::ustring& path_string, const Gtk::CellRendererToggle* cell_renderer, int model_column);
+
+  template<class ColumnType> friend
+  void TreeView_Private::_connect_auto_store_editable_signal_handler(TreeView*,CellRenderer*,const TreeModelColumn<ColumnType>&);
 #endif //DOXYGEN_SHOULD_SKIP_THIS
 };
 
 
+
 template <class ColumnType> inline
 int TreeView::append_column(const Glib::ustring& title, const TreeModelColumn<ColumnType>& model_column)
 {
@@ -279,7 +302,7 @@
 
   //connect signal handlers for auto-storing of edited cell data
   CellRenderer* pCellRender = pViewColumn->get_first_cell_renderer();
-  _connect_auto_store_editable_signal_handler<ColumnType>(pCellRender, model_column);
+  TreeView_Private::_connect_auto_store_editable_signal_handler<ColumnType>(this, pCellRender, model_column);
 
   return append_column(*pViewColumn);
 }
@@ -303,19 +326,23 @@
 
    //connect signal handlers for auto-storing of edited cell data
   CellRenderer* pCellRender = pViewColumn->get_first_cell_renderer();
-  _connect_auto_store_editable_signal_handler(pCellRender, model_column);
+  TreeView_Private::_connect_auto_store_editable_signal_handler(this, pCellRender, model_column);
 
   return insert_column(*pViewColumn, position);
 }
 
+
+namespace TreeView_Private
+{
+
 //Template specializations, for different model column types:
 //TODO: Move these specializations into the .ccg file - I tried, but the int specialization was not used by the compiler. murrayc.
 
 //bool specialization:
 template<> inline
-void TreeView::_connect_auto_store_editable_signal_handler(CellRenderer* pCellRenderer,  const TreeModelColumn<bool>& model_column)
+void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer,  const Gtk::TreeModelColumn<bool>& model_column)
 {
-  CellRendererToggle* pCellToggle = dynamic_cast<CellRendererToggle*>(pCellRenderer);
+  Gtk::CellRendererToggle* pCellToggle = dynamic_cast<Gtk::CellRendererToggle*>(pCellRenderer);
   if(pCellToggle)
   {
     //Set the appropriate property,
@@ -323,16 +350,15 @@
 
     //Connect to the appropriate signal, sending the model_column too,
     pCellToggle->signal_toggled().connect(
-      SigC::bind( SigC::slot(*this, &TreeView::_auto_store_on_cellrenderer_toggle_edited), pCellToggle, model_column.index()) );
+      SigC::bind( SigC::slot(*this_p, &Gtk::TreeView::_auto_store_on_cellrenderer_toggle_edited), pCellToggle, model_column.index()) );
   }
 }
 
-#ifdef GTKMM_MEMBER_FUNCTIONS_MEMBER_TEMPLATES
 //int specialization:
 template<> inline
-void TreeView::_connect_auto_store_editable_signal_handler(CellRenderer* pCellRenderer,  const TreeModelColumn<int>& model_column)
+void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer,  const Gtk::TreeModelColumn<int>& model_column)
 {
-  CellRendererText* pCellText = dynamic_cast<CellRendererText*>(pCellRenderer);
+  Gtk::CellRendererText* pCellText = dynamic_cast<Gtk::CellRendererText*>(pCellRenderer);
   if(pCellText)
   {
     //Set the appropriate property,
@@ -340,15 +366,15 @@
 
     //Connect to the appropriate signal, sending the model_column too,
     pCellText->signal_edited().connect(
-      SigC::bind( SigC::slot(*this, &TreeView::_auto_store_on_cellrenderer_text_edited_numerical<int>), model_column.index()) );
+      SigC::bind( SigC::slot(*this_p, &Gtk::TreeView::_auto_store_on_cellrenderer_text_edited_numerical<int>), model_column.index()) );
   }
 }
 
 //unsigned int specialization:
 template<> inline
-void TreeView::_connect_auto_store_editable_signal_handler(CellRenderer* pCellRenderer,  const TreeModelColumn<unsigned int>& model_column)
+void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer,  const Gtk::TreeModelColumn<unsigned int>& model_column)
 {
-  CellRendererText* pCellText = dynamic_cast<CellRendererText*>(pCellRenderer);
+  Gtk::CellRendererText* pCellText = dynamic_cast<Gtk::CellRendererText*>(pCellRenderer);
   if(pCellText)
   {
     //Set the appropriate property,
@@ -356,15 +382,15 @@
 
     //Connect to the appropriate signal, sending the model_column too,
     pCellText->signal_edited().connect(
-      SigC::bind( SigC::slot(*this, &TreeView::_auto_store_on_cellrenderer_text_edited_numerical<unsigned int>), model_column.index()) );
+      SigC::bind( SigC::slot(*this_p, &Gtk::TreeView::_auto_store_on_cellrenderer_text_edited_numerical<unsigned int>), model_column.index()) );
   }
 }
 
 //long specialization:
 template<> inline
-void TreeView::_connect_auto_store_editable_signal_handler(CellRenderer* pCellRenderer,  const TreeModelColumn<long>& model_column)
+void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer,  const Gtk::TreeModelColumn<long>& model_column)
 {
-  CellRendererText* pCellText = dynamic_cast<CellRendererText*>(pCellRenderer);
+  Gtk::CellRendererText* pCellText = dynamic_cast<Gtk::CellRendererText*>(pCellRenderer);
   if(pCellText)
   {
     //Set the appropriate property,
@@ -372,15 +398,15 @@
 
     //Connect to the appropriate signal, sending the model_column too,
     pCellText->signal_edited().connect(
-      SigC::bind( SigC::slot(*this, &TreeView::_auto_store_on_cellrenderer_text_edited_numerical<long>), model_column.index()) );
+      SigC::bind( SigC::slot(*this_p, &Gtk::TreeView::_auto_store_on_cellrenderer_text_edited_numerical<long>), model_column.index()) );
   }
 }
 
 //unsigned long specialization:
 template<> inline
-void TreeView::_connect_auto_store_editable_signal_handler(CellRenderer* pCellRenderer,  const TreeModelColumn<unsigned long>& model_column)
+void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer,  const Gtk::TreeModelColumn<unsigned long>& model_column)
 {
-  CellRendererText* pCellText = dynamic_cast<CellRendererText*>(pCellRenderer);
+  Gtk::CellRendererText* pCellText = dynamic_cast<Gtk::CellRendererText*>(pCellRenderer);
   if(pCellText)
   {
     //Set the appropriate property,
@@ -388,10 +414,9 @@
 
     //Connect to the appropriate signal, sending the model_column too,
     pCellText->signal_edited().connect(
-      SigC::bind( SigC::slot(*this, &TreeView::_auto_store_on_cellrenderer_text_edited_numerical<unsigned long>), model_column.index()) );
+      SigC::bind( SigC::slot(*this_p, &Gtk::TreeView::_auto_store_on_cellrenderer_text_edited_numerical<unsigned long>), model_column.index()) );
   }
 }
-#endif //GTKMM_MEMBER_FUNCTIONS_MEMBER_TEMPLATES
 
 //This is used on string model columns:
 template <class ColumnType> inline
@@ -410,6 +435,8 @@
   }
 }
 
+} // namespace TreeView_Private
+
 
 template <class ColumnType> inline
 void TreeView::_auto_store_on_cellrenderer_text_edited_numerical(const Glib::ustring& path_string, const Glib::ustring& new_text, int model_column)
@@ -434,8 +461,12 @@
   }
 }
 
+
+namespace TreeView_Private
+{
+
 template <class ColumnType> inline
-void TreeView::_connect_auto_store_editable_signal_handler(CellRenderer* pCellRenderer,  const TreeModelColumn<ColumnType>& model_column)
+void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer,  const Gtk::TreeModelColumn<ColumnType>& model_column)
 {
   g_assert(model_column.type() != 0);
 
@@ -443,7 +474,7 @@
   //and numerical values need to convert the text value to a number,
   //so there are specializations for this tempate.
 
-  CellRendererText* pCellText = dynamic_cast<CellRendererText*>(pCellRenderer);
+  Gtk::CellRendererText* pCellText = dynamic_cast<Gtk::CellRendererText*>(pCellRenderer);
 
   //Set the appropriate property,
   //and connect to the appropriate signal, sending the model_column too,
@@ -452,10 +483,11 @@
     pCellText->property_editable() = true;
 
     pCellText->signal_edited().connect(
-      SigC::bind( SigC::slot(*this, &TreeView::_auto_store_on_cellrenderer_text_edited_string<ColumnType>), model_column.index()) );
+      SigC::bind( SigC::slot(*this_p, &Gtk::TreeView::_auto_store_on_cellrenderer_text_edited_string<ColumnType>), model_column.index()) );
   }
 }
 
+} // namespace TreeView_Private
 
 
 } // namespace Gtk
