source: trunk/third/GConf/gconf/gconf-internals.h @ 15500

Revision 15500, 7.7 KB checked in by ghudson, 23 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r15499, which included commits to RCS files with non-trunk default branches.
Line 
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
34gchar*       gconf_key_directory  (const gchar* key);
35const gchar* gconf_key_key        (const gchar* key);
36
37/* These file tests are in libgnome, I cut-and-pasted them */
38enum {
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
45gboolean gconf_file_test   (const gchar* filename, int test);
46gboolean gconf_file_exists (const gchar* filename);
47
48GConfValue*  gconf_value_from_corba_value      (const ConfigValue *value);
49ConfigValue* corba_value_from_gconf_value      (GConfValue        *value);
50void         fill_corba_value_from_gconf_value (GConfValue        *value,
51                                                ConfigValue       *dest);
52ConfigValue* invalid_corba_value               (void);
53
54
55gchar* gconf_object_to_string (CORBA_Object obj,
56                               GError **err);
57
58void          fill_corba_schema_from_gconf_schema (GConfSchema        *sc,
59                                                   ConfigSchema       *dest);
60ConfigSchema* corba_schema_from_gconf_schema      (GConfSchema        *sc);
61GConfSchema*  gconf_schema_from_corba_schema      (const ConfigSchema *cs);
62
63const gchar*   gconf_value_type_to_string   (GConfValueType  type);
64GConfValueType gconf_value_type_from_string (const gchar    *str);
65
66
67gchar**       gconf_load_source_path (const gchar* filename, GError** err);
68
69/* shouldn't be used in applications (although implemented in gconf.c) */
70
71void     gconf_shutdown_daemon (GError **err);
72gboolean gconf_ping_daemon     (void);
73gboolean gconf_spawn_daemon    (GError **err);
74
75
76/* Returns 0 on failure (or if the string is "0" of course) */
77gulong       gconf_string_to_gulong (const gchar *str);
78gboolean     gconf_string_to_double (const gchar *str,
79                                     gdouble     *val);
80gchar*       gconf_double_to_string (gdouble      val);
81const gchar* gconf_current_locale   (void);
82
83
84/* Log wrapper; we might want to not use syslog someday */
85typedef 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
96void          gconf_log      (GConfLogPriority pri, const gchar* format, ...) G_GNUC_PRINTF (2, 3);
97
98/* return FALSE and set error if the key is bad */
99gboolean      gconf_key_check(const gchar* key, GError** err);
100
101/*
102 * If these were public they'd be in gconf-value.h
103 */
104
105/* doesn't work on complicated types (only string, int, bool, float) */
106GConfValue* gconf_value_new_from_string      (GConfValueType type,
107                                              const gchar* str,
108                                              GError** err);
109/* for the complicated types */
110GConfValue* gconf_value_new_list_from_string (GConfValueType list_type,
111                                              const gchar* str,
112                                              GError** err);
113GConfValue* gconf_value_new_pair_from_string (GConfValueType car_type,
114                                              GConfValueType cdr_type,
115                                              const gchar* str,
116                                              GError** err);
117
118/* These are a hack to encode values into strings and ship them over CORBA,
119 * necessary for obscure reasons (ORBit doesn't like recursive datatypes yet)
120 */
121
122/* string quoting is only public for the benefit of the test suite */
123
124gchar* gconf_quote_string           (const gchar  *str);
125gchar* gconf_unquote_string         (const gchar  *str,
126                                     const gchar **end,
127                                     GError      **err);
128void   gconf_unquote_string_inplace (gchar        *str,
129                                     gchar       **end,
130                                     GError      **err);
131
132GConfValue* gconf_value_decode (const gchar *encoded);
133gchar*      gconf_value_encode (GConfValue  *val);
134
135/* FIXME is this used? */
136gchar* gconf_quote_percents (const gchar* src);
137
138/*
139 * List/pair conversion stuff
140 */
141
142GConfValue* gconf_value_list_from_primitive_list (GConfValueType  list_type,
143                                                  GSList         *list);
144GConfValue* gconf_value_pair_from_primitive_pair (GConfValueType  car_type,
145                                                  GConfValueType  cdr_type,
146                                                  gconstpointer   address_of_car,
147                                                  gconstpointer   address_of_cdr);
148
149
150GSList*  gconf_value_list_to_primitive_list_destructive (GConfValue      *val,
151                                                         GConfValueType   list_type,
152                                                         GError         **err);
153gboolean gconf_value_pair_to_primitive_pair_destructive (GConfValue      *val,
154                                                         GConfValueType   car_type,
155                                                         GConfValueType   cdr_type,
156                                                         gpointer         car_retloc,
157                                                         gpointer         cdr_retloc,
158                                                         GError         **err);
159
160
161void         gconf_set_daemon_mode (gboolean     setting);
162gboolean     gconf_in_daemon_mode  (void);
163void         gconf_set_daemon_ior  (const gchar *ior);
164const gchar* gconf_get_daemon_ior  (void);
165
166/* Returns TRUE if there was an error, frees exception, sets err */
167gboolean gconf_handle_oaf_exception (CORBA_Environment* ev, GError** err);
168
169void gconf_nanosleep (gulong useconds);
170
171typedef struct _GConfLock GConfLock;
172
173GConfLock* gconf_get_lock     (const gchar  *lock_directory,
174                               GError      **err);
175gboolean   gconf_release_lock (GConfLock    *lock,
176                               GError      **err);
177
178
179
180
181GError*  gconf_error_new  (GConfError en,
182                           const gchar* format, ...) G_GNUC_PRINTF (2, 3);
183
184void     gconf_set_error  (GError** err,
185                           GConfError en,
186                           const gchar* format, ...) G_GNUC_PRINTF (3, 4);
187
188/* merge two errors into a single message */
189GError*  gconf_compose_errors (GError* err1, GError* err2);
190
191#ifdef ENABLE_NLS
192#    include <libintl.h>
193#    include <config.h>
194#    undef _
195#    define _(String) dgettext (GETTEXT_PACKAGE, String)
196#    ifdef gettext_noop
197#        define N_(String) gettext_noop (String)
198#    else
199#        define N_(String) (String)
200#    endif
201#else
202/* Stubs that do something close enough.  */
203#    define textdomain(String) (String)
204#    define bindtextdomain(Domain,Directory) (Domain)
205#    define _(String) (String)
206#    define N_(String) (String)
207#endif
208
209#endif /* GCONF_ENABLE_INTERNALS */
210
211#endif /* GCONF_GCONF_INTERNALS_H */
212
213
Note: See TracBrowser for help on using the repository browser.