[Aptitude-svn-commit] r3449 - in branches/aptitude-0.3/aptitude: . src

Daniel Burrows dburrows@costa.debian.org
Sun, 26 Jun 2005 11:01:41 +0000


Author: dburrows
Date: Sun Jun 26 11:01:39 2005
New Revision: 3449

Removed:
   branches/aptitude-0.3/aptitude/src/pkg_item_with_subtree.cc
Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/Makefile.am
   branches/aptitude-0.3/aptitude/src/pkg_item_with_subtree.h
Log:
Move the implementation of setup_column back into the with_subtree class's
header, since (doh) the class is templated.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Sun Jun 26 11:01:39 2005
@@ -1,5 +1,10 @@
 2005-06-26  Daniel Burrows  <dburrows@debian.org>
 
+	* src/Makefile.am, src/pkg_item_with_subtree.cc, src/pkg_item_with_subtree.h:
+
+	  Doh, of course since pkg_i_w_s is templated, all its method
+	  implementations have to go in the .h (ew).
+
 	* src/pkg_item.cc:
 
 	  Store the output of the columnizer in the right type.

Modified: branches/aptitude-0.3/aptitude/src/Makefile.am
==============================================================================
--- branches/aptitude-0.3/aptitude/src/Makefile.am	(original)
+++ branches/aptitude-0.3/aptitude/src/Makefile.am	Sun Jun 26 11:01:39 2005
@@ -56,7 +56,6 @@
 	pkg_info_screen.h \
 	pkg_item.cc	\
 	pkg_item.h	\
-	pkg_item_with_subtree.cc \
 	pkg_item_with_subtree.h \
 	pkg_grouppolicy.h\
 	pkg_grouppolicy.cc\

Modified: branches/aptitude-0.3/aptitude/src/pkg_item_with_subtree.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/pkg_item_with_subtree.h	(original)
+++ branches/aptitude-0.3/aptitude/src/pkg_item_with_subtree.h	Sun Jun 26 11:01:39 2005
@@ -26,9 +26,10 @@
 #include "pkg_item.h"
 #include "pkg_columnizer.h"
 
-#include "vscreen/vs_subtree.h"
-#include "vscreen/columnify.h"
-#include "vscreen/config/column_definition.h"
+#include <vscreen/columnify.h>
+#include <vscreen/config/column_definition.h>
+#include <vscreen/transcode.h>
+#include <vscreen/vs_subtree.h>
 
 template<class child, class sorter=tag_sort_policy>
 class pkg_item_with_subtree:public vs_subtree<child, sorter>, public pkg_item
@@ -37,7 +38,27 @@
   {
     bool expanded, hierarchical;
   protected:
-    column_disposition setup_column(int type);
+    column_disposition setup_column(int type)
+      {
+	if(type==name)
+	  {
+	    std::wstring name;
+	    if(!transcode(get_pkg().Name(), name))
+	      name=L"INTERNAL ERROR OCCURED";
+
+	    // Interesting question: would it be reasonable to use graphical
+	    // characters here?  What about Unicode graphical characters?
+	    if(hierarchical)
+	      return column_disposition(std::wstring(expanded?L"--\\ ":L"--- ")+name, get_basex());
+	    else
+	      {
+		return column_disposition(std::wstring(L"-> ")+name, get_basex());
+	      }
+	  }
+	else
+	  return pkg_columnizer::setup_column(type);
+      }
+
   public:
     pkg_with_subtree_columnizer(bool _expanded, bool _hierarchical,
 				const pkgCache::PkgIterator &_pkg,