how to use gnome_config??



hi all,

I'm having problems with using gnome_config in the mail client i'm trying
to put together. (http://gmail.linuxpower.org - I'm hoping to use the
gnome-mailer backend once it starts working)

In particular, I can't always get gnome_config_get_string to work, even
though I KNOW that the particular path has a value.

Here is an example code snippet:
 str = gnome_config_get_string("/gmail/UserInfo/EmailAddress");
  while (str == NULL) {
    gnome_config_set_string("/gmail/UserInfo/EmailAddress", "This now has a
value");
    gnome_config_sync();  /* Write info to config file */
    g_free(str);
    str = gnome_config_get_string("/gmail/UserInfo/EmailAddress");
    }

this code will loop infinitely. i can't see why... :(
Why would str still be NULL after I have set a value and ran config_sync?
Besides, the path already had a value...

After looking through example usage of gnome_config in gnome_libs.. I tried
the following:

  str =
gnome_config_get_string_with_default("/gmail/UserInfo/EmailAddress", &def);
  while (def) {
    gnome_config_set_string("/gmail/UserInfo/EmailAddress", "this now has a
value");
    gnome_config_sync();  /* Write info to config file */
    g_free(str);
    str =
gnome_config_get_string_with_default("/gmail/UserInfo/EmailAddress", &def);
    }

This too looped inifinitely.

I can't seem to get a grip on this stuff.... 

As far as I can see I don't need to use gnome_config_push_prefix etc... Nor
do I see the point of gnome_config_sync_file...

At other points in my code, gnome_config_set and gnome_config_get do seem
to work ok. I can't work out the difference. I'm half wondering whether
there might be a bug in gnome-libs, but more likely it is my lack of knowledge.

I'm using RH 5.2, with everything installed from the latest tarballs. This
behaviour occurs in both gnome-libs 1.0.9 and 1.0.pre10

Any pointers?

thanks,
wayne.
---------------------------------------------------------
Wayne Schuller - BSc. (Computer Science) Network Administrator
Centre for Health Program Evaluation - Austin Repat Hospital - Heidelberg.
Web: http://ariel.unimelb.edu.au/chpe/  My phone: (03) 94964448 
w.schuller@gpph.unimelb.edu.au



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