[15499] | 1 | /* GConf |
---|
| 2 | * Copyright (C) 1999, 2000 Red Hat Inc. |
---|
| 3 | * |
---|
| 4 | * This library is free software; you can redistribute it and/or |
---|
| 5 | * modify it under the terms of the GNU Library General Public |
---|
| 6 | * License as published by the Free Software Foundation; either |
---|
| 7 | * version 2 of the License, or (at your option) any later version. |
---|
| 8 | * |
---|
| 9 | * This library is distributed in the hope that it will be useful, |
---|
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 12 | * Library General Public License for more details. |
---|
| 13 | * |
---|
| 14 | * You should have received a copy of the GNU Library General Public |
---|
| 15 | * License along with this library; if not, write to the |
---|
| 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
| 17 | * Boston, MA 02111-1307, USA. |
---|
| 18 | */ |
---|
| 19 | |
---|
| 20 | #ifndef GCONF_GCONF_INTERNALS_H |
---|
| 21 | #define GCONF_GCONF_INTERNALS_H |
---|
| 22 | |
---|
| 23 | #ifndef GCONF_ENABLE_INTERNALS |
---|
| 24 | #warning "you are trying to use GConf internal functions outside of GConf. This is a Bad Idea" |
---|
| 25 | #endif |
---|
| 26 | |
---|
| 27 | #ifdef GCONF_ENABLE_INTERNALS |
---|
| 28 | |
---|
| 29 | #include <glib.h> |
---|
| 30 | #include "gconf-error.h" |
---|
| 31 | #include "gconf-value.h" |
---|
| 32 | #include "GConf.h" |
---|
| 33 | |
---|
| 34 | gchar* gconf_key_directory (const gchar* key); |
---|
| 35 | const gchar* gconf_key_key (const gchar* key); |
---|
| 36 | |
---|
| 37 | /* These file tests are in libgnome, I cut-and-pasted them */ |
---|
| 38 | enum { |
---|
| 39 | GCONF_FILE_EXISTS=(1<<0)|(1<<1)|(1<<2), /*any type of file*/ |
---|
| 40 | GCONF_FILE_ISFILE=1<<0, |
---|
| 41 | GCONF_FILE_ISLINK=1<<1, |
---|
| 42 | GCONF_FILE_ISDIR=1<<2 |
---|
| 43 | }; |
---|
| 44 | |
---|
| 45 | gboolean gconf_file_test (const gchar* filename, int test); |
---|
| 46 | gboolean gconf_file_exists (const gchar* filename); |
---|
| 47 | |
---|
| 48 | GConfValue* gconf_value_from_corba_value (const ConfigValue *value); |
---|
| 49 | ConfigValue* corba_value_from_gconf_value (GConfValue *value); |
---|
| 50 | void fill_corba_value_from_gconf_value (GConfValue *value, |
---|
| 51 | ConfigValue *dest); |
---|
| 52 | ConfigValue* invalid_corba_value (void); |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | gchar* gconf_object_to_string (CORBA_Object obj, |
---|
| 56 | GError **err); |
---|
| 57 | |
---|
| 58 | void fill_corba_schema_from_gconf_schema (GConfSchema *sc, |
---|
| 59 | ConfigSchema *dest); |
---|
| 60 | ConfigSchema* corba_schema_from_gconf_schema (GConfSchema *sc); |
---|
| 61 | GConfSchema* gconf_schema_from_corba_schema (const ConfigSchema *cs); |
---|
| 62 | |
---|
| 63 | const gchar* gconf_value_type_to_string (GConfValueType type); |
---|
| 64 | GConfValueType gconf_value_type_from_string (const gchar *str); |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | gchar** gconf_load_source_path (const gchar* filename, GError** err); |
---|
| 68 | |
---|
| 69 | /* shouldn't be used in applications (although implemented in gconf.c) */ |
---|
| 70 | |
---|
| 71 | void gconf_shutdown_daemon (GError **err); |
---|
| 72 | gboolean gconf_ping_daemon (void); |
---|
| 73 | gboolean gconf_spawn_daemon (GError **err); |
---|
| 74 | |
---|
| 75 | |
---|
| 76 | /* Returns 0 on failure (or if the string is "0" of course) */ |
---|
| 77 | gulong gconf_string_to_gulong (const gchar *str); |
---|
| 78 | gboolean gconf_string_to_double (const gchar *str, |
---|
| 79 | gdouble *val); |
---|
| 80 | gchar* gconf_double_to_string (gdouble val); |
---|
| 81 | const gchar* gconf_current_locale (void); |
---|
| 82 | |
---|
| 83 | |
---|
| 84 | /* Log wrapper; we might want to not use syslog someday */ |
---|
| 85 | typedef enum { |
---|
| 86 | GCL_EMERG, |
---|
| 87 | GCL_ALERT, |
---|
| 88 | GCL_CRIT, |
---|
| 89 | GCL_ERR, |
---|
| 90 | GCL_WARNING, |
---|
| 91 | GCL_NOTICE, |
---|
| 92 | GCL_INFO, |
---|
| 93 | GCL_DEBUG |
---|
| 94 | } GConfLogPriority; |
---|
| 95 | |
---|
| 96 | void gconf_log (GConfLogPriority pri, const gchar* format, ...) G_GNUC_PRINTF (2, 3); |
---|
| 97 | |
---|
[17086] | 98 | extern gboolean gconf_log_debug_messages; |
---|
| 99 | |
---|
[15499] | 100 | /* return FALSE and set error if the key is bad */ |
---|
| 101 | gboolean gconf_key_check(const gchar* key, GError** err); |
---|
| 102 | |
---|
| 103 | /* |
---|
| 104 | * If these were public they'd be in gconf-value.h |
---|
| 105 | */ |
---|
| 106 | |
---|
| 107 | /* doesn't work on complicated types (only string, int, bool, float) */ |
---|
| 108 | GConfValue* gconf_value_new_from_string (GConfValueType type, |
---|
| 109 | const gchar* str, |
---|
| 110 | GError** err); |
---|
| 111 | /* for the complicated types */ |
---|
| 112 | GConfValue* gconf_value_new_list_from_string (GConfValueType list_type, |
---|
| 113 | const gchar* str, |
---|
| 114 | GError** err); |
---|
| 115 | GConfValue* gconf_value_new_pair_from_string (GConfValueType car_type, |
---|
| 116 | GConfValueType cdr_type, |
---|
| 117 | const gchar* str, |
---|
| 118 | GError** err); |
---|
| 119 | |
---|
| 120 | /* These are a hack to encode values into strings and ship them over CORBA, |
---|
| 121 | * necessary for obscure reasons (ORBit doesn't like recursive datatypes yet) |
---|
| 122 | */ |
---|
| 123 | |
---|
| 124 | /* string quoting is only public for the benefit of the test suite */ |
---|
| 125 | |
---|
| 126 | gchar* gconf_quote_string (const gchar *str); |
---|
| 127 | gchar* gconf_unquote_string (const gchar *str, |
---|
| 128 | const gchar **end, |
---|
| 129 | GError **err); |
---|
| 130 | void gconf_unquote_string_inplace (gchar *str, |
---|
| 131 | gchar **end, |
---|
| 132 | GError **err); |
---|
| 133 | |
---|
| 134 | GConfValue* gconf_value_decode (const gchar *encoded); |
---|
| 135 | gchar* gconf_value_encode (GConfValue *val); |
---|
| 136 | |
---|
| 137 | /* FIXME is this used? */ |
---|
| 138 | gchar* gconf_quote_percents (const gchar* src); |
---|
| 139 | |
---|
| 140 | /* |
---|
| 141 | * List/pair conversion stuff |
---|
| 142 | */ |
---|
| 143 | |
---|
| 144 | GConfValue* gconf_value_list_from_primitive_list (GConfValueType list_type, |
---|
[17086] | 145 | GSList *list, |
---|
| 146 | GError **err); |
---|
[15499] | 147 | GConfValue* gconf_value_pair_from_primitive_pair (GConfValueType car_type, |
---|
| 148 | GConfValueType cdr_type, |
---|
| 149 | gconstpointer address_of_car, |
---|
[17086] | 150 | gconstpointer address_of_cdr, |
---|
| 151 | GError **err); |
---|
[15499] | 152 | |
---|
| 153 | GSList* gconf_value_list_to_primitive_list_destructive (GConfValue *val, |
---|
| 154 | GConfValueType list_type, |
---|
| 155 | GError **err); |
---|
| 156 | gboolean gconf_value_pair_to_primitive_pair_destructive (GConfValue *val, |
---|
| 157 | GConfValueType car_type, |
---|
| 158 | GConfValueType cdr_type, |
---|
| 159 | gpointer car_retloc, |
---|
| 160 | gpointer cdr_retloc, |
---|
| 161 | GError **err); |
---|
| 162 | |
---|
| 163 | |
---|
| 164 | void gconf_set_daemon_mode (gboolean setting); |
---|
| 165 | gboolean gconf_in_daemon_mode (void); |
---|
| 166 | void gconf_set_daemon_ior (const gchar *ior); |
---|
| 167 | const gchar* gconf_get_daemon_ior (void); |
---|
| 168 | |
---|
| 169 | /* Returns TRUE if there was an error, frees exception, sets err */ |
---|
| 170 | gboolean gconf_handle_oaf_exception (CORBA_Environment* ev, GError** err); |
---|
| 171 | |
---|
| 172 | void gconf_nanosleep (gulong useconds); |
---|
| 173 | |
---|
| 174 | typedef struct _GConfLock GConfLock; |
---|
| 175 | |
---|
| 176 | GConfLock* gconf_get_lock (const gchar *lock_directory, |
---|
| 177 | GError **err); |
---|
| 178 | gboolean gconf_release_lock (GConfLock *lock, |
---|
| 179 | GError **err); |
---|
[17086] | 180 | GConfLock* gconf_get_lock_or_current_holder (const gchar *lock_directory, |
---|
| 181 | ConfigServer *current_server, |
---|
| 182 | GError **err); |
---|
| 183 | ConfigServer gconf_get_current_lock_holder (const gchar *lock_directory); |
---|
[15499] | 184 | |
---|
| 185 | GError* gconf_error_new (GConfError en, |
---|
| 186 | const gchar* format, ...) G_GNUC_PRINTF (2, 3); |
---|
| 187 | |
---|
| 188 | void gconf_set_error (GError** err, |
---|
| 189 | GConfError en, |
---|
| 190 | const gchar* format, ...) G_GNUC_PRINTF (3, 4); |
---|
| 191 | |
---|
| 192 | /* merge two errors into a single message */ |
---|
| 193 | GError* gconf_compose_errors (GError* err1, GError* err2); |
---|
| 194 | |
---|
[17086] | 195 | CORBA_ORB gconf_orb_get (void); |
---|
| 196 | |
---|
| 197 | ConfigServer gconf_activate_server (gboolean start_if_not_found, |
---|
| 198 | GError **error); |
---|
| 199 | |
---|
| 200 | char* gconf_get_lock_dir (void); |
---|
| 201 | char* gconf_get_daemon_dir (void); |
---|
| 202 | |
---|
| 203 | gboolean gconf_schema_validate (GConfSchema *sc, |
---|
| 204 | GError **err); |
---|
| 205 | gboolean gconf_value_validate (GConfValue *value, |
---|
| 206 | GError **err); |
---|
| 207 | |
---|
| 208 | #define g_utf8_validate gconf_g_utf8_validate |
---|
| 209 | |
---|
| 210 | gboolean gconf_g_utf8_validate (const gchar *str, |
---|
| 211 | gssize max_len, |
---|
| 212 | const gchar **end); |
---|
| 213 | |
---|
[18003] | 214 | int gconf_mkdir_private (const char *path); |
---|
| 215 | |
---|
[15499] | 216 | #ifdef ENABLE_NLS |
---|
| 217 | # include <libintl.h> |
---|
| 218 | # include <config.h> |
---|
| 219 | # undef _ |
---|
| 220 | # define _(String) dgettext (GETTEXT_PACKAGE, String) |
---|
| 221 | # ifdef gettext_noop |
---|
| 222 | # define N_(String) gettext_noop (String) |
---|
| 223 | # else |
---|
| 224 | # define N_(String) (String) |
---|
| 225 | # endif |
---|
| 226 | #else |
---|
| 227 | /* Stubs that do something close enough. */ |
---|
| 228 | # define textdomain(String) (String) |
---|
| 229 | # define bindtextdomain(Domain,Directory) (Domain) |
---|
| 230 | # define _(String) (String) |
---|
| 231 | # define N_(String) (String) |
---|
| 232 | #endif |
---|
| 233 | |
---|
| 234 | #endif /* GCONF_ENABLE_INTERNALS */ |
---|
| 235 | |
---|
| 236 | #endif /* GCONF_GCONF_INTERNALS_H */ |
---|
| 237 | |
---|
| 238 | |
---|