g_idle_add() clarification

2015-01-20 Thread Ian Chapman
Hi all, Sorry to bother but I'm lost with the workings of guint g_idle_add () My code is as follows extern C void on_StartScan_activate() //from gtk menu item { printf(Start Scan Activated. \n); scan_on_fg =1; Scanning_lvl = g_idle_add((GSourceFunc) Scanning(), (gpointer) 0);

Re: g_idle_add() clarification

2015-01-20 Thread richard boaz
hi, Scanning() is being called as part of g_idle_add(). Scanning() returns FALSE, which = NULL in C, so your call to g_idle_add() at execution time resolves to: g_idle_add((GSourceFunc) 0, (gpointer) 0); this clearly won't work. rewrite as: Scanning_lvl = g_idle_add((GSourceFunc) Scanning,

Re: g_idle_add() clarification

2015-01-20 Thread Chris Vine
On Tue, 20 Jan 2015 16:47:27 -0500 Ian Chapman ichap...@videotron.ca wrote: Thanks for your reply Richard. Yes, I know that. I thought Scanning() was a lower level than the gtk window and thus the StartScan_active() would exit before the mainloop would add Scanning() and then only execute

Re: g_idle_add() clarification

2015-01-20 Thread Ian Chapman
Thanks Chris, I think that not only is my code broken my idea on how to do what I want is broken. I must fix that before I start on the code. My starting point was two button, scan off and scan on in glade. Scan on sets a flag and it scans til the off button is pressed. So the off

Re: g_idle_add() clarification

2015-01-20 Thread Paul Davis
On Tue, Jan 20, 2015 at 7:55 PM, Ian Chapman ichap...@videotron.ca wrote: Thanks Chris, I think that not only is my code broken my idea on how to do what I want is broken. I must fix that before I start on the code. My starting point was two button, scan off and scan on in glade.