G_settings_set_string [solved]

Contribute code & patches
Forum rules
No support questions here please

G_settings_set_string [solved]

Postby KOLEGA on Sun Nov 03, 2013 7:37 am

Hi!
How to use g_settings_set_string (C) , I've read devhelp, but i am not wiser about it and of course i tried to google it, but nothing relevant found (or helpfull). I suppose, that 2nd a 3rd parametrs are key and value, but what should be the first one? https://developer.gnome.org/gio/2.26/GSettings.html (g_settings_set_string part)

Thx for advice
(just need some materials tu study, kick me on the right way)
Last edited by KOLEGA on Tue Nov 05, 2013 9:19 am, edited 1 time in total.
Liberal Fanatic Linux Mint User
KOLEGA
Level 1
Level 1
 
Posts: 36
Joined: Mon Jul 02, 2012 5:46 pm

Linux Mint is funded by ads and donations.
 

Re: G_settings_set_string

Postby KOLEGA on Sun Nov 03, 2013 6:25 pm

I managed to move a little bit
Code: Select all
#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.gnome.desktop.background");
  g_settings_set_string(settings, "picture-uri", "file:///home/ondrej/x.jpg");
  printf("%s\n", g_settings_get_string(settings, "picture-uri"));
   return 0;
}


But another problem, the change doesnt affect my background :/
Liberal Fanatic Linux Mint User
KOLEGA
Level 1
Level 1
 
Posts: 36
Joined: Mon Jul 02, 2012 5:46 pm

Re: G_settings_set_string

Postby KOLEGA on Tue Nov 05, 2013 9:18 am

Solved!

Explained on http://stackoverflow.com/questions/1977 ... ly-changes
after g_settings_set() it's necessary to call g_settings_sync()
Liberal Fanatic Linux Mint User
KOLEGA
Level 1
Level 1
 
Posts: 36
Joined: Mon Jul 02, 2012 5:46 pm


Return to Code & Patches

Who is online

Users browsing this forum: No registered users and 1 guest