<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Idle Functions</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="GTK+ 2.0 Tutorial" HREF="book1.html"><LINK REL="UP" TITLE="Timeouts, IO and Idle Functions" HREF="c1759.html"><LINK REL="PREVIOUS" TITLE="Monitoring IO" HREF="x1770.html"><LINK REL="NEXT" TITLE="Advanced Event and Signal Handling" HREF="c1797.html"></HEAD ><BODY CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >GTK+ 2.0 Tutorial</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="x1770.html" ACCESSKEY="P" ><<< Previous</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Timeouts, IO and Idle Functions</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="c1797.html" ACCESSKEY="N" >Next >>></A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="SEC-IDLEFUNCTIONS" >Idle Functions</A ></H1 ><P >What if you have a function which you want to be called when nothing else is happening ?</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >gint gtk_idle_add( GtkFunction function, gpointer data );</PRE ></TD ></TR ></TABLE ><P >This causes GTK to call the specified function whenever nothing else is happening.</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >void gtk_idle_remove( gint tag );</PRE ></TD ></TR ></TABLE ><P >I won't explain the meaning of the arguments as they follow very much like the ones above. The function pointed to by the first argument to gtk_idle_add will be called whenever the opportunity arises. As with the others, returning FALSE will stop the idle function from being called.</P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="x1770.html" ACCESSKEY="P" ><<< Previous</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="book1.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="c1797.html" ACCESSKEY="N" >Next >>></A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Monitoring IO</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="c1759.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Advanced Event and Signal Handling</TD ></TR ></TABLE ></DIV ></BODY ></HTML >