summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Burrows <dburrows@debian.org>2009-01-04 16:54:21 -0800
committerDaniel Burrows <dburrows@debian.org>2009-01-04 16:54:21 -0800
commit8f45d25cb7c685c937c7f15c9edc0d901c0a491e (patch)
treec1542be66acb69d30a3d9e16b12c339f01fe9075
parentba6805eefec722a4785d242d4fe1e62fe83d8e5e (diff)
downloadaptitude-8f45d25cb7c685c937c7f15c9edc0d901c0a491e.tar.gz
Add support to the Preview tab for the new pakage search entry object.
This incidentally fixes how the preview tab is built so that it's compatible with the new search code in PkgView, so previews have information again instead of being empty.
-rw-r--r--src/gtk/previewtab.cc25
-rw-r--r--src/gtk/previewtab.h10
2 files changed, 23 insertions, 12 deletions
diff --git a/src/gtk/previewtab.cc b/src/gtk/previewtab.cc
index a3c46732..1bdf6a83 100644
--- a/src/gtk/previewtab.cc
+++ b/src/gtk/previewtab.cc
@@ -1,6 +1,6 @@
// previewtab.cc
//
-// Copyright 1999-2008 Daniel Burrows
+// Copyright 1999-2009 Daniel Burrows
// Copyright 2008 Obey Arthur Liu
//
// This program is free software; you can redistribute it and/or modify
@@ -32,6 +32,7 @@
#include <gtk/gui.h>
#include <gtk/info.h>
#include <gtk/packageinformation.h>
+#include <gtk/packagestab.h> // For PackageSearchEntry.
#include <gtk/pkgview.h>
#include <gtk/notify.h>
@@ -120,19 +121,27 @@ namespace gui
PreviewTab::PreviewTab(const Glib::ustring &label) :
Tab(Preview, label, Gnome::Glade::Xml::create(glade_main_file, "main_packages_hpaned"), "main_packages_hpaned")
{
+ Gtk::Entry *pLimitEntry;
+ Gtk::Button *pLimitButton;
+ Gtk::Label *pLimitErrors;
+
get_xml()->get_widget("main_packages_textview", pPackagesTextView);
get_xml()->get_widget("main_notebook_packages_limit_entry", pLimitEntry);
- pLimitEntry->signal_activate().connect(sigc::mem_fun(*this, &PreviewTab::repopulate_model));
+ get_xml()->get_widget("main_notebook_packages_limit_errors", pLimitErrors);
get_xml()->get_widget("main_notebook_packages_limit_button", pLimitButton);
- pLimitButton->signal_clicked().connect(sigc::mem_fun(*this, &PreviewTab::repopulate_model));
+
+ pSearchEntry = PackageSearchEntry::create(pLimitEntry,
+ pLimitErrors,
+ pLimitButton);
+ pSearchEntry->activated.connect(sigc::mem_fun(*this, &PreviewTab::limit_changed));
using cwidget::util::ref_ptr;
pPkgView = ref_ptr<PreviewView>(new PreviewView(get_xml(), "main_packages_treeview"));
pPkgView->get_treeview()->signal_selection.connect(sigc::mem_fun(*this, &PreviewTab::activated_package_handler));
- // A PreviewTab should be fully populated by default
- repopulate_model();
+ // Start out with no limit.
+ limit_changed(aptitude::matching::pattern::make_true());
pPkgView->get_treeview()->expand_all();
@@ -158,11 +167,11 @@ namespace gui
}
}
- void PreviewTab::repopulate_model()
+ void PreviewTab::limit_changed(const cwidget::util::ref_ptr<aptitude::matching::pattern> &limit)
{
- /*pPkgView->set_limit(pLimitEntry->get_text());
+ pPkgView->set_limit(limit);
pPkgView->get_treeview()->expand_all();
- set_label(_("Preview: ") + pLimitEntry->get_text());*/
+ set_label(_("Preview: ") + pSearchEntry->get_text());
}
void PreviewTab::display_desc(const cwidget::util::ref_ptr<Entity> &ent)
diff --git a/src/gtk/previewtab.h b/src/gtk/previewtab.h
index 7dbd9b32..ccb5c7c3 100644
--- a/src/gtk/previewtab.h
+++ b/src/gtk/previewtab.h
@@ -2,7 +2,7 @@
// previewtab.h
//
-// Copyright 1999-2008 Daniel Burrows
+// Copyright 1999-2009 Daniel Burrows
// Copyright 2008 Obey Arthur Liu
//
// This program is free software; you can redistribute it and/or modify
@@ -37,6 +37,7 @@
namespace gui
{
class Notification;
+ class PackageSearchEntry;
/** \brief A tree-view that displays a preview of which actions are
* to be performed.
@@ -73,14 +74,15 @@ namespace gui
private:
cwidget::util::ref_ptr<PreviewView> pPkgView;
Gtk::TextView * pPackagesTextView;
- Gtk::Entry * pLimitEntry;
- Gtk::Button * pLimitButton;
+
+ cwidget::util::ref_ptr<PackageSearchEntry> pSearchEntry;
+
+ void limit_changed(const cwidget::util::ref_ptr<aptitude::matching::pattern> &limit);
public:
PreviewTab(const Glib::ustring &label);
void activated_package_handler();
- void repopulate_model();
void display_desc(const cwidget::util::ref_ptr<Entity> &ent);
const cwidget::util::ref_ptr<PreviewView> &get_pkg_view() const { return pPkgView; };
};