Yoda/src/app/browser.cpp

67 lines
1.3 KiB
C++
Raw Normal View History

2024-08-05 03:15:41 +03:00
#include "browser.h"
namespace app
{
// Construct
Browser::Browser(
GtkApplication *application
) {
2024-08-05 23:43:42 +03:00
// Init dependencies
2024-08-06 03:55:20 +03:00
this->app = application;
2024-08-05 23:43:42 +03:00
2024-08-05 03:15:41 +03:00
// Init GTK
this->gtk = gtk_application_window_new(
GTK_APPLICATION(
2024-08-06 03:55:20 +03:00
this->app
2024-08-05 03:15:41 +03:00
)
);
gtk_window_set_default_size(
GTK_WINDOW(
this->gtk
),
Browser::WIDTH,
Browser::HEIGHT
);
2024-08-06 03:39:31 +03:00
// Init components
2024-08-05 03:15:41 +03:00
this->header = new browser::Header(
this
);
gtk_window_set_titlebar(
GTK_WINDOW(
this->gtk
),
this->header->gtk
);
// Render
gtk_widget_show(
GTK_WIDGET(
this->gtk
)
);
2024-08-06 03:39:31 +03:00
// Connect signals
g_signal_connect(
G_APPLICATION(
2024-08-06 03:55:20 +03:00
this->app
2024-08-06 03:39:31 +03:00
),
"shutdown",
G_CALLBACK(
_shutdown
),
NULL
);
}
// Events
void Browser::_shutdown(
GtkApplication *application
) {
// @TODO save session, clean cache, etc
g_print("Shutdown..\n");
2024-08-05 03:15:41 +03:00
}
}