| Libxfce4ui Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#include <libxfce4ui/libxfce4ui.h> GtkWidget * xfce_message_dialog_new (GtkWindow *parent,const gchar *title,const gchar *stock_id,const gchar *primary_text,const gchar *secondary_text,const gchar *first_button_text,...); GtkWidget * xfce_message_dialog_new_valist (GtkWindow *parent,const gchar *title,const gchar *icon_stock_id,const gchar *primary_text,const gchar *secondary_text,const gchar *first_button_text,va_list args); gint xfce_message_dialog (GtkWindow *parent,const gchar *title,const gchar *stock_id,const gchar *primary_text,const gchar *secondary_text,const gchar *first_button_text,...); void xfce_dialog_show_info (GtkWindow *parent,const gchar *secondary_text,const gchar *primary_format,...); void xfce_dialog_show_warning (GtkWindow *parent,const gchar *secondary_text,const gchar *primary_format,...); void xfce_dialog_show_error (GtkWindow *parent,const GError *error,const gchar *primary_format,...); gboolean xfce_dialog_confirm (GtkWindow *parent,const gchar *stock_id,const gchar *confirm_label,const gchar *secondary_text,const gchar *primary_format,...); #define XFCE_BUTTON_TYPE_MIXED #define XFCE_BUTTON_TYPE_PIXBUF
GtkWidget * xfce_message_dialog_new (GtkWindow *parent,const gchar *title,const gchar *stock_id,const gchar *primary_text,const gchar *secondary_text,const gchar *first_button_text,...);
xfce_message_dialog_new() allows you to easily create Gtk+ message dialogs.
It accepts GTK+ stock buttons, mixed buttons (using XFCE_BUTTON_TYPE_MIXED)
or buttons with a GdkPixbuf (using XFCE_BUTTON_TYPE_PIXBUF).
The buttons are defined by first_button_text and the next arguments in the
following format type, param1[, param2, param3].
|
This allows you to easily create mixed buttons in a dialog.
|
|
Creates a button with the GdkPixbuf as button icon.
|
Stock Buttons |
When the variables above were not matched, the button type
will be a stock button. |
To clarify this behaviour see the example below. We create a dialog with two stock buttons, a GdkPixbuf button and a mixed button.
Example 2. Creating a Xfce Message Dialog
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_size (filename, 24, 24);
GtkWidget *dialog = xfce_message_dialog (parent, "Question",
GTK_STOCK_DIALOG_QUESTION,
"There are unsaved modifications",
"The menu has been modified, do you want to save it before quitting?",
GTK_STOCK_SAVE, GTK_RESPONSE_YES,
XFCE_BUTTON_TYPE_MIXED, GTK_STOCK_DELETE, "Forget modifications", GTK_RESPONSE_APPLY,
XFCE_BUTTON_TYPE_PIXBUF, pixbuf, "Quit", GTK_RESPONSE_NO,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
NULL);
g_object_unref (G_OBJECT (pixbuf));
|
transient parent of the dialog, or NULL.
|
|
title of the dialog, or NULL.
|
|
gtk stock icon name to show in the dialog. |
|
primary text shown in large bold font. |
|
secondary text shown in normal font. |
|
text for the first button. |
|
NULL terminated list of parameters.
|
Returns : |
A new GtkMessageDialog. |
GtkWidget * xfce_message_dialog_new_valist (GtkWindow *parent,const gchar *title,const gchar *icon_stock_id,const gchar *primary_text,const gchar *secondary_text,const gchar *first_button_text,va_list args);
See xfce_message_dialog_new(), this version takes a va_list for
language bindings to use.
|
transient parent of the dialog, or NULL.
|
|
title of the dialog, or NULL.
|
|
gtk stock icon name to show in the dialog. |
|
primary text shown in large bold font. |
|
secondary text shown in normal font. |
|
text for the first button. |
|
argument list. |
Returns : |
A new GtkMessageDialog. |
gint xfce_message_dialog (GtkWindow *parent,const gchar *title,const gchar *stock_id,const gchar *primary_text,const gchar *secondary_text,const gchar *first_button_text,...);
Create a new dialog as in xfce_message_dialog_new(), then runs the
dialog using gtk_dialog_run and return the response id selected by the user.
See xfce_message_dialog_new() for more information.
|
transient parent of the dialog, or NULL.
|
|
title of the dialog, or NULL.
|
|
gtk stock icon name to show in the dialog. |
|
primary text shown in large bold font. |
|
secondary text shown in normal font. |
|
text for the first button. |
|
NULL ended list of parameters.
|
Returns : |
the selected response id. |
void xfce_dialog_show_info (GtkWindow *parent,const gchar *secondary_text,const gchar *primary_format,...);
Displays an information dialog on parent using the primary_format as message.
|
transient parent of the dialog, or NULL.
|
|
secondary text of the dialog or NULL.
|
|
the printf()-style format for the primary problem description.
|
|
argument list for the format.
|
void xfce_dialog_show_warning (GtkWindow *parent,const gchar *secondary_text,const gchar *primary_format,...);
Displays a warning dialog on parent using the primary_format as message.
|
transient parent of the dialog, or NULL.
|
|
secondary text of the dialog or NULL.
|
|
the printf()-style format for the primary problem description.
|
|
argument list for the format.
|
void xfce_dialog_show_error (GtkWindow *parent,const GError *error,const gchar *primary_format,...);
Displays an error dialog on parent using the primary_format as primary message and optionally
displaying error as secondary error text.
|
transient parent of the dialog, or NULL.
|
|
a GError, which gives a more precise description of the problem or NULL.
|
|
the printf()-style format for the primary problem description.
|
|
argument list for the primary_format.
|
gboolean xfce_dialog_confirm (GtkWindow *parent,const gchar *stock_id,const gchar *confirm_label,const gchar *secondary_text,const gchar *primary_format,...);
Runs a questions dialog, that has a 'Cancel' and a 'Confirm' button. The 'Confirm'
button text can be set by action if given.
If stock_id is equal to GTK_STOCK_YES, the 'Cancel' button becomes a 'No' button.
|
transient parent of the dialog, or NULL.
|
|
the stock name of the confirm button, for example GTK_STOCK_YES or GTK_STOCK_CLEAR. |
|
if non-NULL, this text is used on the confirm button together with the stock_id icon.
|
|
secondary text in the dialog. |
|
the printf()-style format for the dialog question.
|
|
argument list for the primary_format.
|
Returns : |
TRUE if the user confirms, else FALSE. |
#define XFCE_BUTTON_TYPE_MIXED "button-mixed"
Used to define a mixed button in xfce_message_dialog_new() and
xfce_message_dialog_run().
#define XFCE_BUTTON_TYPE_PIXBUF "button-pixbuf"
Used to define a GdkPixuf button in xfce_message_dialog_new() and
xfce_message_dialog_run().