diff options
author | Daniel Burrows <dburrows@debian.org> | 2009-04-19 18:43:51 -0700 |
---|---|---|
committer | Daniel Burrows <dburrows@debian.org> | 2009-04-19 18:43:51 -0700 |
commit | 1d63408f86a15423fa37827c9e2f38e02a5dc7c4 (patch) | |
tree | d6071d8b143dbd81940efb14dacf58e1fce4ba17 /src/gtk/resolver.cc | |
parent | 0795b9b1a8e91a112952b394454e327dddf50c88 (diff) | |
download | aptitude-1d63408f86a15423fa37827c9e2f38e02a5dc7c4.tar.gz |
Use analyze_action() to generate more accurate and more complete tooltips for action preference icons.
Diffstat (limited to 'src/gtk/resolver.cc')
-rw-r--r-- | src/gtk/resolver.cc | 115 |
1 files changed, 90 insertions, 25 deletions
diff --git a/src/gtk/resolver.cc b/src/gtk/resolver.cc index 4a70be82..74cf2045 100644 --- a/src/gtk/resolver.cc +++ b/src/gtk/resolver.cc @@ -301,18 +301,51 @@ namespace gui { Glib::ustring icon_tooltip; // Generate a friendly message about what's happening. - if(ver.end()) - icon_tooltip = ssprintf(_("Removing %s is rejected."), pkg.Name()); - else if(ver == pkg.CurrentVer() && - pkg->CurrentState != pkgCache::State::NotInstalled && - pkg->CurrentState != pkgCache::State::ConfigFiles) - icon_tooltip = ssprintf(_("Keeping %s at version %s is rejected."), - pkg.Name(), - pkg.CurrentVer().VerStr()); - else - icon_tooltip = ssprintf(_("Installing %s version %s is rejected."), - pkg.Name(), - pkg.CurrentVer().VerStr()); + switch(analyze_action(c.get_ver())) + { + case action_remove: + icon_tooltip = ssprintf(_("Removing %s is rejected."), pkg.Name()); + break; + + case action_keep: + if(ver.end()) + icon_tooltip = ssprintf(_("Canceling the installation of %s is rejected."), + pkg.Name()); + else + { + aptitude_resolver_package + resolver_pkg(c.get_ver().get_package()); + aptitude_resolver_version + resolver_pkg_current_ver(resolver_pkg.current_version()); + + if(resolver_pkg_current_ver.get_ver().end()) + icon_tooltip = ssprintf(_("Canceling the removal of %s is rejected."), + pkg.Name()); + else + icon_tooltip = ssprintf(_("Keeping %s at version %s is rejected."), + pkg.Name(), + pkg.CurrentVer().VerStr()); + } + break; + + case action_install: + icon_tooltip = ssprintf(_("Installing %s version %s is rejected."), + pkg.Name(), + pkg.CurrentVer().VerStr()); + break; + + case action_downgrade: + icon_tooltip = ssprintf(_("Downgrading %s to version %s is rejected."), + pkg.Name(), + ver.VerStr()); + break; + + case action_upgrade: + icon_tooltip = ssprintf(_("Upgrading %s to version %s is rejected."), + pkg.Name(), + ver.VerStr()); + break; + } return preference_info(Gtk::Stock::CANCEL.id, icon_tooltip, @@ -322,19 +355,51 @@ namespace gui else if(manager->is_mandatory(c.get_ver())) { Glib::ustring icon_tooltip; - if(ver.end()) - icon_tooltip = ssprintf(_("Removing %s is preferred over all un-accepted alternatives."), - pkg.Name()); - else if(ver == pkg.CurrentVer() && - pkg->CurrentState != pkgCache::State::NotInstalled && - pkg->CurrentState != pkgCache::State::ConfigFiles) - icon_tooltip = ssprintf(_("Keeping %s at version %s is preferred over all un-accepted alternatives."), - pkg.Name(), - pkg.CurrentVer().VerStr()); - else - icon_tooltip = ssprintf(_("Installing %s version %s is preferred over all un-accepted alternatives."), - pkg.Name(), - pkg.CurrentVer().VerStr()); + switch(analyze_action(c.get_ver())) + { + case action_remove: + icon_tooltip = ssprintf(_("Removing %s is preferred over all un-accepted alternatives."), pkg.Name()); + break; + + case action_keep: + if(ver.end()) + icon_tooltip = ssprintf(_("Canceling the installation of %s is preferred over all un-accepted alternatives."), + pkg.Name()); + else + { + aptitude_resolver_package + resolver_pkg(c.get_ver().get_package()); + aptitude_resolver_version + resolver_pkg_current_ver(resolver_pkg.current_version()); + + if(resolver_pkg_current_ver.get_ver().end()) + icon_tooltip = ssprintf(_("Canceling the removal of %s is preferred over all un-accepted alternatives."), + pkg.Name()); + else + icon_tooltip = ssprintf(_("Keeping %s at version %s is preferred over all un-accepted alternatives."), + pkg.Name(), + pkg.CurrentVer().VerStr()); + } + break; + + case action_install: + icon_tooltip = ssprintf(_("Installing %s version %s is preferred over all un-accepted alternatives."), + pkg.Name(), + pkg.CurrentVer().VerStr()); + break; + + case action_downgrade: + icon_tooltip = ssprintf(_("Downgrading %s to version %s is preferred over all un-accepted alternatives."), + pkg.Name(), + ver.VerStr()); + break; + + case action_upgrade: + icon_tooltip = ssprintf(_("Upgrading %s to version %s is preferred over all un-accpted alternatives."), + pkg.Name(), + ver.VerStr()); + break; + } return preference_info(Gtk::Stock::APPLY.id, icon_tooltip, |