-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathmain.cpp
45 lines (35 loc) · 1.14 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 "mainwindow.h"
#include <gtkmm/application.h>
CMainWindow *mainwindow;
#ifdef _WIN32
#include <windows.h>
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
#else
int main (int argc, char *argv[])
#endif
{
Gsv::init();
#ifdef _WIN32
if (g_getenv("NK_WIN32_DEBUG") && AllocConsole()) {
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
}
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create("com.github.blackhole89.notekit");
#else
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "com.github.blackhole89.notekit");
#endif
app->signal_activate().connect( [app,&mainwindow]() {
mainwindow=new CMainWindow(app);
app->add_window(*mainwindow);
} );
app->set_accel_for_action("notebook.next-note", "<Primary>Tab");
app->set_accel_for_action("notebook.prev-note", "<Primary><Shift>Tab");
app->set_accel_for_action("notebook.show-find", "<Primary>F");
app->set_accel_for_action("win.sidebar", "F9");
app->set_accel_for_action("win.presentation", "F11");
auto ret = app->run();
if(mainwindow != nullptr){
delete mainwindow;
}
return ret;
}