]> matita.cs.unibo.it Git - helm.git/commitdiff
Porting to lablgtk2 completed.
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Fri, 7 Nov 2003 11:04:17 +0000 (11:04 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Fri, 7 Nov 2003 11:04:17 +0000 (11:04 +0000)
helm/hbugs/client/hbugs_client.ml

index 8eac8a022c8ec9f679ec59f5823aed6d2859535c..4613dbf0d57ddeabe071b299d1576c30cb6cf052 100644 (file)
@@ -225,23 +225,26 @@ class hbugsClient
           self#listTutors ();
           subscribeWindow#subscribeWindow#show ()));
 
+      let get_selected_row_index () =
+       match mainWindow#hintsCList#selection#get_selected_rows with
+          [path] ->
+            (match GTree.Path.get_indices path with
+                [|n|] -> n
+              | _ -> assert false)
+        | _ -> assert false
+      in
         (* GUI: hints list *)
-      ignore (mainWindow#hintsCList#selection#set_select_function
-        (fun path already_selected ->
-          let row =
-prerr_endline ("**** BEFORE CRASH: " ^ if already_selected then "yes" else "no") ;
-           match GTree.Path.get_indices path with
-              [|n|] -> n
-            | _ -> assert false
-          in
-prerr_endline ("**** AFTER CRASH: " ^ string_of_int row) ;
-           (*CSC: there used to be an event whose type was checked against *)
-           (*CSC: `TWO_BUTTON_PRESS. This is just a bad approximation.     *)
-           if already_selected then
-            use_hint_callback (self#hint row)
-           else
-            describe_hint_callback (self#hint row) ;
-           true)) ;
+      ignore (
+       let event_ops = new GObj.event_ops mainWindow#hintsCList#as_widget in
+        event_ops#connect#button_press
+         (fun event ->
+           if GdkEvent.get_type event = `TWO_BUTTON_PRESS then
+            use_hint_callback (self#hint (get_selected_row_index ())) ;
+           false));
+
+      ignore (mainWindow#hintsCList#selection#connect#changed
+       (fun () ->
+         describe_hint_callback (self#hint (get_selected_row_index ())))) ;
 
         (* GUI: main status bar *)
       let ctxt = mainWindow#mainWindowStatusBar#new_context "0" in