Core, mceditor, mcviewer and mcdiffviewer code tweak and cleanup
[midnight-commander.git] / lib / mcconfig.h
blob0518ac152e3717c2497a33c29a715040ca93efe3
1 #ifndef MC_CONFIG_H
2 #define MC_CONFIG_H
4 #include "lib/vfs/vfs.h" /* vfs_path_t */
6 /*** typedefs(not structures) and defined constants **********************************************/
8 #define CONFIG_APP_SECTION "Midnight-Commander"
9 #define CONFIG_PANELS_SECTION "Panels"
10 #define CONFIG_LAYOUT_SECTION "Layout"
11 #define CONFIG_MISC_SECTION "Misc"
13 /*** enums ***************************************************************************************/
15 /*** structures declarations (and typedefs of structures)*****************************************/
17 typedef struct mc_config_t
19 GKeyFile *handle;
20 gchar *ini_path;
21 } mc_config_t;
23 /*** global variables defined in .c file *********************************************************/
25 extern mc_config_t *mc_main_config;
26 extern mc_config_t *mc_panels_config;
28 /*** declarations of public functions ************************************************************/
30 /* mcconfig/common.c: */
32 mc_config_t *mc_config_init (const gchar *);
33 void mc_config_deinit (mc_config_t *);
35 gboolean mc_config_del_key (mc_config_t *, const char *, const gchar *);
36 gboolean mc_config_del_group (mc_config_t *, const char *);
38 gboolean mc_config_has_param (const mc_config_t *, const char *, const gchar *);
39 gboolean mc_config_has_group (mc_config_t *, const char *);
41 gboolean mc_config_read_file (mc_config_t * mc_config, const gchar * ini_path,
42 gboolean remove_empty);
44 gboolean mc_config_save_file (mc_config_t * config, GError ** error);
46 gboolean mc_config_save_to_file (mc_config_t * config, const gchar * filename, GError ** error);
49 /* mcconfig/get.c: */
51 gchar **mc_config_get_groups (const mc_config_t *, gsize *);
53 gchar **mc_config_get_keys (const mc_config_t *, const gchar *, gsize *);
55 gchar *mc_config_get_string (mc_config_t *, const gchar *, const gchar *, const gchar *);
57 gchar *mc_config_get_string_raw (const mc_config_t *, const gchar *, const gchar *, const gchar *);
59 gboolean mc_config_get_bool (mc_config_t *, const gchar *, const gchar *, gboolean);
61 int mc_config_get_int (mc_config_t *, const gchar *, const gchar *, int);
64 gchar **mc_config_get_string_list (mc_config_t *, const gchar *, const gchar *, gsize *);
66 gboolean *mc_config_get_bool_list (mc_config_t *, const gchar *, const gchar *, gsize *);
68 int *mc_config_get_int_list (mc_config_t *, const gchar *, const gchar *, gsize *);
71 /* mcconfig/set.c: */
73 void mc_config_set_string_raw (mc_config_t *, const gchar *, const gchar *, const gchar *);
75 void mc_config_set_string_raw_value (mc_config_t *, const gchar *, const gchar *, const gchar *);
77 void mc_config_set_string (const mc_config_t *, const gchar *, const gchar *, const gchar *);
79 void mc_config_set_bool (mc_config_t *, const gchar *, const gchar *, gboolean);
81 void mc_config_set_int (mc_config_t *, const gchar *, const gchar *, int);
83 void
84 mc_config_set_string_list (mc_config_t *, const gchar *,
85 const gchar *, const gchar * const[], gsize);
87 void mc_config_set_bool_list (mc_config_t *, const gchar *, const gchar *, gboolean[], gsize);
89 void mc_config_set_int_list (mc_config_t *, const gchar *, const gchar *, int[], gsize);
92 /* mcconfig/dialog.c: */
94 void mc_config_show_dialog (void);
97 /* mcconfig/paths.c: */
99 void mc_config_init_config_paths (GError ** error);
101 void mc_config_deinit_config_paths (void);
103 gboolean mc_config_deprecated_dir_present (void);
105 void mc_config_migrate_from_old_place (GError ** error);
107 const char *mc_config_get_data_path (void);
109 const char *mc_config_get_cache_path (void);
111 const char *mc_config_get_path (void);
113 const char *mc_config_get_home_dir (void);
115 char *mc_config_get_full_path (const char *config_name);
117 vfs_path_t *mc_config_get_full_vpath (const char *config_name);
119 /*** inline functions ****************************************************************************/
121 #endif