summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hult <rhult@src.gnome.org>2003-11-24 13:31:11 +0000
committerRichard Hult <rhult@src.gnome.org>2003-11-24 13:31:11 +0000
commitb8bba414804972003e769048d22eb46e8ddd7324 (patch)
treee051215787dc892dc0f0f7c174d9d9d137823e0a
parent4b3c6b95ff9ddb3a7b60d4627d35915bbbdb8b55 (diff)
downloadgconf-b8bba414804972003e769048d22eb46e8ddd7324.tar.gz
Make it compile.
-rw-r--r--gconf/gconf-corba-utils.h4
-rw-r--r--gconf/gconf-corba.c839
-rw-r--r--gconf/gconf-corba.h311
-rw-r--r--gconf/gconf-dbus.c64
-rw-r--r--gconf/gconf.c69
-rw-r--r--gconf/gconfd-corba.c57
-rw-r--r--gconf/gconfd.c1
7 files changed, 76 insertions, 1269 deletions
diff --git a/gconf/gconf-corba-utils.h b/gconf/gconf-corba-utils.h
index cb0fa8aa..781ed981 100644
--- a/gconf/gconf-corba-utils.h
+++ b/gconf/gconf-corba-utils.h
@@ -31,7 +31,9 @@ ConfigValue* gconf_invalid_corba_value (void);
void gconf_daemon_blow_away_locks (void);
-CORBA_ORB gconf_orb_get (void);
+CORBA_ORB gconf_orb_get (void);
+
+int gconf_orb_release (void);
GConfLock* gconf_get_lock_or_current_holder (const gchar *lock_directory,
ConfigServer *current_server,
diff --git a/gconf/gconf-corba.c b/gconf/gconf-corba.c
index 3efab646..caa2ff63 100644
--- a/gconf/gconf-corba.c
+++ b/gconf/gconf-corba.c
@@ -20,6 +20,7 @@
#include <popt.h>
#include "GConfX.h"
#include "gconf.h"
+#include "gconf-corba-utils.h"
#include "gconf-internals.h"
#include "gconf-sources.h"
#include "gconf-locale.h"
@@ -43,29 +44,6 @@ static void gconf_detach_config_server(void);
/* Maximum number of times to try re-spawning the server if it's down. */
#define MAX_RETRIES 1
-gboolean
-gconf_key_check(const gchar* key, GError** err)
-{
- gchar* why = NULL;
-
- if (key == NULL)
- {
- if (err)
- *err = gconf_error_new (GCONF_ERROR_BAD_KEY,
- _("Key \"%s\" is NULL"),
- key);
- return FALSE;
- }
- else if (!gconf_valid_key (key, &why))
- {
- if (err)
- *err = gconf_error_new (GCONF_ERROR_BAD_KEY, _("\"%s\": %s"),
- key, why);
- g_free(why);
- return FALSE;
- }
- return TRUE;
-}
typedef struct _CnxnTable CnxnTable;
@@ -1996,29 +1974,6 @@ gconf_engine_remove_dir (GConfEngine* conf,
return;
}
-gboolean
-gconf_engine_key_is_writable (GConfEngine *conf,
- const gchar *key,
- GError **err)
-{
- gboolean is_writable = TRUE;
- GConfValue *val;
-
- CHECK_OWNER_USE (conf);
-
- /* FIXME implement IDL to allow getting only writability
- * (not that urgent since GConfClient caches this crap
- * anyway)
- */
-
- val = gconf_engine_get_full(conf, key, NULL, TRUE,
- NULL, &is_writable, err);
-
- gconf_value_free (val);
-
- return is_writable;
-}
-
/*
* Connection maintenance
*/
@@ -2391,330 +2346,7 @@ gconf_get_config_listener(void)
return listener;
}
-
-void
-gconf_preinit (gpointer app, gpointer mod_info)
-{
- /* Deprecated */
-}
-
-void
-gconf_postinit (gpointer app, gpointer mod_info)
-{
- /* Deprecated */
-}
-/* All deprecated */
-const char gconf_version[] = VERSION;
-
-struct poptOption gconf_options[] = {
- {NULL}
-};
-
-/* Also deprecated */
-gboolean
-gconf_init (int argc, char **argv, GError** err)
-{
-
- return TRUE;
-}
-
-gboolean
-gconf_is_initialized (void)
-{
- return TRUE;
-}
-
-/*
- * Ampersand and <> are not allowed due to the XML backend; shell
- * special characters aren't allowed; others are just in case we need
- * some magic characters someday. hyphen, underscore, period, colon
- * are allowed as separators. % disallowed to avoid printf confusion.
- */
-
-/* Key/dir validity is exactly the same, except that '/' must be a dir,
- but we are sort of ignoring that for now. */
-
-/* Also, keys can contain only ASCII */
-
-static const gchar invalid_chars[] = " \t\r\n\"$&<>,+=#!()'|{}[]?~`;%\\";
-
-gboolean
-gconf_valid_key (const gchar* key, gchar** why_invalid)
-{
- const gchar* s = key;
- gboolean just_saw_slash = FALSE;
-
- /* Key must start with the root */
- if (*key != '/')
- {
- if (why_invalid != NULL)
- *why_invalid = g_strdup(_("Must begin with a slash (/)"));
- return FALSE;
- }
-
- /* Root key is a valid dir */
- if (*key == '/' && key[1] == '\0')
- return TRUE;
-
- while (*s)
- {
- if (just_saw_slash)
- {
- /* Can't have two slashes in a row, since it would mean
- * an empty spot.
- * Can't have a period right after a slash,
- * because it would be a pain for filesystem-based backends.
- */
- if (*s == '/' || *s == '.')
- {
- if (why_invalid != NULL)
- {
- if (*s == '/')
- *why_invalid = g_strdup(_("Can't have two slashes (/) in a row"));
- else
- *why_invalid = g_strdup(_("Can't have a period (.) right after a slash (/)"));
- }
- return FALSE;
- }
- }
-
- if (*s == '/')
- {
- just_saw_slash = TRUE;
- }
- else
- {
- const gchar* inv = invalid_chars;
-
- just_saw_slash = FALSE;
-
- if (((unsigned char)*s) > 127)
- {
- if (why_invalid != NULL)
- *why_invalid = g_strdup_printf (_("'%c' is not an ASCII character, so isn't allowed in key names"),
- *s);
- return FALSE;
- }
-
- while (*inv)
- {
- if (*inv == *s)
- {
- if (why_invalid != NULL)
- *why_invalid = g_strdup_printf(_("`%c' is an invalid character in key/directory names"), *s);
- return FALSE;
- }
- ++inv;
- }
- }
-
- ++s;
- }
-
- /* Can't end with slash */
- if (just_saw_slash)
- {
- if (why_invalid != NULL)
- *why_invalid = g_strdup(_("Key/directory may not end with a slash (/)"));
- return FALSE;
- }
- else
- return TRUE;
-}
-
-/**
- * gconf_escape_key:
- * @arbitrary_text: some text in any encoding or format
- * @len: length of @arbitrary_text in bytes, or -1 if @arbitrary_text is nul-terminated
- *
- * Escape @arbitrary_text such that it's a valid key element (i.e. one
- * part of the key path). The escaped key won't pass gconf_valid_key()
- * because it isn't a whole key (i.e. it doesn't have a preceding
- * slash), but prepending a slash to the escaped text should always
- * result in a valid key.
- *
- * Return value: a nul-terminated valid GConf key
- **/
-char*
-gconf_escape_key (const char *arbitrary_text,
- int len)
-{
- const char *p;
- const char *end;
- GString *retval;
-
- g_return_val_if_fail (arbitrary_text != NULL, NULL);
-
- /* Nearly all characters we would normally use for escaping aren't allowed in key
- * names, so we use @ for that.
- *
- * Invalid chars and @ itself are escaped as @xxx@ where xxx is the
- * Latin-1 value in decimal
- */
-
- if (len < 0)
- len = strlen (arbitrary_text);
-
- retval = g_string_new (NULL);
-
- p = arbitrary_text;
- end = arbitrary_text + len;
- while (p != end)
- {
- if (*p == '/' || *p == '.' || *p == '@' || ((guchar) *p) > 127 ||
- strchr (invalid_chars, *p))
- {
- g_string_append_c (retval, '@');
- g_string_append_printf (retval, "%u", (unsigned int) *p);
- g_string_append_c (retval, '@');
- }
- else
- g_string_append_c (retval, *p);
-
- ++p;
- }
-
- return g_string_free (retval, FALSE);
-}
-
-/**
- * gconf_unescape_key:
- * @escaped_key: a key created with gconf_escape_key()
- * @len: length of @escaped_key in bytes, or -1 if @escaped_key is nul-terminated
- *
- * Converts a string escaped with gconf_escape_key() back into its original
- * form.
- *
- * Return value: the original string that was escaped to create @escaped_key
- **/
-char*
-gconf_unescape_key (const char *escaped_key,
- int len)
-{
- const char *p;
- const char *end;
- const char *start_seq;
- GString *retval;
-
- g_return_val_if_fail (escaped_key != NULL, NULL);
-
- if (len < 0)
- len = strlen (escaped_key);
-
- retval = g_string_new (NULL);
-
- p = escaped_key;
- end = escaped_key + len;
- start_seq = NULL;
- while (p != end)
- {
- if (start_seq)
- {
- if (*p == '@')
- {
- /* *p is the @ that ends a seq */
- char *end;
- guchar val;
-
- val = strtoul (start_seq, &end, 10);
- if (start_seq != end)
- g_string_append_c (retval, val);
-
- start_seq = NULL;
- }
- }
- else
- {
- if (*p == '@')
- start_seq = p + 1;
- else
- g_string_append_c (retval, *p);
- }
-
- ++p;
- }
-
- return g_string_free (retval, FALSE);
-}
-
-
-gboolean
-gconf_key_is_below (const gchar* above, const gchar* below)
-{
- int len;
-
- if (above[0] == '/' && above[1] == '\0')
- return TRUE;
-
- len = strlen (above);
- if (strncmp (below, above, len) == 0)
- {
- /* only if this is a complete key component,
- * so that /foo is not above /foofoo/bar */
- if (below[len] == '\0' || below[len] == '/')
- return TRUE;
- else
- return FALSE;
- }
- else
- return FALSE;
-}
-
-gchar*
-gconf_unique_key (void)
-{
- /* This function is hardly cryptographically random but should be
- "good enough" */
-
- static guint serial = 0;
- gchar* key;
- guint t, ut, p, u, r;
- struct timeval tv;
-
- gettimeofday(&tv, NULL);
-
- t = tv.tv_sec;
- ut = tv.tv_usec;
-
- p = getpid();
-
- u = getuid();
-
- /* don't bother to seed; if it's based on the time or any other
- changing info we can get, we may as well just use that changing
- info. since we don't seed we'll at least get a different number
- on every call to this function in the same executable. */
- r = rand();
-
- /* The letters may increase uniqueness by preventing "melds"
- i.e. 01t01k01 and 0101t0k1 are not the same */
- key = g_strdup_printf("%ut%uut%uu%up%ur%uk%u",
- /* Duplicate keys must be generated
- by two different program instances */
- serial,
- /* Duplicate keys must be generated
- in the same microsecond */
- t,
- ut,
- /* Duplicate keys must be generated by
- the same user */
- u,
- /* Duplicate keys must be generated by
- two programs that got the same PID */
- p,
- /* Duplicate keys must be generated with the
- same random seed and the same index into
- the series of pseudorandom values */
- r,
- /* Duplicate keys must result from running
- this function at the same stack location */
- GPOINTER_TO_UINT(&key));
-
- ++serial;
-
- return key;
-}
/*
* Table of connections
@@ -2921,434 +2553,6 @@ gconf_spawn_daemon(GError** err)
return TRUE;
}
-/*
- * Sugar functions
- */
-
-gdouble
-gconf_engine_get_float (GConfEngine* conf, const gchar* key,
- GError** err)
-{
- GConfValue* val;
- static const gdouble deflt = 0.0;
-
- g_return_val_if_fail(conf != NULL, 0.0);
- g_return_val_if_fail(key != NULL, 0.0);
-
- val = gconf_engine_get (conf, key, err);
-
- if (val == NULL)
- return deflt;
- else
- {
- gdouble retval;
-
- if (val->type != GCONF_VALUE_FLOAT)
- {
- if (err)
- *err = gconf_error_new(GCONF_ERROR_TYPE_MISMATCH, _("Expected float, got %s"),
- gconf_value_type_to_string(val->type));
- gconf_value_free(val);
- return deflt;
- }
-
- retval = gconf_value_get_float(val);
-
- gconf_value_free(val);
-
- return retval;
- }
-}
-
-gint
-gconf_engine_get_int (GConfEngine* conf, const gchar* key,
- GError** err)
-{
- GConfValue* val;
- static const gint deflt = 0;
-
- g_return_val_if_fail(conf != NULL, 0);
- g_return_val_if_fail(key != NULL, 0);
-
- val = gconf_engine_get (conf, key, err);
-
- if (val == NULL)
- return deflt;
- else
- {
- gint retval;
-
- if (val->type != GCONF_VALUE_INT)
- {
- if (err)
- *err = gconf_error_new(GCONF_ERROR_TYPE_MISMATCH, _("Expected int, got %s"),
- gconf_value_type_to_string(val->type));
- gconf_value_free(val);
- return deflt;
- }
-
- retval = gconf_value_get_int(val);
-
- gconf_value_free(val);
-
- return retval;
- }
-}
-
-gchar*
-gconf_engine_get_string(GConfEngine* conf, const gchar* key,
- GError** err)
-{
- GConfValue* val;
- static const gchar* deflt = NULL;
-
- g_return_val_if_fail(conf != NULL, NULL);
- g_return_val_if_fail(key != NULL, NULL);
-
- val = gconf_engine_get (conf, key, err);
-
- if (val == NULL)
- return deflt ? g_strdup(deflt) : NULL;
- else
- {
- gchar* retval;
-
- if (val->type != GCONF_VALUE_STRING)
- {
- if (err)
- *err = gconf_error_new(GCONF_ERROR_TYPE_MISMATCH, _("Expected string, got %s"),
- gconf_value_type_to_string(val->type));
- gconf_value_free(val);
- return deflt ? g_strdup(deflt) : NULL;
- }
-
- retval = gconf_value_steal_string (val);
- gconf_value_free (val);
-
- return retval;
- }
-}
-
-gboolean
-gconf_engine_get_bool (GConfEngine* conf, const gchar* key,
- GError** err)
-{
- GConfValue* val;
- static const gboolean deflt = FALSE;
-
- g_return_val_if_fail(conf != NULL, FALSE);
- g_return_val_if_fail(key != NULL, FALSE);
-
- val = gconf_engine_get (conf, key, err);
-
- if (val == NULL)
- return deflt;
- else
- {
- gboolean retval;
-
- if (val->type != GCONF_VALUE_BOOL)
- {
- if (err)
- *err = gconf_error_new(GCONF_ERROR_TYPE_MISMATCH, _("Expected bool, got %s"),
- gconf_value_type_to_string(val->type));
- gconf_value_free(val);
- return deflt;
- }
-
- retval = gconf_value_get_bool(val);
-
- gconf_value_free(val);
-
- return retval;
- }
-}
-
-GConfSchema*
-gconf_engine_get_schema (GConfEngine* conf, const gchar* key, GError** err)
-{
- GConfValue* val;
-
- g_return_val_if_fail(conf != NULL, NULL);
- g_return_val_if_fail(key != NULL, NULL);
-
- val = gconf_engine_get_with_locale(conf, key, gconf_current_locale(), err);
-
- if (val == NULL)
- return NULL;
- else
- {
- GConfSchema* retval;
-
- if (val->type != GCONF_VALUE_SCHEMA)
- {
- if (err)
- *err = gconf_error_new(GCONF_ERROR_TYPE_MISMATCH, _("Expected schema, got %s"),
- gconf_value_type_to_string(val->type));
- gconf_value_free(val);
- return NULL;
- }
-
- retval = gconf_value_steal_schema (val);
- gconf_value_free (val);
-
- return retval;
- }
-}
-
-GSList*
-gconf_engine_get_list (GConfEngine* conf, const gchar* key,
- GConfValueType list_type, GError** err)
-{
- GConfValue* val;
-
- g_return_val_if_fail(conf != NULL, NULL);
- g_return_val_if_fail(key != NULL, NULL);
- g_return_val_if_fail(list_type != GCONF_VALUE_INVALID, NULL);
- g_return_val_if_fail(list_type != GCONF_VALUE_LIST, NULL);
- g_return_val_if_fail(list_type != GCONF_VALUE_PAIR, NULL);
- g_return_val_if_fail(err == NULL || *err == NULL, NULL);
-
- val = gconf_engine_get_with_locale(conf, key, gconf_current_locale(), err);
-
- if (val == NULL)
- return NULL;
- else
- {
- /* This type-checks the value */
- return gconf_value_list_to_primitive_list_destructive(val, list_type, err);
- }
-}
-
-gboolean
-gconf_engine_get_pair (GConfEngine* conf, const gchar* key,
- GConfValueType car_type, GConfValueType cdr_type,
- gpointer car_retloc, gpointer cdr_retloc,
- GError** err)
-{
- GConfValue* val;
- GError* error = NULL;
-
- g_return_val_if_fail(conf != NULL, FALSE);
- g_return_val_if_fail(key != NULL, FALSE);
- g_return_val_if_fail(car_type != GCONF_VALUE_INVALID, FALSE);
- g_return_val_if_fail(car_type != GCONF_VALUE_LIST, FALSE);
- g_return_val_if_fail(car_type != GCONF_VALUE_PAIR, FALSE);
- g_return_val_if_fail(cdr_type != GCONF_VALUE_INVALID, FALSE);
- g_return_val_if_fail(cdr_type != GCONF_VALUE_LIST, FALSE);
- g_return_val_if_fail(cdr_type != GCONF_VALUE_PAIR, FALSE);
- g_return_val_if_fail(car_retloc != NULL, FALSE);
- g_return_val_if_fail(cdr_retloc != NULL, FALSE);
- g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
-
- val = gconf_engine_get_with_locale(conf, key, gconf_current_locale(), &error);
-
- if (error != NULL)
- {
- g_assert(val == NULL);
-
- if (err)
- *err = error;
- else
- g_error_free(error);
-
- return FALSE;
- }
-
- if (val == NULL)
- {
- return TRUE;
- }
- else
- {
- /* Destroys val */
- return gconf_value_pair_to_primitive_pair_destructive(val,
- car_type, cdr_type,
- car_retloc, cdr_retloc,
- err);
- }
-}
-
-/*
- * Setters
- */
-
-static gboolean
-error_checked_set(GConfEngine* conf, const gchar* key,
- GConfValue* gval, GError** err)
-{
- GError* my_err = NULL;
-
- gconf_engine_set (conf, key, gval, &my_err);
-
- gconf_value_free(gval);
-
- if (my_err != NULL)
- {
- if (err)
- *err = my_err;
- else
- g_error_free(my_err);
- return FALSE;
- }
- else
- return TRUE;
-}
-
-gboolean
-gconf_engine_set_float (GConfEngine* conf, const gchar* key,
- gdouble val, GError** err)
-{
- GConfValue* gval;
-
- g_return_val_if_fail(conf != NULL, FALSE);
- g_return_val_if_fail(key != NULL, FALSE);
- g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
-
- gval = gconf_value_new(GCONF_VALUE_FLOAT);
-
- gconf_value_set_float(gval, val);
-
- return error_checked_set(conf, key, gval, err);
-}
-
-gboolean
-gconf_engine_set_int (GConfEngine* conf, const gchar* key,
- gint val, GError** err)
-{
- GConfValue* gval;
-
- g_return_val_if_fail(conf != NULL, FALSE);
- g_return_val_if_fail(key != NULL, FALSE);
- g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
-
- gval = gconf_value_new(GCONF_VALUE_INT);
-
- gconf_value_set_int(gval, val);
-
- return error_checked_set(conf, key, gval, err);
-}
-
-gboolean
-gconf_engine_set_string (GConfEngine* conf, const gchar* key,
- const gchar* val, GError** err)
-{
- GConfValue* gval;
-
- g_return_val_if_fail (val != NULL, FALSE);
- g_return_val_if_fail (conf != NULL, FALSE);
- g_return_val_if_fail (key != NULL, FALSE);
- g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
-
- g_return_val_if_fail (g_utf8_validate (val, -1, NULL), FALSE);
-
- gval = gconf_value_new(GCONF_VALUE_STRING);
-
- gconf_value_set_string(gval, val);
-
- return error_checked_set(conf, key, gval, err);
-}
-
-gboolean
-gconf_engine_set_bool (GConfEngine* conf, const gchar* key,
- gboolean val, GError** err)
-{
- GConfValue* gval;
-
- g_return_val_if_fail(conf != NULL, FALSE);
- g_return_val_if_fail(key != NULL, FALSE);
- g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
-
- gval = gconf_value_new(GCONF_VALUE_BOOL);
-
- gconf_value_set_bool(gval, !!val); /* canonicalize the bool */
-
- return error_checked_set(conf, key, gval, err);
-}
-
-gboolean
-gconf_engine_set_schema (GConfEngine* conf, const gchar* key,
- const GConfSchema* val, GError** err)
-{
- GConfValue* gval;
-
- g_return_val_if_fail(conf != NULL, FALSE);
- g_return_val_if_fail(key != NULL, FALSE);
- g_return_val_if_fail(val != NULL, FALSE);
- g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
-
- gval = gconf_value_new(GCONF_VALUE_SCHEMA);
-
- gconf_value_set_schema(gval, val);
-
- return error_checked_set(conf, key, gval, err);
-}
-
-gboolean
-gconf_engine_set_list (GConfEngine* conf, const gchar* key,
- GConfValueType list_type,
- GSList* list,
- GError** err)
-{
- GConfValue* value_list;
- GError *tmp_err = NULL;
-
- g_return_val_if_fail(conf != NULL, FALSE);
- g_return_val_if_fail(key != NULL, FALSE);
- g_return_val_if_fail(list_type != GCONF_VALUE_INVALID, FALSE);
- g_return_val_if_fail(list_type != GCONF_VALUE_LIST, FALSE);
- g_return_val_if_fail(list_type != GCONF_VALUE_PAIR, FALSE);
- g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
-
- value_list = gconf_value_list_from_primitive_list(list_type, list, &tmp_err);
-
- if (tmp_err)
- {
- g_propagate_error (err, tmp_err);
- return FALSE;
- }
-
- /* destroys the value_list */
-
- return error_checked_set(conf, key, value_list, err);
-}
-
-gboolean
-gconf_engine_set_pair (GConfEngine* conf, const gchar* key,
- GConfValueType car_type, GConfValueType cdr_type,
- gconstpointer address_of_car,
- gconstpointer address_of_cdr,
- GError** err)
-{
- GConfValue* pair;
- GError *tmp_err = NULL;
-
- g_return_val_if_fail(conf != NULL, FALSE);
- g_return_val_if_fail(key != NULL, FALSE);
- g_return_val_if_fail(car_type != GCONF_VALUE_INVALID, FALSE);
- g_return_val_if_fail(car_type != GCONF_VALUE_LIST, FALSE);
- g_return_val_if_fail(car_type != GCONF_VALUE_PAIR, FALSE);
- g_return_val_if_fail(cdr_type != GCONF_VALUE_INVALID, FALSE);
- g_return_val_if_fail(cdr_type != GCONF_VALUE_LIST, FALSE);
- g_return_val_if_fail(cdr_type != GCONF_VALUE_PAIR, FALSE);
- g_return_val_if_fail(address_of_car != NULL, FALSE);
- g_return_val_if_fail(address_of_cdr != NULL, FALSE);
- g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
-
-
- pair = gconf_value_pair_from_primitive_pair(car_type, cdr_type,
- address_of_car, address_of_cdr,
- &tmp_err);
-
- if (tmp_err)
- {
- g_propagate_error (err, tmp_err);
- return FALSE;
- }
-
- return error_checked_set(conf, key, pair, err);
-}
-
/* CORBA Util */
/* Set GConfError from an exception, free exception, etc. */
@@ -3465,44 +2669,3 @@ gconf_handle_corba_exception(CORBA_Environment* ev, GError** err)
}
}
-/*
- * Enumeration conversions
- */
-
-gboolean
-gconf_string_to_enum (GConfEnumStringPair lookup_table[],
- const gchar* str,
- gint* enum_value_retloc)
-{
- int i = 0;
-
- while (lookup_table[i].str != NULL)
- {
- if (g_ascii_strcasecmp (lookup_table[i].str, str) == 0)
- {
- *enum_value_retloc = lookup_table[i].enum_value;
- return TRUE;
- }
-
- ++i;
- }
-
- return FALSE;
-}
-
-const gchar*
-gconf_enum_to_string (GConfEnumStringPair lookup_table[],
- gint enum_value)
-{
- int i = 0;
-
- while (lookup_table[i].str != NULL)
- {
- if (lookup_table[i].enum_value == enum_value)
- return lookup_table[i].str;
-
- ++i;
- }
-
- return NULL;
-}
diff --git a/gconf/gconf-corba.h b/gconf/gconf-corba.h
index b16c8efd..9fc869bc 100644
--- a/gconf/gconf-corba.h
+++ b/gconf/gconf-corba.h
@@ -1,311 +1,4 @@
-/* GConf
- * Copyright (C) 1999, 2000 Red Hat Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
+/* FIXME: remove this file */
-#ifndef GCONF_GCONF_CORBA_H
-#define GCONF_GCONF_CORBA_H
+#error "Dont include this"
-#include <glib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#include <gconf/gconf-schema.h>
-#include <gconf/gconf-engine.h>
-#include <gconf/gconf-error.h>
-#include <gconf/gconf-enum-types.h>
-
-typedef void (*GConfNotifyFunc) (GConfEngine* conf,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data);
-
-/* Returns ID of the notification */
-/* returns 0 on error, 0 is an invalid ID */
-guint gconf_engine_notify_add (GConfEngine *conf,
- /* dir or key to listen to */
- const gchar *namespace_section,
- GConfNotifyFunc func,
- gpointer user_data,
- GError **err);
-
-void gconf_engine_notify_remove (GConfEngine *conf,
- guint cnxn);
-
-
-
-/* Low-level interfaces */
-GConfValue* gconf_engine_get (GConfEngine *conf,
- const gchar *key,
- GError **err);
-
-GConfValue* gconf_engine_get_without_default (GConfEngine *conf,
- const gchar *key,
- GError **err);
-
-GConfEntry* gconf_engine_get_entry (GConfEngine *conf,
- const gchar *key,
- const gchar *locale,
- gboolean use_schema_default,
- GError **err);
-
-
-/* Locale only matters if you are expecting to get a schema, or if you
- don't know what you are expecting and it might be a schema. Note
- that gconf_engine_get () automatically uses the current locale, which is
- normally what you want. */
-GConfValue* gconf_engine_get_with_locale (GConfEngine *conf,
- const gchar *key,
- const gchar *locale,
- GError **err);
-
-
-/* Get the default value stored in the schema associated with this key */
-GConfValue* gconf_engine_get_default_from_schema (GConfEngine *conf,
- const gchar *key,
- GError **err);
-gboolean gconf_engine_set (GConfEngine *conf,
- const gchar *key,
- const GConfValue *value,
- GError **err);
-gboolean gconf_engine_unset (GConfEngine *conf,
- const gchar *key,
- GError **err);
-
-
-/*
- * schema_key should have a schema (if key stores a value) or a dir
- * full of schemas (if key stores a directory name)
- */
-
-gboolean gconf_engine_associate_schema (GConfEngine *conf,
- const gchar *key,
- const gchar *schema_key,
- GError **err);
-GSList* gconf_engine_all_entries (GConfEngine *conf,
- const gchar *dir,
- GError **err);
-GSList* gconf_engine_all_dirs (GConfEngine *conf,
- const gchar *dir,
- GError **err);
-void gconf_engine_suggest_sync (GConfEngine *conf,
- GError **err);
-gboolean gconf_engine_dir_exists (GConfEngine *conf,
- const gchar *dir,
- GError **err);
-void gconf_engine_remove_dir (GConfEngine* conf,
- const gchar* dir,
- GError** err);
-
-gboolean gconf_engine_key_is_writable (GConfEngine *conf,
- const gchar *key,
- GError **err);
-
-/* if you pass non-NULL for why_invalid, it gives a user-readable
- explanation of the problem in g_malloc()'d memory
-*/
-gboolean gconf_valid_key (const gchar *key,
- gchar **why_invalid);
-
-
-/* return TRUE if the path "below" would be somewhere below the directory "above" */
-gboolean gconf_key_is_below (const gchar *above,
- const gchar *below);
-
-
-/* Returns allocated concatenation of these two */
-gchar* gconf_concat_dir_and_key (const gchar *dir,
- const gchar *key);
-
-
-/* Returns a different string every time (at least, the chances of
- getting a duplicate are like one in a zillion). The key is a
- legal gconf key name (a single element of one) */
-gchar* gconf_unique_key (void);
-
-/* Escape/unescape a string to create a valid key */
-char* gconf_escape_key (const char *arbitrary_text,
- int len);
-char* gconf_unescape_key (const char *escaped_key,
- int len);
-
-
-/*
- * Higher-level stuff
- */
-
-
-gdouble gconf_engine_get_float (GConfEngine *conf,
- const gchar *key,
- GError **err);
-gint gconf_engine_get_int (GConfEngine *conf,
- const gchar *key,
- GError **err);
-
-
-/* free the retval, retval can be NULL for "unset" */
-gchar* gconf_engine_get_string (GConfEngine *conf,
- const gchar *key,
- GError **err);
-gboolean gconf_engine_get_bool (GConfEngine *conf,
- const gchar *key,
- GError **err);
-
-
-/* this one has no default since it would be expensive and make little
- sense; it returns NULL as a default, to indicate unset or error */
-/* free the retval */
-/* Note that this returns the schema stored at key, NOT
- the schema associated with the key. */
-GConfSchema* gconf_engine_get_schema (GConfEngine *conf,
- const gchar *key,
- GError **err);
-
-
-/*
- This automatically converts the list to the given list type;
- a list of int or bool stores values in the list->data field
- using GPOINTER_TO_INT(), a list of strings stores the gchar*
- in list->data, a list of float contains pointers to allocated
- gdouble (gotta love C!).
-*/
-GSList* gconf_engine_get_list (GConfEngine *conf,
- const gchar *key,
- GConfValueType list_type,
- GError **err);
-
-/*
- The car_retloc and cdr_retloc args should be the address of the appropriate
- type:
- bool gboolean*
- int gint*
- string gchar**
- float gdouble*
- schema GConfSchema**
-*/
-gboolean gconf_engine_get_pair (GConfEngine *conf,
- const gchar *key,
- GConfValueType car_type,
- GConfValueType cdr_type,
- gpointer car_retloc,
- gpointer cdr_retloc,
- GError **err);
-
-
-/* setters return TRUE on success; note that you still should suggest a sync */
-gboolean gconf_engine_set_float (GConfEngine *conf,
- const gchar *key,
- gdouble val,
- GError **err);
-gboolean gconf_engine_set_int (GConfEngine *conf,
- const gchar *key,
- gint val,
- GError **err);
-gboolean gconf_engine_set_string (GConfEngine *conf,
- const gchar *key,
- const gchar *val,
- GError **err);
-gboolean gconf_engine_set_bool (GConfEngine *conf,
- const gchar *key,
- gboolean val,
- GError **err);
-gboolean gconf_engine_set_schema (GConfEngine *conf,
- const gchar *key,
- const GConfSchema *val,
- GError **err);
-
-
-/* List should be the same as the one gconf_engine_get_list() would return */
-gboolean gconf_engine_set_list (GConfEngine *conf,
- const gchar *key,
- GConfValueType list_type,
- GSList *list,
- GError **err);
-gboolean gconf_engine_set_pair (GConfEngine *conf,
- const gchar *key,
- GConfValueType car_type,
- GConfValueType cdr_type,
- gconstpointer address_of_car,
- gconstpointer address_of_cdr,
- GError **err);
-
-
-/* Utility function converts enumerations to and from strings */
-typedef struct _GConfEnumStringPair GConfEnumStringPair;
-
-struct _GConfEnumStringPair {
- gint enum_value;
- const gchar* str;
-};
-
-gboolean gconf_string_to_enum (GConfEnumStringPair lookup_table[],
- const gchar *str,
- gint *enum_value_retloc);
-const gchar* gconf_enum_to_string (GConfEnumStringPair lookup_table[],
- gint enum_value);
-
-int gconf_debug_shutdown (void);
-
-#ifndef GCONF_DISABLE_DEPRECATED
-gboolean gconf_init (int argc, char **argv, GError** err);
-gboolean gconf_is_initialized (void);
-#endif /* GCONF_DISABLE_DEPRECATED */
-
-/* No, you can't use this stuff. Bad application developer. Bad. */
-#ifdef GCONF_ENABLE_INTERNALS
-
-/* This stuff is only useful in GNOME 2.0, so isn't in this GConf
- * release.
- */
-
-#ifndef GCONF_DISABLE_DEPRECATED
-/* For use by the Gnome module system */
-void gconf_preinit(gpointer app, gpointer mod_info);
-void gconf_postinit(gpointer app, gpointer mod_info);
-
-extern const char gconf_version[];
-
-#ifdef HAVE_POPT_H
-#include <popt.h>
-#endif
-
-#ifdef POPT_AUTOHELP
-/* If people are using popt, then make the table available to them */
-extern struct poptOption gconf_options[];
-#endif
-#endif /* GCONF_DISABLE_DEPRECATED */
-
-void gconf_clear_cache(GConfEngine* conf, GError** err);
-void gconf_synchronous_sync(GConfEngine* conf, GError** err);
-
-GConfValue * gconf_engine_get_full (GConfEngine *conf,
- const gchar *key,
- const gchar *locale,
- gboolean use_schema_default,
- gboolean *is_default_p,
- gboolean *is_writable_p,
- GError **err);
-
-#endif /* GCONF_ENABLE_INTERNALS */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
diff --git a/gconf/gconf-dbus.c b/gconf/gconf-dbus.c
index 0a282e6d..a42c1221 100644
--- a/gconf/gconf-dbus.c
+++ b/gconf/gconf-dbus.c
@@ -2069,29 +2069,6 @@ gconf_engine_remove_dir (GConfEngine* conf,
return;
}
-gboolean
-gconf_engine_key_is_writable (GConfEngine *conf,
- const gchar *key,
- GError **err)
-{
- gboolean is_writable = TRUE;
- GConfValue *val;
-
- CHECK_OWNER_USE (conf);
-
- /* FIXME implement IDL to allow getting only writability
- * (not that urgent since GConfClient caches this crap
- * anyway)
- */
-
- val = gconf_engine_get_full(conf, key, NULL, TRUE,
- NULL, &is_writable, err);
-
- gconf_value_free (val);
-
- return is_writable;
-}
-
/*
* Connection maintenance
*/
@@ -2578,44 +2555,3 @@ gconf_server_broken(CORBA_Environment* ev)
}
}
-/*
- * Enumeration conversions
- */
-
-gboolean
-gconf_string_to_enum (GConfEnumStringPair lookup_table[],
- const gchar* str,
- gint* enum_value_retloc)
-{
- int i = 0;
-
- while (lookup_table[i].str != NULL)
- {
- if (g_ascii_strcasecmp (lookup_table[i].str, str) == 0)
- {
- *enum_value_retloc = lookup_table[i].enum_value;
- return TRUE;
- }
-
- ++i;
- }
-
- return FALSE;
-}
-
-const gchar*
-gconf_enum_to_string (GConfEnumStringPair lookup_table[],
- gint enum_value)
-{
- int i = 0;
-
- while (lookup_table[i].str != NULL)
- {
- if (lookup_table[i].enum_value == enum_value)
- return lookup_table[i].str;
-
- ++i;
- }
-
- return NULL;
-}
diff --git a/gconf/gconf.c b/gconf/gconf.c
index e9d9ab8d..2be8e7c8 100644
--- a/gconf/gconf.c
+++ b/gconf/gconf.c
@@ -31,6 +31,9 @@
#include <sys/time.h>
#include <unistd.h>
+/* FIXME: get this working again */
+#define CHECK_OWNER_USE(engine)
+
gboolean
gconf_key_check (const gchar* key, GError** err)
@@ -807,3 +810,69 @@ gconf_engine_set_pair (GConfEngine* conf, const gchar* key,
return error_checked_set(conf, key, pair, err);
}
+
+gboolean
+gconf_engine_key_is_writable (GConfEngine *conf,
+ const gchar *key,
+ GError **err)
+{
+ gboolean is_writable = TRUE;
+ GConfValue *val;
+
+ CHECK_OWNER_USE (conf);
+
+ /* FIXME implement IDL to allow getting only writability
+ * (not that urgent since GConfClient caches this crap
+ * anyway)
+ */
+
+ val = gconf_engine_get_full(conf, key, NULL, TRUE,
+ NULL, &is_writable, err);
+
+ gconf_value_free (val);
+
+ return is_writable;
+}
+
+
+/*
+ * Enumeration conversions
+ */
+
+gboolean
+gconf_string_to_enum (GConfEnumStringPair lookup_table[],
+ const gchar* str,
+ gint* enum_value_retloc)
+{
+ int i = 0;
+
+ while (lookup_table[i].str != NULL)
+ {
+ if (g_ascii_strcasecmp (lookup_table[i].str, str) == 0)
+ {
+ *enum_value_retloc = lookup_table[i].enum_value;
+ return TRUE;
+ }
+
+ ++i;
+ }
+
+ return FALSE;
+}
+
+const gchar*
+gconf_enum_to_string (GConfEnumStringPair lookup_table[],
+ gint enum_value)
+{
+ int i = 0;
+
+ while (lookup_table[i].str != NULL)
+ {
+ if (lookup_table[i].enum_value == enum_value)
+ return lookup_table[i].str;
+
+ ++i;
+ }
+
+ return NULL;
+}
diff --git a/gconf/gconfd-corba.c b/gconf/gconfd-corba.c
index a4db8519..e24fe7d2 100644
--- a/gconf/gconfd-corba.c
+++ b/gconf/gconfd-corba.c
@@ -1529,35 +1529,6 @@ gconfd_corba_check_in_shutdown (CORBA_Environment *ev)
return FALSE;
}
-gboolean
-gconf_CORBA_Object_equal (gconstpointer a, gconstpointer b)
-{
- CORBA_Environment ev;
- CORBA_Object _obj_a = (gpointer)a;
- CORBA_Object _obj_b = (gpointer)b;
- gboolean retval;
-
- CORBA_exception_init (&ev);
- retval = CORBA_Object_is_equivalent(_obj_a, _obj_b, &ev);
- CORBA_exception_free (&ev);
-
- return retval;
-}
-
-guint
-gconf_CORBA_Object_hash (gconstpointer key)
-{
- CORBA_Environment ev;
- CORBA_Object _obj = (gpointer)key;
- CORBA_unsigned_long retval;
-
- CORBA_exception_init (&ev);
- retval = CORBA_Object_hash(_obj, G_MAXUINT, &ev);
- CORBA_exception_free (&ev);
-
- return retval;
-}
-
GConfValue*
gconf_value_from_corba_value(const ConfigValue* value)
{
@@ -1846,34 +1817,6 @@ gconf_invalid_corba_value ()
return cv;
}
-gchar*
-gconf_object_to_string (CORBA_Object obj,
- GError **err)
-{
- CORBA_Environment ev;
- gchar *ior;
- gchar *retval;
-
- CORBA_exception_init (&ev);
-
- ior = CORBA_ORB_object_to_string (gconf_orb_get (), obj, &ev);
-
- if (ior == NULL)
- {
- gconf_set_error (err,
- GCONF_ERROR_FAILED,
- _("Failed to convert object to IOR"));
-
- return NULL;
- }
-
- retval = g_strdup (ior);
-
- CORBA_free (ior);
-
- return retval;
-}
-
static ConfigValueType
corba_type_from_gconf_type(GConfValueType type)
{
diff --git a/gconf/gconfd.c b/gconf/gconfd.c
index b4ed8ed4..bb4cf827 100644
--- a/gconf/gconfd.c
+++ b/gconf/gconfd.c
@@ -39,6 +39,7 @@
#ifdef HAVE_ORBIT
#include "gconfd-corba.h"
#include "gconf-database-corba.h"
+#include "gconf-corba-utils.h"
#endif
#ifdef HAVE_DBUS