<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4937.800" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff><FONT face=Arial size=2>
<DIV>Hi,</DIV>
<DIV>The main function should have a main loop running this will fix the
problem.</DIV>
<DIV>in your graphical app you had the gtk_main_run so it was working....</DIV>
<DIV>below patch in gcont_test.c would fix the problem.</DIV>
<DIV><BR>int main(int argc, char
**argv)<BR>{<BR> //Initialize
GConf<BR> GMainLoop *loop =
NULL;<BR>
g_type_init();<BR> loop =
g_main_loop_new(NULL, FALSE);<BR>
gconf_init(argc, argv, NULL);<BR>
config_init();<BR>
g_main_loop_run(loop);</DIV>
<DIV> </DIV>
<DIV>}<BR></DIV>
<DIV>Regards,</DIV>
<DIV>Ratna</DIV></FONT>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=mraccount1@gmail.com href="mailto:mraccount1@gmail.com">Manuel
Roman</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=maemo-developers@maemo.org
href="mailto:maemo-developers@maemo.org">maemo-developers@maemo.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, December 12, 2006 12:08
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [maemo-developers] gconf
notifications?</DIV>
<DIV><BR></DIV>Hi,<BR><BR>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.<BR><BR>GCONF_TEST<BR>#include
<gconf/gconf-client.h><BR>#define GCONF_MAEMO_PREFIX
"/apps/maemo"<BR>#define GCONF_KEY_OPERATION
GCONF_MAEMO_PREFIX"/mc/operation"<BR><BR>static void callback(GConfClient
*gconf_client, guint cnxn_id, GConfEntry *entry, gpointer
user_data)<BR>{<BR> char
*operationName = gconf_client_get_string(gconf_client,
GCONF_KEY_OPERATION, NULL);<BR>
printf("OpName:%s\n",operationName);<BR>}<BR><BR>void
config_init()<BR>{<BR> GConfValue
*value;<BR> gchar *str;<BR><BR>
GConfClient *gconf_client =
gconf_client_get_default();<BR><BR>
if(!gconf_client)<BR>
{<BR> printf("Failed to initialize
GConf. Quitting.");<BR>
exit(1);<BR> }<BR><BR>
gconf_client_add_dir(gconf_client, GCONF_KEY_OPERATION,
GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);<BR>
gconf_client_notify_add(gconf_client, GCONF_KEY_OPERATION, callback, NULL,
NULL, NULL);<BR><BR>
g_object_unref(gconf_client);<BR>}<BR><BR>int main(int argc, char
**argv)<BR>{<BR> //Initialize
GConf<BR>
g_type_init();<BR> gconf_init(argc,
argv, NULL);<BR>
config_init();<BR><BR>
while(1)<BR>
sleep(1);<BR>}<BR><BR><BR>GCONF_TEST<BR>#include
<gconf/gconf-client.h><BR>#define GCONF_MAEMO_PREFIX
"/apps/maemo"<BR>#define GCONF_KEY_OPERATION
GCONF_MAEMO_PREFIX"/mc/operation"<BR><BR>static
void<BR>config_init()<BR>{<BR> GConfValue
*value;<BR> gchar *str;<BR><BR>
GConfClient *gconf_client =
gconf_client_get_default();<BR><BR>
if(!gconf_client)<BR>
{<BR> printf("Failed to initialize
GConf. Quitting.");<BR>
exit(1);<BR> }<BR><BR>
printf("Setting:%s\n",GCONF_KEY_OPERATION);<BR>
gconf_client_set_string(gconf_client, GCONF_KEY_OPERATION, "deactivate",
NULL);<BR><BR> g_object_unref(gconf_client);<BR>}<BR><BR>int
main(int argc, char **argv)<BR>{<BR>
//Initialize GConf<BR>
g_type_init();<BR> gconf_init(argc,
argv, NULL);<BR>
config_init();<BR><BR> return
1;<BR>}<BR><BR>Thanks!<BR>Manuel<BR>
<P>
<HR>
<P></P>_______________________________________________<BR>maemo-developers
mailing
list<BR>maemo-developers@maemo.org<BR>https://maemo.org/mailman/listinfo/maemo-developers<BR></BLOCKQUOTE></BODY></HTML>