-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
45 lines (37 loc) · 1.2 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <glibmm/refptr.h>
#include <gtkmm/application.h>
#include <gtkmm/builder.h>
#include <gtkmm/messagedialog.h>
#include "mainWindow.h"
#include "fileHelper.h"
int main(int argc, char* argv[])
{
using namespace Gtk;
#ifdef NDEBUG
try {
#endif
fileHelper::checkForOurDirectories();
Glib::RefPtr<Application> app = Application::create(argc, argv, "br.net.vitorhnn.livestreamer-gtkmm3");
Glib::RefPtr<Builder> builder = Builder::create();
builder->add_from_file(fileHelper::getDataFilePath("UI/mainWindow.glade"));
mainWindow* window = nullptr;
builder->get_widget_derived("MainWindow", window);
app->run(*window);
delete window;
#ifdef NDEBUG
}
catch (const std::exception& ex) {
MessageDialog dlg("Uncaught exception", false, MESSAGE_ERROR);
dlg.set_secondary_text(ex.what());
dlg.run();
return 1;
}
catch (const Glib::Exception& ex) { // For whatever reason, Glib::Exception does not inherit from std::exception
MessageDialog dlg("Uncaught exception", false, MESSAGE_ERROR);
dlg.set_secondary_text(ex.what());
dlg.run();
return 1;
}
#endif
return 0;
}