destroyed, if it's None "self#quit" is invoked
*)
class hbugsClient
- ~(on_use_hint: hint -> unit)
- ?(on_exit: (unit -> unit) option)
+ ?(use_hint_callback: hint -> unit = (fun _ -> ()))
()
=
val subscribeWindow = new Hbugs_client_gui.subscribeWindow ()
val messageDialog = new Hbugs_client_gui.messageDialog ()
val myOwnId = Hbugs_id_generator.new_client_id ()
+ val mutable use_hint_callback = use_hint_callback
val mutable myOwnUrl = "localhost:49082"
val mutable brokerUrl = "localhost:49081"
val mutable brokerId: broker_id option = None
method show = mainWindow#hbugsMainWindow#show
method hide = mainWindow#hbugsMainWindow#misc#hide
+ method setUseHintCallback callback =
+ use_hint_callback <- callback
+
method private debugButtons =
List.map
(fun (b: GButton.button) -> new GObj.misc_ops b#as_widget)
method private initGui =
(* GUI: main window *)
- let on_exit =
- match on_exit with
- | None -> (fun () -> self#quit (); false)
- | Some f -> (fun () -> f (); true)
- in
+ let on_exit = fun () -> self#quit (); false in
ignore (mainWindow#hbugsMainWindow#event#connect#destroy
(fun _ -> on_exit ()));
ignore (mainWindow#hbugsMainWindow#event#connect#delete
(fun ~row ~column ~event ->
match event with
| Some event when GdkEvent.get_type event = `TWO_BUTTON_PRESS ->
- on_use_hint (self#hint row)
+ use_hint_callback (self#hint row)
| _ -> ()));
(* GUI: main status bar *)
exception Invalid_URL of string
class hbugsClient :
- on_use_hint: (hint -> unit) ->
- ?on_exit: (unit -> unit) ->
+ ?use_hint_callback: (hint -> unit) ->
unit ->
object
method show : unit -> unit
method hide : unit -> unit
+ method setUseHintCallback : (hint -> unit) -> unit
method registerToBroker : unit -> unit
method unregisterFromBroker : unit -> unit
method subscribeAll : unit -> unit
- method stateChange : state -> unit
+ method stateChange : state option -> unit
(** @return an hint by index *)
method hint : int -> hint