Hello
On Thu, 2007-10-04 at 15:21 +0530, umang gupta wrote:
> Hi ,
>
> I want to clear some issues regarding gconftool-2 .
>
> [1] If I attach schema structure to a key "KEY' as with schema key
> "SCEHMAKEY' { using "gconftool-2 --install-schema-file = ./xxx.schemas"
> command where xxx.schemas is a xml file contaning schema
> information }.
>
> gconftool-2 --get-schema-name KEY gives me o/p as "SCEHMAKEY"
> [as what we expect].
>
> [2]But If I attach schema by using schema api:
> gconf_client_set_schema(),
Thanks for code. I have modified the same, and attached it.
>
> "gconftool-2 --get-schema-name KEY" gives me "no schema set for KEY"
>
> why it is so ?
When writing schema programmatically, certain information needed by
gconftool-2 is skipped out.
A base schema file
<gconfschemafile>
<schemalist>
<schema>
<key>/schemas/dummy/testgconf/inttest</key>
<applyto>/apps/dummy/testgconf/inttest</applyto>
<owner>TestingApps</owner>
<type>int</type>
<default>999</default>
<locale name="C">
<short> short desciption</short>
<longdesc>a long description</longdesc>
</locale>
</schema>
</schemalist>
</gconfschemafile>
The schema file which is written.
<gconf>
<entry name="inttest" mtime="1191774109" type="schema"
stype="int" owner="TestingApps">
<local_schema locale="C" short_desc=" a short
desciption">
<default type="int" value="999">
</default>
<longdesc>a long description</longdesc>
</local_schema>
</entry>
</gconf>
From the above, i strongly suspected gconftool-2 was unable to find
associated schema due to missing "applyto" key. On deeper analysis, this
does turn out to be true. This seems to be a limitation of gconftool
from gconftool.c
static int
get_schema_values_from_xml(xmlNodePtr node, GSList** ret_values)
...
static int
extract_global_info(xmlNodePtr node,
SchemaInfo* info)
{
...
else if (strcmp((char *)iter->name, "applyto") == 0)
...
}
Retrieving the schema works fine programmatically.
>
> Where does schema info [xml file] getting stored in both above cases.[as
> what I know in $(HOME)/.gconf ] & from where gconftool-2 access the
> schema attached to a KEY.
>
> Is there any configuration source path to be added to /etc/gconf/2/path
> file. {it has .gconf already}
>
> Thanks in advance:
> Umang Gupta
>
>
>
>
> _______________________________________________
> gconf-list mailing list
> gconf-list gnome org
> http://mail.gnome.org/mailman/listinfo/gconf-list
--
Ritesh Khadgaray
ॐ मणि पद्मे हूँ
Desktop LinuX N Stuff
Ph: +919970164885
Eat Right, Exercise, Die Anyway.
/*
Ritesh Khadgaray <khadgaray gmail com> -- gconf schema thinggy
Note:
adds a dummy schema entery to gconf registery, and checks the value
To build
$ gcc -o gconf_test gconf_test.c `pkg-config --libs --cflags gconf-2.0` && ./gconf_test
*/
#include <glib.h>
#include <gconf/gconf-client.h>
#include <gconf/gconf-schema.h>
#define KEY "/dummy/testgconf/inttest"
#define SKEY "/schemas/dummy/testgconf/inttest"
void gconf_test_get(void)
{
static const gchar fn[] = "gconf_test_get";
g_message("%s : starting", fn);
GConfClient *client = NULL;
GConfSchema *schema = NULL;
client = gconf_client_get_default();
schema = gconf_client_get_schema(client, SKEY, NULL);
if(NULL == schema){
g_object_unref(client);
g_warning("%s : unable to retireve schema for %s", fn, SKEY);
g_message("%s : premature ending\n", fn);
return;
}
GConfValue *value = gconf_schema_get_default_value(schema);
switch(gconf_schema_get_type(schema)){
case GCONF_VALUE_INT:
g_message("%s: schema : %s \n type int with default value: %d"
"\n current value of: %d",
fn, SKEY,
gconf_value_get_int(value),
gconf_client_get_int(client, KEY, NULL));
break;
default:
g_warning("%s : something wrong with type", fn);
}
g_message("%s : "
"\n locale - %s"
"\n owner - %s"
"\n short desciption - %s"
"\n long desciption -\n\t %s",
fn,
gconf_schema_get_locale(schema),
gconf_schema_get_owner(schema),
gconf_schema_get_short_desc(schema),
gconf_schema_get_long_desc(schema));
gconf_schema_free(schema);
g_object_unref(client);
g_message("%s : ending\n", fn);
}
void gconf_test_set(void)
{
static const char fn[]="gconf_test_set";
g_message("%s : starting",fn);
GConfClient *client=NULL;
GConfSchema *schema=NULL;
GConfValue *value=NULL;
client = gconf_client_get_default();
value = gconf_value_new(GCONF_VALUE_INT);
gconf_value_set_int(value,999);
schema=gconf_schema_new();
gconf_schema_set_type(schema,GCONF_VALUE_INT);
gconf_schema_set_locale(schema,"C");
gconf_schema_set_short_desc(schema," a short desciption");
gconf_schema_set_long_desc(schema,"a long description");
gconf_schema_set_owner(schema,"TestingApps");
gconf_schema_set_default_value(schema,value);
if(FALSE==gconf_client_set_schema(client, SKEY,schema, NULL))
g_warning("%s : error setting schema key: %s",fn, SKEY);
else
g_message("%s : set schema %s", fn, SKEY);
if(FALSE==gconf_client_set_int(client,KEY,100,NULL))
g_warning("%s : error setting key: %s", fn, KEY);
else
g_message("%s : set key%s", fn, KEY);
gconf_client_suggest_sync(client,NULL);
gconf_schema_free(schema);
g_object_unref(client);
g_message("%s : ending\n", fn);
}
int main(int argc, char **argv)
{
/* create client object */
g_type_init();
gconf_init(argc,argv,NULL);
gconf_test_set();
gconf_test_get();
return 0;
}
Attachment:
smime.p7s
Description: S/MIME cryptographic signature