[Debtags-commits] [svn] r900 - in debtags-edit/trunk: . src

Enrico Zini debtags-commits@lists.alioth.debian.org
Sat, 18 Jun 2005 12:45:18 +0000


Author: enrico
Date: Sat Jun 18 12:45:17 2005
New Revision: 900

Removed:
   debtags-edit/trunk/src/PackageBuffer.cc
   debtags-edit/trunk/src/PackageBuffer.h
Modified:
   debtags-edit/trunk/TODO
   debtags-edit/trunk/src/DebtagsDocument.cc
   debtags-edit/trunk/src/DebtagsDocument.h
   debtags-edit/trunk/src/DebtagsEditor.cc
   debtags-edit/trunk/src/DebtagsEditor.h
   debtags-edit/trunk/src/FilterPanel.cc
   debtags-edit/trunk/src/FilterPanel.h
   debtags-edit/trunk/src/Makefile.am
   debtags-edit/trunk/src/RelatedPanel.cc
   debtags-edit/trunk/src/RelatedPanel.h
   debtags-edit/trunk/src/TagMenu.cc
   debtags-edit/trunk/src/TagMenu.h
Log:
Use std::string instead of Package anytime it can

Modified: debtags-edit/trunk/TODO
==============================================================================
--- debtags-edit/trunk/TODO	(original)
+++ debtags-edit/trunk/TODO	Sat Jun 18 12:45:17 2005
@@ -1,4 +1,6 @@
 TODO:
+ - try to use Debtags<string>
+ 
  - Allow to increase the distance in the "related" box
    (or self-increase if less than 4 results)
  - Related: show the distance in a second column, and increase automatically

Modified: debtags-edit/trunk/src/DebtagsDocument.cc
==============================================================================
--- debtags-edit/trunk/src/DebtagsDocument.cc	(original)
+++ debtags-edit/trunk/src/DebtagsDocument.cc	Sat Jun 18 12:45:17 2005
@@ -39,13 +39,7 @@
 using namespace std;
 using namespace Debtags;
 
-/*
-const char* fn_tagdb = "/var/lib/debtags/package-tags";
-const char* fn_impls = "/var/lib/debtags/implications";
-const char* fn_deriv = "/var/lib/debtags/derived-tags";
-*/
-
-DebtagsDocument::DebtagsDocument() throw () : DebtagsSimple<Package>(true), _undoTail(0), specialsGen(*this), computeIntensive(true), specials(100), hasSpecials(NO)
+DebtagsDocument::DebtagsDocument() throw () : DebtagsSimple<string>(true), _undoTail(0), specialsGen(*this), computeIntensive(true), specials(100), hasSpecials(NO)
 {
 	regenerateSpecials();
 }
@@ -57,18 +51,19 @@
 	return !_interrupt;
 }
 
-class TFLimit : public Tagcoll::TagcollFilter<Package, Tag>
+template<class ITEM>
+class TFLimit : public Tagcoll::TagcollFilter<ITEM, Tag>
 {
 protected:
 	int count;
 
 public:
 	TFLimit(int count) : count(count) {}
-	TFLimit(int count, Tagcoll::TagcollConsumer<Package, Tag>* cons)
-		: Tagcoll::TagcollFilter<Package, Tag>(cons), count(count) {}
+	TFLimit(int count, Tagcoll::TagcollConsumer<ITEM, Tag>* cons)
+		: Tagcoll::TagcollFilter<ITEM, Tag>(cons), count(count) {}
 
-	void consume(const Package& pkg) { if (count > 0) { consumer->consume(pkg); count--; } }
-	void consume(const Package& pkg, const Tagcoll::OpSet<Tag>& tags)
+	void consume(const ITEM& pkg) { if (count > 0) { consumer->consume(pkg); count--; } }
+	void consume(const ITEM& pkg, const Tagcoll::OpSet<Tag>& tags)
 	{
 		if (count > 0) { consumer->consume(pkg, tags); count--; }
 	}
@@ -89,7 +84,7 @@
 	if (0)
 	{
 		// Limit the number of packages, to have decent times during debugging
-		TFLimit limFilter(100, &doc.specials);
+		TFLimit<string> limFilter(100, &doc.specials);
 		doc.tagDB().output(limFilter);
 	} else {
 		doc.tagDB().output(doc.specials);
@@ -201,7 +196,7 @@
 	do_changed();
 }
 
-void DebtagsDocument::applyChange(const PatchList<Debtags::Package, Tag>& change)
+void DebtagsDocument::applyChange(const PatchList<std::string, Tag>& change)
 {
 	//TagcollChange<Debtags::Package, Tag> reverse = Debtags::Environment::get().tagDB().applyChange(change);
 	tagDB().applyChange(change);

Modified: debtags-edit/trunk/src/DebtagsDocument.h
==============================================================================
--- debtags-edit/trunk/src/DebtagsDocument.h	(original)
+++ debtags-edit/trunk/src/DebtagsDocument.h	Sat Jun 18 12:45:17 2005
@@ -26,9 +26,10 @@
 #include <sigc++/sigc++.h>
 
 #include <debtags/DebtagsSimple.h>
-#include <debtags/Package.h>
+//#include <debtags/Package.h>
 #include <debtags/Tag.h>
-#include <debtags/PackageSet.h>
+#include <debtags/PackageDB.h>
+//#include <debtags/PackageSet.h>
 #include <tagcoll/Patches.h>
 #include <tagcoll/InputMerger.h>
 
@@ -40,7 +41,7 @@
 
 #include <vector>
 
-class DebtagsDocument : public Debtags::DebtagsSimple<Debtags::Package>
+class DebtagsDocument : public Debtags::DebtagsSimple<std::string>
 {
 public:
 	typedef SigC::Signal0<void> type_signal_changed;
@@ -71,13 +72,15 @@
 	//PackageDB _packagedb;
 	//PackagePool _packagepool;
 	//PackageIndex _packageindex;
-	std::vector<Tagcoll::PatchList<Debtags::Package, Debtags::Tag> > _undoBuffer;
+	std::vector<Tagcoll::PatchList<std::string, Debtags::Tag> > _undoBuffer;
 	unsigned int _undoTail;
 
 	type_signal_changed _signal_changed;
 	type_signal_filename_changed _signal_filename_changed;
 
 	//OpSet<T> handlesToItems(const OpSet<int>& handles) const throw ();
+	
+	Debtags::PackageDB _packageDB;
 
 	SpecialsGen specialsGen;
 
@@ -87,6 +90,9 @@
 	DebtagsDocument() throw ();
 	virtual ~DebtagsDocument() {}
 
+	Debtags::PackageDB& packageDB() throw () { return _packageDB; }
+	const Debtags::PackageDB& packageDB() const throw () { return _packageDB; }
+
 	bool getComputeIntensive() const throw () { return computeIntensive; }
 	void setComputeIntensive(bool val) throw ()
 	{
@@ -103,7 +109,7 @@
 	//const Debtags::Packages& collection() const throw () { return _collection; }
 
 	// Apply a change, appending the reverse change in the undo buffer
-	void applyChange(const Tagcoll::PatchList<Debtags::Package, Debtags::Tag>& change);
+	void applyChange(const Tagcoll::PatchList<std::string, Debtags::Tag>& change);
 
 	bool canUndo() const;
 	bool canRedo() const;
@@ -120,9 +126,9 @@
 
 	// Results of the package filter
 	//Debtags::PackageSet currentPackages;
-	Tagcoll::InputMerger<Debtags::Package, Debtags::Tag> subCollection;
+	Tagcoll::InputMerger<std::string, Debtags::Tag> subCollection;
 
-	Debtags::DebtagsTODOSpecials<Debtags::Package> specials;
+	Debtags::DebtagsTODOSpecials<std::string> specials;
 	enum { YES, NO, GENERATING } hasSpecials;
 	Mutex specialsMutex;
 

Modified: debtags-edit/trunk/src/DebtagsEditor.cc
==============================================================================
--- debtags-edit/trunk/src/DebtagsEditor.cc	(original)
+++ debtags-edit/trunk/src/DebtagsEditor.cc	Sat Jun 18 12:45:17 2005
@@ -199,10 +199,11 @@
 }
 
 template<class DOC>
-void DebtagsEditor<DOC>::on_package_selected(Debtags::Package pkg) throw ()
+void DebtagsEditor<DOC>::on_package_selected(std::string pkg) throw ()
 {
+	Package p = doc.packageDB().getPackage(pkg);
 	current = pkg;
-	descrBuf->set_text(pkg.fulldata());
+	descrBuf->set_text(p.fulldata());
 	tagEditor.setSelected(doc.tagDB().getTags(pkg));
 }
 
@@ -212,9 +213,9 @@
 	TagSet newTags = tagEditor.selected();
 
 	// Make the change
-	PatchList<Debtags::Package, Tag> change;
+	PatchList<string, Tag> change;
 	TagSet oldTags = doc.tagDB().getTags(current);
-	change.addPatch(Patch<Package, Tag>(current, newTags - oldTags, oldTags - newTags));
+	change.addPatch(Patch<string, Tag>(current, newTags - oldTags, oldTags - newTags));
 	doc.applyChange(change);
 	//Debtags::Environment::get().tagDB().applyChange(change);
 

Modified: debtags-edit/trunk/src/DebtagsEditor.h
==============================================================================
--- debtags-edit/trunk/src/DebtagsEditor.h	(original)
+++ debtags-edit/trunk/src/DebtagsEditor.h	Sat Jun 18 12:45:17 2005
@@ -23,7 +23,7 @@
 
 #pragma interface
 
-#include <debtags/Package.h>
+//#include <debtags/Package.h>
 #include "FilterPanel.h"
 #include "RelatedPanel.h"
 #include "TagEditor.h"
@@ -78,7 +78,7 @@
 	RelatedPanel<DOC> rpanel;
 	Glib::RefPtr<Gtk::TextBuffer> descrBuf;
 
-	Debtags::Package current;
+	std::string current;
 	
 	//Gtk::Table panelTable;
 	bool changed;
@@ -111,7 +111,7 @@
 	TagPanel<DOC>& otherPanel() { return *panels[1 - currentPanel]; }
 	*/
 
-	void on_package_selected(Debtags::Package pkg) throw ();
+	void on_package_selected(std::string pkg) throw ();
 
 public:
 	DebtagsEditor(DOC& doc);

Modified: debtags-edit/trunk/src/FilterPanel.cc
==============================================================================
--- debtags-edit/trunk/src/FilterPanel.cc	(original)
+++ debtags-edit/trunk/src/FilterPanel.cc	Sat Jun 18 12:45:17 2005
@@ -29,7 +29,6 @@
 #include "Environment.h"
 
 #include "DebtagsDocument.h"
-#include "PackageBuffer.h"
 
 #include <gtkmm/table.h>
 #include <gtkmm/label.h>
@@ -45,7 +44,7 @@
 
 template<class DOC>
 FilterPanel<DOC>::FilterPanel(DOC& doc)
-	: Gtk::Frame("Filter"), doc(doc), specialQuery("No TODO query"), tagSelector(doc), specialID(0)
+	: Gtk::Frame("Filter"), doc(doc), filter(doc.packageDB()), specialQuery("No TODO query"), tagSelector(doc), specialID(0)
 {
 	Gtk::Table* table = manage(new Gtk::Table(7, 2));
 	add(*table);
@@ -68,7 +67,7 @@
 		maintFilter.set_text(defmail);
 		statusFilter.set_history(0);
 	} else {
-		filter.setInstalled(Debtags::BasicPackageMatcher::YES);
+		filter.setInstalled(Debtags::BasicPackageMatcher<string>::YES);
 		statusFilter.set_history(1);
 	}
 
@@ -124,7 +123,10 @@
 void FilterPanel<DOC>::on_statusFilter_changed() throw ()
 {
 	int cur = statusFilter.get_history();
-	filter.setInstalled(cur == 0 ? Debtags::BasicPackageMatcher::ANY : cur == 1 ? Debtags::BasicPackageMatcher::YES : Debtags::BasicPackageMatcher::NO);
+	filter.setInstalled(
+			cur == 0 ? Debtags::BasicPackageMatcher<string>::ANY :
+			cur == 1 ? Debtags::BasicPackageMatcher<string>::YES :
+			           Debtags::BasicPackageMatcher<string>::NO);
 	updateList();
 }
 
@@ -159,7 +161,7 @@
 
 	DOC& doc;
 
-	class Stats : public TagcollConsumer<Package, Tag>, public std::map<Facet, int>
+	class Stats : public TagcollConsumer<string, Tag>, public std::map<Facet, int>
 	{
 	protected:
 		DOC& doc;
@@ -186,12 +188,12 @@
 			facets = doc.vocabulary().getFacets();
 		}
 		virtual ~Stats() {}
-		void consume(const Package& pkg) {}
-		void consume(const Package& item, const Tagcoll::OpSet<Tag>& tags)
+		void consume(const string& pkg) {}
+		void consume(const string& item, const Tagcoll::OpSet<Tag>& tags)
 		{
 			update(tags, 1);
 		}
-		void consume(const Tagcoll::OpSet<Package>& items, const Tagcoll::OpSet<Tag>& tags)
+		void consume(const Tagcoll::OpSet<string>& items, const Tagcoll::OpSet<Tag>& tags)
 		{
 			update(tags, items.size());
 		}
@@ -327,7 +329,7 @@
 	int selected;
 	std::string selectedLabel;
 	Facet specialFacet;
-	PackageSet specialPackages;
+	OpSet<string> specialPackages;
 
 	void on_selected_changed(int val)
 	{
@@ -345,7 +347,7 @@
 			doc.wantSpecials();
 	
 			int count = 0;
-			for (std::map<Facet, OpSet<Package> >::const_iterator i = doc.specials.specials.begin();
+			for (std::map<Facet, OpSet<string> >::const_iterator i = doc.specials.specials.begin();
 					i != doc.specials.specials.end(); i++, count++)
 				if (count == val - 5)
 				{
@@ -388,7 +390,7 @@
 			{
 				doc.wantSpecials();
 			
-				for (std::map<Facet, OpSet<Package> >::const_iterator i = doc.specials.specials.begin();
+				for (std::map<Facet, OpSet<string> >::const_iterator i = doc.specials.specials.begin();
 						i != doc.specials.specials.end(); i++, count++)
 					addButton("Specials: [" + i->first.name() + "] " + i->first.sdesc() + " (" + stringf::fmt(i->second.size()) + ")", count);
 			} else if (doc.hasSpecials == DebtagsDocument::GENERATING) {
@@ -407,7 +409,7 @@
 	std::string getSelectedLabel() { return selectedLabel; }
 	int getSelected() { return selected; }
 	Facet getSpecialFacet() { return specialFacet; }
-	PackageSet getSpecialPackages() { return specialPackages; }
+	OpSet<string> getSpecialPackages() { return specialPackages; }
 };
 
 
@@ -458,9 +460,10 @@
 	if (iter)
 	{
 		Gtk::TreeModel::Row row = *iter;
-		Debtags::Package p = row[itemListModelColumns.pkg];
-		fprintf(stderr, "Selected %.*s\n", PFSTR(p.name()));
-		signal_selected().emit(p);
+		//Debtags::Package p = doc.packageDB().getPackage(row[itemListModelColumns.pkg]);
+		//fprintf(stderr, "Selected %.*s\n", PFSTR(p.name()));
+		Glib::ustring up = row[itemListModelColumns.pkg];
+		signal_selected().emit(up);
 	}
 }
 
@@ -487,32 +490,32 @@
 };
 
 template<class DOC>
-void FilterPanel<DOC>::outputSpecialColl(Tagcoll::TagcollConsumer<Package, Tag>& consumer) throw ()
+void FilterPanel<DOC>::outputSpecialColl(Tagcoll::TagcollConsumer<string, Tag>& consumer) throw ()
 {
 	if (specialID == -1)
 	{
-		ExpressionFilter filter(doc.serializer(), specialExpression, &consumer);
+		ExpressionFilter<string> filter(doc.serializer(), specialExpression, &consumer);
 		doc.tagDB().output(filter);
 	} else if (specialID == 0) {
 		doc.tagDB().output(consumer);
 	} else if (specialID == 1) {
-		UntaggedFilter filter(&consumer);
+		UntaggedFilter<string> filter(&consumer);
 		doc.tagDB().output(filter);
 	} else if (specialID == 2) {
-		ExpressionFilter filter(doc.serializer(), "uitoolkit::* && !interface::*", &consumer);
+		ExpressionFilter<string> filter(doc.serializer(), "uitoolkit::* && !interface::*", &consumer);
 		doc.tagDB().output(filter);
 	} else if (specialID == 3) {
-		ExpressionFilter filter(doc.serializer(), "uitoolkit::* && !implemented-in::*", &consumer);
+		ExpressionFilter<string> filter(doc.serializer(), "uitoolkit::* && !implemented-in::*", &consumer);
 		doc.tagDB().output(filter);
 	} else if (specialID == 4) {
-		ExpressionFilter filter(doc.serializer(), "!role::*", &consumer);
+		ExpressionFilter<string> filter(doc.serializer(), "!role::*", &consumer);
 		doc.tagDB().output(filter);
 	} else {
 		if (!specialFacet)
 		{
 			warning("I don't know how to handle special ID %d", specialID);
 		} else {
-			for (PackageSet::const_iterator i = specialPackages.begin();
+			for (OpSet<string>::const_iterator i = specialPackages.begin();
 					i != specialPackages.end(); i++)
 			{
 				TagSet tags = doc.tagDB().getTags(*i);
@@ -534,8 +537,9 @@
 
 	if (specialID != 0)
 	{
-		PMFilter f(filter, &doc.subCollection);
-		outputSpecialColl(f);
+		filter.setConsumer(&doc.subCollection);
+		//PMFilter f(filter, &doc.subCollection);
+		outputSpecialColl(filter);
 	}
 	else
 	{
@@ -583,22 +587,26 @@
 }
 
 template<class DOC>
-void FilterPanel<DOC>::consume(const Debtags::Package& item) throw ()
+void FilterPanel<DOC>::consume(const std::string& item) throw ()
 {
 	static const unsigned int max_pkg = 200;
 	if (itemListModel->children().size() > max_pkg)
 		return;
-	Gtk::TreeModel::Row row;
-	row = *(itemListModel->append());
-	row[itemListModelColumns.pkg] = item;
-	row[itemListModelColumns.name] = item.name();
-	row[itemListModelColumns.desc] = item.sdesc();
+	Package pkg = doc.packageDB().getPackage(item);
+	if (pkg)
+	{
+		Gtk::TreeModel::Row row;
+		row = *(itemListModel->append());
+		row[itemListModelColumns.pkg] = pkg.name();
+		row[itemListModelColumns.name] = pkg.name();
+		row[itemListModelColumns.desc] = pkg.sdesc();
+	}
 	//if (sel.find(*i) != sel.end())
 	//itemList.get_selection()->select(row);
 }
 
 template<class DOC>
-void FilterPanel<DOC>::consume(const Debtags::Package& item, const Tagcoll::OpSet<Debtags::Tag>& tags) throw ()
+void FilterPanel<DOC>::consume(const std::string& item, const Tagcoll::OpSet<Debtags::Tag>& tags) throw ()
 {
 	consume(item);
 }

Modified: debtags-edit/trunk/src/FilterPanel.h
==============================================================================
--- debtags-edit/trunk/src/FilterPanel.h	(original)
+++ debtags-edit/trunk/src/FilterPanel.h	Sat Jun 18 12:45:17 2005
@@ -25,7 +25,7 @@
 
 #include <tagcoll/OpSet.h>
 #include <debtags/BasicPackageMatcher.h>
-#include <debtags/PackageSet.h>
+//#include <debtags/PackageSet.h>
 #include <tagcoll/TagcollConsumer.h>
 
 //#include "PackageBuffer.h"
@@ -42,15 +42,15 @@
 #include <gtkmm/radiobutton.h>
 
 template<class DOC>
-class FilterPanel : public Gtk::Frame, public Tagcoll::TagcollConsumer<Debtags::Package, Debtags::Tag>
+class FilterPanel : public Gtk::Frame, public Tagcoll::TagcollConsumer<std::string, Debtags::Tag>
 {
 public:
 	typedef SigC::Signal0<void> type_signal_changed;
-	typedef SigC::Signal1<void, Debtags::Package> type_signal_selected;
+	typedef SigC::Signal1<void, std::string> type_signal_selected;
 
 protected:
 	DOC& doc;
-	Debtags::BasicPackageMatcher filter;
+	Debtags::BasicPackageMatcher<std::string> filter;
 	Gtk::Entry nameFilter;
 	Gtk::Entry maintFilter;
 	Gtk::Entry ftextFilter;
@@ -66,7 +66,7 @@
 	int specialID;
 	std::string specialExpression;
 	Debtags::Facet specialFacet;
-	Debtags::PackageSet specialPackages;
+	Tagcoll::OpSet<std::string> specialPackages;
 
 	// Tree model columns
 	class ItemListModelColumns : public Gtk::TreeModel::ColumnRecord
@@ -74,7 +74,7 @@
 	public:
 		ItemListModelColumns() { add(pkg); add(name); add(desc); }
 
-		Gtk::TreeModelColumn<Debtags::Package> pkg;
+		Gtk::TreeModelColumn<Glib::ustring> pkg;
 		Gtk::TreeModelColumn<Glib::ustring> name;
 		Gtk::TreeModelColumn<Glib::ustring> desc;
 	};
@@ -111,7 +111,7 @@
 
 	void updateList() throw ();
 	
-	void outputSpecialColl(Tagcoll::TagcollConsumer<Debtags::Package, Debtags::Tag>& consumer) throw ();
+	void outputSpecialColl(Tagcoll::TagcollConsumer<std::string, Debtags::Tag>& consumer) throw ();
 
 public:
 	FilterPanel(DOC& doc);
@@ -138,8 +138,8 @@
 	type_signal_list_focus signal_list_focus_out() throw () { return _signal_list_focus; }
 	*/
 
-	virtual void consume(const Debtags::Package& item) throw ();
-	virtual void consume(const Debtags::Package& item, const Tagcoll::OpSet<Debtags::Tag>& tags) throw ();
+	virtual void consume(const std::string& item) throw ();
+	virtual void consume(const std::string& item, const Tagcoll::OpSet<Debtags::Tag>& tags) throw ();
 
 	//virtual bool do_list_focus_in_event(GdkEventFocus*);
 	

Modified: debtags-edit/trunk/src/Makefile.am
==============================================================================
--- debtags-edit/trunk/src/Makefile.am	(original)
+++ debtags-edit/trunk/src/Makefile.am	Sat Jun 18 12:45:17 2005
@@ -9,7 +9,6 @@
 	Environment.cc \
 	CommandlineParser.cc \
 	DebtagsDocument.cc \
-	PackageBuffer.cc \
 	TagMenu.cc \
 	TagSelector.cc \
 	TagEditor.cc \

Modified: debtags-edit/trunk/src/RelatedPanel.cc
==============================================================================
--- debtags-edit/trunk/src/RelatedPanel.cc	(original)
+++ debtags-edit/trunk/src/RelatedPanel.cc	Sat Jun 18 12:45:17 2005
@@ -78,7 +78,8 @@
 	if (iter)
 	{
 		Gtk::TreeModel::Row row = *iter;
-		signal_selected().emit(row[itemListModelColumns.pkg]);
+		Package pkg = row[itemListModelColumns.pkg];
+		signal_selected().emit(pkg.name());
 	}
 }
 
@@ -88,46 +89,53 @@
 	static const unsigned int max_pkg = 200;
 
 	printf("rpUPDATELIST start\n");
-	if (!pivot)
+	if (!pivot.empty())
 	{
 		printf("rpUPDATELIST end\n");
 		return;
 	}
 
 	unsigned int dist = 0;
-	pkgs.clear();
+	//pkgs.clear();
 	TagSet ref = doc.tagDB().getTags(pivot);
-	for ( ; pkgs.size() == 0 && dist <= ref.size(); dist++)
+	OpSet<string> related;
+	for ( ; related.size() == 0 && dist <= ref.size(); dist++)
 	{
 		fprintf(stderr, "Trying distance %d...\n", dist);
 		//Debtags::Environment::get().outputRelated(pkgs, pivot, dist);
-		PackageSet(doc.tagDB().getRelatedItems(pivot, dist)).output(pkgs);
+		related += doc.tagDB().getRelatedItems(pivot, dist);
+		//related.output(pkgs);
 	}
 
-	PackageBuffer::const_iterator lastIter = pkgs.size() > max_pkg ? pkgs.begin() + max_pkg : pkgs.end();
+	//PackageBuffer::const_iterator lastIter = pkgs.size() > max_pkg ? pkgs.begin() + max_pkg : pkgs.end();
 	
 	string state;
-	if (lastIter != pkgs.end())
+	if (related.size() > max_pkg)
 	{
-		state = stringf::fmt(">%d (%d) packages at distance %d", max_pkg, pkgs.size(), dist);
+		state = stringf::fmt(">%d (%d) packages at distance %d", max_pkg, related.size(), dist);
 		//printf("The limit of %d visualized packages has been reached: please narrow your search.\n", max_pkg);
 	} else {
-		state = stringf::fmt("%d packages at distance %d", pkgs.size(), dist);
+		state = stringf::fmt("%d packages at distance %d", related.size(), dist);
 	}
 	foundStats.set_text(state);
 
-	pkgs.sort();
+	//pkgs.sort();
 
 	printf("rpUPDATELIST populate\n");
 	Gtk::TreeModel::Row row;
 	itemListModel->clear();
-	for (PackageBuffer::const_iterator i = pkgs.begin(); i != lastIter; i++)
+	unsigned int count = 0;
+	for (OpSet<string>::const_iterator i = related.begin(); count < max_pkg && i != related.end(); i++, count++)
 	{
 		//printf("rpUPDATELIST: %.*s\n", PFSTR((*i)->name()));
-		row = *(itemListModel->append());
-		row[itemListModelColumns.pkg] = *i;
-		row[itemListModelColumns.name] = (*i).name();
-		row[itemListModelColumns.desc] = (*i).sdesc();
+		Package pkg = doc.packageDB().getPackage(*i);
+		if (pkg)
+		{
+			row = *(itemListModel->append());
+			row[itemListModelColumns.pkg] = pkg;
+			row[itemListModelColumns.name] = pkg.name();
+			row[itemListModelColumns.desc] = pkg.sdesc();
+		}
 	}
 	printf("rpUPDATELIST end\n");
 }

Modified: debtags-edit/trunk/src/RelatedPanel.h
==============================================================================
--- debtags-edit/trunk/src/RelatedPanel.h	(original)
+++ debtags-edit/trunk/src/RelatedPanel.h	Sat Jun 18 12:45:17 2005
@@ -24,7 +24,6 @@
 #pragma interface
 
 #include <debtags/Package.h>
-#include "PackageBuffer.h"
 #include "TagSelector.h"
 
 #include <sigc++/sigc++.h>
@@ -41,7 +40,7 @@
 class RelatedPanel : public Gtk::VBox
 {
 public:
-	typedef SigC::Signal1<void, Debtags::Package> type_signal_selected;
+	typedef SigC::Signal1<void, std::string> type_signal_selected;
 
 protected:
 	DOC& doc;
@@ -50,8 +49,8 @@
 	Gtk::ScrolledWindow scrolledItemList;
 	Glib::RefPtr<Gtk::ListStore> itemListModel;
 
-	Debtags::Package pivot;
-	PackageBuffer pkgs;
+	std::string pivot;
+	//PackageBuffer pkgs;
 
 	// Tree model columns
 	class ItemListModelColumns : public Gtk::TreeModel::ColumnRecord
@@ -76,7 +75,7 @@
 	RelatedPanel(DOC& doc);
 	virtual ~RelatedPanel() {}
 
-	void do_pivot_change(Debtags::Package _pivot) throw ()
+	void do_pivot_change(std::string _pivot) throw ()
 	{
 		if (doc.getComputeIntensive())
 		{

Modified: debtags-edit/trunk/src/TagMenu.cc
==============================================================================
--- debtags-edit/trunk/src/TagMenu.cc	(original)
+++ debtags-edit/trunk/src/TagMenu.cc	Sat Jun 18 12:45:17 2005
@@ -147,7 +147,7 @@
 }
 
 template<class DOC>
-void TagMenu<DOC>::populateAvailable(const DOC& doc, const TagSet& selectedTags, const TaggedCollection<Package, Tag>& items) throw ()
+void TagMenu<DOC>::populateAvailable(const DOC& doc, const TagSet& selectedTags, const TaggedCollection<string, Tag>& items) throw ()
 {
 	/*
 	TagSet merged;
@@ -175,21 +175,21 @@
 void TagMenu<DOC>::populateAvailableSmart(
 		const DOC& doc,
 		const TagSet& selectedTags,
-		const TaggedCollection<Package, Tag>& items) throw ()
+		const TaggedCollection<string, Tag>& items) throw ()
 {
 	// Compute the minimum set of toplevel facets that can be used to select
 	// all items in `items'
 
-	TagCollection<Package, Facet> coll;
+	TagCollection<string, Facet> coll;
 	FacetSet toplevelFacets;
 
 	// Make a new collection tagged with facets instead of tags
-	TagToFacet<Package> tagStripper(&coll);
+	TagToFacet<string> tagStripper(&coll);
 	items.output(tagStripper);
 
 	Facet f;
-	SmartHierarchyNode<Package, Facet> node(f, coll, 0);
-	for (HierarchyNode<Package, Facet>::iterator i = node.begin();
+	SmartHierarchyNode<string, Facet> node(f, coll, 0);
+	for (HierarchyNode<string, Facet>::iterator i = node.begin();
 			i != node.end(); i++)
 		toplevelFacets += (*i)->tag();
 

Modified: debtags-edit/trunk/src/TagMenu.h
==============================================================================
--- debtags-edit/trunk/src/TagMenu.h	(original)
+++ debtags-edit/trunk/src/TagMenu.h	Sat Jun 18 12:45:17 2005
@@ -26,7 +26,7 @@
 #include <gtkmm/menu.h>
 #include <debtags/Tag.h>
 #include <debtags/TagSet.h>
-#include <debtags/PackageSet.h>
+//#include <debtags/PackageSet.h>
 #include <tagcoll/TaggedCollection.h>
 
 #include <vector>
@@ -65,8 +65,8 @@
 	// Populate with all companion tags of the given tag set
 	void populateAvailable(const DOC& doc, const Debtags::TagSet& selectedTags) throw ();
 	// Populate with all companion tags of the tags with which the given packages have been tagged
-	void populateAvailable(const DOC& doc, const Debtags::TagSet& selectedTags, const Tagcoll::TaggedCollection<Debtags::Package, Debtags::Tag>& items) throw ();
-	void populateAvailableSmart(const DOC& doc, const Debtags::TagSet& selectedTags, const Tagcoll::TaggedCollection<Debtags::Package, Debtags::Tag>& items) throw ();
+	void populateAvailable(const DOC& doc, const Debtags::TagSet& selectedTags, const Tagcoll::TaggedCollection<std::string, Debtags::Tag>& items) throw ();
+	void populateAvailableSmart(const DOC& doc, const Debtags::TagSet& selectedTags, const Tagcoll::TaggedCollection<std::string, Debtags::Tag>& items) throw ();
 	// Populate with all companion tags of the given tag set in the given facet
 	void populateAvailable(const DOC& doc, const Debtags::TagSet& selectedTags, const Debtags::Facet& facet) throw ();
 	// Populate with all tags except the ones in selectedTags