aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-07-14 08:12:47 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-07-14 03:35:25 +0100
commit80328502c8562e43cd2ede72387afbfe95dc0a56 (patch)
treea8269e8e9ec0d1fa46b199d08682bd841f8c03b3
parent8a4a6b294bbf57e5ea37a5735085fb9a54d212a3 (diff)
downloadpaludis-80328502c8562e43cd2ede72387afbfe95dc0a56.tar.gz
paludis-80328502c8562e43cd2ede72387afbfe95dc0a56.tar.xz
Show notifications for installs
-rw-r--r--src/output/console_install_task.cc40
-rw-r--r--src/output/console_install_task.hh4
2 files changed, 43 insertions, 1 deletions
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index 40ffeda..442ac78 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -55,6 +55,7 @@
#include <paludis/output_manager_from_environment.hh>
#include <paludis/output_manager.hh>
#include <paludis/dep_list.hh>
+#include <paludis/notifier_callback.hh>
#include <tr1/functional>
#include <algorithm>
@@ -198,8 +199,42 @@ ConsoleInstallTask::try_to_set_targets_from_user_specs(const std::tr1::shared_pt
void
ConsoleInstallTask::on_build_deplist_pre()
{
- output_activity_start_message("Building dependency list");
+ output_activity_start_message("Building dependency list: ");
output_xterm_title("Building dependency list");
+
+ _notifier_callback.reset(new NotifierCallbackID(environment()->add_notifier_callback(
+ std::tr1::bind(std::tr1::mem_fn(&ConsoleInstallTask::_notifier_callback_fn),
+ this, std::tr1::placeholders::_1))));
+}
+
+namespace
+{
+ struct CallbackDisplayer
+ {
+ std::ostream & stream;
+
+ CallbackDisplayer(std::ostream & s) :
+ stream(s)
+ {
+ }
+
+ void visit(const NotifierCallbackResolverStepEvent &)
+ {
+ stream << "." << std::flush;
+ }
+
+ void visit(const NotifierCallbackGeneratingMetadataEvent &)
+ {
+ stream << "*" << std::flush;
+ }
+ };
+}
+
+void
+ConsoleInstallTask::_notifier_callback_fn(const NotifierCallbackEvent & e)
+{
+ CallbackDisplayer d(output_stream());
+ e.accept(d);
}
void
@@ -207,6 +242,9 @@ ConsoleInstallTask::on_build_deplist_post()
{
output_activity_end_message();
_resolution_finished = true;
+
+ environment()->remove_notifier_callback(*_notifier_callback);
+ _notifier_callback.reset();
}
void
diff --git a/src/output/console_install_task.hh b/src/output/console_install_task.hh
index 0781eab..90ee086 100644
--- a/src/output/console_install_task.hh
+++ b/src/output/console_install_task.hh
@@ -110,6 +110,10 @@ namespace paludis
bool _resolution_finished;
+ std::tr1::shared_ptr<NotifierCallbackID> _notifier_callback;
+
+ void _notifier_callback_fn(const NotifierCallbackEvent &);
+
protected:
ConsoleInstallTask(Environment * const env, const DepListOptions & options,
const std::tr1::shared_ptr<const DestinationsSet> &);