xref: /haiku/src/apps/haikudepot/util/AppUtils.cpp (revision 12dba4e70f831d6d27a7f769cc9dab19c19a155d)
1 /*
2  * Copyright 2018, Andrew Lindesay <apl@lindesay.co.nz>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include "AppUtils.h"
8 
9 #include <string.h>
10 
11 #include <Application.h>
12 #include <Messenger.h>
13 
14 #include "HaikuDepotConstants.h"
15 
16 /*! This method can be called to pop up an error in the user interface;
17     typically in a background thread.
18  */
19 
20 /* static */ void
21 AppUtils::NotifySimpleError(const char* title, const char* text)
22 {
23 	BMessage message(MSG_ALERT_SIMPLE_ERROR);
24 
25 	if (title != NULL && strlen(title) != 0)
26 		message.AddString(KEY_ALERT_TITLE, title);
27 
28 	if (text != NULL && strlen(text) != 0)
29 		message.AddString(KEY_ALERT_TEXT, text);
30 
31 	be_app->PostMessage(&message);
32 }