2 * messagebox.cpp: MessageBox dialog
5 * Moonlight List (moonlight-list@lists.ximian.com)
7 * Copyright 2007, 2009 Novell, Inc. (http://www.novell.com)
9 * See the LICENSE file included with the distribution for details.
14 #include "messagebox.h"
17 message_box_show (const char *caption
, const char* text
, int buttons
)
19 if (!caption
|| !text
)
20 return MESSAGE_BOX_RESULT_NONE
;
22 // NOTE: this dialog is displayed even WITHOUT any user action
23 //if (!Deployment::GetCurrent ()->GetSurface ()->IsUserInitiatedEvent ())
24 // return MESSAGE_BOX_RESULT_NONE;
26 GtkButtonsType bt
= buttons
== MESSAGE_BOX_BUTTON_OK
? GTK_BUTTONS_OK
: GTK_BUTTONS_OK_CANCEL
;
28 GtkWidget
*widget
= gtk_message_dialog_new (NULL
,
34 gtk_window_set_title (GTK_WINDOW (widget
), caption
);
36 gint result
= gtk_dialog_run (GTK_DIALOG (widget
));
37 gtk_widget_destroy (widget
);
41 return MESSAGE_BOX_RESULT_OK
;
42 case GTK_RESPONSE_CANCEL
:
43 return MESSAGE_BOX_RESULT_CANCEL
;
44 case GTK_RESPONSE_YES
:
45 return MESSAGE_BOX_RESULT_YES
;
47 return MESSAGE_BOX_RESULT_NO
;
48 case GTK_RESPONSE_NONE
:
50 return MESSAGE_BOX_RESULT_NONE
;