From 27be26be62536dc9fd56429046a2d187d961ce9c Mon Sep 17 00:00:00 2001
From: Allan Blanchard <allan.blanchard@cea.fr>
Date: Mon, 1 Jul 2024 11:08:06 +0200
Subject: [PATCH] [kernel] use standard mechanism for user dirs visibility

---
 .../plugin_entry_points/plugin.ml                | 16 +---------------
 .../plugin_entry_points/plugin.mli               | 15 ---------------
 src/plugins/gui/gui_parameters.ml                |  1 -
 3 files changed, 1 insertion(+), 31 deletions(-)

diff --git a/src/kernel_services/plugin_entry_points/plugin.ml b/src/kernel_services/plugin_entry_points/plugin.ml
index 7731ea1766c..ae7e9e43cd3 100644
--- a/src/kernel_services/plugin_entry_points/plugin.ml
+++ b/src/kernel_services/plugin_entry_points/plugin.ml
@@ -88,13 +88,6 @@ let is_share_visible () = share_visible_ref := true
 let session_visible_ref = ref false
 let is_session_visible () = session_visible_ref := true
 
-let cache_visible_ref = ref false
-let is_cache_visible () = cache_visible_ref := true
-let config_visible_ref = ref false
-let is_config_visible () = config_visible_ref := true
-let state_visible_ref = ref false
-let is_state_visible () = state_visible_ref := true
-
 let plugin_subpath_ref = ref None
 let plugin_subpath s = plugin_subpath_ref := Some s
 
@@ -104,9 +97,6 @@ let reset_plugin () =
   kernel := false;
   share_visible_ref := false;
   session_visible_ref := false;
-  cache_visible_ref := false;
-  config_visible_ref := false;
-  state_visible_ref := false;
   plugin_subpath_ref := None;
   default_msg_keys_ref := [];
 ;;
@@ -481,7 +471,6 @@ struct
   module type User_dir_input = sig
     val name: string
     val getter: unit -> Fc_Filepath.Normalized.t
-    val visible_ref: bool ref
     val kernel_get: unit -> Fc_Filepath.Normalized.t
     val kernel_is_set: unit -> bool
   end
@@ -504,7 +493,7 @@ struct
               | Some p when p <> "" -> Fc_Filepath.Normalized.of_string p
               | _ -> I.getter ()
           ]
-          let visible_ref = !I.visible_ref
+          let visible_ref = !Parameter_customize.is_visible_ref
         end)
   end
 
@@ -512,7 +501,6 @@ struct
       (struct
         let name = "cache"
         let getter = System_config.User_dirs.cache
-        let visible_ref = cache_visible_ref
         let kernel_get () = !cache_ref ()
         let kernel_is_set () = !cache_is_set_ref ()
       end)
@@ -521,7 +509,6 @@ struct
       (struct
         let name = "config"
         let getter = System_config.User_dirs.config
-        let visible_ref = config_visible_ref
         let kernel_get () = !config_ref ()
         let kernel_is_set () = !config_is_set_ref ()
       end)
@@ -530,7 +517,6 @@ struct
       (struct
         let name = "state"
         let getter = System_config.User_dirs.state
-        let visible_ref = state_visible_ref
         let kernel_get () = !state_ref ()
         let kernel_is_set () = !state_is_set_ref ()
       end)
diff --git a/src/kernel_services/plugin_entry_points/plugin.mli b/src/kernel_services/plugin_entry_points/plugin.mli
index 58f69a3f554..890465ab053 100644
--- a/src/kernel_services/plugin_entry_points/plugin.mli
+++ b/src/kernel_services/plugin_entry_points/plugin.mli
@@ -143,21 +143,6 @@ val is_session_visible: unit -> unit
     To be called just before applying {!Register} to create plug-in services.
     @since Neon-20140301 *)
 
-val is_cache_visible: unit -> unit
-(** Make visible to the end-user the -<plug-in>-cache-dir option.
-    To be called just before applying {!Register} to create plug-in services.
-    @since Neon-20140301 *)
-
-val is_config_visible: unit -> unit
-(** Make visible to the end-user the -<plug-in>-config-dir option.
-    To be called just before applying {!Register} to create plug-in services.
-    @since Neon-20140301 *)
-
-val is_state_visible: unit -> unit
-(** Make visible to the end-user the -<plug-in>-state-dir option.
-    To be called just before applying {!Register} to create plug-in services.
-    @since Neon-20140301 *)
-
 val plugin_subpath: string -> unit
 (** Use the given string as the sub-directory in which the plugin files will
     be installed (ie. [share/frama-c/plugin_subpath]...). Relevant for
diff --git a/src/plugins/gui/gui_parameters.ml b/src/plugins/gui/gui_parameters.ml
index 4284fb0a1a6..c34495398aa 100644
--- a/src/plugins/gui/gui_parameters.ml
+++ b/src/plugins/gui/gui_parameters.ml
@@ -20,7 +20,6 @@
 (*                                                                        *)
 (**************************************************************************)
 
-let () = Plugin.is_config_visible ()
 include Plugin.Register
     (struct
       let name = "GUI"
-- 
GitLab