From 737e7996bd29716d6cef090684f466b1106a1191 Mon Sep 17 00:00:00 2001 From: Daniel Burrows Date: Tue, 15 Nov 2005 22:50:53 +0000 Subject: [aptitude @ Use the new description-extraction routines instead of directly looking up the description.] --- src/cmdline/cmdline_show.cc | 7 ++++--- src/generic/apt/matchers.cc | 3 ++- src/pkg_columnizer.cc | 7 +------ src/pkg_info_screen.cc | 8 ++++---- src/pkg_ver_item.cc | 5 +---- src/pkg_view.cc | 11 +---------- src/solution_item.cc | 2 +- 7 files changed, 14 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/cmdline/cmdline_show.cc b/src/cmdline/cmdline_show.cc index e168789d..d1060676 100644 --- a/src/cmdline/cmdline_show.cc +++ b/src/cmdline/cmdline_show.cc @@ -327,9 +327,10 @@ static fragment *version_file_fragment(pkgCache::VerIterator ver, fragments.push_back(prv_lst_frag(ver.ProvidesList(), false, _("Provides"))); fragments.push_back(prv_lst_frag(ver.ParentPkg().ProvidesList(), true, _("Provided by"))); - fragments.push_back(fragf("%s%s%n", - _("Description: "), rec.ShortDesc().c_str())); - fragments.push_back(indentbox(1, 1, make_desc_fragment(transcode(rec.LongDesc())))); + fragments.push_back(fragf("%s%ls%n", + _("Description: "), + get_short_description(ver).c_str())); + fragments.push_back(indentbox(1, 1, make_desc_fragment(get_long_description(ver)))); fragment *tags = make_tags_fragment(pkg); if(tags) diff --git a/src/generic/apt/matchers.cc b/src/generic/apt/matchers.cc index e019a720..86e4f122 100644 --- a/src/generic/apt/matchers.cc +++ b/src/generic/apt/matchers.cc @@ -39,6 +39,7 @@ #include #include +#include #include @@ -349,7 +350,7 @@ public: if(ver.end()) return match_target(false, ""); else - return match_target(true, apt_package_records->Lookup(ver.FileList()).LongDesc().c_str()); + return match_target(true, transcode(get_long_description(ver).c_str())); } }; diff --git a/src/pkg_columnizer.cc b/src/pkg_columnizer.cc index b60e5da2..c3a18761 100644 --- a/src/pkg_columnizer.cc +++ b/src/pkg_columnizer.cc @@ -309,12 +309,7 @@ column_disposition pkg_item::pkg_columnizer::setup_column(int type) break; case description: - if(!visible_ver.end() && - !visible_ver.FileList().end() && - apt_package_records) - return column_disposition(apt_package_records->Lookup(visible_ver.FileList()).ShortDesc(), 0); - else - return column_disposition("", 0); + return column_disposition(get_short_description(visible_ver), 0); break; case maintainer: diff --git a/src/pkg_info_screen.cc b/src/pkg_info_screen.cc index 44cd3322..f76c01ed 100644 --- a/src/pkg_info_screen.cc +++ b/src/pkg_info_screen.cc @@ -78,8 +78,8 @@ void pkg_grouppolicy_info::setup_package_info(const pkgCache::PkgIterator &pkg, { pkgRecords::Parser &rec=apt_package_records->Lookup(ver.FileList()); - string desc=apt_package_records->Lookup(ver.FileList()).LongDesc(); - string shortdesc=string(desc, 0, desc.find('\n')); + std::wstring desc(get_long_description(ver)); + std::wstring shortdesc(desc, 0, desc.find(L'\n')); vector frags; @@ -91,9 +91,9 @@ void pkg_grouppolicy_info::setup_package_info(const pkgCache::PkgIterator &pkg, } // Avoid creating new strings to translate. - frags.push_back(clipbox(fragf("%B%s%b%s%n", + frags.push_back(clipbox(fragf("%B%s%b%ls%n", _("Description: "), shortdesc.c_str()))); - frags.push_back(indentbox(2, 2, make_desc_fragment(transcode(desc)))); + frags.push_back(indentbox(2, 2, make_desc_fragment(desc))); fragment *tags = make_tags_fragment(pkg); if(tags != NULL) diff --git a/src/pkg_ver_item.cc b/src/pkg_ver_item.cc index 49650795..45a5e8f9 100644 --- a/src/pkg_ver_item.cc +++ b/src/pkg_ver_item.cc @@ -329,10 +329,7 @@ column_disposition pkg_ver_columnizer::setup_column(int type) break; case description: - if(ver.end()) - return column_disposition("", 0); - - return column_disposition(apt_package_records->Lookup(ver.FileList()).ShortDesc(), 0); + return column_disposition(get_short_description(ver), 0); case maintainer: if(ver.end()) return column_disposition("", 0); diff --git a/src/pkg_view.cc b/src/pkg_view.cc index 1bd6f76f..dd4cc912 100644 --- a/src/pkg_view.cc +++ b/src/pkg_view.cc @@ -176,16 +176,7 @@ public: void set_package(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver) { - wstring newdesc; - - if(!pkg.end() && !ver.end()) - { - if(!transcode(apt_package_records->Lookup(ver.FileList()).LongDesc(), newdesc)) - { - if(!transcode(_("Encoding error in long description."), newdesc)) - newdesc=L"Encoding error in long description."; - } - } + wstring newdesc(get_long_description(ver)); fragment *frag=make_desc_fragment(newdesc); diff --git a/src/solution_item.cc b/src/solution_item.cc index 21965f92..cc3eca46 100644 --- a/src/solution_item.cc +++ b/src/solution_item.cc @@ -261,7 +261,7 @@ void solution_act_item::highlighted(vs_tree *win) apt_package_records == NULL) set_short_description(fragf("")); else - set_short_description(text_fragment(apt_package_records->Lookup(real_ver.FileList()).ShortDesc())); + set_short_description(text_fragment(get_short_description(real_ver))); set_active_dep(d); } -- cgit v1.2.3