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 07:41:40 +03:00
|
|
|
// Init header
|
2024-08-05 03:15:41 +03:00
|
|
|
this->header = new browser::Header(
|
|
|
|
this
|
|
|
|
);
|
|
|
|
|
|
|
|
gtk_window_set_titlebar(
|
|
|
|
GTK_WINDOW(
|
|
|
|
this->gtk
|
|
|
|
),
|
2024-08-06 07:33:42 +03:00
|
|
|
GTK_WIDGET(
|
|
|
|
this->header->gtk
|
|
|
|
)
|
2024-08-05 03:15:41 +03:00
|
|
|
);
|
|
|
|
|
2024-08-06 07:41:40 +03:00
|
|
|
// Init container
|
|
|
|
this->container = new browser::Container(
|
|
|
|
this
|
|
|
|
);
|
|
|
|
|
|
|
|
gtk_window_set_child(
|
|
|
|
GTK_WINDOW(
|
|
|
|
this->gtk
|
|
|
|
),
|
|
|
|
GTK_WIDGET(
|
|
|
|
this->container->gtk
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2024-08-05 03:15:41 +03:00
|
|
|
// 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
|
|
|
}
|
|
|
|
}
|