Convenience Routines

Since message boxes almost always have the same button (a single "OK"), there are convenience routines covering that case. Each routine has a _parented() variant which calls gnome_dialog_set_parent(). The three function pairs in Figure 11 display an info box, a warning box, and an error box, respectively; they create and show the widget, so you can ignore the return value if you like.

The only purpose of these functions is to save you typing. They are pure syntactic sugar. I find it much easier to remember them than to use gnome_message_box_new(), though; I always forget the order of the arguments to gnome_message_box_new().

     #include <libgnomeui/gnome-dialog-util.h>

GtkWidget* gnome_ok_dialog(const gchar* message);

GtkWidget* gnome_ok_dialog_parented(const gchar* message, GtkWindow* parent);

GtkWidget* gnome_warning_dialog(const gchar* warning);

GtkWidget* gnome_warning_dialog_parented(const gchar* warning, GtkWindow* parent);

GtkWidget* gnome_error_dialog(const gchar* error);

GtkWidget* gnome_error_dialog_parented(const gchar* error, GtkWindow* parent);

Figure 11. Convenience Dialogs