# # patch "database.ml" # from [c65ed1ed8166c502a853693457268b259762e7ab] # to [4f0605a86f36c1e05c68933a73363b410c47b8f6] # # patch "query.ml" # from [433642e55735b40057c21d1cdc488c93f7c556a4] # to [9052a40399e3393ce59027a5b4003090a5f90c3f] # # patch "status.ml" # from [18cfb6866b670ee8fde9bcc6baa0636a5dede9ad] # to [af601035c94836765af3c05c748829ec128ab84f] # # patch "view.ml" # from [762e4cf45b09e19c3275a5c995b585e1fd432e8e] # to [214a899619bb1cdc842f53cff5e7a560608e141c] # # patch "view.mli" # from [892722ed6f7f65f92555cc5b7609554a07f5c2ea] # to [132253c13a9469d919d301d6c0e845b78f34d9d1] # ======================================================================== --- database.ml c65ed1ed8166c502a853693457268b259762e7ab +++ database.ml 4f0605a86f36c1e05c68933a73363b410c47b8f6 @@ -355,7 +355,7 @@ Sqlite3.close_db db let with_progress prg f db = - Sqlite3.progress_handler_set db.db 5000 prg ; + Sqlite3.progress_handler_set db.db 2000 prg ; try let r = f db in Sqlite3.progress_handler_unset db.db ; r with exn -> Sqlite3.progress_handler_unset db.db ; raise exn ======================================================================== --- query.ml 433642e55735b40057c21d1cdc488c93f7c556a4 +++ query.ml 9052a40399e3393ce59027a5b4003090a5f90c3f @@ -136,6 +136,7 @@ let (e1, e2, e3) = setup_query_builder w#vbox in let (m, rv, set_label) = setup_results_view w#vbox in + let status = Status.new_reporter "query" in w#add_button_stock `CLOSE `CLOSE ; w#add_button_stock `CLEAR `CLEAR ; @@ -156,13 +157,18 @@ clear_model m ; set_label 0 | `QUERY -> - let results = - do_query - ~cert_name:e1#text ~cert_value:e2#text - ~revision_content:e3#text - v in - update_results m results ; - set_label (List.length results))) ; + View.with_busy_cursor w (fun () -> + Status.with_status + status + "Searching the monotone database ..." + (fun () -> + let results = + do_query + ~cert_name:e1#text ~cert_value:e2#text + ~revision_content:e3#text + v in + update_results m results ; + set_label (List.length results))))) ; ignore (rv#connect#row_activated (fun path view_col -> let id = ======================================================================== --- status.ml 18cfb6866b670ee8fde9bcc6baa0636a5dede9ad +++ status.ml af601035c94836765af3c05c748829ec128ab84f @@ -15,3 +15,8 @@ let new_reporter id = !make_reporter id + +let with_status r msg f = + r#push msg ; + try let res = f () in r#pop () ; res + with exn -> r#pop () ; raise exn ======================================================================== --- view.ml 762e4cf45b09e19c3275a5c995b585e1fd432e8e +++ view.ml 214a899619bb1cdc842f53cff5e7a560608e141c @@ -35,8 +35,17 @@ f db) +let busy_cursor = lazy (Gdk.Cursor.create `WATCH) +let normal_cursor = lazy (Gdk.Cursor.create `LEFT_PTR) +let set_busy_cursor w busy = + Gdk.Window.set_cursor w#misc#window + (Lazy.force + (if busy then busy_cursor else normal_cursor)) +let with_busy_cursor w f = + set_busy_cursor w true ; + try let r = f () in set_busy_cursor w false ; r + with exn -> set_busy_cursor w false ; raise exn - type info_display = { revision_label : GMisc.label ; empty_label : string ; @@ -532,12 +541,8 @@ external pango_fix : unit -> unit = "ml_fix_libgnomecanvas_pango" let _ = pango_fix () - let set_busy_cursor = - let busy_cursor = Gdk.Cursor.create `WATCH in - let normal_cursor = Gdk.Cursor.create `LEFT_PTR in - fun canvas busy -> - Gdk.Window.set_cursor canvas.w#misc#window - (if busy then busy_cursor else normal_cursor) + let set_busy_cursor canvas busy = + set_busy_cursor canvas.w busy let make ~aa ~packing = let sw = GBin.scrolled_window ~width:700 ~height:400 ~packing () in @@ -966,10 +971,16 @@ may Agraph.abort_layout v.agraph ; Canvas.clear v ; v.agraph <- Some ( + let agraph = + Status.with_status + (Lazy.force v.status_reporter) + "Building ancestry graph ..." + (fun () -> + nice_fetch + (fun db -> Database.fetch_ancestry_graph db query) + db) in Agraph.make - (nice_fetch - (fun db -> Database.fetch_ancestry_graph db query) - db) + agraph query (layout_params v) (function | `LAYOUT_ERROR msg -> ======================================================================== --- view.mli 892722ed6f7f65f92555cc5b7609554a07f5c2ea +++ view.mli 132253c13a9469d919d301d6c0e845b78f34d9d1 @@ -1,9 +1,11 @@ val error_notice : parent:#GObj.widget -> string -> unit val wrap_in_scroll_window : (GObj.widget -> unit) -> GObj.widget -> unit val nice_fetch : (Database.t -> 'a) -> Database.t -> 'a +val with_busy_cursor : #GObj.widget -> (unit -> 'a) -> 'a + type info_display type branch_selector type event =