diff options
author | Havoc Pennington <hp@pobox.com> | 2002-04-27 15:25:14 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2002-04-27 15:25:14 +0000 |
commit | 8753c2dae812a4006ef2935e0faaed96d5d00cee (patch) | |
tree | 0f0b45f1a3d7a08ce5723589808420267c7f4292 | |
parent | b50855d390b0556c99b546be680fafe6f89eebd4 (diff) | |
download | gconf-8753c2dae812a4006ef2935e0faaed96d5d00cee.tar.gz |
make the internal functions static
2002-04-26 Havoc Pennington <hp@pobox.com>
* gconf/gconf-changeset.c: make the internal functions static
* gconf/gconf-internals.c (byte_type): make static
(get_hostname): remove
* gconf/gconfd.c (add_client): set the maximum connection buffer
to a reasonable-size value in order to handle locked-up clients.
* backends/xml-entry.c (node_set_schema_value): opacity fixes
* gconf/gconftool.c (list_pairs_in_dir): opacity fixes
* gconf/gconf.c: opacity fixes
(gconf_engine_get_for_address): remove the g_warning about using
this function; the change notification is a bit broken but maybe
it's still useful.
* gconf/gconf-sources.c: opacity fixes
* gconf/gconf-database.c: namespace fixes
* gconf/gconf-internals.h: namespace some things
* gconf/gconf-internals.c: opacity fixes
(fill_corba_schema_from_gconf_schema):
make static
(corba_schema_from_gconf_schema): make static
* gconf/gconf-schema.c: do groundwork to make GConfSchema opaque,
and fix some lack of spaces before parens
* gconf/gconf-value.c: do groundwork to make GConfEntry mostly
opaque (implement with GConfRealEntry)
-rw-r--r-- | ChangeLog | 38 | ||||
-rw-r--r-- | backends/xml-entry.c | 30 | ||||
-rw-r--r-- | doc/gconf/tmpl/gconf-internals.sgml | 44 | ||||
-rw-r--r-- | doc/gconf/tmpl/gconf-schema.sgml | 2 | ||||
-rw-r--r-- | doc/gconf/tmpl/gconf-unused.sgml | 39 | ||||
-rw-r--r-- | doc/gconf/tmpl/gconf-value.sgml | 1 | ||||
-rw-r--r-- | examples/basic-gconf-app.c | 6 | ||||
-rw-r--r-- | examples/simple-view.c | 6 | ||||
-rw-r--r-- | gconf/gconf-changeset.c | 8 | ||||
-rw-r--r-- | gconf/gconf-client.c | 2 | ||||
-rw-r--r-- | gconf/gconf-database.c | 36 | ||||
-rw-r--r-- | gconf/gconf-internals.c | 99 | ||||
-rw-r--r-- | gconf/gconf-internals.h | 22 | ||||
-rw-r--r-- | gconf/gconf-schema.c | 210 | ||||
-rw-r--r-- | gconf/gconf-schema.h | 16 | ||||
-rw-r--r-- | gconf/gconf-sources.c | 48 | ||||
-rw-r--r-- | gconf/gconf-value.c | 136 | ||||
-rw-r--r-- | gconf/gconf-value.h | 27 | ||||
-rw-r--r-- | gconf/gconf.c | 25 | ||||
-rw-r--r-- | gconf/gconfd.c | 9 | ||||
-rw-r--r-- | gconf/gconftool.c | 6 |
21 files changed, 426 insertions, 384 deletions
@@ -1,10 +1,46 @@ +2002-04-26 Havoc Pennington <hp@pobox.com> + + * gconf/gconf-changeset.c: make the internal functions static + + * gconf/gconf-internals.c (byte_type): make static + (get_hostname): remove + + * gconf/gconfd.c (add_client): set the maximum connection buffer + to a reasonable-size value in order to handle locked-up clients. + + * backends/xml-entry.c (node_set_schema_value): opacity fixes + + * gconf/gconftool.c (list_pairs_in_dir): opacity fixes + + * gconf/gconf.c: opacity fixes + (gconf_engine_get_for_address): remove the g_warning about using + this function; the change notification is a bit broken but maybe + it's still useful. + + * gconf/gconf-sources.c: opacity fixes + + * gconf/gconf-database.c: namespace fixes + + * gconf/gconf-internals.h: namespace some things + + * gconf/gconf-internals.c: opacity fixes + (fill_corba_schema_from_gconf_schema): + make static + (corba_schema_from_gconf_schema): make static + + * gconf/gconf-schema.c: do groundwork to make GConfSchema opaque, + and fix some lack of spaces before parens + + * gconf/gconf-value.c: do groundwork to make GConfEntry mostly + opaque (implement with GConfRealEntry) + 2002-04-19 Abel Cheung <maddog@linux.org.hk> * configure.in: Added "zh_TW" to ALL_LINGUAS. 2002-04-10 jacob berkman <jacob@ximian.com> - * backends/xml-dir.c (my_xml_parse_file): g_File_get_contents() + * backends/xml-dir.c (my_xml_parse_file): g_file_get_contents() takes gsize, not int 2002-03-29 Havoc Pennington <hp@pobox.com> diff --git a/backends/xml-entry.c b/backends/xml-entry.c index b5fd9e54..946e554a 100644 --- a/backends/xml-entry.c +++ b/backends/xml-entry.c @@ -445,24 +445,24 @@ node_set_schema_value(xmlNodePtr node, const gchar* type; xmlNodePtr found = NULL; - sc = gconf_value_get_schema(value); + sc = gconf_value_get_schema (value); /* Set the types */ - if (sc->list_type != GCONF_VALUE_INVALID) + if (gconf_schema_get_list_type (sc) != GCONF_VALUE_INVALID) { - type = gconf_value_type_to_string(sc->list_type); + type = gconf_value_type_to_string(gconf_schema_get_list_type (sc)); g_assert(type != NULL); my_xmlSetProp(node, "list_type", type); } - if (sc->car_type != GCONF_VALUE_INVALID) + if (gconf_schema_get_car_type (sc) != GCONF_VALUE_INVALID) { - type = gconf_value_type_to_string(sc->car_type); + type = gconf_value_type_to_string(gconf_schema_get_car_type (sc)); g_assert(type != NULL); my_xmlSetProp(node, "car_type", type); } - if (sc->cdr_type != GCONF_VALUE_INVALID) + if (gconf_schema_get_cdr_type (sc) != GCONF_VALUE_INVALID) { - type = gconf_value_type_to_string(sc->cdr_type); + type = gconf_value_type_to_string(gconf_schema_get_cdr_type (sc)); g_assert(type != NULL); my_xmlSetProp(node, "cdr_type", type); } @@ -471,8 +471,8 @@ node_set_schema_value(xmlNodePtr node, my_xmlSetProp(node, "value", NULL); /* set the cross-locale attributes */ - my_xmlSetProp(node, "stype", gconf_value_type_to_string(sc->type)); - my_xmlSetProp(node, "owner", sc->owner); + my_xmlSetProp(node, "stype", gconf_value_type_to_string(gconf_schema_get_type (sc))); + my_xmlSetProp(node, "owner", gconf_schema_get_owner (sc)); locale = gconf_schema_get_locale(sc); @@ -487,23 +487,23 @@ node_set_schema_value(xmlNodePtr node, found = xmlNewChild(node, NULL, "local_schema", NULL); /* OK if these are set to NULL, since that unsets the property */ - my_xmlSetProp(found, "locale", sc->locale); - my_xmlSetProp(found, "short_desc", sc->short_desc); + my_xmlSetProp(found, "locale", gconf_schema_get_locale (sc)); + my_xmlSetProp(found, "short_desc", gconf_schema_get_short_desc (sc)); free_childs(found); - if (sc->default_value != NULL) + if (gconf_schema_get_default_value (sc) != NULL) { xmlNodePtr default_value_node; default_value_node = xmlNewChild(found, NULL, "default", NULL); - node_set_value(default_value_node, sc->default_value); + node_set_value(default_value_node, gconf_schema_get_default_value (sc)); } - if (sc->long_desc) + if (gconf_schema_get_long_desc (sc)) { xmlNodePtr ld_node; - ld_node = xmlNewChild(found, NULL, "longdesc", sc->long_desc); + ld_node = xmlNewChild(found, NULL, "longdesc", gconf_schema_get_long_desc (sc)); } } diff --git a/doc/gconf/tmpl/gconf-internals.sgml b/doc/gconf/tmpl/gconf-internals.sgml index be6d8b07..9189b2a7 100644 --- a/doc/gconf/tmpl/gconf-internals.sgml +++ b/doc/gconf/tmpl/gconf-internals.sgml @@ -60,50 +60,6 @@ gconf-internals @Returns: -<!-- ##### FUNCTION corba_value_from_gconf_value ##### --> -<para> - -</para> - -@value: -@Returns: - - -<!-- ##### FUNCTION fill_corba_value_from_gconf_value ##### --> -<para> - -</para> - -@value: -@dest: - - -<!-- ##### FUNCTION invalid_corba_value ##### --> -<para> - -</para> - -@Returns: - - -<!-- ##### FUNCTION fill_corba_schema_from_gconf_schema ##### --> -<para> - -</para> - -@sc: -@dest: - - -<!-- ##### FUNCTION corba_schema_from_gconf_schema ##### --> -<para> - -</para> - -@sc: -@Returns: - - <!-- ##### FUNCTION gconf_schema_from_corba_schema ##### --> <para> diff --git a/doc/gconf/tmpl/gconf-schema.sgml b/doc/gconf/tmpl/gconf-schema.sgml index ffafd863..afc52334 100644 --- a/doc/gconf/tmpl/gconf-schema.sgml +++ b/doc/gconf/tmpl/gconf-schema.sgml @@ -19,7 +19,7 @@ gconf-schema </para> -@type: +@dummy: @list_type: @car_type: @cdr_type: diff --git a/doc/gconf/tmpl/gconf-unused.sgml b/doc/gconf/tmpl/gconf-unused.sgml index 0b0a5861..a5d0da18 100644 --- a/doc/gconf/tmpl/gconf-unused.sgml +++ b/doc/gconf/tmpl/gconf-unused.sgml @@ -75,6 +75,38 @@ err->code and err->message. @code: @message: +<!-- ##### FUNCTION corba_schema_from_gconf_schema ##### --> +<para> + +</para> + +@sc: +@Returns: + +<!-- ##### FUNCTION corba_value_from_gconf_value ##### --> +<para> + +</para> + +@value: +@Returns: + +<!-- ##### FUNCTION fill_corba_schema_from_gconf_schema ##### --> +<para> + +</para> + +@sc: +@dest: + +<!-- ##### FUNCTION fill_corba_value_from_gconf_value ##### --> +<para> + +</para> + +@value: +@dest: + <!-- ##### FUNCTION g_clear_error ##### --> <para> Internal function. @@ -180,3 +212,10 @@ Internal function. @en: @Returns: +<!-- ##### FUNCTION invalid_corba_value ##### --> +<para> + +</para> + +@Returns: + diff --git a/doc/gconf/tmpl/gconf-value.sgml b/doc/gconf/tmpl/gconf-value.sgml index 889c474f..5117f598 100644 --- a/doc/gconf/tmpl/gconf-value.sgml +++ b/doc/gconf/tmpl/gconf-value.sgml @@ -508,7 +508,6 @@ value, use gconf_entry_get_key() and gconf_entry_get_value(). value is not set.</para></warning> @key: an absolute key name -@value: a #GConfValue @schema_name: name of the schema applied to this entry @pad1: @pad2: diff --git a/examples/basic-gconf-app.c b/examples/basic-gconf-app.c index 32def7e3..d54fda76 100644 --- a/examples/basic-gconf-app.c +++ b/examples/basic-gconf-app.c @@ -174,14 +174,14 @@ configurable_widget_config_notify (GConfClient *client, * gconftool --break-key */ - if (entry->value == NULL) + if (gconf_entry_get_value (entry) == NULL) { gtk_label_set_text (GTK_LABEL (label), ""); } - else if (entry->value->type == GCONF_VALUE_STRING) + else if (gconf_entry_get_value (entry)->type == GCONF_VALUE_STRING) { gtk_label_set_text (GTK_LABEL (label), - gconf_value_get_string (entry->value)); + gconf_value_get_string (gconf_entry_get_value (entry))); } else { diff --git a/examples/simple-view.c b/examples/simple-view.c index b517ace4..e1f39878 100644 --- a/examples/simple-view.c +++ b/examples/simple-view.c @@ -33,16 +33,16 @@ key_changed_callback(GConfClient* client, label = GTK_WIDGET(user_data); - if (entry->value == NULL) + if (gconf_entry_get_value (entry) == NULL) { gtk_label_set_text (GTK_LABEL (label), "<unset>"); } else { - if (entry->value->type == GCONF_VALUE_STRING) + if (gconf_entry_get_value (entry)->type == GCONF_VALUE_STRING) { gtk_label_set_text (GTK_LABEL (label), - gconf_value_get_string (entry->value)); + gconf_value_get_string (gconf_entry_get_value (entry))); } else { diff --git a/gconf/gconf-changeset.c b/gconf/gconf-changeset.c index b6146116..1590911b 100644 --- a/gconf/gconf-changeset.c +++ b/gconf/gconf-changeset.c @@ -34,10 +34,10 @@ struct _Change { GConfValue* value; }; -Change* change_new (const gchar* key); -void change_set (Change* c, GConfValue* value); -void change_unset (Change* c); -void change_destroy(Change* c); +static Change* change_new (const gchar* key); +static void change_set (Change* c, GConfValue* value); +static void change_unset (Change* c); +static void change_destroy(Change* c); struct _GConfChangeSet { guint refcount; diff --git a/gconf/gconf-client.c b/gconf/gconf-client.c index 305c9e31..f3aa05ec 100644 --- a/gconf/gconf-client.c +++ b/gconf/gconf-client.c @@ -2335,7 +2335,7 @@ notify_one_entry (GConfClient *client, */ gconf_client_value_changed (client, entry->key, - entry->value); + gconf_entry_get_value (entry)); /* Now notify our listeners, if any */ if (client->listeners != NULL) diff --git a/gconf/gconf-database.c b/gconf/gconf-database.c index c80845cf..ef05b20d 100644 --- a/gconf/gconf-database.c +++ b/gconf/gconf-database.c @@ -114,7 +114,7 @@ impl_ConfigDatabase_lookup_with_locale(PortableServer_Servant servant, gboolean is_writable = TRUE; if (gconfd_check_in_shutdown (ev)) - return invalid_corba_value (); + return gconf_invalid_corba_value (); locale_list = locale_cache_lookup(locale); @@ -132,7 +132,7 @@ impl_ConfigDatabase_lookup_with_locale(PortableServer_Servant servant, if (val != NULL) { - ConfigValue* cval = corba_value_from_gconf_value(val); + ConfigValue* cval = gconf_corba_value_from_gconf_value(val); gconf_value_free(val); @@ -144,7 +144,7 @@ impl_ConfigDatabase_lookup_with_locale(PortableServer_Servant servant, { gconf_set_exception(&error, ev); - return invalid_corba_value(); + return gconf_invalid_corba_value (); } } @@ -154,7 +154,7 @@ impl_ConfigDatabase_lookup(PortableServer_Servant servant, CORBA_Environment * ev) { if (gconfd_check_in_shutdown (ev)) - return invalid_corba_value (); + return gconf_invalid_corba_value (); return impl_ConfigDatabase_lookup_with_locale (servant, key, NULL, TRUE, NULL, @@ -173,7 +173,7 @@ impl_ConfigDatabase_lookup_default_value(PortableServer_Servant servant, GConfLocaleList* locale_list; if (gconfd_check_in_shutdown (ev)) - return invalid_corba_value (); + return gconf_invalid_corba_value (); locale_list = locale_cache_lookup(locale); @@ -186,7 +186,7 @@ impl_ConfigDatabase_lookup_default_value(PortableServer_Servant servant, if (val != NULL) { - ConfigValue* cval = corba_value_from_gconf_value(val); + ConfigValue* cval = gconf_corba_value_from_gconf_value(val); gconf_value_free(val); @@ -198,7 +198,7 @@ impl_ConfigDatabase_lookup_default_value(PortableServer_Servant servant, { gconf_set_exception(&error, ev); - return invalid_corba_value(); + return gconf_invalid_corba_value (); } } @@ -406,7 +406,8 @@ impl_ConfigDatabase_all_entries(PortableServer_Servant servant, g_assert(p->key != NULL); (*keys)->_buffer[i] = CORBA_string_dup(p->key); - fill_corba_value_from_gconf_value(p->value, &((*values)->_buffer[i])); + gconf_fill_corba_value_from_gconf_value (gconf_entry_get_value (p), + &((*values)->_buffer[i])); (*is_defaults)->_buffer[i] = gconf_entry_get_is_default(p); (*is_writables)->_buffer[i] = gconf_entry_get_is_writable(p); @@ -566,7 +567,7 @@ impl_ConfigDatabase2_lookup_with_schema_name(PortableServer_Servant servant, ConfigValue* cval; if (gconfd_check_in_shutdown (ev)) - return invalid_corba_value (); + return gconf_invalid_corba_value (); locale_list = locale_cache_lookup(locale); @@ -592,13 +593,13 @@ impl_ConfigDatabase2_lookup_with_schema_name(PortableServer_Servant servant, if (val != NULL) { - cval = corba_value_from_gconf_value(val); + cval = gconf_corba_value_from_gconf_value(val); gconf_value_free(val); g_return_val_if_fail(error == NULL, cval); } else { - cval = invalid_corba_value(); + cval = gconf_invalid_corba_value (); } gconf_log (GCL_DEBUG, "In lookup_with_schema_name returning schema name '%s' error '%s'", @@ -688,8 +689,9 @@ impl_ConfigDatabase2_all_entries_with_schema_name(PortableServer_Servant servant g_assert(p != NULL); g_assert(p->key != NULL); - (*keys)->_buffer[i] = CORBA_string_dup(p->key); - fill_corba_value_from_gconf_value(p->value, &((*values)->_buffer[i])); + (*keys)->_buffer[i] = CORBA_string_dup (p->key); + gconf_fill_corba_value_from_gconf_value (gconf_entry_get_value (p), + &((*values)->_buffer[i])); (*schema_names)->_buffer[i] = CORBA_string_dup (gconf_entry_get_schema_name (p)); if ((*schema_names)->_buffer[i] == NULL) (*schema_names)->_buffer[i] = CORBA_string_dup (""); @@ -1362,12 +1364,12 @@ gconf_database_unset (GConfDatabase *db, if (def_value != NULL) { - val = corba_value_from_gconf_value(def_value); + val = gconf_corba_value_from_gconf_value(def_value); gconf_value_free(def_value); } else { - val = invalid_corba_value(); + val = gconf_invalid_corba_value (); } gconf_database_schedule_sync(db); @@ -1447,12 +1449,12 @@ gconf_database_recursive_unset (GConfDatabase *db, if (new_value != NULL) { - val = corba_value_from_gconf_value (new_value); + val = gconf_corba_value_from_gconf_value (new_value); gconf_value_free (new_value); } else { - val = invalid_corba_value(); + val = gconf_invalid_corba_value (); } gconf_database_schedule_sync (db); diff --git a/gconf/gconf-internals.c b/gconf/gconf-internals.c index edb5b69d..57cfce6e 100644 --- a/gconf/gconf-internals.c +++ b/gconf/gconf-internals.c @@ -294,8 +294,8 @@ gconf_value_from_corba_value(const ConfigValue* value) } void -fill_corba_value_from_gconf_value(const GConfValue* value, - ConfigValue* cv) +gconf_fill_corba_value_from_gconf_value(const GConfValue *value, + ConfigValue *cv) { if (value == NULL) { @@ -323,8 +323,8 @@ fill_corba_value_from_gconf_value(const GConfValue* value, break; case GCONF_VALUE_SCHEMA: cv->_d = SchemaVal; - fill_corba_schema_from_gconf_schema(gconf_value_get_schema(value), - &cv->_u.schema_value); + gconf_fill_corba_schema_from_gconf_schema (gconf_value_get_schema(value), + &cv->_u.schema_value); break; case GCONF_VALUE_LIST: { @@ -375,8 +375,8 @@ fill_corba_value_from_gconf_value(const GConfValue* value, while (list != NULL) { /* That dubious ConfigBasicValue->ConfigValue cast again */ - fill_corba_value_from_gconf_value((GConfValue*)list->data, - (ConfigValue*)&cv->_u.list_value.seq._buffer[i]); + gconf_fill_corba_value_from_gconf_value((GConfValue*)list->data, + (ConfigValue*)&cv->_u.list_value.seq._buffer[i]); list = g_slist_next(list); ++i; @@ -394,10 +394,10 @@ fill_corba_value_from_gconf_value(const GConfValue* value, CORBA_sequence_set_release(&cv->_u.pair_value, TRUE); /* dubious cast */ - fill_corba_value_from_gconf_value(gconf_value_get_car(value), - (ConfigValue*)&cv->_u.pair_value._buffer[0]); - fill_corba_value_from_gconf_value(gconf_value_get_cdr(value), - (ConfigValue*)&cv->_u.pair_value._buffer[1]); + gconf_fill_corba_value_from_gconf_value (gconf_value_get_car(value), + (ConfigValue*)&cv->_u.pair_value._buffer[0]); + gconf_fill_corba_value_from_gconf_value(gconf_value_get_cdr(value), + (ConfigValue*)&cv->_u.pair_value._buffer[1]); } break; @@ -412,19 +412,19 @@ fill_corba_value_from_gconf_value(const GConfValue* value, } ConfigValue* -corba_value_from_gconf_value(const GConfValue* value) +gconf_corba_value_from_gconf_value (const GConfValue* value) { ConfigValue* cv; cv = ConfigValue__alloc(); - fill_corba_value_from_gconf_value(value, cv); + gconf_fill_corba_value_from_gconf_value(value, cv); return cv; } ConfigValue* -invalid_corba_value() +gconf_invalid_corba_value () { ConfigValue* cv; @@ -518,48 +518,48 @@ gconf_type_from_corba_type(ConfigValueType type) } void -fill_corba_schema_from_gconf_schema(const GConfSchema* sc, - ConfigSchema* cs) +gconf_fill_corba_schema_from_gconf_schema(const GConfSchema *sc, + ConfigSchema *cs) { - cs->value_type = corba_type_from_gconf_type(sc->type); - cs->value_list_type = corba_type_from_gconf_type(sc->list_type); - cs->value_car_type = corba_type_from_gconf_type(sc->car_type); - cs->value_cdr_type = corba_type_from_gconf_type(sc->cdr_type); + cs->value_type = corba_type_from_gconf_type (gconf_schema_get_type (sc)); + cs->value_list_type = corba_type_from_gconf_type (gconf_schema_get_list_type (sc)); + cs->value_car_type = corba_type_from_gconf_type (gconf_schema_get_car_type (sc)); + cs->value_cdr_type = corba_type_from_gconf_type (gconf_schema_get_cdr_type (sc)); - cs->locale = CORBA_string_dup(sc->locale ? sc->locale : ""); - cs->short_desc = CORBA_string_dup(sc->short_desc ? sc->short_desc : ""); - cs->long_desc = CORBA_string_dup(sc->long_desc ? sc->long_desc : ""); - cs->owner = CORBA_string_dup(sc->owner ? sc->owner : ""); + cs->locale = CORBA_string_dup (gconf_schema_get_locale (sc) ? gconf_schema_get_locale (sc) : ""); + cs->short_desc = CORBA_string_dup (gconf_schema_get_short_desc (sc) ? gconf_schema_get_short_desc (sc) : ""); + cs->long_desc = CORBA_string_dup (gconf_schema_get_long_desc (sc) ? gconf_schema_get_long_desc (sc) : ""); + cs->owner = CORBA_string_dup (gconf_schema_get_owner (sc) ? gconf_schema_get_owner (sc) : ""); { gchar* encoded; GConfValue* default_val; - default_val = gconf_schema_get_default_value(sc); + default_val = gconf_schema_get_default_value (sc); if (default_val) { - encoded = gconf_value_encode(default_val); + encoded = gconf_value_encode (default_val); - g_assert(encoded != NULL); + g_assert (encoded != NULL); - cs->encoded_default_value = CORBA_string_dup(encoded); + cs->encoded_default_value = CORBA_string_dup (encoded); - g_free(encoded); + g_free (encoded); } else - cs->encoded_default_value = CORBA_string_dup(""); + cs->encoded_default_value = CORBA_string_dup (""); } } ConfigSchema* -corba_schema_from_gconf_schema(const GConfSchema* sc) +gconf_corba_schema_from_gconf_schema (const GConfSchema* sc) { ConfigSchema* cs; - cs = ConfigSchema__alloc(); + cs = ConfigSchema__alloc (); - fill_corba_schema_from_gconf_schema(sc, cs); + gconf_fill_corba_schema_from_gconf_schema (sc, cs); return cs; } @@ -1768,7 +1768,7 @@ static gchar type_byte(GConfValueType type) } } -GConfValueType +static GConfValueType byte_type(gchar byte) { switch (byte) @@ -2700,39 +2700,6 @@ gconf_get_current_lock_holder (const gchar *lock_directory, return server; } -#include <netinet/in.h> -#include <netdb.h> -#include <arpa/inet.h> -const char * -get_hostname (void) -{ - static char *hostname = NULL; - char hn_tmp[65]; - gulong ha_tmp; - struct hostent *hent; - - if (!hostname) { - gethostname (hn_tmp, sizeof (hn_tmp) - 1); - - hent = gethostbyname (hn_tmp); - if (hent) { - memcpy (&ha_tmp, hent->h_addr, 4); - hent = gethostbyaddr ((char *)&ha_tmp, 4, AF_INET); - if (hent) - hostname = g_strdup (hent->h_name); - else - hostname = - g_strdup (inet_ntoa - (* - ((struct in_addr *) - &ha_tmp))); - } else - hostname = g_strdup (hn_tmp); - } - - return hostname; -} - static CORBA_ORB gconf_orb = CORBA_OBJECT_NIL; CORBA_ORB diff --git a/gconf/gconf-internals.h b/gconf/gconf-internals.h index 70afca72..79f55585 100644 --- a/gconf/gconf-internals.h +++ b/gconf/gconf-internals.h @@ -53,21 +53,20 @@ enum { gboolean gconf_file_test (const gchar* filename, int test); gboolean gconf_file_exists (const gchar* filename); -GConfValue* gconf_value_from_corba_value (const ConfigValue *value); -ConfigValue* corba_value_from_gconf_value (const GConfValue *value); -void fill_corba_value_from_gconf_value (const GConfValue *value, - ConfigValue *dest); -ConfigValue* invalid_corba_value (void); +GConfValue* gconf_value_from_corba_value (const ConfigValue *value); +ConfigValue* gconf_corba_value_from_gconf_value (const GConfValue *value); +void gconf_fill_corba_value_from_gconf_value (const GConfValue *value, + ConfigValue *dest); +ConfigValue* gconf_invalid_corba_value (void); +void gconf_fill_corba_schema_from_gconf_schema (const GConfSchema *sc, + ConfigSchema *dest); +ConfigSchema* gconf_corba_schema_from_gconf_schema (const GConfSchema *sc); +GConfSchema* gconf_schema_from_corba_schema (const ConfigSchema *cs); gchar* gconf_object_to_string (CORBA_Object obj, GError **err); -void fill_corba_schema_from_gconf_schema (const GConfSchema *sc, - ConfigSchema *dest); -ConfigSchema* corba_schema_from_gconf_schema (const GConfSchema *sc); -GConfSchema* gconf_schema_from_corba_schema (const ConfigSchema *cs); - const gchar* gconf_value_type_to_string (GConfValueType type); GConfValueType gconf_value_type_from_string (const gchar *str); @@ -240,6 +239,9 @@ void gconf_entry_ref (GConfEntry *entry); void gconf_entry_unref (GConfEntry *entry); int gconf_value_compare (const GConfValue *value_a, const GConfValue *value_b); + +GConfValue* gconf_schema_steal_default_value (GConfSchema *schema); + #endif /* GCONF_ENABLE_INTERNALS */ #endif /* GCONF_GCONF_INTERNALS_H */ diff --git a/gconf/gconf-schema.c b/gconf/gconf-schema.c index 9f15ce39..1f631b5b 100644 --- a/gconf/gconf-schema.c +++ b/gconf/gconf-schema.c @@ -1,5 +1,5 @@ /* GConf - * Copyright (C) 1999, 2000 Red Hat Inc. + * Copyright (C) 1999, 2000, 2002 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 @@ -20,170 +20,201 @@ #include "gconf-schema.h" #include "gconf-internals.h" +/* FIXME clean this up, obviously RealSchema isn't needed. */ +struct _GConfSchema { + int dummy; +}; + +typedef struct { + GConfValueType type; /* Type of the described entry */ + GConfValueType list_type; /* List type of the described entry */ + GConfValueType car_type; /* Pair car type of the described entry */ + GConfValueType cdr_type; /* Pair cdr type of the described entry */ + gchar* locale; /* Schema locale */ + gchar* owner; /* Name of creating application */ + gchar* short_desc; /* 40 char or less description, no newlines */ + gchar* long_desc; /* could be a paragraph or so */ + GConfValue* default_value; /* Default value of the key */ + gpointer pad1; + gpointer pad2; + gpointer pad3; + int pad4; +} GConfRealSchema; + +#define REAL_SCHEMA(schema) ((GConfRealSchema*)(schema)) + GConfSchema* -gconf_schema_new(void) +gconf_schema_new (void) { - GConfSchema* sc; + GConfRealSchema *real; - sc = g_new0(GConfSchema, 1); + real = g_new0 (GConfRealSchema, 1); - sc->type = GCONF_VALUE_INVALID; - sc->list_type = GCONF_VALUE_INVALID; - sc->car_type = GCONF_VALUE_INVALID; - sc->cdr_type = GCONF_VALUE_INVALID; + real->type = GCONF_VALUE_INVALID; + real->list_type = GCONF_VALUE_INVALID; + real->car_type = GCONF_VALUE_INVALID; + real->cdr_type = GCONF_VALUE_INVALID; - return sc; + return (GConfSchema*) real; } void -gconf_schema_free(GConfSchema* sc) +gconf_schema_free (GConfSchema* sc) { - if (sc->locale) - g_free(sc->locale); + GConfRealSchema *real = REAL_SCHEMA (sc); + + if (real->locale) + g_free (real->locale); - if (sc->short_desc) - g_free(sc->short_desc); + if (real->short_desc) + g_free (real->short_desc); - if (sc->long_desc) - g_free(sc->long_desc); + if (real->long_desc) + g_free (real->long_desc); - if (sc->owner) - g_free(sc->owner); + if (real->owner) + g_free (real->owner); - if (sc->default_value) - gconf_value_free(sc->default_value); + if (real->default_value) + gconf_value_free (real->default_value); - g_free(sc); + g_free (sc); } GConfSchema* -gconf_schema_copy(const GConfSchema* sc) +gconf_schema_copy (const GConfSchema* sc) { - GConfSchema* dest; + GConfRealSchema *dest; + const GConfRealSchema *real; - dest = gconf_schema_new(); + real = REAL_SCHEMA (sc); + dest = (GConfRealSchema*) gconf_schema_new (); - dest->type = sc->type; - dest->list_type = sc->list_type; - dest->car_type = sc->car_type; - dest->cdr_type = sc->cdr_type; + dest->type = real->type; + dest->list_type = real->list_type; + dest->car_type = real->car_type; + dest->cdr_type = real->cdr_type; - dest->locale = sc->locale ? g_strdup(sc->locale) : NULL; + dest->locale = real->locale ? g_strdup (real->locale) : NULL; - dest->short_desc = sc->short_desc ? g_strdup(sc->short_desc) : NULL; + dest->short_desc = real->short_desc ? g_strdup (real->short_desc) : NULL; - dest->long_desc = sc->long_desc ? g_strdup(sc->long_desc) : NULL; + dest->long_desc = real->long_desc ? g_strdup (real->long_desc) : NULL; - dest->owner = sc->owner ? g_strdup(sc->owner) : NULL; + dest->owner = real->owner ? g_strdup (real->owner) : NULL; - dest->default_value = sc->default_value ? gconf_value_copy(sc->default_value) : NULL; + dest->default_value = real->default_value ? gconf_value_copy (real->default_value) : NULL; - return dest; + return (GConfSchema*) dest; } void -gconf_schema_set_type(GConfSchema* sc, GConfValueType type) +gconf_schema_set_type (GConfSchema* sc, GConfValueType type) { - sc->type = type; + REAL_SCHEMA (sc)->type = type; } void -gconf_schema_set_list_type(GConfSchema* sc, GConfValueType type) +gconf_schema_set_list_type (GConfSchema* sc, GConfValueType type) { - sc->list_type = type; + REAL_SCHEMA (sc)->list_type = type; } void -gconf_schema_set_car_type(GConfSchema* sc, GConfValueType type) +gconf_schema_set_car_type (GConfSchema* sc, GConfValueType type) { - sc->car_type = type; + REAL_SCHEMA (sc)->car_type = type; } void -gconf_schema_set_cdr_type(GConfSchema* sc, GConfValueType type) +gconf_schema_set_cdr_type (GConfSchema* sc, GConfValueType type) { - sc->cdr_type = type; + REAL_SCHEMA (sc)->cdr_type = type; } void -gconf_schema_set_locale(GConfSchema* sc, const gchar* locale) +gconf_schema_set_locale (GConfSchema* sc, const gchar* locale) { g_return_if_fail (locale == NULL || g_utf8_validate (locale, -1, NULL)); - if (sc->locale) - g_free(sc->locale); + if (REAL_SCHEMA (sc)->locale) + g_free (REAL_SCHEMA (sc)->locale); if (locale) - sc->locale = g_strdup(locale); + REAL_SCHEMA (sc)->locale = g_strdup (locale); else - sc->locale = NULL; + REAL_SCHEMA (sc)->locale = NULL; } void -gconf_schema_set_short_desc(GConfSchema* sc, const gchar* desc) +gconf_schema_set_short_desc (GConfSchema* sc, const gchar* desc) { g_return_if_fail (desc == NULL || g_utf8_validate (desc, -1, NULL)); - if (sc->short_desc) - g_free(sc->short_desc); + if (REAL_SCHEMA (sc)->short_desc) + g_free (REAL_SCHEMA (sc)->short_desc); if (desc) - sc->short_desc = g_strdup(desc); + REAL_SCHEMA (sc)->short_desc = g_strdup (desc); else - sc->short_desc = NULL; + REAL_SCHEMA (sc)->short_desc = NULL; } void -gconf_schema_set_long_desc(GConfSchema* sc, const gchar* desc) +gconf_schema_set_long_desc (GConfSchema* sc, const gchar* desc) { g_return_if_fail (desc == NULL || g_utf8_validate (desc, -1, NULL)); - if (sc->long_desc) - g_free(sc->long_desc); + if (REAL_SCHEMA (sc)->long_desc) + g_free (REAL_SCHEMA (sc)->long_desc); if (desc) - sc->long_desc = g_strdup(desc); + REAL_SCHEMA (sc)->long_desc = g_strdup (desc); else - sc->long_desc = NULL; + REAL_SCHEMA (sc)->long_desc = NULL; } void -gconf_schema_set_owner(GConfSchema* sc, const gchar* owner) +gconf_schema_set_owner (GConfSchema* sc, const gchar* owner) { g_return_if_fail (owner == NULL || g_utf8_validate (owner, -1, NULL)); - if (sc->owner) - g_free(sc->owner); + if (REAL_SCHEMA (sc)->owner) + g_free (REAL_SCHEMA (sc)->owner); if (owner) - sc->owner = g_strdup(owner); + REAL_SCHEMA (sc)->owner = g_strdup (owner); else - sc->owner = NULL; + REAL_SCHEMA (sc)->owner = NULL; } void -gconf_schema_set_default_value(GConfSchema* sc, const GConfValue* val) +gconf_schema_set_default_value (GConfSchema* sc, const GConfValue* val) { - if (sc->default_value != NULL) - gconf_value_free(sc->default_value); + if (REAL_SCHEMA (sc)->default_value != NULL) + gconf_value_free (REAL_SCHEMA (sc)->default_value); - sc->default_value = gconf_value_copy(val); + REAL_SCHEMA (sc)->default_value = gconf_value_copy (val); } void -gconf_schema_set_default_value_nocopy(GConfSchema* sc, GConfValue* val) +gconf_schema_set_default_value_nocopy (GConfSchema* sc, GConfValue* val) { - if (sc->default_value != NULL) - gconf_value_free(sc->default_value); + if (REAL_SCHEMA (sc)->default_value != NULL) + gconf_value_free (REAL_SCHEMA (sc)->default_value); - sc->default_value = val; + REAL_SCHEMA (sc)->default_value = val; } gboolean gconf_schema_validate (const GConfSchema *sc, GError **err) { - if (sc->locale && !g_utf8_validate (sc->locale, -1, NULL)) + GConfRealSchema *real; + + real = REAL_SCHEMA (sc); + + if (real->locale && !g_utf8_validate (real->locale, -1, NULL)) { g_set_error (err, GCONF_ERROR, GCONF_ERROR_FAILED, @@ -191,7 +222,7 @@ gconf_schema_validate (const GConfSchema *sc, return FALSE; } - if (sc->short_desc && !g_utf8_validate (sc->short_desc, -1, NULL)) + if (real->short_desc && !g_utf8_validate (real->short_desc, -1, NULL)) { g_set_error (err, GCONF_ERROR, GCONF_ERROR_FAILED, @@ -199,7 +230,7 @@ gconf_schema_validate (const GConfSchema *sc, return FALSE; } - if (sc->long_desc && !g_utf8_validate (sc->long_desc, -1, NULL)) + if (real->long_desc && !g_utf8_validate (real->long_desc, -1, NULL)) { g_set_error (err, GCONF_ERROR, GCONF_ERROR_FAILED, @@ -207,7 +238,7 @@ gconf_schema_validate (const GConfSchema *sc, return FALSE; } - if (sc->owner && !g_utf8_validate (sc->owner, -1, NULL)) + if (real->owner && !g_utf8_validate (real->owner, -1, NULL)) { g_set_error (err, GCONF_ERROR, GCONF_ERROR_FAILED, @@ -223,7 +254,7 @@ gconf_schema_get_type (const GConfSchema *schema) { g_return_val_if_fail (schema != NULL, GCONF_VALUE_INVALID); - return schema->type; + return REAL_SCHEMA (schema)->type; } GConfValueType @@ -231,7 +262,7 @@ gconf_schema_get_list_type (const GConfSchema *schema) { g_return_val_if_fail (schema != NULL, GCONF_VALUE_INVALID); - return schema->list_type; + return REAL_SCHEMA (schema)->list_type; } GConfValueType @@ -239,7 +270,7 @@ gconf_schema_get_car_type (const GConfSchema *schema) { g_return_val_if_fail (schema != NULL, GCONF_VALUE_INVALID); - return schema->car_type; + return REAL_SCHEMA (schema)->car_type; } GConfValueType @@ -247,7 +278,7 @@ gconf_schema_get_cdr_type (const GConfSchema *schema) { g_return_val_if_fail (schema != NULL, GCONF_VALUE_INVALID); - return schema->cdr_type; + return REAL_SCHEMA (schema)->cdr_type; } const char* @@ -255,7 +286,7 @@ gconf_schema_get_locale (const GConfSchema *schema) { g_return_val_if_fail (schema != NULL, NULL); - return schema->locale; + return REAL_SCHEMA (schema)->locale; } const char* @@ -263,7 +294,7 @@ gconf_schema_get_short_desc (const GConfSchema *schema) { g_return_val_if_fail (schema != NULL, NULL); - return schema->short_desc; + return REAL_SCHEMA (schema)->short_desc; } const char* @@ -271,7 +302,7 @@ gconf_schema_get_long_desc (const GConfSchema *schema) { g_return_val_if_fail (schema != NULL, NULL); - return schema->long_desc; + return REAL_SCHEMA (schema)->long_desc; } const char* @@ -279,7 +310,7 @@ gconf_schema_get_owner (const GConfSchema *schema) { g_return_val_if_fail (schema != NULL, NULL); - return schema->owner; + return REAL_SCHEMA (schema)->owner; } GConfValue* @@ -287,5 +318,18 @@ gconf_schema_get_default_value (const GConfSchema *schema) { g_return_val_if_fail (schema != NULL, NULL); - return schema->default_value; + return REAL_SCHEMA (schema)->default_value; +} + +GConfValue* +gconf_schema_steal_default_value (GConfSchema *schema) +{ + GConfValue *val; + + g_return_val_if_fail (schema != NULL, NULL); + + val = REAL_SCHEMA (schema)->default_value; + REAL_SCHEMA (schema)->default_value = NULL; + + return val; } diff --git a/gconf/gconf-schema.h b/gconf/gconf-schema.h index d1005c36..67bd6ee7 100644 --- a/gconf/gconf-schema.h +++ b/gconf/gconf-schema.h @@ -32,22 +32,6 @@ * etc. */ -struct _GConfSchema { - GConfValueType type; /* Type of the described entry */ - GConfValueType list_type; /* List type of the described entry */ - GConfValueType car_type; /* Pair car type of the described entry */ - GConfValueType cdr_type; /* Pair cdr type of the described entry */ - gchar* locale; /* Schema locale */ - gchar* owner; /* Name of creating application */ - gchar* short_desc; /* 40 char or less description, no newlines */ - gchar* long_desc; /* could be a paragraph or so */ - GConfValue* default_value; /* Default value of the key */ - gpointer pad1; - gpointer pad2; - gpointer pad3; - int pad4; -}; - GConfSchema* gconf_schema_new (void); void gconf_schema_free (GConfSchema *sc); GConfSchema* gconf_schema_copy (const GConfSchema *sc); diff --git a/gconf/gconf-sources.c b/gconf/gconf-sources.c index a3559a07..777c98ed 100644 --- a/gconf/gconf-sources.c +++ b/gconf/gconf-sources.c @@ -592,10 +592,11 @@ gconf_sources_query_value (GConfSources* sources, } else if (val != NULL) { - GConfValue* retval = gconf_value_get_schema(val)->default_value; - /* cheat, "unparent" the value to avoid a copy */ - gconf_value_get_schema(val)->default_value = NULL; - gconf_value_free(val); + GConfValue* retval; + + retval = gconf_schema_steal_default_value (gconf_value_get_schema (val)); + + gconf_value_free (val); if (schema_namep) *schema_namep = schema_name; @@ -1054,12 +1055,12 @@ hash_lookup_defaults_func(gpointer key, gpointer value, gpointer user_data) if (val != NULL && val->type == GCONF_VALUE_SCHEMA) { - GConfValue* defval = gconf_value_get_schema(val)->default_value; - /* cheat, "unparent" the value to avoid a copy */ - gconf_value_get_schema(val)->default_value = NULL; + GConfValue* defval; - gconf_entry_set_value_nocopy(entry, defval); - gconf_entry_set_is_default(entry, TRUE); + defval = gconf_schema_steal_default_value (gconf_value_get_schema(val)); + + gconf_entry_set_value_nocopy (entry, defval); + gconf_entry_set_is_default (entry, TRUE); } if (val) @@ -1187,11 +1188,12 @@ gconf_sources_all_entries (GConfSources* sources, * gconfd side */ full = gconf_concat_dir_and_key (dir, previous->key); - - previous->is_writable = key_is_writable (sources, - src, - full, - NULL); + + gconf_entry_set_is_writable (previous, + key_is_writable (sources, + src, + full, + NULL)); g_free (full); } @@ -1208,11 +1210,12 @@ gconf_sources_all_entries (GConfSources* sources, * gconfd side */ full = gconf_concat_dir_and_key (dir, pair->key); - - pair->is_writable = key_is_writable (sources, - src, - full, - NULL); + + gconf_entry_set_is_writable (pair, + key_is_writable (sources, + src, + full, + NULL)); g_free (full); } @@ -1517,11 +1520,10 @@ gconf_sources_query_default_value(GConfSources* sources, if (schema != NULL) { GConfValue* retval; - /* Cheat, steal value from schema */ - retval = schema->default_value; - schema->default_value = NULL; - gconf_schema_free(schema); + retval = gconf_schema_steal_default_value (schema); + + gconf_schema_free (schema); return retval; } diff --git a/gconf/gconf-value.c b/gconf/gconf-value.c index 4bb0c2c5..32222ef1 100644 --- a/gconf/gconf-value.c +++ b/gconf/gconf-value.c @@ -1,5 +1,5 @@ /* GConf - * Copyright (C) 1999, 2000 Red Hat Inc. + * Copyright (C) 1999, 2000, 2002 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 @@ -1418,6 +1418,24 @@ gconf_meta_info_set_mod_time(GConfMetaInfo* gcmi, * GConfEntry */ +typedef struct { + char *key; + GConfValue *value; + char *schema_name; + int pad1; + gpointer pad2; + gpointer pad3; + GTime pad4; + int refcount; + guint is_default : 1; + guint is_writable : 1; + guint pad5 : 1; + guint pad6 : 1; + guint pad7 : 1; +} GConfRealEntry; + +#define REAL_ENTRY(x) ((GConfRealEntry*)(x)) + GConfEntry* gconf_entry_new (const char *key, const GConfValue *val) @@ -1430,43 +1448,48 @@ gconf_entry_new (const char *key, GConfEntry* gconf_entry_new_nocopy (char* key, GConfValue* val) { - GConfEntry* pair; + GConfRealEntry* real; - pair = g_new (GConfEntry, 1); + real = g_new (GConfRealEntry, 1); - pair->key = key; - pair->value = val; - pair->schema_name = NULL; - pair->is_default = FALSE; - pair->is_writable = TRUE; - pair->refcount = 1; + real->key = key; + real->value = val; + real->schema_name = NULL; + real->is_default = FALSE; + real->is_writable = TRUE; + real->refcount = 1; - return pair; + return (GConfEntry*) real; } void gconf_entry_ref (GConfEntry *entry) { g_return_if_fail (entry != NULL); - entry->refcount += 1; + + REAL_ENTRY (entry)->refcount += 1; } void gconf_entry_unref (GConfEntry *entry) { + GConfRealEntry *real; + g_return_if_fail (entry != NULL); - g_return_if_fail (entry->refcount > 0); + g_return_if_fail (REAL_ENTRY (entry)->refcount > 0); - entry->refcount -= 1; + real = REAL_ENTRY (entry); + + real->refcount -= 1; - if (entry->refcount == 0) + if (real->refcount == 0) { - g_free (entry->key); - if (entry->value) - gconf_value_free (entry->value); - if (entry->schema_name) - g_free (entry->schema_name); - g_free (entry); + g_free (real->key); + if (real->value) + gconf_value_free (real->value); + if (real->schema_name) + g_free (real->schema_name); + g_free (real); } } @@ -1480,12 +1503,15 @@ GConfEntry* gconf_entry_copy (const GConfEntry *src) { GConfEntry *entry; - - entry = gconf_entry_new (src->key, src->value); - - entry->schema_name = g_strdup (src->schema_name); - entry->is_default = src->is_default; - entry->is_writable = src->is_writable; + GConfRealEntry *real; + + entry = gconf_entry_new (REAL_ENTRY (src)->key, + REAL_ENTRY (src)->value); + real = REAL_ENTRY (entry); + + real->schema_name = g_strdup (REAL_ENTRY (src)->schema_name); + real->is_default = REAL_ENTRY (src)->is_default; + real->is_writable = REAL_ENTRY (src)->is_writable; return entry; } @@ -1494,29 +1520,35 @@ gboolean gconf_entry_equal (const GConfEntry *a, const GConfEntry *b) { + GConfRealEntry *real_a; + GConfRealEntry *real_b; + g_return_val_if_fail (a != NULL, FALSE); g_return_val_if_fail (b != NULL, FALSE); + real_a = REAL_ENTRY (a); + real_b = REAL_ENTRY (b); + /* do the cheap checks first, why not */ - if (a->value && !b->value) + if (real_a->value && !real_b->value) return FALSE; - else if (!a->value && b->value) + else if (!real_a->value && real_b->value) return FALSE; - else if (a->is_default != b->is_default) + else if (real_a->is_default != real_b->is_default) return FALSE; - else if (a->is_writable != b->is_writable) + else if (real_a->is_writable != real_b->is_writable) return FALSE; - else if (strcmp (a->key, b->key) != 0) + else if (strcmp (real_a->key, real_b->key) != 0) return FALSE; - else if (a->schema_name && !b->schema_name) + else if (real_a->schema_name && !real_b->schema_name) return FALSE; - else if (!a->schema_name && b->schema_name) + else if (!real_a->schema_name && real_b->schema_name) return FALSE; - else if (a->schema_name && b->schema_name && - strcmp (a->schema_name, b->schema_name) != 0) + else if (real_a->schema_name && real_b->schema_name && + strcmp (real_a->schema_name, real_b->schema_name) != 0) return FALSE; - else if (a->value && b->value && - gconf_value_compare (a->value, b->value) != 0) + else if (real_a->value && real_b->value && + gconf_value_compare (real_a->value, real_b->value) != 0) return FALSE; else return TRUE; @@ -1525,8 +1557,8 @@ gconf_entry_equal (const GConfEntry *a, GConfValue* gconf_entry_steal_value (GConfEntry* entry) { - GConfValue* val = entry->value; - entry->value = NULL; + GConfValue* val = REAL_ENTRY (entry)->value; + REAL_ENTRY (entry)->value = NULL; return val; } @@ -1535,7 +1567,7 @@ gconf_entry_get_key (const GConfEntry *entry) { g_return_val_if_fail (entry != NULL, NULL); - return entry->key; + return REAL_ENTRY (entry)->key; } GConfValue* @@ -1543,7 +1575,7 @@ gconf_entry_get_value (const GConfEntry *entry) { g_return_val_if_fail (entry != NULL, NULL); - return entry->value; + return REAL_ENTRY (entry)->value; } const char* @@ -1551,7 +1583,7 @@ gconf_entry_get_schema_name (const GConfEntry *entry) { g_return_val_if_fail (entry != NULL, NULL); - return entry->schema_name; + return REAL_ENTRY (entry)->schema_name; } gboolean @@ -1559,7 +1591,7 @@ gconf_entry_get_is_default (const GConfEntry *entry) { g_return_val_if_fail (entry != NULL, FALSE); - return entry->is_default; + return REAL_ENTRY (entry)->is_default; } gboolean @@ -1567,7 +1599,7 @@ gconf_entry_get_is_writable (const GConfEntry *entry) { g_return_val_if_fail (entry != NULL, FALSE); - return entry->is_writable; + return REAL_ENTRY (entry)->is_writable; } @@ -1583,34 +1615,34 @@ void gconf_entry_set_value_nocopy(GConfEntry* entry, GConfValue* val) { - if (entry->value) - gconf_value_free(entry->value); + if (REAL_ENTRY (entry)->value) + gconf_value_free (REAL_ENTRY (entry)->value); - entry->value = val; + REAL_ENTRY (entry)->value = val; } void gconf_entry_set_schema_name(GConfEntry* entry, const gchar* name) { - if (entry->schema_name) - g_free(entry->schema_name); + if (REAL_ENTRY (entry)->schema_name) + g_free (REAL_ENTRY (entry)->schema_name); - entry->schema_name = name ? g_strdup(name) : NULL; + REAL_ENTRY (entry)->schema_name = name ? g_strdup(name) : NULL; } void gconf_entry_set_is_default (GConfEntry* entry, gboolean is_default) { - entry->is_default = is_default; + REAL_ENTRY (entry)->is_default = is_default; } void gconf_entry_set_is_writable (GConfEntry *entry, gboolean is_writable) { - entry->is_writable = is_writable; + REAL_ENTRY (entry)->is_writable = is_writable; } diff --git a/gconf/gconf-value.h b/gconf/gconf-value.h index 82644706..d726ecba 100644 --- a/gconf/gconf-value.h +++ b/gconf/gconf-value.h @@ -55,22 +55,6 @@ typedef struct _GConfValue GConfValue; struct _GConfValue { GConfValueType type; - /* this is all PRIVATE dangit */ - union { - gchar* string_data; - gint int_data; - gboolean bool_data; - gdouble float_data; - GConfSchema* schema_data; - struct { - GConfValueType type; - GSList* list; - } list_data; - struct { - GConfValue* car; - GConfValue* cdr; - } pair_data; - } d; }; const char* gconf_value_get_string (const GConfValue *value); @@ -164,17 +148,6 @@ typedef struct _GConfEntry GConfEntry; struct _GConfEntry { char *key; GConfValue *value; - char *schema_name; - int pad1; - gpointer pad2; - gpointer pad3; - GTime pad4; - int refcount; - guint is_default : 1; - guint is_writable : 1; - guint pad5 : 1; - guint pad6 : 1; - guint pad7 : 1; }; const char* gconf_entry_get_key (const GConfEntry *entry); diff --git a/gconf/gconf.c b/gconf/gconf.c index 280630cb..f9a883a7 100644 --- a/gconf/gconf.c +++ b/gconf/gconf.c @@ -467,8 +467,6 @@ GConfEngine* gconf_engine_get_for_address (const gchar* address, GError** err) { GConfEngine* conf; - - g_warning("Non-default configuration sources currently do not support change-notification, and are not yet recommended for use in applications."); conf = lookup_engine (address); @@ -951,10 +949,11 @@ gconf_engine_get_entry(GConfEngine* conf, entry = gconf_entry_new_nocopy (g_strdup (key), val); - - entry->is_default = is_default; - entry->is_writable = is_writable; - entry->schema_name = schema_name; /* transfer memory ownership */ + + gconf_entry_set_is_default (entry, is_default); + gconf_entry_set_is_writable (entry, is_writable); + gconf_entry_set_schema_name (entry, schema_name); + g_free (schema_name); return entry; } @@ -1126,7 +1125,7 @@ gconf_engine_set (GConfEngine* conf, const gchar* key, return FALSE; } - cv = corba_value_from_gconf_value(value); + cv = gconf_corba_value_from_gconf_value (value); ConfigDatabase_set(db, (gchar*)key, cv, @@ -1545,15 +1544,13 @@ gconf_engine_all_entries(GConfEngine* conf, const gchar* dir, GError** err) gconf_entry_new_nocopy(gconf_concat_dir_and_key (dir, keys->_buffer[i]), gconf_value_from_corba_value(&(values->_buffer[i]))); - /* note, there's an accesor function for setting this that we are - cheating and not using */ - pair->is_default = is_defaults->_buffer[i]; - pair->is_writable = is_writables->_buffer[i]; + gconf_entry_set_is_default (pair, is_defaults->_buffer[i]); + gconf_entry_set_is_writable (pair, is_writables->_buffer[i]); if (schema_names) { /* empty string means no schema name */ if (*(schema_names->_buffer[i]) != '\0') - pair->schema_name = g_strdup (schema_names->_buffer[i]); + gconf_entry_set_schema_name (pair, schema_names->_buffer[i]); } pairs = g_slist_prepend(pairs, pair); @@ -2244,8 +2241,8 @@ notify(PortableServer_Servant servant, entry = gconf_entry_new_nocopy (g_strdup (key), gvalue); - entry->is_default = is_default; - entry->is_writable = is_writable; + gconf_entry_set_is_default (entry, is_default); + gconf_entry_set_is_writable (entry, is_writable); gconf_cnxn_notify(cnxn, entry); diff --git a/gconf/gconfd.c b/gconf/gconfd.c index 0bbce61c..02adbe1d 100644 --- a/gconf/gconfd.c +++ b/gconf/gconfd.c @@ -2120,12 +2120,21 @@ add_client (const ConfigListener client) { CORBA_Environment ev; ConfigListener copy; + ORBitConnection *connection; CORBA_exception_init (&ev); copy = CORBA_Object_duplicate (client, &ev); g_hash_table_insert (client_table, copy, copy); CORBA_exception_free (&ev); + /* Set maximum buffer size, which makes the connection nonblocking + * if the kernel buffers are full and keeps gconfd from + * locking up. Set the max to a pretty high number to avoid + * dropping clients that are just stuck for a while. + */ + connection = ORBit_small_get_connection (copy); + ORBit_connection_set_max_buffer (connection, 1024 * 128); + log_client_add (client); gconf_log (GCL_DEBUG, "Added a new client"); diff --git a/gconf/gconftool.c b/gconf/gconftool.c index 9edae20e..e5927b34 100644 --- a/gconf/gconftool.c +++ b/gconf/gconftool.c @@ -943,10 +943,10 @@ list_pairs_in_dir(GConfEngine* conf, const gchar* dir, guint depth) GConfEntry* pair = tmp->data; gchar* s; - if (pair->value) - s = gconf_value_to_string(pair->value); + if (gconf_entry_get_value (pair)) + s = gconf_value_to_string (gconf_entry_get_value (pair)); else - s = g_strdup(_("(no value set)")); + s = g_strdup(_("(no value set)")); printf(" %s%s = %s\n", whitespace, gconf_key_key (gconf_entry_get_key (pair)), |