mcconfig.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #ifndef MC_CONFIG_H
  2. #define MC_CONFIG_H
  3. #include "lib/vfs/vfs.h" /* vfs_path_t */
  4. /*** typedefs(not structures) and defined constants **********************************************/
  5. #define CONFIG_APP_SECTION "Midnight-Commander"
  6. #define CONFIG_PANELS_SECTION "Panels"
  7. #define CONFIG_LAYOUT_SECTION "Layout"
  8. #define CONFIG_MISC_SECTION "Misc"
  9. #define CONFIG_EXT_EDITOR_VIEWER_SECTION "External editor or viewer parameters"
  10. /*** enums ***************************************************************************************/
  11. /*** structures declarations (and typedefs of structures)*****************************************/
  12. typedef struct mc_config_t
  13. {
  14. GKeyFile *handle;
  15. gchar *ini_path;
  16. } mc_config_t;
  17. /*** global variables defined in .c file *********************************************************/
  18. extern mc_config_t *mc_main_config;
  19. extern mc_config_t *mc_panels_config;
  20. /*** declarations of public functions ************************************************************/
  21. /* mcconfig/common.c: */
  22. mc_config_t *mc_config_init (const gchar * ini_path, gboolean read_only);
  23. void mc_config_deinit (mc_config_t * mc_config);
  24. gboolean mc_config_del_key (mc_config_t *, const char *, const gchar *);
  25. gboolean mc_config_del_group (mc_config_t *, const char *);
  26. gboolean mc_config_has_param (const mc_config_t *, const char *, const gchar *);
  27. gboolean mc_config_has_group (mc_config_t *, const char *);
  28. gboolean mc_config_read_file (mc_config_t * mc_config, const gchar * ini_path, gboolean read_only,
  29. gboolean remove_empty);
  30. gboolean mc_config_save_file (mc_config_t * config, GError ** error);
  31. gboolean mc_config_save_to_file (mc_config_t * config, const gchar * filename, GError ** error);
  32. /* mcconfig/get.c: */
  33. gchar **mc_config_get_groups (const mc_config_t *, gsize *);
  34. gchar **mc_config_get_keys (const mc_config_t *, const gchar *, gsize *);
  35. gchar *mc_config_get_string (mc_config_t *, const gchar *, const gchar *, const gchar *);
  36. gchar *mc_config_get_string_raw (const mc_config_t *, const gchar *, const gchar *, const gchar *);
  37. gboolean mc_config_get_bool (mc_config_t *, const gchar *, const gchar *, gboolean);
  38. int mc_config_get_int (mc_config_t *, const gchar *, const gchar *, int);
  39. gchar **mc_config_get_string_list (mc_config_t *, const gchar *, const gchar *, gsize *);
  40. gboolean *mc_config_get_bool_list (mc_config_t *, const gchar *, const gchar *, gsize *);
  41. int *mc_config_get_int_list (mc_config_t *, const gchar *, const gchar *, gsize *);
  42. /* mcconfig/set.c: */
  43. void mc_config_set_string_raw (mc_config_t *, const gchar *, const gchar *, const gchar *);
  44. void mc_config_set_string_raw_value (mc_config_t *, const gchar *, const gchar *, const gchar *);
  45. void mc_config_set_string (const mc_config_t *, const gchar *, const gchar *, const gchar *);
  46. void mc_config_set_bool (mc_config_t *, const gchar *, const gchar *, gboolean);
  47. void mc_config_set_int (mc_config_t *, const gchar *, const gchar *, int);
  48. void
  49. mc_config_set_string_list (mc_config_t *, const gchar *,
  50. const gchar *, const gchar * const[], gsize);
  51. void mc_config_set_bool_list (mc_config_t *, const gchar *, const gchar *, gboolean[], gsize);
  52. void mc_config_set_int_list (mc_config_t *, const gchar *, const gchar *, int[], gsize);
  53. /* mcconfig/dialog.c: */
  54. void mc_config_show_dialog (void);
  55. /* mcconfig/paths.c: */
  56. void mc_config_init_config_paths (GError ** error);
  57. void mc_config_deinit_config_paths (void);
  58. gboolean mc_config_migrate_from_old_place (GError ** error, char **msg);
  59. const char *mc_config_get_data_path (void);
  60. const char *mc_config_get_cache_path (void);
  61. const char *mc_config_get_path (void);
  62. const char *mc_config_get_home_dir (void);
  63. char *mc_config_get_full_path (const char *config_name);
  64. vfs_path_t *mc_config_get_full_vpath (const char *config_name);
  65. /*** inline functions ****************************************************************************/
  66. #endif