[Evolution-hackers] Alert Dialog API



So, my current thoughts on writing the API for the HIG-compliant alert
dialogs, is that there will be a generic API call for creating custom,
and/or extended alert dialogs, and some simplistic API calls for popping
up simple dialogs to alert the user of an error, warning, or a simple
informational piece of text. The API would look something like this:

GtkWidget  * e_alert_dialog_new (const gchar * summary,
				 const gchar * message,
				 GtkMessageDialogType alert_type,
				 GtkWindow * parent);

void e_alert_dialog_set_icon (EAlertDialog * dialog,
			      const gchar * name);
void e_alert_dialog_set_icon_from_pixbuf (EAlertDialog * dialog,
					  GdkPixbuf * pixbuf);
void e_alert_dialog_set_icon_from_... (...);

This would be the generic interface for creating a custom or extended
alert dialog. The _new () call creates a new dialog with the appropriate
summary, message, icons, and window title, based on the given
alert_type, and sets the appropriate flags for blocking the given parent
when it is shown. The current GtkDialog APIs can be used to add buttons
to the dialog, and run it. And, the response signal will get emitted,
when the user clicks one of the buttons.

void e_alert_dialog_popup_simple (const gchar * summary,
				  const gchar * message,
				  GtkMessageDialogType alert_type,
				  GtkWindow * parent);

This would be the simple interface for popping up quick alert dialogs
that don't need extra programmatic interaction. It is useful for simple
warnings and errors, so that no extra code needs to be written to handle
running and closing the dialog, for instance, when there is only an "OK"
button, in the case of most common errors.

GtkWidget * e_alert_dialog_new_confirmation (const gchar * summary,
					     const gchar * message,
					     GtkWindow * parent);

This is to handle simple confirmation dialogs, such as confirming the
"Empty Trash" request, or such. It returns a GtkWidget, so that the
programmatic interface can be set up to do the right thing if the
user confirms the action.

GtkWidget * e_alert_dialog_new_save_confirmation (const gchar * summary,
						  const gchar * message,
						  GtkWindow * parent);

This is to handle save confirmation dialogs. It also returns a GtkWidget
for use in the programmatic interface needed to do the correct thing
when the user chooses to save, not save, or cancel.

So, that is all I have now. A simple API for having HIG-compliant alerts
that can be extended and customized if need be. Any thoughts, or other
requests or constructive complaints?

-- dobey

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]