mcconfig.h 3.5 KB

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