From 9b7fc566bed503408f2495977fc2f0a07340cd70 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Fri, 27 Mar 2009 16:06:44 +0000 Subject: [PATCH] Print Requires by / Requires in the tooltip. --- rpmdepsize.ml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/rpmdepsize.ml b/rpmdepsize.ml index 28e9f33..3de9065 100644 --- a/rpmdepsize.ml +++ b/rpmdepsize.ml @@ -387,7 +387,6 @@ let open_window pkgstr = (* Force a repaint of the drawing area. *) let drawing_area_repaint () = - debug "drawing_area_repaint\n%!"; GtkBase.Widget.queue_draw da#as_widget in @@ -778,21 +777,35 @@ Tot: %.1f%% %s" pkg.name kill_tooltip () | Some (colour, pkg, total, increm) -> (* Update 'current' which points to the currently moused package. *) - set_current (Some (StringMap.find pkg.nevra depsmap)); + let dep = StringMap.find pkg.nevra depsmap in + set_current (Some dep); + + let deps_of_string deps = + String.concat "\n " + (List.sort (List.map (fun d -> d.pkg.nevra) deps)) + in (* The only way to make the tooltip follow the mouse is to * kill the whole tooltips object and recreate it each time ... *) kill_tooltip (); let tt = GData.tooltips ~delay:100 () in - (* Tooltip text is the same as txt1. *) + (* Tooltip text is the same as txt1 + extra. *) let text = sprintf "%s Package: %.1f%% %s (%Ld bytes) Incremental: %.1f%% %s (%Ld bytes) Total: %.1f%% %s (%Ld bytes)" pkg.nevra (display_percent pkg.size top_total) (display_size pkg.size) pkg.size -(display_percent increm top_total) (display_size increm) increm -(display_percent total top_total) (display_size total) total in + (display_percent increm top_total) (display_size increm) increm + (display_percent total top_total) (display_size total) total in + let text = if dep.parents = [] then text else text ^ sprintf " +Required by: + %s" + (deps_of_string dep.parents) in + let text = if dep.children = [] then text else text ^ sprintf " +Requires: + %s" + (deps_of_string dep.children) in tt#set_tip ~text (da :> GObj.widget); tt#enable (); tooltips := Some tt -- 1.8.3.1