Listing 1. The Preferences dialog is created the first time it is
requested,
and the widget ID is saved in a global variable.

void
XRPreferences    (GtkButton       *button,
                  gpointer         user_data)
{


   /* If it hasn't been opened before, create
    * the dialog.
    */

   if ( XR_Preferences_Window == NULL )
   {
      XR_Preferences_Window = create_preferences();
      gtk_widget_realize(XR_Preferences_Window);
   }
   ...
}

