# # patch "ui.ml" # from [b7ef06298881927e45f40ca98daf6cb02da81efa] # to [e18db3fd1fddaf0c5b1efcd5a31bfc25b4188bb8] # # patch "view.ml" # from [83f362ba3f6afabb069a8bf1fb0db6c2d31d440f] # to [c5852ee52bcf4a2e65f0da517cacca19cb6de336] # # patch "view.mli" # from [30ccdc219586dfe86f23cbc5e3715ff40238e6be] # to [01d6087db6831d53ec35e1da6c9eb63ecc523804] # ======================================================================== --- ui.ml b7ef06298881927e45f40ca98daf6cb02da81efa +++ ui.ml e18db3fd1fddaf0c5b1efcd5a31bfc25b4188bb8 @@ -23,6 +23,9 @@ \ \ \ + \ + \ + \ \ \ \ @@ -46,6 +49,7 @@ mutable popup_id : string ; group : GAction.action_group ; mutable signals : (unit Gobject.obj * GtkSignal.id) list ; + menu_cert : GMenu.menu ; clipboard1 : GData.clipboard ; clipboard2 : GData.clipboard ; } @@ -74,6 +78,7 @@ add "Diff_one" ~label:"Diff with ancestor" ; add "Diff_many" ~label:"Diff with ancestor" ; add "Diff_other" ~label:"Diff with selected node" ; + add "Copy_cert" ~stock:`COPY ~label:"Copy the cert value to the clipboard" ; add "Copy_revision" ~stock:`COPY ~label:"Copy revision id to the clipboard" ; add "Copy_manifest" ~stock:`COPY ~label:"Copy manifest id to the clipboard" ] ; let g_view = GAction.action_group ~name:"view" () in @@ -95,6 +100,7 @@ group = g ; signals = [] ; popup_id = "" ; + menu_cert = new GMenu.menu (GtkMenu.Menu.cast (get_obj m "/popup_cert")) ; clipboard1 = GData.clipboard Gdk.Atom.clipboard ; clipboard2 = GData.clipboard Gdk.Atom.primary } @@ -121,6 +127,12 @@ p.diff_many#remove_submenu () ; p.popup_id <- id +let popup_cert m button = + let p = get_popup_data m in + let time = GtkMain.Main.get_current_event_time () in + p.menu_cert#popup ~button ~time + + let popup m v ~selected_id ~popup_id button = let p = get_popup_data m in reset_popup_menu p popup_id ; @@ -399,23 +411,35 @@ View.display_certs v (get_popup_data manager).popup_id) ; + action_connect "/popup_cert/Copy_cert" + (fun () -> + may + (fun c -> + let p = get_popup_data manager in + p.clipboard1#set_text c ; + p.clipboard2#set_text c) + (View.Info_Display.get_current_cert_value v)) ; + action_connect "/FindEntry" (fun () -> View.Find.focus_find_entry v) ; let view_group = manager.view_group in + let action_close = ui#get_action "/toolbar/Close" in View.connect_event v (function | `OPEN_DB -> - (ui#get_action "/toolbar/Close")#set_sensitive true + action_close#set_sensitive true | `CLOSE_DB -> - (ui#get_action "/toolbar/Close")#set_sensitive false + action_close#set_sensitive false | `CLEAR -> view_group#set_sensitive false | `UPDATE_BEGIN -> view_group#set_sensitive true | `NODE_POPUP (popup_id, button) -> popup manager v ~selected_id:(v.View.selected_node) ~popup_id button + | `CERT_POPUP button -> + popup_cert manager button | _ -> ()) end ; ======================================================================== --- view.ml 83f362ba3f6afabb069a8bf1fb0db6c2d31d440f +++ view.ml c5852ee52bcf4a2e65f0da517cacca19cb6de336 @@ -57,6 +57,8 @@ cert_c_sig : sig_verif GTree.column ; cert_model : GTree.list_store ; cert_view : GTree.view ; + + mutable current_row : Gtk.tree_path option ; } type select_info = { @@ -80,7 +82,8 @@ | `UPDATE_END | `NODE_SELECT of string | `NODE_POPUP of string * int - | `NODE_SWITCH_BRANCH of string * string] + | `NODE_SWITCH_BRANCH of string * string + | `CERT_POPUP of int] type canvas = { w : GnoCanvas.canvas ; @@ -267,9 +270,27 @@ cert_c_sig = c_sig ; cert_model = cert_model ; cert_view = cert_view ; + current_row = None ; } + let setup_popup v = + (* setup the signal for the popup menu *) + ignore (v.info.cert_view#event#connect#button_press (fun ev -> + let button = GdkEvent.Button.button ev in + if button = 3 then begin + begin + let x = int_of_float (GdkEvent.Button.x ev) in + let y = int_of_float (GdkEvent.Button.y ev) in + match v.info.cert_view#get_path_at_pos ~x ~y with + | Some (path, _, _, _) -> v.info.current_row <- Some path + | None -> v.info.current_row <- None + end ; + Signal.emit v.event_signal (`CERT_POPUP button) + end ; + false)) + let clear_info { info = i } = + i.current_row <- None ; i.revision_label#set_label i.empty_label ; i.revision_model#clear () ; i.cert_model#clear () @@ -363,6 +384,14 @@ failed_node_data in display_info v.info (filter_certs v.prefs.Viz_style.ignored_certs data) + + let get_current_cert_value v = + maybe + (fun path -> + v.info.cert_model#get + ~row:(v.info.cert_model#get_iter path) + ~column:v.info.cert_c_value) + v.info.current_row end @@ -1118,6 +1147,8 @@ drag_active = false } in + Info_Display.setup_popup v ; + Branch_selector.connect v (fun i -> handle_query v ?id:i.preselect i.query) ; ======================================================================== --- view.mli 30ccdc219586dfe86f23cbc5e3715ff40238e6be +++ view.mli 01d6087db6831d53ec35e1da6c9eb63ecc523804 @@ -17,7 +17,8 @@ | `UPDATE_END | `NODE_SELECT of string | `NODE_POPUP of string * int - | `NODE_SWITCH_BRANCH of string * string] + | `NODE_SWITCH_BRANCH of string * string + | `CERT_POPUP of int] type canvas type keyboard_nav type find @@ -41,6 +42,8 @@ val make : packing:(GObj.widget -> unit) -> info_display val clear_info : t -> unit val fetch_and_display_data : t -> string -> unit + val get_current_cert_value : t -> string option + val setup_popup : t -> unit end module Branch_selector :