[maemo-developers] [maemo-developers] gconf notifications?
From: Santtu Lakkala inz at inz.fiDate: Tue Dec 12 09:54:36 EET 2006
- Previous message: [maemo-developers] gconf notifications?
- Next message: [maemo-developers] gconf notifications?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Manuel Roman wrote:
> I just wrote a very simple application that uses gconf notifications.
> Unfortunately, the callback is never called. I have used gconf from a
> graphical hildon app and notifications worked fine, however, when I try
> from
> a console application it does not seem to work. I include the two simple
> files I wrote: gconf_test, which registers the callback and gconf_test_set,
> which sets a value. If you can pinpoint the problem I would really
> appreciate it. Although there is no error checking for gconf_init, I tested
> it and always returned TRUE.
GConf needs GMainLoop to be running to work. In normal hildon
applications Gtk+ takes care of this, as gtk_main() runs a GMainLoop.
You can alter your main() to use GMainLoop:
int main(int argc, char **argv)
{
GMainLoop *loop;
g_type_init();
config_init();
loop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(loop);
return 0;
}
Do note, that unlike with Gtk+'s gtk_main_quit(), with GMainLoops, you
need to pass the loop "object" to g_main_loop_quit, so you'll need to
store the loop pointer and pass it everywhere it is needed. Also note
that gconf_init() is deprecated and needs not be called.
--
Santtu Lakkala
- Previous message: [maemo-developers] gconf notifications?
- Next message: [maemo-developers] gconf notifications?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
