Application's icon can be used for various purposes by the window managers on Windows and Unix: it can identify the application when it is minimized to the desktop, for example, or it can be displayed next to application's name in the taskbar, etc.

Unfortunately, Gtk+ 1.2.x for Win32 does not support setting the icon programmatically. But on other platforms one should do this:

 1: <?php
 2
:   // create top-level application window
 
3:   $win = &new GtkWindow();
 
4:   // make sure GdkWindow is created
 
5:   $win->realize();
 
6:   $gdkwin $win->window;
 
7:   list($pixmap$mask) =
 
8:      gdk::pixmap_create_from_xpm($gdkwinnull"icon.xpm");
 
9:   $gdkwin->set_icon(null$pixmap$mask);
10?>
The first parameter to set_icon() is a GdkWindow which can serve as an icon for the window when it is minimized. Only certain window managers support this functionality, though.