type t = Filetree_type.t
-let rec create ?status ~packing () =
+let rec create ~packing () =
let view = GTree.view ~packing () in
(*view#set_rules_hint true;*)
(*view#selection#set_mode `MULTIPLE; -- add this later *)
index_col = index_col;
mode_col = mode_col; name_col = name_col; size_col = size_col;
date_col = date_col; link_col = link_col;
- status = status
} in
(* Open a context menu when a button is pressed. *)
let row = model#get_iter path in
let hdata = get_hdata t row in
match hdata with
- | _, (Loading | ErrorMessage _) -> None
+ | _, (Loading | ErrorMessage _ | Info _) -> None
| _, (Top _ | Directory _ | File _) -> Some (path, hdata)
) paths in
let item = factory#add_item "Directory information" in
item#misc#set_sensitive false;
let item = factory#add_item "Space used by directory" in
- item#misc#set_sensitive false;
+ ignore (item#connect#activate ~callback:(disk_usage t path));
ignore (factory#add_separator ());
let item = factory#add_item "Download ..." in
item#misc#set_sensitive false;
| _, File _ | IsLeaf, _ -> assert false
(* Node should not exist in the tree. *)
- | NodeNotStarted, (Loading | ErrorMessage _) -> assert false
+ | NodeNotStarted, (Loading | ErrorMessage _ | Info _) -> assert false
(* This is the callback when the slave has read the directory for us. *)
and when_read_directory ({ model = model } as t) path entries =
model#set ~row ~column:t.link_col (markup_of_link link)
) entries;
- (* Remove the placeholder entry. NB. Must be done AFTER adding
- * the other entries, or else Gtk will unexpand the row.
+ (* Remove the placeholder "Loading" entry. NB. Must be done AFTER
+ * adding the other entries, or else Gtk will unexpand the row.
*)
(try
- let placeholder = model#iter_children ~nth:0 (Some row) in
- ignore (model#remove placeholder)
- with Invalid_argument _ -> ()
+ let hdata = IsLeaf, Loading in
+ let row = find_child_node_by_hdata t row hdata in
+ ignore (model#remove row)
+ with Invalid_argument _ | Not_found -> ()
);
(* The original directory entry has now been loaded, so
| exn ->
(* unexpected exception: re-raise it *)
raise exn
-
-let set_status_fn t status =
- t.status <- Some status