Re: debugging panel applets



> i'm trying to debug a panel applet in gnome2, but (as i understand)
> i cannot run it from prompt, so i cannot debug it normally.
> could you give me some hint on it? i'd like to see the g_warnings
> and all.
You are right. Both stdout and stderr of the applets point to /dev/null.
So the only way for me was to do good old way:

#define O_FLAGS ( O_CREAT | O_WRONLY | O_TRUNC )
 
int handle = fopen ("somefileforoutput", O_FLAGS, 0666 );
dup2( handle, 1 );
handle = fopen ("somefileforerror", O_FLAGS, 0666 );
dup2( handle, 2 );

// Also, useful but makes applet slower
setlinebuf( stdout );
setlinebuf( stderr );

HTH,

-- 
Sergey

Attachment: signature.asc
Description: This is a digitally signed message part



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