Im doing some C coding but im unable to store g_settings permanently!
#include <stdlib.h>
#include <locale.h>
#include <gio/gio.h>
int main(int argc, char **argv)
{
GSettings *settings;
g_type_init();
settings = g_settings_new ("org.nemo.desktop");
printf("%s\n", g_settings_get_string(settings, "font"));
g_settings_set (settings, "font", "s", "Arial");
if (g_settings_get_has_unapplied (settings)) printf("X");
printf("%s\n", g_settings_get_string(settings, "font"));
return 0;
}
Trying on Linux Mint 13 Cinnamon (paths,etc. are correct).
Oh, I misread your code at first... I believe you should call g_settings_sync ()
if you want to ensure your changes are written to disk. Apparently if you run without a mainloop (like in your example case) this is really required to get things on disk at all.
So, just to be clear: a normal application with a glib mainloop will not need (and shouldn't really use) a sync-call.
This isn’t a minimal working example. Could you provide the schema file you’re using?
Compiling your code with gcc `pkg-config --cflags --libs gio-2.0` -o temp temp.c
and using the following schema:
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<schema id="org.nemo.desktop" path="/org/nemo/desktop/">
<key name="font" type="s">
<default>''</default>
<summary>Summary</summary>
<description>Description.</description>
</key>
</schema>
</schemalist>
which I installed with:
sudo cp org.nemo.desktop.gschema.xml /usr/share/glib-2.0/schemas/
sudo glib-compile-schemas /usr/share/glib-2.0/schemas/
I get the following output, which seems to be correct:
Arial