Print Requires by / Requires in the tooltip.
authorRichard Jones <rjones@redhat.com>
Fri, 27 Mar 2009 16:06:44 +0000 (16:06 +0000)
committerRichard Jones <rjones@redhat.com>
Fri, 27 Mar 2009 16:06:44 +0000 (16:06 +0000)
rpmdepsize.ml

index 28e9f33..3de9065 100644 (file)
@@ -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