2009-05-20 10:33:53 +04:00
|
|
|
#ifndef MC_CONFIG_H
|
|
|
|
#define MC_CONFIG_H
|
|
|
|
|
2011-07-18 01:30:58 +04:00
|
|
|
#include "lib/vfs/vfs.h" /* vfs_path_t */
|
|
|
|
|
2010-12-29 18:12:59 +03:00
|
|
|
/*** typedefs(not structures) and defined constants **********************************************/
|
2009-05-20 10:33:53 +04:00
|
|
|
|
|
|
|
#define CONFIG_APP_SECTION "Midnight-Commander"
|
2011-01-02 13:08:23 +03:00
|
|
|
#define CONFIG_PANELS_SECTION "Panels"
|
2012-01-28 19:28:45 +04:00
|
|
|
#define CONFIG_LAYOUT_SECTION "Layout"
|
|
|
|
#define CONFIG_MISC_SECTION "Misc"
|
2009-05-20 10:33:53 +04:00
|
|
|
|
2010-12-29 18:12:59 +03:00
|
|
|
/*** enums ***************************************************************************************/
|
2009-05-20 10:33:53 +04:00
|
|
|
|
2010-12-29 18:12:59 +03:00
|
|
|
/*** structures declarations (and typedefs of structures)*****************************************/
|
2009-05-20 10:33:53 +04:00
|
|
|
|
2011-04-29 13:05:59 +04:00
|
|
|
typedef struct mc_config_t
|
2010-11-08 13:21:45 +03:00
|
|
|
{
|
2009-05-20 10:33:53 +04:00
|
|
|
GKeyFile *handle;
|
|
|
|
gchar *ini_path;
|
|
|
|
} mc_config_t;
|
|
|
|
|
2010-12-29 18:12:59 +03:00
|
|
|
/*** global variables defined in .c file *********************************************************/
|
2009-05-20 10:33:53 +04:00
|
|
|
|
|
|
|
extern mc_config_t *mc_main_config;
|
|
|
|
extern mc_config_t *mc_panels_config;
|
|
|
|
|
2010-12-29 18:12:59 +03:00
|
|
|
/*** declarations of public functions ************************************************************/
|
2009-05-20 10:33:53 +04:00
|
|
|
|
|
|
|
/* mcconfig/common.c: */
|
|
|
|
|
|
|
|
mc_config_t *mc_config_init (const gchar *);
|
|
|
|
void mc_config_deinit (mc_config_t *);
|
|
|
|
|
2011-01-26 13:42:42 +03:00
|
|
|
gboolean mc_config_del_key (mc_config_t *, const char *, const gchar *);
|
2009-05-20 10:33:53 +04:00
|
|
|
gboolean mc_config_del_group (mc_config_t *, const char *);
|
|
|
|
|
2011-06-06 15:54:02 +04:00
|
|
|
gboolean mc_config_has_param (const mc_config_t *, const char *, const gchar *);
|
2009-05-20 10:33:53 +04:00
|
|
|
gboolean mc_config_has_group (mc_config_t *, const char *);
|
|
|
|
|
2011-02-23 15:19:37 +03:00
|
|
|
gboolean mc_config_read_file (mc_config_t * mc_config, const gchar * ini_path,
|
|
|
|
gboolean remove_empty);
|
2009-05-20 10:33:53 +04:00
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
gboolean mc_config_save_file (mc_config_t * config, GError ** error);
|
2009-05-20 10:33:53 +04:00
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
gboolean mc_config_save_to_file (mc_config_t * config, const gchar * filename, GError ** error);
|
2009-05-20 10:33:53 +04:00
|
|
|
|
2010-11-08 21:50:15 +03:00
|
|
|
|
2009-05-20 10:33:53 +04:00
|
|
|
/* mcconfig/get.c: */
|
|
|
|
|
2011-06-06 15:54:02 +04:00
|
|
|
gchar **mc_config_get_groups (const mc_config_t *, gsize *);
|
2009-05-20 10:33:53 +04:00
|
|
|
|
2011-06-06 15:54:02 +04:00
|
|
|
gchar **mc_config_get_keys (const mc_config_t *, const gchar *, gsize *);
|
2009-05-20 10:33:53 +04:00
|
|
|
|
2009-10-27 13:14:32 +03:00
|
|
|
gchar *mc_config_get_string (mc_config_t *, const gchar *, const gchar *, const gchar *);
|
2009-05-20 10:33:53 +04:00
|
|
|
|
2011-06-06 15:54:02 +04:00
|
|
|
gchar *mc_config_get_string_raw (const mc_config_t *, const gchar *, const gchar *, const gchar *);
|
2009-09-14 17:43:03 +04:00
|
|
|
|
2009-10-27 13:14:32 +03:00
|
|
|
gboolean mc_config_get_bool (mc_config_t *, const gchar *, const gchar *, gboolean);
|
2009-05-20 10:33:53 +04:00
|
|
|
|
|
|
|
int mc_config_get_int (mc_config_t *, const gchar *, const gchar *, int);
|
|
|
|
|
|
|
|
|
2009-10-27 13:14:32 +03:00
|
|
|
gchar **mc_config_get_string_list (mc_config_t *, const gchar *, const gchar *, gsize *);
|
2009-05-20 10:33:53 +04:00
|
|
|
|
2009-10-27 13:14:32 +03:00
|
|
|
gboolean *mc_config_get_bool_list (mc_config_t *, const gchar *, const gchar *, gsize *);
|
2009-05-20 10:33:53 +04:00
|
|
|
|
2009-10-27 13:14:32 +03:00
|
|
|
int *mc_config_get_int_list (mc_config_t *, const gchar *, const gchar *, gsize *);
|
2009-05-20 10:33:53 +04:00
|
|
|
|
|
|
|
|
|
|
|
/* mcconfig/set.c: */
|
|
|
|
|
2010-11-16 13:52:23 +03:00
|
|
|
void mc_config_set_string_raw (mc_config_t *, const gchar *, const gchar *, const gchar *);
|
2009-10-12 15:56:46 +04:00
|
|
|
|
2011-12-05 13:45:03 +04:00
|
|
|
void mc_config_set_string_raw_value (mc_config_t *, const gchar *, const gchar *, const gchar *);
|
|
|
|
|
2011-06-06 15:54:02 +04:00
|
|
|
void mc_config_set_string (const mc_config_t *, const gchar *, const gchar *, const gchar *);
|
2009-05-20 10:33:53 +04:00
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
void mc_config_set_bool (mc_config_t *, const gchar *, const gchar *, gboolean);
|
2009-05-20 10:33:53 +04:00
|
|
|
|
|
|
|
void mc_config_set_int (mc_config_t *, const gchar *, const gchar *, int);
|
|
|
|
|
|
|
|
void
|
2010-11-08 13:21:45 +03:00
|
|
|
mc_config_set_string_list (mc_config_t *, const gchar *,
|
|
|
|
const gchar *, const gchar * const[], gsize);
|
2009-05-20 10:33:53 +04:00
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
void mc_config_set_bool_list (mc_config_t *, const gchar *, const gchar *, gboolean[], gsize);
|
2009-05-20 10:33:53 +04:00
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
void mc_config_set_int_list (mc_config_t *, const gchar *, const gchar *, int[], gsize);
|
2009-05-20 10:33:53 +04:00
|
|
|
|
|
|
|
|
|
|
|
/* mcconfig/dialog.c: */
|
|
|
|
|
|
|
|
void mc_config_show_dialog (void);
|
|
|
|
|
2010-12-29 18:12:59 +03:00
|
|
|
|
|
|
|
/* mcconfig/paths.c: */
|
|
|
|
|
|
|
|
void mc_config_init_config_paths (GError ** error);
|
|
|
|
|
|
|
|
void mc_config_deinit_config_paths (void);
|
|
|
|
|
|
|
|
gboolean mc_config_deprecated_dir_present (void);
|
|
|
|
|
|
|
|
void mc_config_migrate_from_old_place (GError ** error);
|
|
|
|
|
|
|
|
const char *mc_config_get_data_path (void);
|
|
|
|
|
|
|
|
const char *mc_config_get_cache_path (void);
|
|
|
|
|
|
|
|
const char *mc_config_get_path (void);
|
|
|
|
|
|
|
|
const char *mc_config_get_home_dir (void);
|
|
|
|
|
2011-11-24 02:28:07 +04:00
|
|
|
char *mc_config_get_full_path (const char *config_name);
|
|
|
|
|
2011-07-18 01:30:58 +04:00
|
|
|
vfs_path_t *mc_config_get_full_vpath (const char *config_name);
|
2010-12-29 18:12:59 +03:00
|
|
|
|
|
|
|
/*** inline functions ****************************************************************************/
|
|
|
|
|
2009-05-20 10:33:53 +04:00
|
|
|
#endif
|