[GSettings] get child failed



Hello!

I have use glib-2.33.3.

XML:
<schemalist>
<enum id = 'config_method'>
    <value nick = 'STATIC' value = '0' />
    <value nick = 'DHCP' value = '1' />
</enum>

<schema id = 'ru.byterg.combineip' path = '/ru/byterg/combineip/'>
    <child name = 'network' schema = 'ru.byterg.combineip.network' />
</schema>
	
<schema id = 'ru.byterg.combineip.network' path = '/ru/byterg/combineip/network/'>
    <key name = 'network-config' enum = 'config_method'>
        <default>'STATIC'</default>
	<description>Configure IP method</description>
    </key>
   <key name = 'network-address' type = 's'>
        <default>'192.168.255.2'</default>
	<description>Static IP-address</description>
    </key>
    <key name = 'network-mask' type = 's'>
        <default>'255.255.255.0'</default>
	<description>Static IP-mask</description>
    </key>
    <key name = 'network-gate' type = 's'>
        <default>'192.168.255.1'</default>
	<description>Static default gateway</description>
    </key>
    <key name = 'network-dns1' type = 's'>
        <default>'192.168.255.1'</default>
	<description>Static DNS1-server</description>
    </key>
</schema>
</schemalist>


Compiled schema stored in /etc, file with config /etc/combineip.

My code:
GSettings *settings = NULL, *net = NULL;
GSettingsSchemaSource *src = NULL;
GSettingsSchema *schema = NULL;
GError *error = NULL;

src = g_settings_schema_source_new_from_directory("/etc", NULL, TRUE, &error);
if (NULL == src) {
    g_print("g_settings_new_schema_source_from_directory failed: %s\n",
				error->message);
		exit(-1);
}

schema = g_settings_schema_source_lookup(src, "ru.byterg.combineip", FALSE);
if (NULL == schema) {
   g_print("g_settings_schema_source_lookup failed\n");
   exit(-1);
}
settings = g_settings_new_full(schema, g_keyfile_settings_backend_new("/etc/combineip", "/ru/byterg/combineip/", "root"), "/ru/byterg/combineip/");
g_assert(settings != NULL);
g_print("Root found");
net = g_settings_get_child(settings, "network");
g_assert(net != NULL);
g_print("Network found");

I successfully get root schema, but when I try get child schema (ru.byterg.combineip.network) program exit with message GLib-GIO-ERROR **: No GSettings schemas are installed on the system.

How can I get child schema ru.byterg.combineip.network ?

Thank you and excuse me for my bad english.

--
Best regards,
Brilliantov Kirill Vladimirovich
…………………………………………………………………
programmer, technical department
Byterg LLC
…………………………………………………………………
+7(495)221-66-22
http://www.byterg.ru    http://www.bestdvr.ru


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]