diff options
author | Obey Arthur Liu <arthur@milliways.fr> | 2009-01-08 16:53:24 +0100 |
---|---|---|
committer | Obey Arthur Liu <arthur@milliways.fr> | 2009-01-08 16:53:24 +0100 |
commit | 96cbf38da615fd4bd4d819c84af1c8cfc18fd2b0 (patch) | |
tree | cf0ed197e6cceabb08cfeb7dbf8b74707b1513ea | |
parent | d30793ec0447c5ab83885dab543e6a2045d55002 (diff) | |
download | aptitude-96cbf38da615fd4bd4d819c84af1c8cfc18fd2b0.tar.gz |
Add feature to display the origin Archive alongside the version.
The layout might need some tweaking to accomodate the added width.
-rw-r--r-- | src/gtk/entityview.cc | 18 | ||||
-rw-r--r-- | src/gtk/entityview.h | 6 | ||||
-rw-r--r-- | src/gtk/info.cc | 8 | ||||
-rw-r--r-- | src/gtk/pkgview.cc | 10 |
4 files changed, 40 insertions, 2 deletions
diff --git a/src/gtk/entityview.cc b/src/gtk/entityview.cc index 71eb3cfc..7b659d91 100644 --- a/src/gtk/entityview.cc +++ b/src/gtk/entityview.cc @@ -61,6 +61,7 @@ namespace gui row[cols->Name] = text; row[cols->Version] = ""; + row[cols->Archive] = ""; } void HeaderEntity::activated(const Gtk::TreeModel::Path &path, @@ -90,8 +91,10 @@ namespace gui add(SelectedStatusIcon); add(NameMarkup); add(VersionMarkup); + add(ArchiveMarkup); add(Name); add(Version); + add(Archive); add(Description); add(StatusDescriptionMarkup); add(AutomaticallyInstalled); @@ -600,6 +603,21 @@ namespace gui renderer_text->property_ellipsize() = Pango::ELLIPSIZE_END; } } + append_markup_column(Glib::ustring(_("Archive")), Archive, cols.ArchiveMarkup, 80); + EditColumnsDialog::set_description(Archive, _("The archives having this version.")); + { + Gtk::CellRenderer *renderer = tree->get_column_cell_renderer(tree->get_columns().size() - 1); + if(renderer == NULL) + std::cerr << "Why don't I have a renderer when I just added one?" << std::endl; + else + { + Gtk::CellRendererText *renderer_text = dynamic_cast<Gtk::CellRendererText *>(renderer); + if(renderer_text == NULL) + std::cerr << "Why don't I have a text renderer when I just added one?" << std::endl; + else + renderer_text->property_ellipsize() = Pango::ELLIPSIZE_END; + } + } tree->set_search_column(cols.Name); diff --git a/src/gtk/entityview.h b/src/gtk/entityview.h index a42a9d76..b826b6b7 100644 --- a/src/gtk/entityview.h +++ b/src/gtk/entityview.h @@ -119,10 +119,14 @@ namespace gui Gtk::TreeModelColumn<Glib::ustring> NameMarkup; /** \brief The markup that's displayed in the "version" column. */ Gtk::TreeModelColumn<Glib::ustring> VersionMarkup; + /** \brief The markup that's displayed in the "archive" column. */ + Gtk::TreeModelColumn<Glib::ustring> ArchiveMarkup; /** \brief The string that the "name" column should be sorted on. */ Gtk::TreeModelColumn<Glib::ustring> Name; /** \brief The string that the "version" column should be sorted on. */ Gtk::TreeModelColumn<Glib::ustring> Version; + /** \brief The string that the "archive" column should be sorted on. */ + Gtk::TreeModelColumn<Glib::ustring> Archive; /** \brief The text used to display the name column's "description" tooltip. * * \todo I'm tired, so this is just a proof-of-concept; it @@ -184,6 +188,7 @@ namespace gui Gtk::TreeViewColumn * AutomaticallyInstalled; Gtk::TreeViewColumn * Name; Gtk::TreeViewColumn * Version; + Gtk::TreeViewColumn * Archive; /** \brief Sets up generic column properties that don't have to do * with creating the renderer. @@ -259,6 +264,7 @@ namespace gui Gtk::TreeViewColumn *get_status_column() const { return Status; } Gtk::TreeViewColumn *get_name_column() const { return Name; } Gtk::TreeViewColumn *get_version_column() const { return Version; } + Gtk::TreeViewColumn *get_archive_column() const { return Archive; } Gtk::TreeViewColumn *get_automatically_installed_column() const { return AutomaticallyInstalled; } Glib::RefPtr<Gtk::TreeModel> get_model() const { return get_treeview()->get_model(); }; const std::multimap<pkgCache::PkgIterator, Gtk::TreeModel::iterator> * get_reverse_store() const { return &revstore; }; diff --git a/src/gtk/info.cc b/src/gtk/info.cc index f6184ba5..8e630046 100644 --- a/src/gtk/info.cc +++ b/src/gtk/info.cc @@ -35,6 +35,8 @@ #include <generic/apt/apt.h> #include <generic/util/undo.h> +#include <solution_fragment.h> + #include <gtk/gui.h> #include <gtk/entityview.h> #include <gtk/packageinformation.h> @@ -161,8 +163,10 @@ namespace gui row[columns->NameMarkup] = Glib::Markup::escape_text(ver.ParentPkg().Name()); row[columns->VersionMarkup] = Glib::Markup::escape_text(ver.VerStr()); + row[columns->ArchiveMarkup] = Glib::Markup::escape_text(archives_text(ver)); row[columns->Name] = ver.ParentPkg().Name(); row[columns->Version] = ver.VerStr(); + row[columns->Archive] = archives_text(ver); } void add_packages(std::set<pkgCache::PkgIterator> &packages) @@ -258,8 +262,10 @@ namespace gui row[columns->SelectedStatusIcon] = ""; row[columns->NameMarkup] = text; row[columns->VersionMarkup] = ""; + row[columns->ArchiveMarkup] = ""; row[columns->Name] = text; - row[columns->Version]; + row[columns->Version] = ""; + row[columns->Archive] = ""; } void add_packages(std::set<pkgCache::PkgIterator> &packages) diff --git a/src/gtk/pkgview.cc b/src/gtk/pkgview.cc index 111f7203..c980a0e7 100644 --- a/src/gtk/pkgview.cc +++ b/src/gtk/pkgview.cc @@ -34,6 +34,8 @@ #include <generic/apt/matching/parse.h> #include <generic/apt/matching/pattern.h> +#include <solution_fragment.h> + #include <gtk/gui.h> #include <gtk/info.h> #include <gtk/progress.h> @@ -197,12 +199,17 @@ namespace gui pkgCache::VerIterator candver=state.CandidateVerIter(*apt_cache_file); if (state.Upgrade() || state.Downgrade()) row[cols->VersionMarkup] = row[cols->VersionMarkup] + "\n<i>" + Glib::Markup::escape_text(candver.VerStr()) + "</i>"; + row[cols->ArchiveMarkup] = archives_text(ver); } else + { row[cols->VersionMarkup] = ""; + row[cols->ArchiveMarkup] = ""; + } row[cols->Name] = pkg.end() ? "" : pkg.Name(); row[cols->Version] = ver.end() ? "" : ver.VerStr(); + row[cols->Archive] = ver.end() ? "" : archives_text(ver); { const bool is_auto = (state.Flags & pkgCache::Flag::Auto) != 0; @@ -368,6 +375,7 @@ namespace gui cache_reloaded.connect(sigc::mem_fun(*this, &PkgViewBase::rebuild_store)); get_version_column()->set_visible(false); + get_archive_column()->set_visible(false); } PkgViewBase::~PkgViewBase() @@ -403,7 +411,7 @@ namespace gui ref_ptr<search_cache> search_info(search_cache::create()); if(limited) { - search(limit, search_info, matches, *apt_cache_file, *apt_package_records); + search(limit, search_info, matches, *apt_cache_file, *apt_package_records); int num = 0; const int total = static_cast<int>(matches.size()); |