1 /* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */ 2 /* Balsa E-Mail Client 3 * 4 * Copyright (C) 1997-2013 Stuart Parmenter and others, 5 * See the file AUTHORS for a list. 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2, or (at your option) 10 * any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 * 02111-1307, USA. 21 */ 22 23 #ifndef __LIBCONFIG_H__ 24 #define __LIBCONFIG_H__ 25 26 #include <gtk/gtk.h> 27 28 void libbalsa_conf_push_group(const char *group); 29 void libbalsa_conf_remove_group_(const char *group, gboolean priv); 30 #define libbalsa_conf_remove_group(group) \ 31 (libbalsa_conf_remove_group_((group),FALSE)) 32 #define libbalsa_conf_private_remove_group(group) \ 33 (libbalsa_conf_remove_group_((group),TRUE)) 34 35 gboolean libbalsa_conf_has_group(const char *group); 36 gboolean libbalsa_conf_has_key(const gchar *key); 37 38 /* Wrapper for iterating over groups. */ 39 typedef gboolean (*LibBalsaConfForeachFunc)(const gchar * key, 40 const gchar * value, 41 gpointer data); 42 void libbalsa_conf_foreach_group(const gchar * prefix, 43 LibBalsaConfForeachFunc func, 44 gpointer data); 45 46 void libbalsa_conf_foreach_keys (const gchar * group, 47 LibBalsaConfForeachFunc func, 48 gpointer data); 49 50 void libbalsa_conf_pop_group (void); 51 void libbalsa_conf_clean_key (const char *key); 52 53 void libbalsa_conf_set_bool_ (const char *path, 54 gboolean value, 55 gboolean priv); 56 #define libbalsa_conf_set_bool(path,new_value) \ 57 (libbalsa_conf_set_bool_((path),(new_value),FALSE)) 58 59 gboolean libbalsa_conf_get_bool_with_default_(const char *path, 60 gboolean * def, 61 gboolean priv); 62 #define libbalsa_conf_get_bool_with_default(path,def) \ 63 (libbalsa_conf_get_bool_with_default_((path),(def),FALSE)) 64 #define libbalsa_conf_get_bool(path) \ 65 (libbalsa_conf_get_bool_with_default_ ((path), NULL, FALSE)) 66 67 gint libbalsa_conf_get_int_with_default_ (const char *path, 68 gboolean * def, 69 gboolean priv); 70 #define libbalsa_conf_get_int(path) \ 71 (libbalsa_conf_get_int_with_default_ ((path), NULL, FALSE)) 72 #define libbalsa_conf_get_int_with_default(path, def) \ 73 (libbalsa_conf_get_int_with_default_ ((path), (def), FALSE)) 74 75 gdouble libbalsa_conf_get_double_with_default_ (const char *path, 76 gboolean * def, 77 gboolean priv); 78 #define libbalsa_conf_get_double(path) \ 79 (libbalsa_conf_get_double_with_default_ ((path), NULL, FALSE)) 80 #define libbalsa_conf_get_double_with_default(path, def) \ 81 (libbalsa_conf_get_double_with_default_ ((path), (def), FALSE)) 82 83 void libbalsa_conf_set_int_ (const char *path, 84 int value, 85 gboolean priv); 86 #define libbalsa_conf_set_int(path,new_value) \ 87 (libbalsa_conf_set_int_((path),(new_value),FALSE)) 88 89 void libbalsa_conf_set_double_ (const char *path, 90 double value, 91 gboolean priv); 92 #define libbalsa_conf_set_double(path,new_value) \ 93 (libbalsa_conf_set_double_((path),(new_value),FALSE)) 94 95 void libbalsa_conf_set_string_ (const char *path, 96 const char *value, 97 gboolean priv); 98 #define libbalsa_conf_set_string(path,new_value) \ 99 (libbalsa_conf_set_string_((path),(new_value),FALSE)) 100 #define libbalsa_conf_private_set_string(path,new_value) \ 101 (libbalsa_conf_set_string_((path),(new_value),TRUE)) 102 103 char *libbalsa_conf_get_string_with_default_ (const char *path, 104 gboolean * def, 105 gboolean priv); 106 #define libbalsa_conf_get_string(path) \ 107 (libbalsa_conf_get_string_with_default_((path),NULL, FALSE)) 108 #define libbalsa_conf_get_string_with_default(path, def) \ 109 (libbalsa_conf_get_string_with_default_((path),(def), FALSE)) 110 #define libbalsa_conf_private_get_string(path) \ 111 (libbalsa_conf_get_string_with_default_((path),NULL, TRUE)) 112 113 void libbalsa_conf_set_vector (const char *path, 114 int argc, 115 const char *const argv[]); 116 117 void libbalsa_conf_get_vector_with_default (const char *path, 118 gint * argcp, 119 char ***argvp, 120 gboolean * def); 121 122 void libbalsa_conf_drop_all (void); 123 void libbalsa_conf_sync (void); 124 void libbalsa_conf_queue_sync (void); 125 126 #endif /* __LIBCONFIG_H__ */ 127