[Aptitude-devel] r3048 - in branches/aptitude-0.3/aptitude: . src
Daniel Burrows
dburrows@costa.debian.org
Fri, 22 Apr 2005 23:47:19 +0000
Author: dburrows
Date: Fri Apr 22 23:47:16 2005
New Revision: 3048
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/broken_indicator.cc
Log:
Hide inactive indicators and correctly handle cache reloading
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Fri Apr 22 23:47:16 2005
@@ -1,5 +1,9 @@
2005-04-22 Daniel Burrows <dburrows@debian.org>
+ * src/broken_indicator.cc:
+
+ Hide an inactive indicator; correctly handle cache reloading.
+
* src/generic/problemresolver/problemresolver.h:
Add a method on solutions to explicitly invalidate them.
Modified: branches/aptitude-0.3/aptitude/src/broken_indicator.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/broken_indicator.cc (original)
+++ branches/aptitude-0.3/aptitude/src/broken_indicator.cc Fri Apr 22 23:47:16 2005
@@ -46,6 +46,15 @@
*/
class broken_indicator:public vs_text_layout
{
+ aptitude_resolver::solution last_sol;
+
+ void handle_cache_reload()
+ {
+ if(apt_cache_file)
+ (*apt_cache_file)->package_state_changed.connect(sigc::mem_fun(*this, &broken_indicator::update));
+
+ update();
+ }
public:
broken_indicator()
{
@@ -53,7 +62,7 @@
(*apt_cache_file)->package_state_changed.connect(sigc::mem_fun(*this, &broken_indicator::update));
cache_closed.connect(sigc::mem_fun(*this, &broken_indicator::update));
- cache_reloaded.connect(sigc::mem_fun(*this, &broken_indicator::update));
+ cache_reloaded.connect(sigc::mem_fun(*this, &broken_indicator::handle_cache_reload));
update();
}
@@ -63,6 +72,8 @@
if((!apt_cache_file) || !(*apt_cache_file)->resolver_exists())
{
set_fragment(fragf(""));
+ last_sol.nullify();
+ hide();
return;
}
@@ -77,9 +88,15 @@
{
aptitude_resolver::solution sol=(*apt_cache_file)->get_current_solution();
+ if(sol == last_sol)
+ return;
+
+ last_sol=sol;
+
if(sol.get_actions().empty())
{
set_fragment(fragf(_("%CInternal error: unexpected null solution."), get_color("Error")));
+ show();
return;
}
@@ -189,6 +206,8 @@
set_fragment(fragf(_("%CUnable to resolve dependencies."),
"Error"));
}
+
+ show();
}
};