let global_debug = true;;
+let do_nothing _ = ();;
+
(**
@param on_use_hint function invoked when an hint is used, argumnet is the hint
to use
destroyed, if it's None "self#quit" is invoked
*)
class hbugsClient
- ?(use_hint_callback: hint -> unit = (fun _ -> ()))
+ ?(use_hint_callback: hint -> unit = do_nothing)
+ ?(destroy_callback: unit -> unit = do_nothing)
()
=
method private initGui =
(* GUI: main window *)
- let on_exit = fun () -> self#quit (); false in
+
+ (* ignore delete events so that hbugs window is closable only using
+ menu; on destroy (e.g. while quitting gTopLevel) self#quit is invoked
+ *)
+
+ ignore (mainWindow#hbugsMainWindow#event#connect#delete (fun _ -> true));
ignore (mainWindow#hbugsMainWindow#event#connect#destroy
- (fun _ -> on_exit ()));
- ignore (mainWindow#hbugsMainWindow#event#connect#delete
- (fun _ -> on_exit ()));
+ (fun _ -> self#quit (); false));
(* GUI main window's menu *)
mainWindow#toggleDebuggingMenuItem#set_active debug;
method private quit () =
self#unregisterFromBroker ();
- GMain.Main.quit ()
+ destroy_callback ()
(** enable/disable debugging *)
method private setDebug value = debug <- value
exception Invalid_URL of string
class hbugsClient :
- ?use_hint_callback: (hint -> unit) ->
+ ?use_hint_callback: (hint -> unit) -> (* default = do nothing *)
+ ?destroy_callback: (unit -> unit) -> (* default = do nothing *)
unit ->
object