1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
10
TITLE="GTK+ 2.0 Tutorial"
11
HREF="book1.html"><LINK
13
TITLE="Timeouts, IO and Idle Functions"
14
HREF="c1761.html"><LINK
16
TITLE="Timeouts, IO and Idle Functions"
17
HREF="c1761.html"><LINK
19
TITLE="Idle Functions"
20
HREF="x1792.html"></HEAD
31
SUMMARY="Header navigation table"
40
>GTK+ 2.0 Tutorial</TH
50
><<< Previous</A
56
>Timeouts, IO and Idle Functions</TD
64
>Next >>></A
76
NAME="SEC-MONITORINGIO"
80
>A nifty feature of GDK (the library that underlies GTK), is the
81
ability to have it check for data on a file descriptor for you (as
82
returned by open(2) or socket(2)). This is especially useful for
83
networking applications. The function:</P
91
CLASS="PROGRAMLISTING"
92
>gint gdk_input_add( gint source,
93
GdkInputCondition condition,
94
GdkInputFunction function,
100
>Where the first argument is the file descriptor you wish to have
101
watched, and the second specifies what you want GDK to look for. This
111
> - Call your function when there is data
112
ready for reading on your file descriptor.</P
119
> - Call your function when the file
120
descriptor is ready for writing.</P
124
>As I'm sure you've figured out already, the third argument is the
125
function you wish to have called when the above conditions are
126
satisfied, and the fourth is the data to pass to this function.</P
128
>The return value is a tag that may be used to stop GDK from monitoring
129
this file descriptor using the following function.</P
137
CLASS="PROGRAMLISTING"
138
>void gdk_input_remove( gint tag );</PRE
143
>The callback function should be declared as:</P
151
CLASS="PROGRAMLISTING"
152
>void input_callback( gpointer data,
154
GdkInputCondition condition );</PRE
165
> are as specified above.</P
172
SUMMARY="Footer navigation table"
185
><<< Previous</A
203
>Next >>></A
211
>Timeouts, IO and Idle Functions</TD
b'\\ No newline at end of file'